diff --git a/dtm_release/.gitignore b/dtm_release/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..98adbc9828391630815be751bd43f8820837a9f7 --- /dev/null +++ b/dtm_release/.gitignore @@ -0,0 +1,2 @@ +*.o +/dtm/main diff --git a/dtm_release/README b/dtm_release/README new file mode 100644 index 0000000000000000000000000000000000000000..fee2d402d3b5a855d77f4578ad50fb4e3667361b --- /dev/null +++ b/dtm_release/README @@ -0,0 +1,108 @@ +*************************** +Dynamic Topic Models and the Document Influence Model +*************************** + +This code is the result of work by + +David M. Blei +blei[at]cs.princeton.edu + +and + +Sean M Gerrish +sgerrish[at]cs.princeton.edu. + +(C) Copyright 2006, David M. Blei + (blei [at] cs [dot] princeton [dot] edu) + +(C) Copyright 2011, Sean M. Gerrish + (sgerrish [at] cs [dot] princeton [dot] edu) + +It includes software corresponding to models described in the +following papers: + +[1] D. Blei and J. Lafferty. Dynamic topic models. In + Proceedings of the 23rd International Conference on Machine Learning, + 2006. +[2] S. Gerrish and D. Blei. A Language-based Approach to Measuring + Scholarly Impact. In Proceedings of the 27th International Conference + on Machine Learning, 2010. + +These files are part of DIM. + +DIM 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 2 of the License, or (at your +option) any later version. + +DIM 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, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +USA + +------------------------------------------------------------------------ + +A. COMPILING + +You will need to have several libraries installed to compile this +package. One of these is gsl-devel. Depending on your package +manager, you may be able to install this with *one* of the following +commands: + + sudo aptitude install libgsl0-dev # Ubuntu 10.04 + sudo zypper install gsl-devel # OpenSUSE 11.2 + sudo yum install gsl-devel # CentOS 5.5 + +You can make the main program by changing your working directory to +dtm/ and typing: + + make + +This software has been compiled on Ubuntu 10.04, OpenSUSE 11.2, and +CentOS 5.5. Depending on your environment, you may need to install +additional libraries. + +B. RUNNING + +Once everything is compiled, you can run this software by typing the +command "./main <flags>", where flags is a list of command-line +options. An example command and a description of the input and output +files is given in dtm/sample.sh. You can see all command-line options +by typing + + ./main --help + +(although we suggest you start out with the example in dtm/sample.sh). + +C. SUPPORT and QUESTIONS + +This software is provided as-is, without any warranty or support, +WHATSOEVER. If you have any questions about running this software, +you can post your question to the topic-models mailing list at +topic-models@lists.cs.princeton.edu. You are welcome to submit +modifications or bug-fixes of this software to the authors, although +not all submissions may be posted. + +D. USAGE + +This progam takes as input a collection of text documents and creates +as output a list of topics over time, a description of each document +as a mixture of these topics, and (possibly) a measure of how +"influential" each document is, based on its language. + +We have provided an example dataset, instructions for formatting input +data and processing output files, and example command lines for +running this software in the file dtm/sample.sh. + +E. CHANGES + +Changes in this version include: + + - Change the default top_obs_var flag to 0.5 (from -1.0) + - Change to use more iterations and a tighter convergence criterion in each doc's E-step. + - Change to initialize random topics to be a bit more "flat". diff --git a/dtm_release/dtm-parallel/Makefile b/dtm_release/dtm-parallel/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..d143d3dfca6348f789dcfcde7050399c95178905 --- /dev/null +++ b/dtm_release/dtm-parallel/Makefile @@ -0,0 +1,93 @@ +.SUFFIXES: .c .u +CC= g++ + +CC= g++ + +LIB=../lib +GSLWRAP_LIB=../gslwrap +LOCAL_DIR=../local + +CFLAGS = -I ${LIB} -I ${LIB}/math -I ${GSLWRAP_LIB}/include -I \ + ${GSLWRAP_LIB}/include/gslwrap -I ${LOCAL_DIR}/include -I \ + ${LIB}/util/gflags-1.1/src/gflags + +GDB_CFLAGS = -ggdb -I ${LIB} -I ${LIB}/math -I ${GSLWRAP_LIB}/include \ + -I ${GSLWRAP_LIB}/include/gslwrap -I ${LOCAL_DIR}/include -I \ + ${LIB}/util/gflags-1.1/src/gflags + +BASE_INCLUDES = -I ${LIB} + +LDFLAGS = -L${LOCAL_DIR}/lib -L${LOCAL_DIR}/lib/stl -lgsl -lm -lgslcblas +LOBJECTS = ss-lm.o gsl-wrappers.o data.o param.o util.o lda-seq.o \ + lda.o params.o main.o + +GFLAGS = gflags.o gflags_reporting.o gflags_completions.o + +TOPICS_DIR=/home/sgerrish/portal/src1/topics +TOPICS_DIR=/u/sgerrish/src1/topics + +GGDB = -ggdb +#GGDB = + +CFLAGS = -I ${LIB} -I ${LIB}/math -I ${GSLWRAP_LIB}/include -I \ + ${GSLWRAP_LIB}/include/gslwrap -I ${LOCAL_DIR}/include -I \ + ${LIB}/util/gflags-1.1/src/gflags + +GDB_CFLAGS = -ggdb -I ${LIB} -I ${LIB}/math -I ${GSLWRAP_LIB}/include \ + -I ${GSLWRAP_LIB}/include/gslwrap -I ${LOCAL_DIR}/include -I \ + ${LIB}/util/gflags-1.1/src/gflags + +BASE_INCLUDES = -I ${LIB} + +LDFLAGS = -L${LOCAL_DIR}/lib -L${LOCAL_DIR}/lib/stl -lgsl -lm -lgslcblas +LOBJECTS = ss-lm.o gsl-wrappers.o data.o param.o util.o lda-seq.o \ + lda.o params.o main.o + +E_STEP_FLAGS = ${GGDB} -lgsl -lm -lgslcblas -L/sw/lib +E_STEP_SOURCE = gsl-wrappers.c params.c data.c util.c lda.c main-lda-e-step.c c2_lib.c strutil.c +E_STEP_OBJECTS = gsl-wrappers.o params.o data.o util.o lda.o main-lda-e-step.o c2_lib.o strutil.o + +M_STEP_FLAGS = ${GGDB} -lgsl -lm -lgslcblas -L/sw/lib +M_STEP_SOURCE = gsl-wrappers.c params.c data.c util.c lda.c main-lda-m-step.c c2_lib.c strutil.c +M_STEP_OBJECTS = gsl-wrappers.o params.o data.o util.o lda.o main-lda-m-step.o c2_lib.o strutil.o + +AGGREGATE_FLAGS = ${GGDB} -lgsl -lm -lgslcblas -L/sw/lib +AGGREGATE_SOURCE = gsl-wrappers.c params.c data.c util.c lda.c main-aggregate-ss.c c2_lib.c strutil.c +AGGREGATE_OBJECTS = gsl-wrappers.o params.o data.o util.o lda.o main-aggregate-ss.o c2_lib.o strutil.o + +ST_FLAGS = ${GGDB} -lgsl -lm -lgslcblas -L/sw/lib +ST_SOURCE = ss-lm.c gsl-wrappers.c data.c param.c util.c lda.c lda-seq.c params.c main-fit_seq_topics.c c2_lib.c strutil.c +ST_OBJECTS = ss-lm.o gsl-wrappers.o data.o param.o util.o lda.o lda-seq.o params.o main-fit_seq_topics.o c2_lib.o strutil.o + +SD_FLAGS = ${GGDB} -lgsl -lm -lgslcblas -L/sw/lib +SD_SOURCE = gsl-wrappers.c data.c param.c util.c lda-seq.c lda.c params.c main-fit_seq_docs.c ss-lm.c c2_lib.c strutil.c +SD_OBJECTS = gsl-wrappers.o data.o param.o util.o lda-seq.o lda.o params.o main-fit_seq_docs.o ss-lm.o c2_lib.o strutil.o +GFLAGS = gflags.o gflags_reporting.o gflags_completions.o + +gflags: ${LIB}/util/gflags-1.1/src/gflags.cc + $(CC) -c $(CFLAGS) \ + ${LIB}/util/gflags-1.1/src/gflags.cc \ + ${LIB}/util/gflags-1.1/src/gflags_reporting.cc \ + ${LIB}/util/gflags-1.1/src/gflags_completions.cc +main: $(LOBJECTS) gflags + $(CC) $(CFLAGS) $(LOBJECTS) ${GFLAGS} -o main $(LDFLAGS_PTON) + +st: $(ST_OBJECTS) gflags + $(CC) $(CFLAGS) $(ST_OBJECTS) $(GFLAGS) -o fit-seq-topics $(ST_FLAGS) + +sd: $(SD_OBJECTS) gflags + $(CC) $(CFLAGS) $(SD_OBJECTS) $(GFLAGS) -o fit-seq-docs $(SD_FLAGS) + +lda-e: $(E_STEP_OBJECTS) gflags + $(CC) $(CFLAGS) $(E_STEP_OBJECTS) $(GFLAGS) -o lda-e-step $(E_STEP_FLAGS) + +lda-m: $(M_STEP_OBJECTS) gflags + $(CC) $(CFLAGS) $(M_STEP_OBJECTS) $(GFLAGS) -o lda-m-step $(M_STEP_FLAGS) + +aggregate: $(AGGREGATE_OBJECTS) gflags + $(CC) $(CFLAGS) $(AGGREGATE_OBJECTS) $(GFLAGS) -o main-aggregate-ss $(AGGREGATE_FLAGS) + +all: gflags main st sd lda-e lda-m aggregate + +clean: + -rm -f *.o diff --git a/dtm_release/dtm-parallel/README b/dtm_release/dtm-parallel/README new file mode 100644 index 0000000000000000000000000000000000000000..61e4656b57c987757a7e97d0de7ab9a26f213240 --- /dev/null +++ b/dtm_release/dtm-parallel/README @@ -0,0 +1,28 @@ +*************************** +Document Influence Model and Dynamic Topic Models +*************************** + +This code is the result of work by + +David M. Blei +blei[at]cs.princeton.edu + +and + +Sean M Gerrish +sgerrish[at]cs.princeton.edu. + +(C) Copyright 2006, David M. Blei + (blei [at] cs [dot] princeton [dot] edu) + +(C) Copyright 2009, 2010, Sean M. Gerrish + (sgerrish [at] cs [dot] princeton [dot] edu) + +This directory contains an implementation of the dynamic influence +model intended to be run on a cluster of computers. Compiling and +running this software has not been tested on other computers. It is +therefore supported in no manner. + +This implementation was designed with a PBS cluster in mind, with a +driver to be run on the head node. If you are using a different +cluster, you can modify the cluster interface in c2_lib.c. diff --git a/dtm_release/dtm-parallel/TEST_ROADMAP b/dtm_release/dtm-parallel/TEST_ROADMAP new file mode 100755 index 0000000000000000000000000000000000000000..2a2e306eb99f472c6f2c552380d9cb82348fa2cd --- /dev/null +++ b/dtm_release/dtm-parallel/TEST_ROADMAP @@ -0,0 +1,19 @@ +./main \ + --mode=fit \ + --model=fixed \ + --corpus_prefix=/n/fs/topics/users/sgerrish/data/docinf/data/nature_data/test_corpus_train \ + --outname=/n/fs/topics/users/sgerrish/data/docinf/data/test_data \ + --root_directory=/n/fs/topics/users/sgerrish/data/docinf/data/test_data \ + --prp_obs_var=0.5 \ + --top_obs_var=0.5 \ + --phi_squared_factor=1.0 \ + --prp_chain_var=0.5 \ + --top_chain_var=0.005 \ + --alpha=0.01 \ + --influence_mean_years=20 \ + --influence_mean_years=20 \ + --sigma_d=0.1 \ + --new_phi=true \ + --ntopics=5 \ + --number_tasks=10 \ + --lda_max_em_iter=10 diff --git a/dtm_release/dtm-parallel/c2_lib.c b/dtm_release/dtm-parallel/c2_lib.c new file mode 100644 index 0000000000000000000000000000000000000000..a47daa92d8c5e2640792239bae52472befcbc907 --- /dev/null +++ b/dtm_release/dtm-parallel/c2_lib.c @@ -0,0 +1,429 @@ +#include "gflags.h" +#include "strutil.h" + +#include "c2_lib.h" + +#include <sys/stat.h> +#include <string.h> +#include <hash_set.h> +#include <hash_map.h> +#include <vector.h> +#include "sys/wait.h" +#include <stdlib.h> + +DEFINE_bool(run_locally, false, + "If true, run locally."); +DEFINE_string(bin_directory, ".", + "The directory in which binaries live."); +DEFINE_bool(resume, false, + "If true, resume a halted job."); + +namespace c2_lib { + +bool FileRemove(string file_name) { + return remove(file_name.c_str()) == 0; +} + +string CurrentWorkingDirectory() { + char* cwd = getcwd(NULL, 0); + string result(cwd); + free(cwd); + return result; +} + +bool FileExists(string file_name) { + struct stat stFileInfo; + bool blnReturn; + int intStat; + + // Attempt to get the file attributes + intStat = stat(file_name.c_str(), &stFileInfo); + if(intStat == 0) { + return(true); + } else { + return(false); + } +} + +void WaitOnTask(const Task& task) { + bool done = false; + double backoff(1.0); + while (!done) { + done = true; + if (task.Status() != Task::SUCCESS) { + done = false; + if (task.Status() == Task::FAIL) { + printf("Error. Task failed. Debug: %s\n", + task.DebugString().c_str()); + exit(1); + } + } + if (backoff > 2.0) { + sleep(backoff); + } + backoff *= 1.1; + if (backoff > 30) { + backoff = 30; + } + } +} + +void WaitOnTasks(const vector<Task*>& tasks) { + double backoff(1.0); + vector<Task*> pending_tasks = tasks; + hash_map<long, int> task_tries; + + while (!pending_tasks.empty()) { + for (vector<Task*>::iterator it=pending_tasks.begin(); + it != pending_tasks.end(); + ) { + Task* task = *it; + if (task->Status() != Task::SUCCESS) { + if (task->Status() == Task::FAIL) { + + if (task_tries.find((long) task) == task_tries.end()) { + task_tries[(long) task] = 1; + } + + // Sometimes tasks fail for no good reason. + // Retry up to 3 times. + if (task_tries[(long) task] > 3) { + printf("Error. Task %d failed.\n", + task->id); + printf("Debug string: %s\n", + task->DebugString().c_str()); + exit(1); + } else { + printf("Task %d failed. Retrying. Try: %lld\n", + task->id, + task_tries[(long) task]); + printf("Debug string: %s\n", + task->DebugString().c_str()); + + ++task_tries[(long) task]; + task->Start(); + } + } + // Don't break, since it's worth + // checking whether any tasks have failed + // (in which case, we should die). + ++it; + } else { + printf("Removing task.\n"); + // Delete this element. + it = pending_tasks.erase(it); + } + } + printf("Waiting on %d tasks.\n", + pending_tasks.size()); + if (backoff > 2.0) { + sleep(backoff); + } + backoff *= 1.1; + if (backoff > 30) { + backoff = 30; + } + } +} + + +Resource::Resource(string filename) + : filename(filename) { +} + +Resource::~Resource() { + // We should not let this resource go out of scope if tasks are + // still using it. + if (references_.size() != 0) { + printf("Error. Task exists for deleted reference."); + exit(1); + } + +} + +bool Resource::Available() { + return FileExists(filename); +} + +void Resource::TaskDone(int id) { + hash_set<int>::iterator it = references_.find(id); + if (it != references_.end()) { + references_.erase(it); + } +} + + +// Task definitions. + + +string Task::working_directory_ = ""; + +void Task::AddResource(Resource* resource) { + resources_.push_back(resource); + resource->AddReference(id); +} + +Task::Task(string name, int id) + : command_(""), + id(id), + name(name), + done_(false), + resources_() + { +} + +Task::~Task() { + for (vector<Resource*>::iterator it = resources_.begin(); + it != resources_.end(); + ++it) { + (*it)->TaskDone(id); + } +} + +void Task::ResourcesAvailable_(bool* available, + string* resource_filename) { + *available = true; + for (vector<Resource*>::iterator it = resources_.begin(); + it != resources_.end() && *available; + ++it) { + if (!(*it)->Available()) { + *available = false; + *resource_filename = (*it)->filename; + } + } + *available = true; + + return; +} + +} + +namespace dtm { + +using c2_lib::FileRemove; +using c2_lib::FileExists; +using c2_lib::CurrentWorkingDirectory; + +string QSubTask::binary_ = ""; + +double ReadLikelihoods(const vector<string>& done_sentinels) { + double l_hood = 0.0; + for (vector<string>::const_iterator it = done_sentinels.begin(); + it != done_sentinels.end(); + ++it) { + double l_hood_tmp; + printf("Likelihood: %.2lf\n", l_hood); + FILE* f = fopen((*it).c_str(), "r"); + if (f) { + fscanf(f, "%lf", &l_hood_tmp); + fclose(f); + } else { + printf("Error reading likelihood from file %s.\n", + (*it).c_str()); + } + + l_hood += l_hood_tmp; + printf("Likelihood: %.2lf\n", l_hood); + } + return l_hood; +} + + +string QSubTask::DebugString() const { + return StringPrintf("stderr: %s\n" + "stdout: %s\n" + "sentinel: %s\n" + "full commandline: %s\n", + stderr_filename_.c_str(), + stdout_filename_.c_str(), + done_sentinel_.c_str(), + full_commandline_.c_str()); +} + +static int vsystem(string command) { + int pid; + int return_code = 0; + pid = vfork(); + if (pid == 0) { + // We're the child process. Execute. + execl("/bin/sh", + "/bin/sh", + command.c_str(), + (char*) 0); + _exit (EXIT_FAILURE); + } else if (pid < 0) { + // The fork failed. Report failure. + return_code = -1; + } else { + // This is the parent process. Wait for the + // child to complete. + if (waitpid(pid, &return_code, 0) != pid) { + return_code = -1; + } + } + return return_code; +} + +void QSubTask::Start() { + string resource_filename; + bool available; + ResourcesAvailable_(&available, + &resource_filename); + if (!available) { + printf("Error. Task resource unavailable:%s\n", + resource_filename.c_str()); + } + + if (done_sentinel_.empty()) { + stdout_filename_ = StringPrintf( + "%s/%s_%d.out", + working_directory_.c_str(), + name.c_str(), + id); + stderr_filename_ = StringPrintf( + "%s/%s_%d.err", + working_directory_.c_str(), + name.c_str(), + id); + done_sentinel_ = StringPrintf( + "%s/%s_%d.done", + working_directory_.c_str(), + name.c_str(), + id); + } + + if (FileExists(done_sentinel_)) { + if (!FileRemove(done_sentinel_)) { + printf("Error removing file. Failing.\n"); + exit(1); + } + } + if (FileExists(stdout_filename_)) { + if (!FileRemove(stdout_filename_)) { + printf("Error removing file. Failing.\n"); + exit(1); + } + } + if (FileExists(stderr_filename_)) { + if (!FileRemove(stderr_filename_)) { + printf("Error removing file. Failing.\n"); + exit(1); + } + } + + string job_command = StringPrintf("%s/%s", + FLAGS_bin_directory.c_str(), + command_.c_str()); + const string kFilename = "/tmp/command_asdf.sh"; + if (FLAGS_run_locally) { + full_commandline_ = StringPrintf("nohup ./%s", + job_command.c_str(), + binary_.c_str(), + stdout_filename_.c_str(), + stderr_filename_.c_str()); + } else { + // TODO(sgerrish): Add proper temp file naming. + full_commandline_ = StringPrintf( + "echo \'cd %s ; %s ; \n \' " + "| %s -o %s -e %s " + "-l walltime=%d:00:00,mem=%dmb\n", + CurrentWorkingDirectory().c_str(), + job_command.c_str(), + binary_.c_str(), + stdout_filename_.c_str(), + stderr_filename_.c_str(), + walltime_hours_, + memory_mb_); + } + printf("Current working directory: %s\n.", CurrentWorkingDirectory().c_str()); + FILE* f = fopen(kFilename.c_str(), "w"); + if (f) { + fprintf(f, full_commandline_.c_str()); + fclose(f); + chmod(kFilename.c_str(), 0744); + } else { + printf("Error opening file /tmp/command_asdf.txt\n Skipping."); + } + + printf("Running command: %s.\n", full_commandline_.c_str()); + int return_code = vsystem(kFilename.c_str()); + if (return_code) { + printf("Return code %d when running command:\n" + "%s\n", + return_code, + full_commandline_.c_str()); + exit(1); + } +} + +Task::RunStatus QSubTask::Status() const { + if (FileExists(done_sentinel_)) { + return Task::SUCCESS; + } + + if (!FileExists(stderr_filename_)) { + return(Task::RUN); + } else { + if (!FileExists(done_sentinel_)) { + return(Task::FAIL); + } + } +} + +QSubTask* TaskFactory::NewTask(int id, + string job_name, + const char* root, + const hash_map<std::string, std::string>& flags, + const vector<Resource*>& resources, + const string& done_sentinel, + string binary) { + QSubTask* task = new QSubTask(job_name, id); + string flags_string; + + /* + for (int i=0; i < resources.size(); ++i) { + task->AddResource(resources[i]); + if (i) { + resource_string += " "; + } + resource_string += ("--" + + resources[i]->name + + "=" + + resources[i]->filename); + } + */ + + for (hash_map<string, string>::const_iterator it=flags.begin(); + it != flags.end(); + ++it) { + if (it != flags.begin()) { + flags_string += " "; + } + flags_string += ("--" + + it->first + + "=" + + it->second); + } + + task->set_done_sentinel(done_sentinel); + task->set_working_directory(root); + task->set_command(binary + " " + flags_string); + if (flags.find("done_sentinel") != flags.end()) { + // task->set_done_sentinel(flags["done_sentinel"]); + task->set_done_sentinel(flags.find("done_sentinel")->second); + } + + // Set the parallel-processing binary appropriately. + task->set_binary("/opt/torque/bin/qsub"); + + return(task); +} + +void CreateSentinel(const string& sentinel_filename, + double l_hood) { + FILE* f = fopen(sentinel_filename.c_str(), "w"); + fprintf(f, "%lf\n", l_hood); + fclose(f); +} + +} // namespace dtm diff --git a/dtm_release/dtm-parallel/c2_lib.h b/dtm_release/dtm-parallel/c2_lib.h new file mode 100644 index 0000000000000000000000000000000000000000..b4502b12915054d6b25d24c03bb6a02e616f93a6 --- /dev/null +++ b/dtm_release/dtm-parallel/c2_lib.h @@ -0,0 +1,285 @@ +#include "strutil.h" + +#include <string> +#include <iostream> +#include <vector> +#include <hash_set> +#include <hash_map> + +using namespace std; + +#ifndef c2_lib_h__ +#define c2_lib_h__ + +namespace __gnu_cxx { +template<> struct hash< std::string > +{ + size_t operator()( const std::string& x ) const + { + return hash< const char* >()( x.c_str() ); + } +}; +} + + +namespace c2_lib { + +bool FileRemove(string file_name); +string CurrentWorkingDirectory(); +bool FileExists(string file_name); + +class Task; + +// Block until all tasks in tasks are complete. +// If any task has failed, print a message and exit(1).; +void WaitOnTask(const Task& task); +void WaitOnTasks(const vector<Task*>& tasks); + +// Generally corresponds to a single file. +class Resource: public FILE { + public: + Resource(string filename); + + ~Resource(); + + // True iff the resource is available. + virtual bool Available(); + + // Removes a task from references_. + void TaskDone(int id); + + void AddReference(int id) { + references_.insert(id); + } + + // The filename corresponding to this resource. + string filename; + + // A name given to this resource. + string name; + + private: + std::hash_set<int> references_; +}; + + +// Generally corresponds to one "parallel" task. +class Task { + public: + // Name can be anything. Id should be unique. + Task(string name, int id); + + ~Task(); + + // Add a resource. + virtual void AddResource(Resource* resource); + + // Launch the task. + virtual void Start() = 0; + + virtual int Priority() const { + return 1; + } + + virtual string DebugString() const { + return ""; + } + + // Removes resources from its tasks. + enum RunStatus { + RUN, + SUCCESS, + FAIL, + }; + virtual RunStatus Status() const = 0; + + void set_command(string command) { + command_ = command; + } + + static void set_working_directory(string working_directory) { + working_directory_ = working_directory; + } + + // A numeric integer describing this job's id. Should be unique at + // any given time (could be recycled over the duration of the + // program). + int id; + + // A string describing this job. Need not be unique. + string name; + + // The working directory for parallel tasks. + static string working_directory_; + + protected: + // If the resources are available + void ResourcesAvailable_(bool* available, + string* resource_filename); + + // The command which has been requested run. + string command_; + + private: + + bool done_; + + vector<Resource*> resources_; + +}; + +} // namespace c2_lib + +using namespace c2_lib; + +namespace dtm { + +// Helper functions +double ReadLikelihoods( + const vector<string>& done_sentinels); + +class QSubTask + : public Task { + public: + QSubTask(string job_name, int id) : Task(job_name, id), + stdout_filename_(""), + stderr_filename_(""), + full_commandline_(""), + done_sentinel_(""), + walltime_hours_(13), + memory_mb_(15000) {} + void Start(); + + RunStatus Status() const; + + int Priority() const { + return walltime_hours_; + } + + string DebugString() const; + + static void set_binary(const string& binary) { + binary_ = binary; + } + + void set_done_sentinel(const string& sentinel) { + done_sentinel_ = sentinel; + stdout_filename_ = sentinel + ".out"; + stderr_filename_ = sentinel + ".err"; + } + + void set_memory_mb(int mb) { + memory_mb_ = mb; + } + + void set_walltime_hours(int hours) { + walltime_hours_ = hours; + } + +private: + + // The parallel processing binary. + static string binary_; + + string stdout_filename_; + + string stderr_filename_; + + string full_commandline_; + + int walltime_hours_; + + int memory_mb_; + + // The name of a small file which should exist iff the program has + // completed successfully. + string done_sentinel_; +}; + +class TaskFactory { + public: + TaskFactory() {} + ~TaskFactory() {} + + static Task* NewEStepTask(int id, + const char* root, + const hash_map<std::string, std::string>& flags, + const vector<Resource*>& resources, + const string& done_sentinel) { + QSubTask* task = NewTask(id, "lda-e-step", + root, + flags, + resources, + done_sentinel, + "lda-e-step"); + task->set_memory_mb(4000); + task->set_walltime_hours(5); + return task; + } + + static Task* NewMStepTask(int id, + const char* root, + const hash_map<std::string, std::string>& flags, + const vector<Resource*>& resources, + const string& done_sentinel) { + QSubTask* task = NewTask(id, "lda-m-step", + root, + flags, + resources, + done_sentinel, + "lda-m-step"); + task->set_memory_mb(4000); + task->set_walltime_hours(3); + return task; + } + + static Task* NewTopicsFitTask(int id, + const char* root, + const hash_map<std::string, std::string>& flags, + const vector<Resource*>& resources, + const string& done_sentinel) { + QSubTask* task = NewTask(id, "dtm-fit_seq_topics", + root, + flags, + resources, + done_sentinel, + "fit-seq-topics"); + task->set_memory_mb(8000); + task->set_walltime_hours(10); + return task; + } + + static Task* NewDocsFitTask(int id, + const char* root, + const hash_map<std::string, std::string>& flags, + const vector<Resource*>& resources, + const string& done_sentinel) { + QSubTask* task = NewTask(id, "dtm-fit_seq_docs", + root, + flags, + resources, + done_sentinel, + "fit-seq-docs"); + task->set_memory_mb(4000); + task->set_walltime_hours(18); + return task; + } + + static QSubTask* NewTask(int id, + string job_name, + const char* root, + const hash_map<std::string, std::string>& flags, + const vector<Resource*>& resources, + const string& done_sentinel, + string binary); + + + private: +}; + +void CreateSentinel(const string& sentinel_filename, + double l_hood); + +} // namespace dtm + +#endif diff --git a/dtm_release/dtm-parallel/data.c b/dtm_release/dtm-parallel/data.c new file mode 100644 index 0000000000000000000000000000000000000000..9d3f5b619832630001944f14f7fb22b6487cb3e6 --- /dev/null +++ b/dtm_release/dtm-parallel/data.c @@ -0,0 +1,472 @@ +#include <string> + +#include "gflags.h" +#include "params.h" +#include "strutil.h" +#include "ss-lm-fit_seq_topics.h" + +#include "data.h" + +DEFINE_double(sigma_l, + 0.05, + "If true, use the new phi calculation."); +DEFINE_double(sigma_d, + 0.05, + "If true, use the new phi calculation."); +DEFINE_double(sigma_c, + 0.05, + "c stdev."); +DEFINE_double(resolution, + 1, + "The resolution. Used to determine how far out the beta mean should be."); +DEFINE_int32(max_number_time_points, + 200, + "Used for the influence window."); +DEFINE_double(time_resolution, + 0.5, + "This is the number of years per time slice."); +DEFINE_double(influence_mean_years, + 20.0, + "How many years is the mean number of citations?"); +DEFINE_double(influence_stdev_years, + 15.0, + "How many years is the stdev number of citations?"); +DEFINE_int32(influence_flat_years, + -1, + "How many years is the influence nonzero?" + "If nonpositive, a lognormal distribution is used."); +DEFINE_int32(fix_topics, + 0, + "Fix all topics below this number."); + +DECLARE_string(normalize_docs); + +using namespace std; + +namespace dtm { + +/* + * seq corpus range: [start, end) + * + * creates a subset of time slices + * + */ + +corpus_seq_t* make_corpus_seq_subset(corpus_seq_t* all, + int start, + int end) { + int n; + corpus_seq_t* subset_corpus = (corpus_seq_t*) malloc(sizeof(corpus_seq_t)); + subset_corpus->nterms = all->nterms; + subset_corpus->len = end - start; + subset_corpus->ndocs = 0; + subset_corpus->corpus = (corpus_t**) malloc(sizeof(corpus_t*) * subset_corpus->len); + for (n = start; n < end; n++) + { + subset_corpus->corpus[n - start] = all->corpus[n]; + subset_corpus->ndocs += all->corpus[n]->ndocs; + } + return(subset_corpus); +} + + +/* + * collapse a sequential corpus to a flat corpus + * + */ + +corpus_t* collapse_corpus_seq(corpus_seq_t* c) { + corpus_t* collapsed = (corpus_t*) malloc(sizeof(corpus_t)); + collapsed->ndocs = c->ndocs; + collapsed->nterms = c->nterms; + collapsed->doc = (doc_t**) malloc(sizeof(doc_t*) * c->ndocs); + collapsed->max_unique = 0; + int t, n, doc_idx = 0; + for (t = 0; t < c->len; t++) + { + for (n = 0; n < c->corpus[t]->ndocs; n++) + { + collapsed->doc[doc_idx] = c->corpus[t]->doc[n]; + if (collapsed->doc[doc_idx]->nterms > collapsed->max_unique) + collapsed->max_unique = collapsed->doc[doc_idx]->nterms; + doc_idx++; + } + } + assert(doc_idx == collapsed->ndocs); + return(collapsed); +} + +/* + * read corpus + * + */ + +corpus_t* read_corpus(const char* name) +{ + int length, count, word, n; + corpus_t* c; + char filename[400]; + sprintf(filename, "%s-mult.dat", name); + outlog("reading corpus from %s", filename); + c = (corpus_t*) malloc(sizeof(corpus_t)); + c->max_unique = 0; + FILE* fileptr = fopen(filename, "r"); + if (fileptr == NULL) { + outlog("Error reading corpus prefix %s. Failing.", + filename); + exit(1); + } + c->ndocs = 0; c->nterms = 0; + c->doc = (doc_t**) malloc(sizeof(doc_t*)); + int grand_total = 0; + while ((fscanf(fileptr, "%10d", &length) != EOF)) + { + if (length > c->max_unique) c->max_unique = length; + c->doc = (doc_t**) realloc(c->doc, sizeof(doc_t*)*(c->ndocs+1)); + c->doc[c->ndocs] = (doc_t*) malloc(sizeof(doc_t)); + c->doc[c->ndocs]->nterms = length; + c->doc[c->ndocs]->total = 0; + c->doc[c->ndocs]->log_likelihood = 0.0; + + c->doc[c->ndocs]->word = (int*) malloc(sizeof(int)*length); + c->doc[c->ndocs]->count = (int*) malloc(sizeof(int)*length); + c->doc[c->ndocs]->lambda = (double*) malloc(sizeof(double)*length); + c->doc[c->ndocs]->log_likelihoods = (double*) malloc(sizeof(double)*length); + for (n = 0; n < length; n++) + { + fscanf(fileptr, "%10d:%10d", &word, &count); + word = word - OFFSET; + if (FLAGS_normalize_docs == "occurrence") { + count = 1; + } + c->doc[c->ndocs]->word[n] = word; + c->doc[c->ndocs]->count[n] = count; + c->doc[c->ndocs]->total += count; + // Is there a better value for initializing lambda? + c->doc[c->ndocs]->lambda[n] = 0.0; + c->doc[c->ndocs]->log_likelihoods[n] = 0.0; + if (word >= c->nterms) { c->nterms = word + 1; } + } + grand_total += c->doc[c->ndocs]->total; + c->ndocs = c->ndocs + 1; + } + fclose(fileptr); + outlog("read corpus (ndocs = %d; nterms = %d; nwords = %d)\n", + c->ndocs, c->nterms, grand_total); + return(c); +} + +void free_corpus(corpus_t* corpus) { + for (int i=0; i < corpus->ndocs; ++i) { + delete corpus->doc[i]->word; + delete corpus->doc[i]->count; + delete corpus->doc[i]->lambda; + delete[] corpus->doc[i]->log_likelihoods; + } + delete corpus->doc; + delete corpus; +} + +/* + * read corpus sequence + * + */ + +corpus_seq_t* read_corpus_seq(const char* name) +{ + char filename[400]; + corpus_seq_t* corpus_seq = (corpus_seq_t*) malloc(sizeof(corpus_seq_t)); + + // read corpus + corpus_t* raw_corpus = read_corpus(name); + corpus_seq->nterms = raw_corpus->nterms; + // read sequence information + sprintf(filename, "%s-seq.dat", name); + outlog("Reading corpus sequence %s.", filename); + FILE* fileptr = fopen(filename, "r"); + if (!fileptr) { + outlog("Error opening dtm sequence file %s.\n", + filename); + exit(1); + } + fscanf(fileptr, "%d", &(corpus_seq->len)); + corpus_seq->corpus = (corpus_t**) malloc(sizeof(corpus_t*) * corpus_seq->len); + // allocate corpora + int doc_idx = 0; + int ndocs, i, j; + corpus_seq->ndocs = 0; + for (i = 0; i < corpus_seq->len; ++i) + { + fscanf(fileptr, "%d", &ndocs); + corpus_seq->ndocs += ndocs; + corpus_seq->corpus[i] = (corpus_t*) malloc(sizeof(corpus_t)); + corpus_seq->corpus[i]->ndocs = ndocs; + corpus_seq->corpus[i]->doc = (doc_t**) malloc(sizeof(doc_t*) * ndocs); + for (j = 0; j < ndocs; j++) + { + if (doc_idx >= raw_corpus->ndocs) { + outlog("Error: too few documents listed in dtm sequence file %s.\n" + "Current line: %d %d %d.\n", + filename, + doc_idx, + ndocs, + j); + exit(1); + } + // outlog("%d %d %d %d\n", i, j, doc_idx, raw_corpus->ndocs); + corpus_seq->corpus[i]->doc[j] = raw_corpus->doc[doc_idx]; + doc_idx++; + } + } + corpus_seq->max_nterms = compute_max_nterms(corpus_seq); + outlog("read corpus of length %d\n", corpus_seq->len); + return(corpus_seq); +} + + +/* + * write sequential corpus + * + */ + +void write_corpus_seq(corpus_seq_t* c, char* name) +{ + char tmp_string[400]; + int n; + + outlog("writing %d slices to %s (%d total docs)", c->len, name, c->ndocs); + sprintf(tmp_string, "%s-seq.dat", name); + FILE* seq_file = fopen(tmp_string, "w"); + fprintf(seq_file, "%d", c->len); + for (n = 0; n < c->len; n++) + fprintf(seq_file, " %d", c->corpus[n]->ndocs); + fclose(seq_file); + + corpus_t* flat = collapse_corpus_seq(c); + sprintf(tmp_string, "%s-mult.dat", name); + write_corpus(flat, tmp_string); +} + +/* + * write corpus + * + */ + +void write_corpus(corpus_t* c, char* filename) +{ + int i, j; + FILE * fileptr; + doc_t * d; + outlog("writing %d docs to %s\n", c->ndocs, filename); + fileptr = fopen(filename, "w"); + for (i = 0; i < c->ndocs; i++) + { + d = c->doc[i]; + fprintf(fileptr, "%d", d->nterms); + for (j = 0; j < d->nterms; j++) + { + fprintf(fileptr, " %d:%d", d->word[j], d->count[j]); + } + fprintf(fileptr, "\n"); + } + fclose(fileptr); +} + +/* + * read and write lda sequence variational distribution + * + */ + +void write_lda_seq_docs(const string& model_type, + const string& root_directory, + int min_time, + int max_time, + const lda_seq* model) { + string filename = StringPrintf("%s/times_%d_%d_info.dat", + root_directory.c_str(), + min_time, + max_time); + FILE* f = fopen(filename.c_str(), "w"); + + params_write_int(f, "NUM_TOPICS", model->ntopics); + params_write_int(f, "NUM_TERMS", model->nterms); + params_write_int(f, "SEQ_LENGTH", model->nseq); + params_write_gsl_vector(f, "ALPHA", model->alpha); + + fclose(f); + + for (int k = 0; k < model->ntopics; k++) { + if (model_type == "fixed") { + gsl_matrix_view view = gsl_matrix_submatrix( + model->topic[k]->w_phi_l, + 0, min_time, model->nterms, max_time - min_time); + filename = StringPrintf( + "%s/w_phi_l-topic_%d-time_%d_%d.dat", + root_directory.c_str(), k, min_time, max_time); + mtx_fprintf(filename.c_str(), &view.matrix); + + // Note that in this case, we write the entire sequence. + view = gsl_matrix_submatrix( + model->topic[k]->m_update_coeff, + 0, 0, model->nterms, max_time - min_time); + filename = StringPrintf("%s/m_update_coeff-topic_%d-time_%d_%d.dat", + root_directory.c_str(), + k, min_time, max_time); + mtx_fprintf(filename.c_str(), &view.matrix); + } + } + + for (int t=min_time; t < max_time; ++t) { + outlog("\nwriting influence weights for time %d to %s", + t, filename.c_str()); + filename = StringPrintf( + "%s/influence_time-%03d", + root_directory.c_str(), t); + gsl_matrix* influence_t = + model->influence->doc_weights[t]; + assert(model->ntopics == influence_t->size2); + mtx_fprintf(filename.c_str(), influence_t); + + filename = StringPrintf("%s/renormalized_influence_time-%03d", + root_directory.c_str(), t); + outlog("\nwriting influence weights for time %d to %s", + t, filename.c_str()); + influence_t = + model->influence->renormalized_doc_weights[t]; + assert(model->ntopics == influence_t->size2); + mtx_fprintf(filename.c_str(), influence_t); + } +} + + +/* + * compute the maximum nterms in a corpus sequence + * + */ + +int compute_max_nterms(const corpus_seq_t* c) +{ + int i,j; + int max = 0; + for (i = 0; i < c->len; i++) + { + corpus_t* corpus = c->corpus[i]; + for (j = 0; j < corpus->ndocs; j++) + if (corpus->doc[j]->nterms > max) + max = corpus->doc[j]->nterms; + } + return(max); +} + + +/* + * compute the total matrix of counts (W x T) + * + */ + +gsl_matrix* compute_total_counts(const corpus_seq_t* c) +{ + int t, d, n; + gsl_matrix* ret = gsl_matrix_alloc(c->nterms, c->len); + + for (t = 0; t < c->len; t++) + { + corpus_t* corpus = c->corpus[t]; + for (d = 0; d < corpus->ndocs; d++) + { + doc_t* doc = corpus->doc[d]; + for (n = 0; n < doc->nterms; n++) + { + minc(ret, doc->word[n], t, (double) doc->count[n]); + } + } + } + return(ret); +} + +// Creates a new array of doubles with kScaledBetaMax +// elements. +double* NewScaledInfluence(int size) { + double* scaled_influence = new double[size]; + + if (FLAGS_influence_flat_years > 0) { + // Note that we round up, to make sure we have at least one epoch. + int number_epochs = FLAGS_influence_flat_years * FLAGS_time_resolution; + double epoch_weight = 1.0 / number_epochs; + for (int i=0; i < number_epochs; ++i) { + scaled_influence[i] = epoch_weight; + } + for (int i=number_epochs; i < size; ++i) { + scaled_influence[i] = 0.0; + } + return scaled_influence; + } + + + /* + // Use the simple distribution: 1 at [0], 0 everywhere else. + for (int i=0; i < size; ++i) { + scaled_influence[i] = 0.0; + } + scaled_influence[0] = 1.0; + // scaled_beta[1] = 0; + return scaled_influence; + */ + + /* + // Simulate a beta distribution with specified mean and variance. + double total = 0.0; + double tmp = (scaled_beta_mean + * (1 - scaled_beta_mean) + / scaled_beta_variance) - 1.0; + double beta_alpha = scaled_beta_mean * tmp; + double beta_beta = (1 - scaled_beta_mean) * tmp; + for (int i=0; i < scaled_beta_max; ++i) { + // Offset tmp by 0.5 so we get a centered distribution + // and don't run into degeneracy issues. + tmp = (i + 0.5) / (scaled_beta_max); + scaled_beta[i] = (pow(tmp, beta_alpha - 1.0) + * pow(1 - tmp, beta_beta - 1.0)); + total += scaled_beta[i]; + } + */ + + + // Handle the log-normal distribution. + double total = 0.0; + + // Here, we're interested more in the median. + // So we treat the variable mean as median and note this in + // our paper. + double scaled_influence_mean = FLAGS_influence_mean_years; + double scaled_influence_variance = (FLAGS_influence_stdev_years + * FLAGS_influence_stdev_years); + double tmp = (1.0 + + (scaled_influence_variance + / (scaled_influence_mean + * scaled_influence_mean))); + double lognormal_sigma_squared = log(tmp); + double lognormal_mu = (log(scaled_influence_mean) + - 0.5 * lognormal_sigma_squared); + printf("Median: %.2f\n", exp(lognormal_mu)); + for (int i = 0; i < size; ++i) { + // Shift right by half a timeframe to avoid corner cases. + double x = (i / FLAGS_time_resolution) + (1.0 / FLAGS_time_resolution) / 2; + double tmp2 = (log(x) - lognormal_mu); + scaled_influence[i] = (1.0 + / (x * sqrt(lognormal_sigma_squared * 2 * 3.1415926)) + * exp(-tmp2 * tmp2 + / (2.0 + * lognormal_sigma_squared))); + total += scaled_influence[i]; + } + + for (int i = 0; i < kScaledInfluenceMax; ++i) { + scaled_influence[i] /= total; + } + + return scaled_influence; + +} + +} // namespace dtm diff --git a/dtm_release/dtm-parallel/data.h b/dtm_release/dtm-parallel/data.h new file mode 100644 index 0000000000000000000000000000000000000000..55538896c1e30b96a611f0e32c0a5370905f0819 --- /dev/null +++ b/dtm_release/dtm-parallel/data.h @@ -0,0 +1,192 @@ +#ifndef DATA_H +#define DATA_H + +#include "gsl-wrappers.h" +#include "param.h" +#include <stdio.h> +#include <stdlib.h> +#include <string> +#include <hash_map> + +#define OFFSET 0 +//class string; + +using namespace std; + +namespace dtm { + + +// Create// Create the scaled beta distribution, which describes +// how much weight documents have after n years. +const int kScaledInfluenceMax = 200; +// This mean and variance are relative to the interval [0, 1.0]. +const double kScaledInfluenceMean = 10.0 / kScaledInfluenceMax; +const double kScaledInfluenceVariance = ((10.0 / kScaledInfluenceMax) + * (10.0 / kScaledInfluenceMax)); + +/* + * a document is a collection of counts and terms + * + */ + +typedef struct doc_t +{ + int total; + int nterms; + int* word; + int* count; + // A parameter for finding phi. + double* lambda; + + // Used for measuring perplexity. + double log_likelihood; + double* log_likelihoods; +} doc_t; + + +/* + * a corpus is a collection of documents + * + */ + +typedef struct corpus_t +{ + doc_t** doc; + int ndocs; + int nterms; + int max_unique; // maximum number of unique terms in a document +} corpus_t; + + +/* + * a sequence is a sequence of corpora + * + */ + +typedef struct corpus_seq_t +{ + corpus_t** corpus; + int nterms; + int max_nterms; + int len; + int ndocs; +} corpus_seq_t; + + +typedef struct inf_var +{ + gsl_matrix** doc_weights; // T matrices of document weights. + // each matrix is d_t x K. + gsl_matrix** renormalized_doc_weights; // T matrices of document weights. + // each matrix is d_t x K. + int ntime; +} inf_var; + +/* + * variational posterior structure + * + */ + + +typedef struct sslm_var { + // properties + + int W; // vocabulary size + int T; // sequence length + + // variational parameters + + gsl_matrix* obs; // observations, W x T + + // biproducts of the variational parameters + + double obs_variance; // observation variance + double chain_variance; // chain variance + gsl_vector* zeta; // extra variational parameter, T + gsl_matrix* e_log_prob; // E log prob(w | t), W x T + + // convenient quantities for inference + + gsl_matrix* fwd_mean; // forward posterior mean, W x T + gsl_matrix* fwd_variance; // forward posterior variance, W x T + gsl_matrix* mean; // posterior mean, W x T + gsl_matrix* variance; // posterior variance, W x T + + gsl_matrix* mean_t; // W x T + gsl_matrix* variance_t; + + gsl_matrix* influence_sum_lgl; // The sum exp * w_phi_l + + // Recent copy of w_phi_l. + gsl_matrix* w_phi_l; // W x T + // gsl_matrix* w_phi_sum; // W x T + // gsl_matrix* w_phi_l_sq; // Square term involving various + gsl_matrix* m_update_coeff; // Terms involving squares of + // W, l, and phi. W x T. + gsl_matrix* m_update_coeff_g; // \sum_i=0..t phi_l(t) r(i-t) + // W x T. + + // useful temporary vector + gsl_vector* T_vct; +} sslm_var; + + +typedef struct lda_seq +{ + int ntopics; // number of topics + int nterms; // number of terms + int nseq; // length of sequence + gsl_vector* alpha; // dirichlet parameters + + sslm_var** topic; // topic chains. + + inf_var* influence; // document weights + + gsl_matrix** influence_sum_lgl; // Sum of document weights at time t (see g in the regression formula) + + // gsl_vector** influence_sum_g; // Sum of document weights at time t. + // gsl_vector** influence_sum_h; // Sum of document weights at time t. + + inf_var* renormalized_influence; // document weights + + // gsl_matrix** w_phi_l; // Product term for the \beta update. + // gsl_matrix** w_phi_l_sq; // Square term involving various + // coefficients for the \beta update. + + pair<int, float>**** top_doc_phis; // T x D_t x n of document phis. +} lda_seq; + +/* + * functions + * + */ + +corpus_t* read_corpus(const char* name); +void free_corpus(corpus_t* corpus); +corpus_seq_t* read_corpus_seq(const char* name); +int compute_max_nterms(const corpus_seq_t* c); +gsl_matrix * compute_total_counts(const corpus_seq_t* c); +corpus_seq_t* make_seq_corpus_subset(corpus_seq_t* all, int start, int end); +void write_corpus(corpus_t* c, char* filename); +void write_corpus_seq(corpus_seq_t* c, char* name); +corpus_seq_t* make_corpus_seq_subset(corpus_seq_t* all, int start, int end); +corpus_t* collapse_corpus_seq(corpus_seq_t* c); +double* NewScaledInfluence(int size); + +/* + * Reading and writing. + * + */ + +// read and write an lda sequence +void write_lda_seq_docs(const string& model_type, + const string& root_directory, + int min_time, + int max_time, + const lda_seq* m); + + + +} // namespace dtm + +#endif diff --git a/dtm_release/dtm-parallel/gsl-wrappers.c b/dtm_release/dtm-parallel/gsl-wrappers.c new file mode 100644 index 0000000000000000000000000000000000000000..3534679610bcd09a03cf66d0708175b49d9699a7 --- /dev/null +++ b/dtm_release/dtm-parallel/gsl-wrappers.c @@ -0,0 +1,528 @@ +#include "gflags.h" +#include "gsl-wrappers.h" + +static gsl_rng* RANDOM_NUMBER_GENERATOR = NULL; + +DEFINE_int64(rng_seed, + 0, + "Specifies the random seed. If 0, seeds pseudo-randomly."); + +// The maximum number of iterations for each update. +const double MAX_ITER = 15; + +/* + * safe logarithm function + * + */ + +double safe_log(double x) +{ + if (x == 0) + { + return(-1000); + } + else + { + return(log(x)); + } +} + + +/* + * given log(a) and log(b), return log(a+b) + * + */ + +double log_sum(double log_a, double log_b) +{ + double v; + + if (log_a == -1) return(log_b); + + if (log_a < log_b) + { + v = log_b+log(1 + exp(log_a-log_b)); + } + else + { + v = log_a+log(1 + exp(log_b-log_a)); + } + return(v); +} + + +void vinc(gsl_vector* v, int i, double x) +{ + vset(v, i, vget(v, i) + x); +} + +void minc(gsl_matrix* m, int i, int j, double x) +{ + mset(m, i, j, mget(m, i, j) + x); +} + + +void msetrow(gsl_matrix* m, int r, const gsl_vector* val) +{ + int i; + gsl_vector v = gsl_matrix_row(m, r).vector; + for (i = 0; i < v.size; i++) + vset(&v, i, vget(val, i)); +} + + +void msetcol(gsl_matrix* m, int r, const gsl_vector* val) +{ + int i; + gsl_vector v = gsl_matrix_column(m, r).vector; + for (i = 0; i < v.size; i++) + vset(&v, i, vget(val, i)); +} + + +/* + * compute the column sums of a matrix + * + */ + +void col_sum(gsl_matrix* m, gsl_vector* val) +{ + int i, j; + gsl_vector_set_all(val, 0); + + for (i = 0; i < m->size1; i++) + for (j = 0; j < m->size2; j++) + vinc(val, j, mget(m, i, j)); +} + + +/* + * print a vector to standard out + * + */ + +void vct_printf(const gsl_vector * v) +{ + int i; + for (i = 0; i < v->size; i++) + printf("%5.5f ", vget(v, i)); + printf("\n\n"); +} + + +/* + * print a matrix to standard out + * + */ + +void mtx_printf(const gsl_matrix * m) +{ + int i, j; + for (i = 0; i < m->size1; i++) + { + for (j = 0; j < m->size2; j++) + printf("%5.5f ", mget(m, i, j)); + printf("\n"); + } +} + + +/* + * read/write a vector/matrix from a file + * + */ + +void vct_fscanf(const char* filename, gsl_vector* v) +{ + outlog("reading %ld vector from %s", v->size, filename); + FILE* fileptr; + if (!fileptr) { + outlog("Error opening file %s. Failing.", filename); + exit(1); + } + fileptr = fopen(filename, "r"); + gsl_vector_fscanf(fileptr, v); + fclose(fileptr); +} + +void mtx_fscanf(const char* filename, gsl_matrix * m) +{ + FILE* fileptr = fopen(filename, "r"); + + outlog("reading %ld x %ld matrix from %s", + m->size1, m->size2, filename); + if (!fileptr) { + outlog("Error opening file %s. Failing.", filename); + exit(1); + } + + gsl_matrix_fscanf(fileptr, m); + fclose(fileptr); +} + +void vct_fprintf(const char* filename, gsl_vector* v) +{ + outlog( "writing %ld vector to %s", v->size, filename); + FILE* fileptr; + fileptr = fopen(filename, "w"); + if (!fileptr) { + outlog("Error opening file %s. Failing.", filename); + exit(1); + } + gsl_vector_fprintf(fileptr, v, "%20.17e"); + fclose(fileptr); +} + + +void mtx_fprintf(const char* filename, const gsl_matrix * m) +{ + outlog( "writing %ld x %ld matrix to %s", + m->size1, m->size2, filename); + FILE* fileptr; + fileptr = fopen(filename, "w"); + if (!fileptr) { + outlog("Error opening file: %s", filename); + exit(1); + } + gsl_matrix_fprintf(fileptr, m, "%20.17e"); + fclose(fileptr); +} + + +/* + * matrix inversion using blas + * + */ + +void matrix_inverse(gsl_matrix* m, gsl_matrix* inverse) +{ + gsl_matrix *lu; + gsl_permutation* p; + int signum; + + p = gsl_permutation_alloc(m->size1); + lu = gsl_matrix_alloc(m->size1, m->size2); + + gsl_matrix_memcpy(lu, m); + gsl_linalg_LU_decomp(lu, p, &signum); + gsl_linalg_LU_invert(lu, p, inverse); + + gsl_matrix_free(lu); + gsl_permutation_free(p); +} + + +/* + * log determinant using blas + * + */ + +double log_det(gsl_matrix* m) +{ + gsl_matrix* lu; + gsl_permutation* p; + double result; + int signum; + + p = gsl_permutation_alloc(m->size1); + lu = gsl_matrix_alloc(m->size1, m->size2); + + gsl_matrix_memcpy(lu, m); + gsl_linalg_LU_decomp(lu, p, &signum); + result = gsl_linalg_LU_lndet(lu); + + gsl_matrix_free(lu); + gsl_permutation_free(p); + + return(result); +} + + +/* + * eigenvalues of a symmetric matrix using blas + * + */ + +void sym_eigen(gsl_matrix* m, gsl_vector* vals, gsl_matrix* vects) +{ + gsl_eigen_symmv_workspace* wk; + gsl_matrix* mcpy; + int r; + + mcpy = gsl_matrix_alloc(m->size1, m->size2); + wk = gsl_eigen_symmv_alloc(m->size1); + gsl_matrix_memcpy(mcpy, m); + r = gsl_eigen_symmv(mcpy, vals, vects, wk); + gsl_eigen_symmv_free(wk); + gsl_matrix_free(mcpy); +} + + +/* + * sum of a vector + * + */ + +double sum(const gsl_vector* v) +{ + double val = 0; + int i, size = v->size; + for (i = 0; i < size; i++) + val += vget(v, i); + return(val); +} + + +/* + * take log of each element + * + */ + +void vct_log(gsl_vector* v) +{ + int i, size = v->size; + for (i = 0; i < size; i++) + vset(v, i, safe_log(vget(v, i))); +} + + +/* + * l2 norm of a vector + * + */ + +// !!! this can be BLASified + +double norm(gsl_vector *v) +{ + double val = 0; + int i; + + for (i = 0; i < v->size; i++) + val += vget(v, i) * vget(v, i); + return(sqrt(val)); +} + + +/* + * draw K random integers from 0..N-1 + * + */ + +void choose_k_from_n(int k, int n, int* result) +{ + int i, x[n]; + + if (RANDOM_NUMBER_GENERATOR == NULL) + RANDOM_NUMBER_GENERATOR = gsl_rng_alloc(gsl_rng_taus); + for (i = 0; i < n; i++) + x[i] = i; + + gsl_ran_choose (RANDOM_NUMBER_GENERATOR, (void *) result, k, + (void *) x, n, sizeof(int)); +} + + +/* + * normalize a vector in log space + * + * x_i = log(a_i) + * v = log(a_1 + ... + a_k) + * x_i = x_i - v + * + */ + +void log_normalize(gsl_vector* x) +{ + double v = vget(x, 0); + int i; + + for (i = 1; i < x->size; i++) + v = log_sum(v, vget(x, i)); + + for (i = 0; i < x->size; i++) + vset(x, i, vget(x,i)-v); +} + + +/* + * normalize a positive vector + * + */ + +void normalize(gsl_vector* x) +{ + double v = 0; + int i; + + for (i = 0; i < x->size; i++) + v += vget(x, i); + + for (i = 0; i < x->size; i++) + vset(x, i, vget(x, i) / v); +} + + +/* + * exponentiate a vector + * + */ + +void vct_exp(gsl_vector* x) +{ + int i; + + for (i = 0; i < x->size; i++) + vset(x, i, exp(vget(x, i))); +} + + +/* + * maximize a function using its derivative + * + */ + +void optimize_fdf(int dim, + gsl_vector* x, + void* params, + void (*fdf)(const gsl_vector*, void*, double*, gsl_vector*), + void (*df)(const gsl_vector*, void*, gsl_vector*), + double (*f)(const gsl_vector*, void*), + double* f_val, + double* conv_val, + int* niter) +{ + gsl_multimin_function_fdf obj; + obj.f = f; + obj.df = df; + obj.fdf = fdf; + obj.n = dim; + obj.params = params; + +// const gsl_multimin_fdfminimizer_type * method = +// gsl_multimin_fdfminimizer_vector_bfgs; + const gsl_multimin_fdfminimizer_type * method = + gsl_multimin_fdfminimizer_conjugate_fr; + + gsl_multimin_fdfminimizer * opt = + gsl_multimin_fdfminimizer_alloc(method, dim); + + gsl_multimin_fdfminimizer_set(opt, &obj, x, 0.01, 1e-3); + + int iter = 0, status; + double converged, f_old = 0; + do + { + iter++; + status = gsl_multimin_fdfminimizer_iterate(opt); + // assert(status==0); + converged = fabs((f_old - opt->f) / (dim * f_old)); + // status = gsl_multimin_test_gradient(opt->gradient, 1e-3); + // printf("f = %1.15e; conv = %5.3e; norm = %5.3e; niter = %03d\n", + // opt->f, converged, norm(opt->gradient), iter); + f_old = opt->f; + } + while (converged > 1e-8 && iter < MAX_ITER); + // while (status == GSL_CONTINUE); + *f_val = opt->f; + *conv_val = converged; + *niter = iter; + gsl_multimin_fdfminimizer_free(opt); +} + + + +/* + * maximize a function + * + */ + +void optimize_f(int dim, + gsl_vector* x, + void* params, + double (*f)(const gsl_vector*, void*)) +{ + gsl_multimin_function obj; + obj.f = f; + obj.n = dim; + obj.params = params; + + const gsl_multimin_fminimizer_type * method = + gsl_multimin_fminimizer_nmsimplex; + + gsl_multimin_fminimizer * opt = + gsl_multimin_fminimizer_alloc(method, dim); + + gsl_vector * step_size = gsl_vector_alloc(dim); + gsl_vector_set_all(step_size, 1); + gsl_multimin_fminimizer_set(opt, &obj, x, step_size); + + int iter = 0, status; + double converged, f_old; + do + { + iter++; + f_old = opt->fval; + status = gsl_multimin_fminimizer_iterate(opt); + converged = fabs((f_old - opt->fval) / f_old); + printf("f = %1.15e; conv = %5.3e; size = %5.3e; niter = %03d\n", + opt->fval, converged, opt->size, iter); + } + while ((converged > 1e-10) || (iter < 10000)); + // while (status == GSL_CONTINUE); + printf("f = %1.15e; conv = %5.3e; niter = %03d\n", + opt->fval, converged, iter); + + gsl_multimin_fminimizer_free(opt); + gsl_vector_free(step_size); +} + + +/* + * check if a directory exists + * + * !!! shouldn't be here + */ + +int directory_exist(const char *dname) +{ + struct stat st; + int ret; + + if (stat(dname,&st) != 0) + { + return 0; + } + + ret = S_ISDIR(st.st_mode); + + if(!ret) + { + errno = ENOTDIR; + } + + return ret; +} + +void make_directory(const char* name) +{ + mkdir(name, S_IRUSR|S_IWUSR|S_IXUSR); +} + +gsl_rng* new_random_number_generator() +{ + gsl_rng* random_number_generator = gsl_rng_alloc(gsl_rng_taus); + long t1; + (void) time(&t1); + + if (FLAGS_rng_seed) { + t1 = FLAGS_rng_seed; + } + + // !!! DEBUG + // t1 = 1147530551; + printf("RANDOM SEED = %ld\n", t1); + gsl_rng_set(random_number_generator, t1); + return(random_number_generator); +} + diff --git a/dtm_release/dtm-parallel/gsl-wrappers.h b/dtm_release/dtm-parallel/gsl-wrappers.h new file mode 100644 index 0000000000000000000000000000000000000000..751611a9f2560a88ffdb780dcb1a5cc5ee320f22 --- /dev/null +++ b/dtm_release/dtm-parallel/gsl-wrappers.h @@ -0,0 +1,99 @@ +#ifndef GSL_WRAPPERS_H +#define GSL_WRAPPERS_H + +// #include <gsl/gsl_check_range.h> +#include <gsl/gsl_vector.h> +#include <gsl/gsl_matrix.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_linalg.h> +#include <gsl/gsl_eigen.h> +#include <gsl/gsl_rng.h> +#include <gsl/gsl_randist.h> +#include <gsl/gsl_multimin.h> +#include <gsl/gsl_math.h> +#include <gsl/gsl_blas.h> +#include <math.h> +#include <assert.h> +#include <time.h> +#include <sys/stat.h> +#include <sys/types.h> + +#define outlog(format, args...) \ + fprintf(stderr, format, args); \ + fprintf(stderr, "\n"); + +double safe_log(double); +double log_sum(double, double); + +static inline double vget(const gsl_vector* v, int i) +{ return(gsl_vector_get(v, i)); }; + +static inline void vset(gsl_vector* v, int i, double x) +{ gsl_vector_set(v, i, x); }; + +// Increment a vector element by a double. +void vinc(gsl_vector*, int, double); + +static inline double mget(const gsl_matrix* m, int i, int j) +{ return(gsl_matrix_get(m, i, j)); }; + +static inline void mset(gsl_matrix* m, int i, int j, double x) +{ gsl_matrix_set(m, i, j, x); }; + +void msetcol(gsl_matrix* m, int r, const gsl_vector* val); + +// Increment a matrix element by a double. +void minc(gsl_matrix*, int, int, double); +void msetrow(gsl_matrix*, int, const gsl_vector*); + +void col_sum(gsl_matrix*, gsl_vector*); + +void vct_printf(const gsl_vector* v); +void mtx_printf(const gsl_matrix* m); +void vct_fscanf(const char*, gsl_vector* v); +void mtx_fscanf(const char*, gsl_matrix* m); +void vct_fprintf(const char* filename, gsl_vector* v); +void mtx_fprintf(const char* filename, const gsl_matrix* m); + +double log_det(gsl_matrix*); + +void matrix_inverse(gsl_matrix*, gsl_matrix*); + +void sym_eigen(gsl_matrix*, gsl_vector*, gsl_matrix*); + +double sum(const gsl_vector* v); + +double norm(gsl_vector * v); + +void vct_log(gsl_vector* v); +void vct_exp(gsl_vector* x); + +void choose_k_from_n(int k, int n, int* result); + +void log_normalize(gsl_vector* x); +void normalize(gsl_vector* x); + +void optimize(int dim, + gsl_vector* x, + void* params, + void (*fdf)(const gsl_vector*, void*, double*, gsl_vector*), + void (*df)(const gsl_vector*, void*, gsl_vector*), + double (*f)(const gsl_vector*, void*)); + +void optimize_fdf(int dim, + gsl_vector* x, + void* params, + void (*fdf)(const gsl_vector*, void*, double*, gsl_vector*), + void (*df)(const gsl_vector*, void*, gsl_vector*), + double (*f)(const gsl_vector*, void*), + double* f_val, + double* conv_val, + int* niter); + +void log_write(FILE* f, char* string); +int directory_exist(const char *dname); +void make_directory(const char* name); + +gsl_rng* new_random_number_generator(); + +#endif diff --git a/dtm_release/dtm-parallel/lda-seq.c b/dtm_release/dtm-parallel/lda-seq.c new file mode 100644 index 0000000000000000000000000000000000000000..a2759a7df9bb0e292f1d2539d40647614aabcca7 --- /dev/null +++ b/dtm_release/dtm-parallel/lda-seq.c @@ -0,0 +1,1803 @@ +#include "c2_lib.h" +#include "lda-seq.h" + +#include "ss-lm.h" + +#include "gflags.h" +#include "strutil.h" + +#include <gsl/gsl_linalg.h> +#include <gsl/gsl_blas.h> +#include <gsl/gsl_vector_double.h> +#include <string.h> +#include <vector> +#include <hash_set> +#include <hash_map> + +DEFINE_double(phi_squared_factor, + 1.0, + "Scale factor for squared phi terms."); + +DEFINE_int32(lda_sequence_max_em_iter, + 30, + "The maximum number of iterations."); +DEFINE_int32(lda_sequence_min_iter, + 1, + "The maximum number of iterations."); + +DEFINE_string(seq_topic_filename, + "", + "The sequential topics filename."); + +DECLARE_string(normalize_docs); + +DEFINE_string(time_boundaries, + "", + "Comma-separated list of integers describing time ranges."); +DECLARE_int32(lda_max_em_iter); +DECLARE_string(doc_boundaries); +DECLARE_string(topic_boundaries); +DECLARE_int64(rng_seed); + +DEFINE_int32(save_time, + -1, + "Save a specific time. If -1, save all times."); + +DECLARE_double(alpha); +DECLARE_int32(ntopics); + +DEFINE_int32(max_time, 0, ""); +DEFINE_int32(min_time, 0, ""); + +DEFINE_double(top_obs_var, -1.0, ""); +DEFINE_double(top_chain_var, -1.0, ""); + +// DEFINE_int32(start, -1, ""); +// DEFINE_int32(end, -1, ""); + +DEFINE_string(model, + "fixed", + "The function to perform. " + "Can be dtm or fixed."); +DEFINE_string(resume_stage, + "lda", + "Resume from this stage. Options are lda, doc, topic."); +DECLARE_string(corpus_prefix); +DECLARE_int32(number_tasks); + +DECLARE_int32(influence_flat_years); + +DECLARE_int32(max_doc); +DECLARE_int32(min_doc); +DECLARE_int32(min_topic); +DECLARE_int32(max_topic); + +DECLARE_int32(fix_topics); +DECLARE_string(root_directory); +DEFINE_string(outname, "", ""); +DECLARE_int32(max_number_time_points); +DECLARE_double(sigma_d); +DECLARE_double(sigma_l); +DECLARE_double(time_resolution); + +namespace dtm { + +extern int LDA_INFERENCE_MAX_ITER; +static double* scaled_influence = NULL; + // using namespace std; +// const int TIME = 61; +const int TIME = -3; +const double PI = 3.141592654; + + +/* + * populate an LDA model at a particular time point + * + */ + +static void write_topic_suffstats(const int min_time, + const int max_time, + gsl_matrix** ss, + int nterms, + int k) { + string filename = StringPrintf( + "%s/lda-seq-ss-topic_%d-time_%d_%d.dat", + FLAGS_root_directory.c_str(), + k, min_time, max_time); + + gsl_matrix_view topics_time_ss = gsl_matrix_submatrix( + ss[k], + 0, min_time, + nterms, + max_time - min_time); + + mtx_fprintf(filename.c_str(), &topics_time_ss.matrix); +} + +static gsl_matrix* read_topic_suffstats( + const vector<int>& time_boundaries, + int nterms, + int k) { + // Note that these sufficient statistics are by time, and stored in + // disjoint subsets of the ss matrix. Therefore we don't need to + // aggregate them. + const int kMaxTime = time_boundaries[time_boundaries.size() - 1]; + gsl_matrix* topics_ss = gsl_matrix_alloc( + nterms, + kMaxTime); + for (int i=0; i + 1 < time_boundaries.size(); ++i) { + const int kMinTime = time_boundaries[i]; + const int kMaxTime = time_boundaries[i + 1]; + string filename = StringPrintf("%s/lda-seq-ss-topic_%d-time_%d_%d.dat", + FLAGS_root_directory.c_str(), + k, kMinTime, kMaxTime); + gsl_matrix_view topics_time_ss = gsl_matrix_submatrix( + topics_ss, + 0, kMinTime, + nterms, + kMaxTime - kMinTime); + mtx_fscanf(filename.c_str(), &topics_time_ss.matrix); + } + return topics_ss; +} + +static void RewriteTopicsAsSequential( + const vector<int>& time_boundaries, + const vector<int>& topic_boundaries, + lda_seq* model) { + // model is of the form W x Time + + // Model is already initialized by new_lda_seq from before. + // model->topic = new sslm_var*[model->ntopics]; + string kSSFilename = StringPrintf("%s/initial-lda-ss.dat", + FLAGS_root_directory.c_str()); + lda_suff_stats* init_suffstats = read_lda_suff_stats( + kSSFilename.c_str(), + model->ntopics, + model->nterms); + + lda* flat_model = new_lda_model(model->ntopics, + model->nterms); + + read_lda_topics(topic_boundaries, flat_model); + + const int W = model->nterms; + const int T = model->nseq; + const int K = model->ntopics; + for (int k=0; k < model->ntopics; ++k) { + // Is this necessary here? + model->topic[k]->w_phi_l = gsl_matrix_calloc(W, T); + model->topic[k]->m_update_coeff_g = NULL; + + model->topic[k]->obs_variance = FLAGS_top_obs_var; + model->topic[k]->chain_variance = FLAGS_top_chain_var; + + gsl_vector_view from = gsl_matrix_column( + flat_model->topics, k); + for (int t=0; t < model->nseq; ++t) { + gsl_vector_view to = + gsl_matrix_column(model->topic[k]->e_log_prob, t); + gsl_vector_memcpy(&to.vector, &from.vector); + } + + gsl_vector slice = gsl_matrix_column( + init_suffstats->topics_ss, k).vector; + + gsl_vector* log_norm_counts = gsl_vector_alloc(slice.size); + + // Populate only a subset of fields. + gsl_vector_memcpy(log_norm_counts, &slice); + gsl_vector_add_constant(log_norm_counts, 1.0 / model->nterms); + normalize(log_norm_counts); + vct_log(log_norm_counts); + + // set variational observations to transformed counts + + for (int t = 0; t < model->nseq; t++) { + msetcol(model->topic[k]->obs, t, log_norm_counts); + } + gsl_vector_free(log_norm_counts); + + const string kTopicsPrefix = + StringPrintf("%s/sslm-topic_%d", + FLAGS_root_directory.c_str(), + k); + + write_sslm_var(model->topic[k], kTopicsPrefix.c_str()); + } + + for (int i=0; i + 1 < time_boundaries.size(); ++i) { + const int kMinTime = time_boundaries[i]; + const int kMaxTime = time_boundaries[i + 1]; + + // Re-allocate m_update_coeff to have the correct size. + for (int k=0; k < K; ++k) { + if (i > 0) { + gsl_matrix_free(model->topic[k]->m_update_coeff); + } + model->topic[k]->m_update_coeff = gsl_matrix_calloc(W, kMaxTime - kMinTime); + } + + write_lda_seq_docs(FLAGS_model, + FLAGS_root_directory, + kMinTime, + kMaxTime, + model); + } + + for (int k=0; k < K; ++k) { + gsl_matrix_free(model->topic[k]->m_update_coeff); + gsl_matrix_free(model->topic[k]->w_phi_l); + model->topic[k]->m_update_coeff = NULL; + model->topic[k]->w_phi_l = NULL; + } + + gsl_matrix_free(init_suffstats->topics_ss); + free_lda_model(flat_model); + +} + +inf_var* inf_var_alloc(int number_topics, + int* ndocs, + int len) { + + // Hate to do this, but I had trouble using it before. This should + // be the first place we use it; otherwise we'll get a sigsev nil. + if (scaled_influence == NULL) { + scaled_influence = + NewScaledInfluence(FLAGS_max_number_time_points); + + printf("New scaled influence: \n"); + for (int i=0; i < FLAGS_max_number_time_points; ++i) { + printf(" %lf", scaled_influence[i]); + } + printf("\n"); + } + + inf_var* inf_var_ptr = (inf_var*) malloc(sizeof(inf_var)); + inf_var_ptr->doc_weights = (gsl_matrix**) malloc(sizeof(gsl_matrix*) + * len); + inf_var_ptr->renormalized_doc_weights = (gsl_matrix**) malloc( + sizeof(gsl_matrix*) + * len); + inf_var_ptr->ntime = len; + int i=0; + for (i=0; i < len; ++i) { + outlog("creating matrix. %d %d", ndocs[i], number_topics); + if (ndocs[i] == 0) { + inf_var_ptr->doc_weights[i] = (gsl_matrix*) malloc(sizeof(gsl_matrix)); + inf_var_ptr->doc_weights[i]->size1 = 0; + inf_var_ptr->doc_weights[i]->size2 = number_topics; + inf_var_ptr->renormalized_doc_weights[i] = (gsl_matrix*) malloc(sizeof(gsl_matrix)); + inf_var_ptr->renormalized_doc_weights[i]->size1 = 0; + inf_var_ptr->renormalized_doc_weights[i]->size2 = number_topics; + } else { + inf_var_ptr->doc_weights[i] = gsl_matrix_calloc(ndocs[i], + number_topics); + inf_var_ptr->renormalized_doc_weights[i] = gsl_matrix_calloc(ndocs[i], + number_topics); + } + } + return inf_var_ptr; +} + +void inf_var_free(inf_var* ptr) { + // TODO. +} + +// Solves the linear system Ax = b for x. +// Assumes that x is already allocated. +void Solve(gsl_matrix* A, + const gsl_vector* b, + gsl_vector* x) { + int permutation_sign; + gsl_permutation* permutation = gsl_permutation_alloc(b->size); + gsl_linalg_LU_decomp(A, permutation, &permutation_sign); + gsl_linalg_LU_solve(A, permutation, b, x); + gsl_permutation_free(permutation); +} + +// Find the sums of influence of all documents in advance. +// g has scores for everything *up to but not including* g. +void InfluenceTotalFixed(lda_seq* seq, + const corpus_seq_t* data) { + gsl_vector* exp_tmp = gsl_vector_alloc(seq->nterms); + + for (int k=0; k < seq->ntopics; ++k) { + + for (int s=0; s < seq->nseq; ++s) { + // Pull out elements of g, and make sure to set them to 0! + gsl_vector_view g = gsl_matrix_column( + seq->influence_sum_lgl[k], s); + gsl_vector_set_zero(&g.vector); + + for (int t=0; t <= s; ++t) { + gsl_vector_view w_phi_l = + gsl_matrix_column(seq->topic[k]->w_phi_l, t); + gsl_vector_memcpy(exp_tmp, &w_phi_l.vector); + gsl_vector_scale(exp_tmp, scaled_influence[s - t]); + gsl_vector_add(&g.vector, exp_tmp); + } + } + } + gsl_vector_free(exp_tmp); +} + +void DumpTimeDocTopicStats(const char* root, + size_t t, + corpus_t* corpus, + gsl_matrix** phi) { + // For all documents, dump the top topics. + + string filename = StringPrintf("%s/%d_doc_term_topics.dat", + FLAGS_root_directory.c_str(), t); + // string filename = FLAGS_root_directory + // Dump the top topics for each word. + FILE* f = fopen(filename.c_str(), "w"); + for (unsigned int d=0; d < corpus->ndocs; ++d) { + gsl_matrix* phi_d = phi[d]; + doc_t* doc = corpus->doc[d]; + for (unsigned int n=0; n < doc->nterms; ++n) { + + unsigned int w = doc->word[n]; + + // First, find the max topic weight. + unsigned int max_topic_index = 0; + double max_topic_weight = gsl_matrix_get(phi_d, n, 0); + for (unsigned int k=0; k < phi_d->size2; ++k) { + double phi_d_n_k = gsl_matrix_get(phi_d, n, k); + if (phi_d_n_k > max_topic_weight) { + max_topic_weight = phi_d_n_k; + max_topic_index = k; + } + } + + fprintf(f, "%d:%d:%.3f", w, max_topic_index, max_topic_weight); + + if (n < doc->nterms - 1) { + fprintf(f, " "); + } + } + fprintf(f, "\n"); + } + fclose(f); +} + + +void PrepareRegressionComponents( + corpus_t* corpus, + lda_seq* seq, + unsigned int k, + gsl_matrix* W_phi, + gsl_matrix* W_phi_var, + gsl_vector* d_phi_var_tmp, + gsl_vector* response, + gsl_vector* d_tmp, + gsl_matrix* dd_tmp, + gsl_vector* document_weights, + gsl_matrix* W_phi_tmp, + gsl_vector* exp_h_tmp) { + + // Then left-multiply this by W_phi: + gsl_blas_dgemv(CblasTrans, + 1.0, + W_phi, + response, + 0.0, + d_tmp); + + // Set up the transformation matrix. + // First, set up W_phi^T \Lambda W_phi. + gsl_matrix_memcpy(W_phi_tmp, W_phi); + for (unsigned int d=0; d < corpus->ndocs; ++d) { + gsl_vector_view col = gsl_matrix_column(W_phi_tmp, d); + gsl_vector_mul(&col.vector, exp_h_tmp); + } + + // Yuck. Maybe we should do this sparsely? + // Probably won't be too bad, at least for now. + gsl_blas_dgemm(CblasTrans, + CblasNoTrans, + 1.0, + W_phi_tmp, + W_phi, + 0.0, + dd_tmp); + + gsl_blas_dgemv(CblasTrans, + 1.0, + W_phi_var, + exp_h_tmp, + 0.0, + d_phi_var_tmp); + + // Next, add elements to the diagonal of dd_tmp. + for (unsigned int d=0; d < corpus->ndocs; ++d) { + double value = gsl_matrix_get(dd_tmp, d, d); + value += (seq->topic[k]->chain_variance + / (FLAGS_sigma_d * FLAGS_sigma_d)); + // sgerrish: Is this supposed to be multiplied by anything? + value += gsl_vector_get(d_phi_var_tmp, d); + gsl_matrix_set(dd_tmp, d, d, value); + } +} + +void SetExpHTmp(lda_seq* seq, + const corpus_seq_t* data, + unsigned int t, + unsigned int k, + unsigned int n, + gsl_vector* exp_h_tmp, + gsl_vector* zw_tmp, + gsl_vector** exp_i_tmp) { + gsl_vector_set_zero(exp_h_tmp); + for (int i = t; i < seq->nseq; ++i) { + gsl_vector_view mean_i_current = + gsl_matrix_column(seq->topic[k]->e_log_prob, i); + gsl_vector_view var_i_current = + gsl_matrix_column(seq->topic[k]->variance, i + 1); + + // Set up exp_h_tmp. + gsl_vector_memcpy(zw_tmp, &var_i_current.vector); + gsl_vector_sub(zw_tmp, &mean_i_current.vector); + gsl_vector_scale(zw_tmp, 2.0); + for (n=0; n < data->nterms; ++n) { + gsl_vector_set(zw_tmp, n, + exp(gsl_vector_get(zw_tmp, n))); + } + gsl_vector_scale(zw_tmp, + scaled_influence[i - t] + * scaled_influence[i - t]); + gsl_vector_add(exp_h_tmp, zw_tmp); + + // Set up exp_i_tmp. + gsl_vector_memcpy(exp_i_tmp[i], &var_i_current.vector); + gsl_vector_scale(exp_i_tmp[i], 0.5); + gsl_vector_sub(exp_i_tmp[i], &mean_i_current.vector); + for (n=0; n < data->nterms; ++n) { + gsl_vector_set(exp_i_tmp[i], n, + exp(gsl_vector_get(exp_i_tmp[i], n))); + } + } +} + +double update_inf_var_fixed(lda_seq* seq, + const corpus_seq_t* data, + gsl_matrix** phi, + size_t t, + const char* root) { + double lhood = 0.0; + // Note that we're missing a suspicious factor of -2 on the document + // weights currently. We won't worry about that for now (since + // we're still experimenting), but it should soon be fixed. + corpus_t* corpus = data->corpus[t]; + if (!corpus->ndocs) { + return lhood; + } + inf_var* influence = seq->influence; + if (t != TIME && 0) { + return lhood; + } + + // We need access to the following: + gsl_matrix* documents_topics_t = influence->doc_weights[t]; + gsl_matrix* renormalized_documents_topics_t = influence->renormalized_doc_weights[t]; + + size_t k; + + gsl_matrix* W_phi = gsl_matrix_calloc( + seq->nterms, corpus->ndocs); + gsl_matrix* W2_phi2 = gsl_matrix_calloc( + seq->nterms, corpus->ndocs); + gsl_matrix* W_phi_var = + gsl_matrix_calloc(seq->nterms, corpus->ndocs); + gsl_matrix* W_phi_tmp = gsl_matrix_alloc( + seq->nterms, corpus->ndocs); + gsl_matrix* dd_tmp = gsl_matrix_alloc( + corpus->ndocs, corpus->ndocs); + gsl_vector* xd_tmp = gsl_vector_calloc( + corpus->ndocs); + gsl_vector* yw_tmp = gsl_vector_calloc( + seq->nterms); + gsl_vector* zw_tmp = gsl_vector_calloc( + seq->nterms); + gsl_vector* terms_inc_tmp = gsl_vector_calloc( + seq->nterms); + gsl_vector** exp_i_tmp = new gsl_vector*[seq->nseq]; + for (int i=0; i < seq->nseq; ++i) { + exp_i_tmp[i] = gsl_vector_calloc(seq->nterms); + } + + int n; + + gsl_vector* response = gsl_vector_calloc(seq->nterms); + gsl_vector* exp_h_tmp = gsl_vector_calloc(seq->nterms); + gsl_vector* d_tmp = gsl_vector_calloc(corpus->ndocs); + gsl_vector* d_phi_var_tmp = gsl_vector_calloc(corpus->ndocs); + + // assert(post->phi->size2 == documents_topics_t->size2); + double* total_terms = new double[corpus->ndocs]; + double* renormalization_totals = new double[corpus->ndocs]; + for (k=0; k < documents_topics_t->size2; ++k) { + // Set up W_phi and W_phi_var. + for (int d=0; d < corpus->ndocs; ++d) { + doc_t* doc = corpus->doc[d]; + total_terms[d] = 0.0; + renormalization_totals[d] = 0.0; + double log_norm_sum = 0.0; + for (n=0; n < doc->nterms; ++n) { + total_terms[d] += doc->count[n]; + if (FLAGS_normalize_docs == "normalize") { + renormalization_totals[d] = 1.0; + } else if (FLAGS_normalize_docs == "log") { + renormalization_totals[d] += log(doc->count[n] + 1); + } else if (FLAGS_normalize_docs == "log_norm") { + double weight = log(doc->count[n] / doc->total); + renormalization_totals[d] += weight; + } else if (FLAGS_normalize_docs == "identity") { + renormalization_totals[d] += doc->count[n]; + } else if (FLAGS_normalize_docs == "occurrence") { + renormalization_totals[d] = 1.0; + } + } + assert(doc->total == total_terms[d]); + + for (n=0; n < doc->nterms; ++n) { + // Phi, for the doc's term n and topic k. + double phi_d_n_k = gsl_matrix_get(phi[d], n, k); + + // This cast should happen automatically because total_terms is a double, + // but we make the cast here to be explicit and to avoid bugs later. + double number_terms; + if (FLAGS_normalize_docs == "normalize") { + number_terms = ((double) doc->count[n] + / (double) total_terms[d]); + } else if (FLAGS_normalize_docs == "log") { + number_terms = log(doc->count[n] + 1.0); + } else if (FLAGS_normalize_docs == "log_norm") { + number_terms = log(doc->count[n] / total_terms[d]); + renormalization_totals[d] += log(doc->count[n] / total_terms[d]); + } else if (FLAGS_normalize_docs == "identity") { + number_terms = doc->count[n]; + } else if (FLAGS_normalize_docs == "occurrence") { + number_terms = ((double) doc->count[n] / (double) total_terms[d]); + assert(doc->count[n] == 1); + } else { + assert(0); + } + + gsl_matrix_set(W_phi, doc->word[n], d, + number_terms * phi_d_n_k); + gsl_matrix_set(W2_phi2, doc->word[n], d, + number_terms * number_terms + * phi_d_n_k * phi_d_n_k); + gsl_matrix_set(W_phi_var, doc->word[n], d, + number_terms * number_terms + * (phi_d_n_k - phi_d_n_k * phi_d_n_k)); + } + } + + gsl_vector_view document_weights = gsl_matrix_column( + documents_topics_t, + k); + gsl_vector_view renormalized_document_weights = gsl_matrix_column( + renormalized_documents_topics_t, + k); + assert(seq->topic[k]->e_log_prob->size2 == data->len); + + // Now, with w_phi_var, etc. set, determine + // \sum_{i=t}^{T-1} r(...) h(t, i) + SetExpHTmp(seq, + data, + t, + k, + n, + exp_h_tmp, + zw_tmp, + exp_i_tmp); + + // Next, set up the weighted response, + // \exp_{-m + v / 2) \circ (m_{t+1} - m_t + v_t}). + // Here we also subtract the current l's contribution to influence_sum_lgl. + gsl_vector_view w_phi_l_t = gsl_matrix_column(seq->topic[k]->w_phi_l, t); + gsl_vector_set_zero(response); + for (int i = t; i < seq->nseq - 1; ++i) { + gsl_vector_view total_influence_time_i = + gsl_matrix_column(seq->influence_sum_lgl[k], i); + gsl_vector_memcpy(zw_tmp, &w_phi_l_t.vector); + gsl_vector_scale(zw_tmp, scaled_influence[i - t]); + gsl_vector_sub(&total_influence_time_i.vector, zw_tmp); + + // Now, copy this total influence at time i back into zw_tmp. + gsl_vector_memcpy(zw_tmp, &total_influence_time_i.vector); + gsl_vector_mul(zw_tmp, exp_i_tmp[i]); + + gsl_vector_view mean_i_current = + gsl_matrix_column(seq->topic[k]->e_log_prob, i); + gsl_vector_view mean_i_next = + gsl_matrix_column(seq->topic[k]->e_log_prob, i + 1); + gsl_vector_view var_i_current = + gsl_matrix_column(seq->topic[k]->variance, i + 1); + gsl_vector_memcpy(terms_inc_tmp, &mean_i_next.vector); + gsl_vector_sub(terms_inc_tmp, &mean_i_current.vector); + gsl_vector_add(terms_inc_tmp, &var_i_current.vector); + gsl_vector_sub(terms_inc_tmp, zw_tmp); + assert(data->nterms == terms_inc_tmp->size); + gsl_vector_mul(terms_inc_tmp, exp_i_tmp[i]); + gsl_vector_scale(terms_inc_tmp, scaled_influence[i - t]); + + gsl_vector_add(response, terms_inc_tmp); + } + + PrepareRegressionComponents(corpus, + seq, + k, + W_phi, + W_phi_var, + d_phi_var_tmp, + response, + d_tmp, + dd_tmp, + &document_weights.vector, + W_phi_tmp, + exp_h_tmp); + // Finally, solve for the document weights d! + Solve(dd_tmp, + d_tmp, + &document_weights.vector); + + // Keep track of the iteration so we can dump certain stats + // occasionally (but not always). + static int dump_count = 0; + ++dump_count; + + if (FLAGS_save_time == -1) { + // First, dump phi's for the top topics. + DumpTimeDocTopicStats(root, t, corpus, phi); + } + outlog("Done updating topic %ld, time %ld.", k, t); + + for (int d = 0; d < document_weights.vector.size; ++d) { + gsl_vector_set(&renormalized_document_weights.vector, d, + vget(&document_weights.vector, d) + * renormalization_totals[d]); + } + + // outlog("influence, topic %d", ); + + // Now copy this and several products to + // the sslm_var object. + + gsl_vector_view w_phi_l = + gsl_matrix_column(seq->topic[k]->w_phi_l, t); + gsl_blas_dgemv(CblasNoTrans, + 1.0, + W_phi, + &document_weights.vector, + 0.0, + &w_phi_l.vector); + + // Copy this value back into lgl. + for (int i=t; i < seq->nseq - 1; ++i) { + gsl_vector_view total_influence_time_i = + gsl_matrix_column(seq->influence_sum_lgl[k], i); + gsl_vector_memcpy(zw_tmp, &w_phi_l.vector); + gsl_vector_scale(zw_tmp, scaled_influence[i - t]); + gsl_vector_add(&total_influence_time_i.vector, zw_tmp); + } + + // Keep track of the term we need to add to m_update_coeff. + gsl_vector_memcpy(terms_inc_tmp, &w_phi_l.vector); + gsl_vector_mul(terms_inc_tmp, &w_phi_l.vector); + + // Copy and square the document weights vector. + for (int i = 0; i < xd_tmp->size; ++i) { + double value = gsl_vector_get(&document_weights.vector, i); + value = value * value + FLAGS_sigma_l * FLAGS_sigma_l; + gsl_vector_set(xd_tmp, i, value); + } + gsl_blas_dgemv(CblasNoTrans, + 1.0, + W_phi_var, + xd_tmp, + 0.0, + yw_tmp); + gsl_vector_add(terms_inc_tmp, yw_tmp); + + for (int i = 0; i < xd_tmp->size; ++i) { + gsl_vector_set(xd_tmp, i, FLAGS_sigma_l * FLAGS_sigma_l); + } + gsl_blas_dgemv(CblasNoTrans, + 1.0, + W2_phi2, + xd_tmp, + 0.0, + yw_tmp); + gsl_vector_add(terms_inc_tmp, yw_tmp); + + // Copy terms_inc_tmp to m_update_coeff_h. + // This later is merged with m_udpate_coeff from all other + // times. + gsl_vector_view m_update_coeff_h = + gsl_matrix_column(seq->topic[k]->m_update_coeff, + t - FLAGS_min_time); + gsl_vector_memcpy(&m_update_coeff_h.vector, terms_inc_tmp); + + /* + // Store an update coefficient for the beta updates. + for (int i = t; i < seq->nseq; ++i) { + gsl_vector_view m_update_coeff_h = + gsl_matrix_column(seq->topic[k]->m_update_coeff, i); + if (t == 0) { + gsl_vector_set_zero(&m_update_coeff_h.vector); + } + gsl_vector_memcpy(yw_tmp, terms_inc_tmp); + gsl_vector_scale(yw_tmp, scaled_influence[i - t]); + gsl_vector_add(&m_update_coeff_h.vector, yw_tmp); + } + + for (int i = t; i < seq->nseq; ++i) { + gsl_vector_view m_update_coeff_g = + gsl_matrix_column(seq->topic[k]->m_update_coeff_g, i); + if (t == 0) { + gsl_vector_set_zero(&m_update_coeff_g.vector); + } + gsl_vector_memcpy(yw_tmp, &w_phi_l.vector); + gsl_vector_scale(yw_tmp, scaled_influence[i - t]); + gsl_vector_add(&m_update_coeff_g.vector, yw_tmp); + } + */ + + for (int i = 0; i < corpus->ndocs; ++i) { + double value = gsl_vector_get(&document_weights.vector, i); + + // While we're here, increment the likelihood. + lhood += (-(value * value + FLAGS_sigma_l * FLAGS_sigma_l) + / (2.0 * FLAGS_sigma_d * FLAGS_sigma_d) + - 0.5 * log(2 * PI) + - log(FLAGS_sigma_d * FLAGS_sigma_d)); + } + } + delete[] total_terms; + delete[] renormalization_totals; + gsl_matrix_free(W_phi); + gsl_matrix_free(W_phi_tmp); + gsl_matrix_free(W2_phi2); + gsl_matrix_free(W_phi_var); + gsl_matrix_free(dd_tmp); + gsl_vector_free(exp_h_tmp); + gsl_vector_free(response); + gsl_vector_free(terms_inc_tmp); + for (int i=0; i < seq->nseq; ++i) { + gsl_vector_free(exp_i_tmp[i]); + } + delete[] exp_i_tmp; + gsl_vector_free(d_tmp); + gsl_vector_free(d_phi_var_tmp); + gsl_vector_free(xd_tmp); + gsl_vector_free(yw_tmp); + gsl_vector_free(zw_tmp); + + return lhood; +} + + +void make_lda_from_seq_slice(lda* lda_m, + lda_seq* lda_seq_m, + int time) { + // set lda model topics + // !!! note: we should be able to point to the view... + + int k; + for (k = 0; k < lda_seq_m->ntopics; k++) { + // get topic + gsl_vector s = + gsl_matrix_column(lda_seq_m->topic[k]->e_log_prob, + time).vector; + gsl_vector d = + gsl_matrix_column(lda_m->topics, k).vector; + gsl_blas_dcopy(&s, &d); + } + gsl_blas_dcopy(lda_seq_m->alpha, lda_m->alpha); +} + +static gsl_matrix* g_alloc(lda_seq* model, + const corpus_seq_t* data, + int time) { + gsl_matrix* g = gsl_matrix_calloc(model->nterms, + model->ntopics); + double exp_m, m, m_next; + for (int k = 0; k < model->ntopics; ++k) { + for (int w=0; w < model->nterms; ++w) { + double variance_first = mget(model->topic[k]->variance, w, time); + double m = mget(model->topic[k]->e_log_prob, w, time); + double m_next; + exp_m = exp(-m + variance_first / 2.0); + gsl_matrix_set(g, w, k, + (scaled_influence[0] + * -variance_first + * exp_m)); + + for (int i=time; i < model->nseq - 1; ++i) { + // This loop is kind of going overboard, but at least we + // do this once per E-M iteration. + double influence_other_times = 0.0; + for (int j = 0; j < i; ++j) { + exp_m = exp(-mget(model->topic[k]->e_log_prob, w, j) + + mget(model->topic[k]->variance, w, j) / 2.0); + // Note that we skip the other docs in this time period. + // Those get special treatment below. + if (j != time) { + influence_other_times += ( + mget(model->topic[k]->w_phi_l, w, j) + * scaled_influence[i - j] + * exp_m); + } + } + + m = mget(model->topic[k]->e_log_prob, w, i); + m_next = mget(model->topic[k]->e_log_prob, w, i + 1); + // Increment the current count by this value. + gsl_matrix_set(g, w, k, + mget(g, w, k) + + (scaled_influence[i - time] + * (m_next - m - influence_other_times))); + } + exp_m = exp(-m + + mget(model->topic[k]->variance, w, time) / 2.0); + int i=5; + gsl_matrix_set(g, w, k, mget(g, w, k) * exp_m); + } + } + return g; +} + +static gsl_matrix* g3_alloc(lda_seq* model, + const corpus_seq_t* data, + int time) { + gsl_matrix* g = gsl_matrix_calloc(model->nterms, + model->ntopics); + double exp_m, m, m_next, variance, total; + for (int k = 0; k < model->ntopics; ++k) { + for (int w=0; w < model->nterms; ++w) { + total = 0.0; + for (int i=time; i < model->nseq - 1; ++i) { + // This loop is kind of going overboard, but at least we + // do this once per E-M iteration. + variance = mget(model->topic[k]->variance, w, i + 1); + m = mget(model->topic[k]->e_log_prob, w, i); + m_next = mget(model->topic[k]->e_log_prob, w, i + 1); + exp_m = exp(-m + variance / 2.0); + total += (scaled_influence[i - time] + * exp_m + * (m_next - m + variance)); + } + gsl_matrix_set(g, w, k, total); + } + } + return g; +} + +static gsl_matrix* g4_alloc(lda_seq* model, + const corpus_seq_t* data, + int time) { + gsl_matrix* g = gsl_matrix_calloc(model->nterms, + model->ntopics); + double exp_m, exp_m_scaled, m, total, variance, w_phi_l; + for (int k=0; k < model->ntopics; ++k) { + for (int w=0; w < model->nterms; ++w) { + total = 0.0; + for (int i=time; i < model->nseq - 1; ++i) { + // This loop is kind of going overboard, but at least we + // do this once per E-M iteration. + variance = mget(model->topic[k]->variance, w, i + 1); + m = mget(model->topic[k]->e_log_prob, w, i); + exp_m = exp(-2.0 * m + 2.0 * variance); + exp_m_scaled = exp_m * scaled_influence[i - time]; + for (int j=0; j <= i; ++j) { + w_phi_l = mget(model->topic[k]->w_phi_l, w, j); + total += exp_m_scaled * w_phi_l * scaled_influence[i - j]; + } + } + gsl_matrix_set(g, w, k, total); + } + } + return g; +} + +static gsl_matrix* g5_alloc(lda_seq* model, + const corpus_seq_t* data, + int time) { + gsl_matrix* g = gsl_matrix_calloc(model->nterms, + model->ntopics); + double exp_m, m, total, variance; + for (int k=0; k < model->ntopics; ++k) { + for (int w=0; w < model->nterms; ++w) { + total = 0.0; + for (int i=time; i < model->nseq - 1; ++i) { + // This loop is kind of going overboard, but at least we + // do this once per E-M iteration. + variance = mget(model->topic[k]->variance, w, i + 1); + m = mget(model->topic[k]->e_log_prob, w, i); + exp_m = exp(-2.0 * m + 2.0 * variance); + total += exp_m * (scaled_influence[i - time] + * scaled_influence[i - time]); + } + gsl_matrix_set(g, w, k, total); + } + } + return g; +} + + /* + * compute the likelihood of a sequential corpus under an LDA seq + * model. return the likelihood bound. + * + */ + +double lda_seq_infer(lda_seq* model, + const corpus_seq_t* data, + gsl_matrix** suffstats, + gsl_matrix* lhoods, + const char* file_root) { + int K = model->ntopics; int W = model->nterms; + double bound = 0.0; + lda* lda_model = new_lda_model(K, W); + lda_post post; + post.phi = gsl_matrix_calloc(data->max_nterms, K); + post.log_phi = gsl_matrix_calloc(data->max_nterms, K); + post.model = lda_model; + int t, d, doc_idx = 0; + + if (FLAGS_model == "fixed") { + // First, pre-compute the functions f and g. + InfluenceTotalFixed(model, data); + } else if (FLAGS_model == "dtm") { + // Do nothing here. + } else { + printf("Error. Unknown model.\n"); + exit(1); + } + + for (t = FLAGS_min_time; t < FLAGS_max_time && t < data->len; ++t) { + // Prepare coefficients for the phi updates. This change is + // relatively painless. + gsl_matrix* g = g_alloc(model, data, t); + + gsl_matrix* g3_matrix = g3_alloc(model, data, t); + gsl_matrix* g4_matrix = g4_alloc(model, data, t); + gsl_matrix* g5_matrix = g5_alloc(model, data, t); + + make_lda_from_seq_slice(lda_model, model, t); + int ndocs = data->corpus[t]->ndocs; + gsl_matrix* gammas = gsl_matrix_calloc(ndocs, K); + gsl_matrix** phi_t = (gsl_matrix**) malloc(ndocs + * sizeof(gsl_matrix*)); + for (d = 0; d < ndocs; d++) { + gsl_vector gam = gsl_matrix_row(gammas, d).vector; + gsl_vector lhood = gsl_matrix_row(lhoods, d).vector; + post.gamma = &gam; + post.doc = data->corpus[t]->doc[d]; + post.lhood = &lhood; + double doc_lhood; + // For now, only do the standard, phi-based update. + doc_lhood = fit_lda_post(d, t, &post, model, g, + g3_matrix, g4_matrix, g5_matrix); + if (suffstats == NULL) { + printf("Sufficient statistics are NULL.\nFailing.\n"); + exit(1); + } + update_lda_seq_ss(t, + data->corpus[t]->doc[d], + &post, + suffstats); + phi_t[d] = gsl_matrix_alloc(post.doc->nterms, K); + gsl_matrix_view phi_view = gsl_matrix_submatrix( + post.phi, + 0, 0, post.doc->nterms, K); + gsl_matrix_memcpy(phi_t[d], &phi_view.matrix); + bound += doc_lhood; + doc_idx++; + } + + if (t < data->len - 1) { + if (FLAGS_model == "fixed") { + double l_bound = update_inf_var_fixed( + model, + data, + // Also want a copy of phi for each doc. + // Can keep this as a vector for now. + phi_t, + t, + file_root); + bound += l_bound; + } + } + + for (int d=0; d < ndocs; ++d) { + gsl_matrix_free(phi_t[d]); + } + free(phi_t); + + // Write out the gammas and likelihoods. + string name = StringPrintf("%s/gam-time-%d.dat", + FLAGS_root_directory.c_str(), + t); + mtx_fprintf(name.c_str(), gammas); + gsl_matrix_free(gammas); + + gsl_matrix_free(g); + gsl_matrix_free(g3_matrix); + gsl_matrix_free(g4_matrix); + gsl_matrix_free(g5_matrix); + } + gsl_matrix_free(post.phi); + gsl_matrix_free(post.log_phi); + free_lda_model(lda_model); + return(bound); +} + +double fit_lda_seq_st() { + corpus_seq_t* data = + read_corpus_seq(FLAGS_corpus_prefix.c_str()); + lda_seq* model_seq = new_lda_seq(data, + NULL, + data->nterms, + data->len, + FLAGS_ntopics); + + double topic_bound = 0.0; + vector<int> time_boundaries; + vector<string> time_boundaries_str; + SplitStringUsing(FLAGS_time_boundaries, ",", &time_boundaries_str); + for (int i=0; i < time_boundaries_str.size(); ++i) { + time_boundaries.push_back(atoi(time_boundaries_str[i].c_str())); + } + + // Read the corpus as a sequence. + int* ndocs = new int[data->len]; + for (int i=0; i < data->len; ++i) { + ndocs[i] = data->corpus[i]->ndocs; + } + + // Initialize the sequence from sufficient statistics. + init_lda_seq(time_boundaries, + FLAGS_root_directory, + FLAGS_model, + model_seq, + ndocs, + data->len, + FLAGS_top_chain_var, + FLAGS_top_obs_var, + FLAGS_alpha, + FLAGS_min_topic, + FLAGS_max_topic, + /*seq_docs=*/false); + + for (int k=FLAGS_min_topic; k < FLAGS_max_topic; ++k) { + // initialize sufficient statistics + gsl_matrix* topic_suffstats = read_topic_suffstats( + time_boundaries, + data->nterms, + k); + + // fit the variational distribution + topic_bound += fit_lda_seq_topic(k, model_seq, topic_suffstats); + + const string kFilePrefix = StringPrintf( + "%s/sslm-topic_%d", + FLAGS_root_directory.c_str(), k); + write_sslm_var(model_seq->topic[k], kFilePrefix.c_str()); + + gsl_matrix_free(topic_suffstats); + } + + delete[] ndocs; + return(topic_bound); +} + + +static bool Converged(double current, double last) { + if (fabs((last - current) / (last)) < 5e-6) { + printf("%f\n", + fabs((last - current))); + printf("%f\n", + fabs(last + 1.0)); + printf("%f\n", + fabs((last - current) / (last + 1.0))); + return true; + } else { + return false; + } +} + + /* +static void WriteTopics(const string& root_directory, + lda_seq* seq, + int k) { + gsl_matrix* mean_t = seq->topic[k]; + const string kMeanFilename = + StringPrintf("%s/topic_mean_%d.dat", + root_directory.c_str(), + k); + mtx_fprintf(kMeanFilename.c_str(), mean_t); + + gsl_matrix* variance_t = seq->topic[k]; + const string kVarianceFilename = + StringPrintf("%s/topic_variance_%d.dat", + root_directory.c_str(), + k); + mtx_fprintf(kVarianceFilename.c_str(), mean_t); +} + */ + + +static double ParallelFitTopics(int corpus_length, + const string& time_boundaries, + string* topic_boundaries_str, + double* lhood) { + // Create a task and set up appropriate flags. + hash_map<string, string> flags; + flags["ntopics"] = StringPrintf("%d", FLAGS_ntopics); + flags["sigma_d"] = StringPrintf("%lf", FLAGS_sigma_d); + flags["sigma_l"] = StringPrintf("%lf", FLAGS_sigma_l); + flags["time_resolution"] = StringPrintf("%lf", + FLAGS_time_resolution); + flags["alpha"] = StringPrintf("%lf", FLAGS_alpha); + flags["model"] = FLAGS_model; + + flags["rng_seed"] = StringPrintf("%d", FLAGS_rng_seed); + + flags["lda_max_em_iter"] = StringPrintf("%d", FLAGS_lda_max_em_iter); + flags["lda_sequence_min_iter"] = StringPrintf("%d", FLAGS_lda_sequence_min_iter); + flags["lda_sequence_max_em_iter"] = StringPrintf("%d", FLAGS_lda_sequence_max_em_iter); + + flags["top_chain_var"] = StringPrintf("%lf", FLAGS_top_chain_var); + flags["top_obs_var"] = StringPrintf("%lf", FLAGS_top_obs_var); + flags["fix_topics"] = StringPrintf("%d", FLAGS_fix_topics); + flags["root_directory"] = FLAGS_root_directory; + flags["influence_flat_years"] = StringPrintf("%d", FLAGS_influence_flat_years); + flags["time_boundaries"] = time_boundaries; + // flags["nterms"] = StringPrintf("%d", nterms); + flags["corpus_prefix"] = FLAGS_corpus_prefix; + flags["normalize_docs"] = FLAGS_normalize_docs; + flags["max_number_time_points"] = StringPrintf("%d", + FLAGS_max_number_time_points); + + const int kNumberTasks = min(FLAGS_number_tasks, + FLAGS_ntopics); + + const int kTopicsPerTask = ((FLAGS_ntopics + + kNumberTasks - 1) + / kNumberTasks); + const int kNumberBigTasks = (kNumberTasks + - (kTopicsPerTask * kNumberTasks + - FLAGS_ntopics)); + vector<int> topic_boundaries; + topic_boundaries.push_back(0); + *topic_boundaries_str = "0"; + int i=1; + for (int t=kTopicsPerTask; + t < FLAGS_ntopics; + ) { + *topic_boundaries_str += StringPrintf(",%d", t); + topic_boundaries.push_back(t); + if (i < kNumberBigTasks) { + t += kTopicsPerTask; + } else { + t += kTopicsPerTask - 1; + } + ++i; + } + topic_boundaries.push_back(FLAGS_ntopics);; + *topic_boundaries_str += StringPrintf(",%d", FLAGS_ntopics); + flags["topic_boundaries"] = *topic_boundaries_str; + + vector<string> done_sentinels; + vector<Resource*> resources; + vector<Task*> tasks; + for (int i=0; i < kNumberTasks; ++i) { + const int kMinTopic = topic_boundaries[i]; + const int kMaxTopic = topic_boundaries[i + 1]; + + flags["min_topic"] = StringPrintf( + "%d", kMinTopic); + flags["max_topic"] = StringPrintf( + "%d", kMaxTopic); + flags["sentinel_filename"] = StringPrintf( + "%s/lda-fit-topics_%d_%d.done", + FLAGS_root_directory.c_str(), + kMinTopic, + kMaxTopic); + done_sentinels.push_back(flags["sentinel_filename"]); + + if (FLAGS_resume_stage == "topic" + && c2_lib::FileExists(flags["sentinel_filename"])) { + continue; + } + + Task* task = TaskFactory::NewTopicsFitTask( + i, + FLAGS_root_directory.c_str(), + flags, + resources, + flags["sentinel_filename"]); + tasks.push_back(task); + + } + + if (FLAGS_resume_stage == "topic") { + FLAGS_resume_stage = ""; + } + + // Run. + for (int t=0; t < tasks.size(); ++t) { + // printf("Starting task.\n"); + tasks[t]->Start(); + } + + c2_lib::WaitOnTasks(tasks); + + *lhood = ReadLikelihoods(done_sentinels); +} + +// Compares objects, to sort them from highest priority to lowest. +bool PriorityCmp(Task* l, Task* r) { + return l->Priority() > r->Priority(); +} + +static void ParallelFitDocs(corpus_seq_t* data, + int corpus_length, + int number_tasks, + const vector<int>& time_boundaries, + const string& time_boundaries_str, + double* lhood) { + // Create a task and set up appropriate flags. + hash_map<string, string> flags; + flags["ntopics"] = StringPrintf("%d", FLAGS_ntopics); + flags["sigma_d"] = StringPrintf("%lf", FLAGS_sigma_d); + flags["sigma_l"] = StringPrintf("%lf", FLAGS_sigma_l); + flags["time_resolution"] = StringPrintf("%lf", + FLAGS_time_resolution); + flags["alpha"] = StringPrintf("%lf", FLAGS_alpha); + flags["model"] = FLAGS_model; + + flags["rng_seed"] = StringPrintf("%d", FLAGS_rng_seed); + + flags["lda_max_em_iter"] = StringPrintf("%d", FLAGS_lda_max_em_iter); + flags["lda_sequence_min_iter"] = StringPrintf("%d", FLAGS_lda_sequence_min_iter); + flags["lda_sequence_max_em_iter"] = StringPrintf("%d", FLAGS_lda_sequence_max_em_iter); + + flags["top_chain_var"] = StringPrintf("%lf", FLAGS_top_chain_var); + flags["top_obs_var"] = StringPrintf("%lf", FLAGS_top_obs_var); + flags["fix_topics"] = StringPrintf("%d", FLAGS_fix_topics); + flags["root_directory"] = FLAGS_root_directory; + flags["influence_flat_years"] = StringPrintf("%d", FLAGS_influence_flat_years); + flags["time_boundaries"] = time_boundaries_str; + flags["max_number_time_points"] = StringPrintf("%d", + FLAGS_max_number_time_points); + // flags["nterms"] = StringPrintf("%d", nterms); + flags["corpus_prefix"] = FLAGS_corpus_prefix; + flags["normalize_docs"] = FLAGS_normalize_docs; + + vector<string> done_sentinels; + vector<Resource*> resources; + vector<Task*> tasks; + for (int i=0; i < number_tasks; ++i) { + // for (int i=0; i < 1; ++i) { + const int kMinTime = time_boundaries[i]; + const int kMaxTime = time_boundaries[i + 1]; + + flags["min_time"] = StringPrintf( + "%d", kMinTime); + flags["max_time"] = StringPrintf( + "%d", kMaxTime); + flags["sentinel_filename"] = StringPrintf( + "%s/lda-fit-times_%d_%d.done", + FLAGS_root_directory.c_str(), + kMinTime, + kMaxTime); + done_sentinels.push_back(flags["sentinel_filename"]); + + if (FLAGS_resume_stage == "doc" + && c2_lib::FileExists(flags["sentinel_filename"])) { + continue; + } + QSubTask* task = (QSubTask*) TaskFactory::NewDocsFitTask( + i, + FLAGS_root_directory.c_str(), + flags, + resources, + flags["sentinel_filename"]); + + int number_docs_sq = 0; + int number_docs = 0; + for (int j=kMinTime; j < kMaxTime; ++j) { + corpus_t* corpus = data->corpus[j]; + number_docs_sq += corpus->ndocs * corpus->ndocs; + number_docs += corpus->ndocs; + } + + printf("number_docs is %d. number_docs_sq is %d.\n", + number_docs, number_docs_sq); + int walltime = number_docs_sq / 1000000 / 6 + 5; + printf("Setting walltime to %d.\n", walltime); + task->set_walltime_hours(walltime); + + int memory_mb = number_docs / 10 + 11800; + // 10959 is too low for 90-93. + // 11xxx also seemed too low. + printf("Setting memory_mb to %d.\n", memory_mb); + // task->set_memory_mb(memory_mb); + // We only need to store half of this information, hopefully.. + task->set_memory_mb((int) (memory_mb * 0.32)); + task->set_memory_mb(4000); + tasks.push_back(task); + } + if (FLAGS_resume_stage == "doc") { + FLAGS_resume_stage = ""; + } + + std::sort(tasks.begin(), tasks.end(), PriorityCmp); + + // Run. + for (int t=0; t < tasks.size(); ++t) { + // printf("Starting task.\n"); + tasks[t]->Start(); + } + + c2_lib::WaitOnTasks(tasks); + + for (vector<Task*>::iterator it=tasks.begin(); + it != tasks.end(); + ++it) { + delete *it; + } + + *lhood = ReadLikelihoods(done_sentinels); +} + +static void CreateTimeBoundaries(int corpus_length, + vector<int>* time_boundaries, + string* time_boundaries_str, + int* number_tasks) { + *number_tasks = min(FLAGS_number_tasks, + corpus_length); + + const int kTimesPerTask = ((corpus_length + + (*number_tasks) - 1) + / (*number_tasks)); + const int kNumberBigTasks = (*number_tasks + - (kTimesPerTask * (*number_tasks) + - corpus_length)); + + time_boundaries->push_back(0); + *time_boundaries_str = "0"; + int i=1; + for (int t=kTimesPerTask; + t < corpus_length; + ) { + *time_boundaries_str += StringPrintf(",%d", t); + time_boundaries->push_back(t); + if (i < kNumberBigTasks) { + t += kTimesPerTask; + } else { + t += kTimesPerTask - 1; + } + ++i; + } + time_boundaries->push_back(corpus_length); + *time_boundaries_str += StringPrintf(",%d", corpus_length); +} + +bool FitParallelLDASeq(const vector<int>& topic_boundaries) { + // !!! make this an option + // Read in the corpus so we know how many terms. + + printf("Preparing model.\n"); + + corpus_seq_t* data_full = read_corpus_seq( + FLAGS_corpus_prefix.c_str()); + lda_seq* model_seq = new_lda_seq(data_full, + NULL, + data_full->nterms, + data_full->len, + FLAGS_ntopics); + + vector<int> time_boundaries; + string time_boundaries_str; + int number_doc_tasks; + CreateTimeBoundaries(data_full->len, + &time_boundaries, + &time_boundaries_str, + &number_doc_tasks); + + if (FLAGS_resume_stage != "doc" + && FLAGS_resume_stage != "topic") { + RewriteTopicsAsSequential(time_boundaries, + topic_boundaries, + model_seq); + } + + // Sleep for a minute to give the machine a chance to rest before + // continuing. + + printf("fitting.. \n"); + // estimate dynamic topic model + + outlog("\n%s\n","### FITTING DYNAMIC TOPIC MODEL ###"); + + bool converged = false; + double last_lhood = -1.0; + int iteration = 0; + while (!converged && iteration < FLAGS_lda_sequence_max_em_iter) { + ++iteration; + double d_lhood = 0.0; + outlog("\n%s\n", "Fitting documents."); + printf("Fitting documents.\n"); + if (FLAGS_resume_stage != "topic") { + ParallelFitDocs(data_full, + data_full->len, + number_doc_tasks, + time_boundaries, + time_boundaries_str, + &d_lhood); + } + + outlog("\n%s\n", "Fitting topics."); + double t_lhood; + string topic_boundaries; + printf("Fitting topics.\n"); + ParallelFitTopics(data_full->len, + time_boundaries_str, + &topic_boundaries, + &t_lhood); + + converged = Converged(t_lhood + d_lhood, + last_lhood); + last_lhood = t_lhood + d_lhood; + printf("Log likelihood bound: %lf\n", last_lhood); + } + + return true; +} + +double fit_lda_seq_topic(int topic, + lda_seq* model, + gsl_matrix* topic_ss) { + double lhood = 0, lhood_term = 0; + outlog( "\nFitting topic %d of %d", topic, model->ntopics); + lhood_term = fit_sslm(model->topic[topic], topic_ss); + lhood += lhood_term; + return(lhood); +} + + +static void ReadSSLMAllTopics(lda_seq* var, + int ntopics) { + for (int k=0; k < ntopics; ++k) { + const string kFilePrefix = StringPrintf( + "%s/sslm-topic_%d", + FLAGS_root_directory.c_str(), k); + // We've already allocated a topic. Delete it and reallocate it. + free(var->topic[k]); + var->topic[k] = read_sslm_var(kFilePrefix.c_str()); + } +} + + /* + * fit an lda sequence model: + * + * . for each time period + * . set up lda model with E[log p(w|z)] and \alpha + * . for each document + * . perform posterior inference + * . update sufficient statistics/likelihood + * . + * . maximize topics + * + */ + +double fit_lda_seq_sd() { + corpus_seq_t* data = + read_corpus_seq(FLAGS_corpus_prefix.c_str()); + // We delete corpus data for the minimum and maximum times to + // save memory. + int* ndocs = new int[data->len]; + int max_ndocs = 0; + for (int i=0; i < data->len; ++i) { + ndocs[i] = data->corpus[i]->ndocs; + if (ndocs[i] > max_ndocs) { + max_ndocs = ndocs[i]; + } + if (i >= FLAGS_min_time && i < FLAGS_max_time) { + continue; + } + free_corpus(data->corpus[i]); + data->corpus[i] = NULL; + } + lda_seq* m = new_lda_seq(NULL, + ndocs, + data->nterms, + data->len, + FLAGS_ntopics); + + const int K = m->ntopics, W = m->nterms; + + vector<string> time_boundaries_str; + vector<int> time_boundaries; + SplitStringUsing(FLAGS_time_boundaries, ",", + &time_boundaries_str); + for (int i=0; i < time_boundaries_str.size(); ++i) { + time_boundaries.push_back(atoi(time_boundaries_str[i].c_str())); + } + + // Initialize topic sufficient statistics and set them all to zero. + gsl_matrix* topic_suffstats[K]; + for (int k = 0; k < K; ++k) { + topic_suffstats[k] = gsl_matrix_calloc(W, data->len); + } + + init_lda_seq(time_boundaries, + FLAGS_root_directory, + FLAGS_model, + m, + ndocs, + data->len, + FLAGS_top_chain_var, + FLAGS_top_obs_var, + FLAGS_alpha, + /* min_topic */ 0, + /* max_topic */ FLAGS_ntopics, + /*seq_docs=*/true); + + delete[] ndocs; + + // set up variables + + gsl_matrix* lhoods = gsl_matrix_calloc(max_ndocs, K+1); + + double bound = 0; + double convergence = LDA_SEQ_EM_THRESH + 1; + + // LDA_INFERENCE_MAX_ITER = 1; + + gsl_matrix_set_zero(lhoods); + + // compute the likelihood of a sequential corpus under an LDA + // seq model and find the evidence lower bound. + bound = lda_seq_infer(m, + data, + topic_suffstats, + lhoods, + FLAGS_root_directory.c_str()); + + // Write out the variational distribution. + + // Write out intermediate matrices. Note that we are taking + // submatrices because we populated only a small fraction of these + // matrices. + write_lda_seq_docs(FLAGS_model, + FLAGS_root_directory, + FLAGS_min_time, + FLAGS_max_time, + m); + + // Delete topic sufficient statistics. + for (int k = 0; k < K; k++) { + write_topic_suffstats(FLAGS_min_time, + FLAGS_max_time, + topic_suffstats, + data->nterms, + k); + // Note that we don't need to write the sslm_var, + // since it's not changed by this task. + + gsl_matrix_free(topic_suffstats[k]); + } + + + return(bound); +} + +/* + * update lda sequence sufficient statistics from an lda posterior + * + */ +void update_lda_seq_ss(int time, + const doc_t* doc, + const lda_post* post, + gsl_matrix** ss) { + int K = post->phi->size2, N = doc->nterms; + int k, n; + + for (k = 0; k < K; k++) { + gsl_matrix* topic_ss = ss[k]; + for (n = 0; n < N; n++) { + int w = doc->word[n]; + int c = doc->count[n]; + minc(topic_ss, w, time, c * mget(post->phi, n, k)); + } + } +} + +/* + * initialize from sufficient statistics (expected counts). + * + */ + +void init_lda_seq( + const vector<int> time_boundaries, + const string& root_directory, + const string& model_type, + lda_seq* model, + int* ndocs, + int len, + double topic_chain_variance, + double topic_obs_variance, + double alpha, + int min_topic, + int max_topic, + bool seq_docs) { + gsl_vector_set_all(model->alpha, alpha); + + gsl_matrix* tmp_terms_time = gsl_matrix_calloc(model->nterms, + model->nseq); + gsl_vector* tmp_terms = gsl_vector_calloc(model->nterms); + for (int k = min_topic; k < max_topic; k++) { + const string kFilePrefix = + StringPrintf("%s/sslm-topic_%d", + FLAGS_root_directory.c_str(), + k); + model->topic[k] = read_sslm_var(kFilePrefix.c_str()); + model->topic[k]->chain_variance = topic_chain_variance; + model->topic[k]->obs_variance = topic_obs_variance; + + // Allocate sequential data. + if (seq_docs) { + model->topic[k]->w_phi_l = gsl_matrix_calloc(model->nterms, + model->nseq); + model->topic[k]->m_update_coeff = gsl_matrix_calloc(model->nterms, + FLAGS_max_time - FLAGS_min_time); + } else { + model->topic[k]->w_phi_l = gsl_matrix_calloc(model->nterms, + model->nseq); + model->topic[k]->m_update_coeff = gsl_matrix_calloc(model->nterms, + model->nseq); + model->topic[k]->m_update_coeff_g = gsl_matrix_calloc(model->nterms, + model->nseq); + } + // Load sequential data. + const int kMaxTime = time_boundaries[time_boundaries.size() - 1]; + for (int i=0; i + 1 < time_boundaries.size(); ++i) { + int min_time = time_boundaries[i]; + int max_time = time_boundaries[i + 1]; + string filename = StringPrintf("%s/w_phi_l-topic_%d-time_%d_%d.dat", + root_directory.c_str(), + k, min_time, max_time); + gsl_matrix_view view = gsl_matrix_submatrix( + model->topic[k]->w_phi_l, + 0, min_time, model->nterms, max_time - min_time); + mtx_fscanf(filename.c_str(), &view.matrix); + + view = gsl_matrix_submatrix( + tmp_terms_time, + 0, min_time, model->nterms, max_time - min_time); + filename = StringPrintf("%s/m_update_coeff-topic_%d-time_%d_%d.dat", + root_directory.c_str(), + k, min_time, max_time); + mtx_fscanf(filename.c_str(), &view.matrix); + } + + // Populate the m_update_coeff matrices. + if (!seq_docs) { + for (int t=0; t < kMaxTime; ++t) { + gsl_vector_view m_update_coeff = + gsl_matrix_column(tmp_terms_time, t); + for (int i=t; i < kMaxTime; ++i) { + gsl_vector_view muc_i = + gsl_matrix_column(model->topic[k]->m_update_coeff, i); + gsl_vector_memcpy(tmp_terms, &m_update_coeff.vector); + gsl_vector_scale(tmp_terms, scaled_influence[i - t]); + gsl_vector_add(&muc_i.vector, tmp_terms); + } + + gsl_vector_view w_phi_l_i = + gsl_matrix_column(model->topic[k]->w_phi_l, t); + for (int i=t; i < kMaxTime; ++i) { + gsl_vector_view muc_i = + gsl_matrix_column(model->topic[k]->m_update_coeff_g, i); + gsl_vector_memcpy(tmp_terms, &w_phi_l_i.vector); + gsl_vector_scale(tmp_terms, scaled_influence[i - t]); + gsl_vector_add(&muc_i.vector, tmp_terms); + } + } + } + } + + if (model_type == "fixed") { + model->influence = (inf_var*) malloc(sizeof(inf_var)); + model->influence->doc_weights = + new gsl_matrix*[model->nseq]; + model->influence->renormalized_doc_weights = + new gsl_matrix*[model->nseq]; + model->influence->ntime = model->nseq; + + // Read in both normalized and unnormalized doc weights. + for (int t=0; t < model->nseq; ++t) { + string filename = StringPrintf("%s/influence_time-%03d", + root_directory.c_str(), t); + outlog("\n reading influence weights for time %d from %s", + t, filename.c_str()); + model->influence->doc_weights[t] = gsl_matrix_alloc( + ndocs[t], + model->ntopics); + mtx_fscanf(filename.c_str(), + model->influence->doc_weights[t]); + + filename = StringPrintf("%s/renormalized_influence_time-%03d", + root_directory.c_str(), t); + outlog("\n reading influence weights for time %d from %s", + t, filename.c_str()); + model->influence->renormalized_doc_weights[t] = gsl_matrix_alloc( + ndocs[t], + model->ntopics); + mtx_fscanf(filename.c_str(), + model->influence->renormalized_doc_weights[t]); + } + } else { + model->influence = NULL; + } + gsl_vector_free(tmp_terms); + gsl_matrix_free(tmp_terms_time); +} + + +/* + * allocate lda seq + * + */ + +lda_seq* new_lda_seq(corpus_seq_t* data, int* ndocs, + int W, int T, int K) { + lda_seq* model = (lda_seq*) malloc(sizeof(lda_seq)); + + model->ntopics = K; + model->nterms = W; + model->nseq = T; + + model->alpha = gsl_vector_alloc(K); + model->topic = (sslm_var**) malloc(sizeof(sslm_var*) * K); + + // Create the vectors of total counts for each time. + model->influence_sum_lgl = (gsl_matrix**) malloc(sizeof(gsl_matrix*) * K); + + for (int k = 0; k < K; k++) { + model->influence_sum_lgl[k] = gsl_matrix_calloc(W, T); + + model->topic[k] = sslm_var_alloc(W, T); + if (k < FLAGS_fix_topics) { + model->topic[k]->chain_variance = 1e-10; + } + model->topic[k]->m_update_coeff = NULL; + model->topic[k]->m_update_coeff_g = NULL; + model->topic[k]->w_phi_l = NULL; + } + + int* ndocs_tmp; + if (data == NULL) { + ndocs_tmp = ndocs; + } else { + ndocs_tmp = new int[data->len]; + for (int i=0; i < data->len; ++i) { + ndocs_tmp[i] = data->corpus[i]->ndocs; + } + } + model->influence = inf_var_alloc(K, ndocs_tmp, T); + if (data != NULL) { + delete[] ndocs_tmp; + } + return model; +} + +} // namespace dtm diff --git a/dtm_release/dtm-parallel/lda-seq.h b/dtm_release/dtm-parallel/lda-seq.h new file mode 100644 index 0000000000000000000000000000000000000000..e2bedaec04653eeccaa5620206b2d024692f7d7a --- /dev/null +++ b/dtm_release/dtm-parallel/lda-seq.h @@ -0,0 +1,143 @@ +#ifndef LDASEQ_H +#define LDASEQ_H + +#include <sys/stat.h> +#include <sys/types.h> + +#include "gsl-wrappers.h" +#include "lda.h" + +#include <string> +#include <vector> + +#define LDA_SEQ_EM_THRESH 1e-4 +#define SAVE_LAG 10 + +/* + * an lda sequence is a collection of simplex sequences for K topics + * and an alpha vector + * + */ + +#include <gsl/gsl_vector.h> +#include <gsl/gsl_matrix.h> +#include <stdlib.h> +#include <assert.h> + +#include "param.h" +#include "ss-lm.h" +#include "data.h" +#include "lda.h" +#include "c2_lib.h" + +#define LDA_SEQ_EM_THRESHOLD 1e-5; + +using c2_lib::Task; +using c2_lib::Resource; + +using namespace std; + +namespace dtm { +// lda sequence variational posterior distribution + + +// === allocation and initialization === + +bool FitParallelLDASeq(const vector<int>& topic_boundaries); + +inf_var* inf_var_alloc(int number_topics, + int* ndocs, + int len); +void inf_var_free(inf_var* ptr); + +// === fitting === + + +// infer a corpus with an lda-seq + +double update_inf_var(lda_seq* seq, + const corpus_seq_t* data, + gsl_matrix** phi, + size_t t, + const char* root); +double update_inf_var_multiple(lda_seq* seq, + const corpus_seq_t* data, + gsl_matrix** phi, + size_t t, + const char* root); +void update_inf_reg(lda_seq* seq, + const corpus_seq_t* data, + gsl_matrix** phi, + size_t t, + const char* root); + +double lda_seq_infer(lda_seq* model, + const corpus_seq_t* data, + gsl_matrix** suffstats, + gsl_matrix* gammas, + gsl_matrix* lhoods, + const char* file_root); + +// fit lda sequence from sufficient statistics + +double fit_lda_seq_st(); + +double fit_lda_seq_topic(int topic, + lda_seq* model, + gsl_matrix* topic_ss); + +double fit_lda_seq_sd(); + +void update_lda_seq_ss(int time, + const doc_t* doc, + const lda_post* post, + gsl_matrix** ss); + +// === reading and writing === + + +// read and write a lda sequence + +void write_lda_seq(const lda_seq* m, const char* root); + + // lda_seq* read_lda_seq(const char* root, corpus_seq_t* data); + +lda_seq* read_lda_seq(const string& model_type, + const char* root, + corpus_seq_t* data); + +// write lda sequence sufficient statistics +void init_lda_seq( + const vector<int> time_boundaries, + const string& root_directory, + const string& model_type, + lda_seq* model, + int* ndocs, + int len, + double topic_chain_variance, + double topic_obs_variance, + double alpha, + int min_topic, + int max_topic, + bool seq_docs); + +void write_lda_seq_suffstats(lda_seq* m, + gsl_matrix** topic_ss, + const char* root); + +// new lda sequence + +lda_seq* new_lda_seq(corpus_seq_t* data, + int* ndocs, + int W, + int T, + int K); + +void make_lda_from_seq_slice(lda* lda_m, + lda_seq* lda_seq_m, + int time); + + +} // namespace dtm + +#endif diff --git a/dtm_release/dtm-parallel/lda.c b/dtm_release/dtm-parallel/lda.c new file mode 100644 index 0000000000000000000000000000000000000000..9569debb17504e2ecfe4fd0fa87edae2df84ae7f --- /dev/null +++ b/dtm_release/dtm-parallel/lda.c @@ -0,0 +1,1041 @@ +#include "gflags.h" + +#include "c2_lib.h" +#include "data.h" +#include "lda.h" +#include "strutil.h" + +#include <hash_map.h> +#include <vector.h> + +DEFINE_bool(new_phi, + true, + "If true, use the new phi calculation."); + +DEFINE_int32(nterms, + 0, + "Number of terms."); +DEFINE_int32(ntopics, + 0, + "Number of topics."); + +DEFINE_int32(number_tasks, + 5, + "Number of tasks."); + +DEFINE_string(doc_boundaries, + "", + "Comma-separated list of integers describing epochs."); +DEFINE_int32(max_doc, 0, ""); +DEFINE_int32(min_doc, 0, ""); + +DEFINE_string(topic_boundaries, + "", + "Comma-separated list of integers describing epochs."); +DEFINE_int32(max_topic, 0, ""); +DEFINE_int32(min_topic, 0, ""); + +DEFINE_string(corpus_prefix, + "", + "The function to perform. " + "Can be dtm or dim."); + +DEFINE_string(root_directory, + "", + "A directory in which all data is read and written."); + +DEFINE_string(normalize_docs, + "normalize", + "How should we transform docs' word counts? " + "Options: take the log (log), normalize so they sum to 1 (normalize), " + "take the count (identity), set positive counts to 1 (occurrence)."); + +DEFINE_int32(lda_max_em_iter, -1, ""); + +DECLARE_int32(max_number_time_points); +DECLARE_string(model); +DECLARE_double(sigma_d); +DECLARE_double(sigma_l); +DEFINE_double(alpha, -10.0, ""); + +using c2_lib::Task; +using c2_lib::Resource; + +namespace dtm { + +const int LDA_INFERENCE_MAX_ITER=15; +const int LDA_INFERENCE_INIT_ITER=12; + +// Used for the phi update: how small can the smallest phi be? +// We assert around 1e-10, since that is around the smallest beta +// for a term. +static const double kSmallLogNumber = -100.0; +static const double kSmallNumber = exp(kSmallLogNumber); +static double* scaled_influence = NULL; + +/* + * posterior inference for lda + * time and doc_number are only necessary if + * var is not NULL. + */ + +static void SaveTopicsPartial(const char* name, lda* model) { + gsl_matrix_view topics_view = gsl_matrix_submatrix( + model->topics, + 0, + FLAGS_min_topic, + FLAGS_nterms, + FLAGS_max_topic - FLAGS_min_topic); + mtx_fprintf(name, &topics_view.matrix); +} + +double RunEStep() { + double l_hood; + + // Load the topics and run inference on select documents. + lda* model = new_lda_model(FLAGS_ntopics, + FLAGS_nterms); + gsl_vector_set_all(model->alpha, FLAGS_alpha); + + corpus_t* data = read_corpus(FLAGS_corpus_prefix.c_str()); + + read_lda_topics(model); + lda_suff_stats* ss_docs = new_lda_suff_stats(model); + + l_hood = lda_e_step(model, data, ss_docs); + + // Write topic sufficient statistics for these docs (to be + // aggregated later). + string name = StringPrintf("%s/lda-ss-docs_%d_%d.dat", + FLAGS_root_directory.c_str(), + FLAGS_min_doc, + FLAGS_max_doc); + write_lda_suff_stats(ss_docs, name.c_str()); + + return l_hood; +} + +double RunMStep() { + double l_hood; + lda* model = new_lda_model(FLAGS_ntopics, + FLAGS_nterms); + gsl_vector_set_all(model->alpha, FLAGS_alpha); + + string name = StringPrintf("%s/initial-lda-ss.dat", + FLAGS_root_directory.c_str()); + outlog("Reading file %s.\n", name.c_str()); + lda_suff_stats* ss = read_lda_suff_stats(name.c_str(), + FLAGS_ntopics, + FLAGS_nterms); + + l_hood = lda_m_step(model, ss); + + outlog("Writing file %s.\n", name.c_str()); + name = StringPrintf("%s/lda-ss-topics_%d_%d.dat", + FLAGS_root_directory.c_str(), + FLAGS_min_topic, + FLAGS_max_topic); + outlog("Writing file %s.\n", name.c_str()); + SaveTopicsPartial(name.c_str(), model); + + return l_hood; +} + +void AggregateSuffStats() { + string doc_boundaries_str = FLAGS_doc_boundaries; + int nterms = FLAGS_nterms; + int ntopics = FLAGS_ntopics; + string name; + + vector<string> doc_boundaries; + SplitStringUsing(doc_boundaries_str, + ",", + &doc_boundaries); + gsl_matrix* ss = gsl_matrix_calloc(nterms, + ntopics); + + // TODO(sgerrish): Fix this part. + for (int i=0; i + 1 < doc_boundaries.size(); ++i) { + const string kMinDoc = doc_boundaries[i]; + const string kMaxDoc = doc_boundaries[i + 1]; + name = StringPrintf("%s/lda-ss-docs_%s_%s.dat", + FLAGS_root_directory.c_str(), + kMinDoc.c_str(), + kMaxDoc.c_str()); + lda_suff_stats* ss_docs = read_lda_suff_stats(name.c_str(), + ntopics, + nterms); + gsl_matrix_add(ss, ss_docs->topics_ss); + gsl_matrix_free(ss_docs->topics_ss); + delete ss_docs; + } + name = StringPrintf("%s/initial-lda-ss.dat", + FLAGS_root_directory.c_str()); + mtx_fprintf(name.c_str(), ss); + + gsl_matrix_free(ss); +} + +static bool LDAConverged(double current, double last) { + if (fabs((last - current) / (last)) < 5e-6) { + printf("%f\n", + fabs((last - current))); + printf("%f\n", + fabs(last + 1.0)); + printf("%f\n", + fabs((last - current) / (last + 1.0))); + return true; + } else { + return false; + } +} + +static void RunMStepInParallel(int nterms, + double* l_hood, + string* topic_boundaries_str, + const vector<int>& topic_boundaries) { + // Create a task and set up appropriate flags. + hash_map<string, string> flags; + flags["ntopics"] = StringPrintf("%d", FLAGS_ntopics); + flags["root_directory"] = FLAGS_root_directory; + flags["nterms"] = StringPrintf("%d", nterms); + flags["corpus_prefix"] = FLAGS_corpus_prefix; + + *topic_boundaries_str = "0"; + for (int i=1; i < topic_boundaries.size(); ++i) { + *topic_boundaries_str += StringPrintf(",%d", topic_boundaries[i]); + } + flags["topic_boundaries"] = *topic_boundaries_str; + + vector<string> done_sentinels; + vector<Resource*> resources; + vector<Task*> tasks; + for (int i=0; i < FLAGS_number_tasks; ++i) { + const int kMinTopic = topic_boundaries[i]; + const int kMaxTopic = topic_boundaries[i + 1]; + + flags["min_topic"] = StringPrintf( + "%d", kMinTopic); + flags["max_topic"] = StringPrintf( + "%d", kMaxTopic); + flags["sentinel_filename"] = StringPrintf( + "%s/lda-topics_%d_%d.done", + FLAGS_root_directory.c_str(), + kMinTopic, + kMaxTopic); + done_sentinels.push_back(flags["sentinel_filename"]); + + Task* task = TaskFactory::NewMStepTask( + i, + FLAGS_root_directory.c_str(), + flags, + resources, + flags["sentinel_filename"]); + tasks.push_back(task); + + } + + // Run. + for (int t=0; t < tasks.size(); ++t) { + // printf("Starting task.\n"); + tasks[t]->Start(); + } + + c2_lib::WaitOnTasks(tasks); + + // Read the log likelihoods. + *l_hood = ReadLikelihoods(done_sentinels); +} + +static void RunEStepInParallel(int nterms, + int ndocs, + const string& topic_boundaries, + string* doc_boundaries_str, + double* l_hood) { + + hash_map<string, string> flags; + // flags["ndocs"] = StringPrintf("%d", ndocs); + flags["alpha"] = StringPrintf("%f", FLAGS_alpha); + + flags["ntopics"] = StringPrintf("%d", FLAGS_ntopics); + flags["topic_boundaries"] = topic_boundaries; + flags["root_directory"] = FLAGS_root_directory; + flags["nterms"] = StringPrintf("%d", nterms); + flags["corpus_prefix"] = FLAGS_corpus_prefix; + + const int kDocsPerTask = ((ndocs + + FLAGS_number_tasks - 1) + / FLAGS_number_tasks); + const int kNumberBigTasks = (FLAGS_number_tasks + - (kDocsPerTask * FLAGS_number_tasks + - ndocs)); + vector<int> doc_boundaries; + doc_boundaries.push_back(0); + *doc_boundaries_str = "0"; + int i=1; + for (int t=kDocsPerTask; + t < ndocs; + ) { + *doc_boundaries_str += StringPrintf(",%d", t); + doc_boundaries.push_back(t); + if (i < kNumberBigTasks) { + t += kDocsPerTask; + } else { + t += kDocsPerTask - 1; + } + ++i; + } + doc_boundaries.push_back(ndocs); + *doc_boundaries_str += StringPrintf(",%d", ndocs); + flags["doc_boundaries"] = *doc_boundaries_str; + + vector<string> done_sentinels; + vector<Resource*> resources; + vector<Task*> tasks; + for (int i=0; i < FLAGS_number_tasks; ++i) { + const int kMinDoc = doc_boundaries[i]; + const int kMaxDoc = doc_boundaries[i + 1]; + + flags["min_doc"] = StringPrintf( + "%d", kMinDoc); + flags["max_doc"] = StringPrintf( + "%d", kMaxDoc); + flags["sentinel_filename"] = StringPrintf( + "%s/lda-ss-docs_%d_%d.done", + FLAGS_root_directory.c_str(), + kMinDoc, + kMaxDoc); + done_sentinels.push_back(flags["sentinel_filename"]); + + Task* task = TaskFactory::NewEStepTask( + i, + FLAGS_root_directory.c_str(), + flags, + resources, + flags["sentinel_filename"]); + tasks.push_back(task); + + } + + // Run. + for (int t=0; t < tasks.size(); ++t) { + tasks[t]->Start(); + } + + c2_lib::WaitOnTasks(tasks); + + // Read the log likelihoods. + printf("Reading likelihoods.\n"); + *l_hood = ReadLikelihoods(done_sentinels); + printf("Read likelihood %.2lf.\n", l_hood); +} + + +void AggregateSuffStatsInParallel(const string& doc_boundaries, + int nterms, + int ntopics) { + printf("assip a\n"); + hash_map<string, string> flags; + flags["ntopics"] = StringPrintf("%d", ntopics); + flags["nterms"] = StringPrintf("%d", nterms); + flags["doc_boundaries"] = doc_boundaries; + flags["root_directory"] = FLAGS_root_directory; + printf("assip c\n"); + flags["sentinel_filename"] = StringPrintf("%s/aggregate_suff_stats.done", + FLAGS_root_directory.c_str()); + + vector<Resource*> resources; + printf("assip d\n"); + Task* task = TaskFactory::NewTask(0, + "aggregate_suff_stats", + FLAGS_root_directory.c_str(), + flags, + resources, + flags["sentinel_filename"], + "main-aggregate-ss"); + task->Start(); + WaitOnTask(*task); + delete task; + printf("assip e\n"); +} + + +bool RunParallelLDA(const vector<int>& topic_boundaries) { + // !!! + bool converged = false; + + corpus_t* initial_lda_data = read_corpus( + FLAGS_corpus_prefix.c_str()); + const int kNTerms = initial_lda_data->nterms; + + lda* lda_model = new_lda_model(FLAGS_ntopics, + initial_lda_data->nterms); + gsl_vector_set_all(lda_model->alpha, FLAGS_alpha); + lda_suff_stats* lda_ss = new_lda_suff_stats(lda_model); + + initialize_lda_ss_from_random(lda_ss); + + string name = StringPrintf("%s/initial-lda-ss.dat", + FLAGS_root_directory.c_str()); + write_lda_suff_stats(lda_ss, name.c_str()); + + int iterations = 0; + + if (FLAGS_number_tasks > initial_lda_data->ndocs) { + FLAGS_number_tasks = initial_lda_data->ndocs; + } + if (FLAGS_number_tasks > FLAGS_ntopics) { + FLAGS_number_tasks = FLAGS_ntopics; + } + + double m_lhood, e_lhood, last = 1.0; + string topic_boundaries_str; + + RunMStepInParallel(initial_lda_data->nterms, + &m_lhood, + &topic_boundaries_str, + topic_boundaries); + + while (!converged + && iterations++ < FLAGS_lda_max_em_iter) { + + string doc_boundaries; + RunEStepInParallel(initial_lda_data->nterms, + initial_lda_data->ndocs, + topic_boundaries_str, + &doc_boundaries, + &e_lhood); + + // Aggregate sufficient statistics across all documents. + AggregateSuffStatsInParallel(doc_boundaries, + initial_lda_data->nterms, + FLAGS_ntopics); + RunMStepInParallel(initial_lda_data->nterms, + &m_lhood, + &topic_boundaries_str, + topic_boundaries); + + if (!(converged = LDAConverged(m_lhood + e_lhood, + last))) { + last = m_lhood + e_lhood; + } + + printf("LDA Log likelihood: %lf\n", + last); + } + + free_corpus(initial_lda_data); + + return true; +} + +double fit_lda_post(int doc_number, int time, + lda_post* p, lda_seq* var, + gsl_matrix* g, + gsl_matrix* g3_matrix, + gsl_matrix* g4_matrix, + gsl_matrix* g5_matrix) { + init_lda_post(p); + gsl_vector_view topic_view; + gsl_vector_view renormalized_topic_view; + if (var && var->influence) { + // Make sure this stays in scope while the posterior is in + // use! + topic_view = gsl_matrix_row( + var->influence->doc_weights[time], doc_number); + renormalized_topic_view = gsl_matrix_row( + var->influence->renormalized_doc_weights[time], doc_number); + p->doc_weight = &topic_view.vector; + p->renormalized_doc_weight = &renormalized_topic_view.vector; + } + + double lhood = compute_lda_lhood(p); + double lhood_old = 0; + double converged = 0; + int iter = 0; + + do { + iter++; + lhood_old = lhood; + update_gamma(p); + if (FLAGS_model == "fixed" && var != NULL) { + update_phi_fixed(doc_number, + time, + p, + var, + g3_matrix, + g4_matrix, + g5_matrix); + } else { + update_phi(doc_number, time, p, var, g); + } + // TODO(sgerrish): Remove this. + // output_phi(p); + lhood = compute_lda_lhood(p); + converged = fabs((lhood_old - lhood) / + (lhood_old * p->doc->total)); + } while ((converged > LDA_INFERENCE_CONVERGED) && + (iter <= LDA_INFERENCE_MAX_ITER)); + + return(lhood); +} + + +/* + * initialize variational posterior + * + */ + +void init_lda_post(lda_post* p) { + int k, n, K = p->model->ntopics, N = p->doc->nterms; + + for (k = 0; k < K; k++) + { + vset(p->gamma, k, + vget(p->model->alpha, k) + ((double) p->doc->total) / K); + for (n = 0; n < N; n++) + mset(p->phi, n, k, 1.0/K); + } + p->doc_weight = NULL; +} + +/* + * update variational dirichlet parameters + * + */ + +void update_gamma(lda_post* p) { + int k, n, K = p->model->ntopics, N = p->doc->nterms; + + gsl_vector_memcpy(p->gamma, p->model->alpha); + for (n = 0; n < N; n++) { + gsl_vector phi_row = gsl_matrix_row(p->phi, n).vector; + int count = p->doc->count[n]; + for (k = 0; k < K; k++) + vinc(p->gamma, k, vget(&phi_row, k) * count); + } +} + +/* + * update variational multinomial parameters + * + */ + +void update_phi(int doc_number, int time, + lda_post* p, lda_seq* var, + gsl_matrix* g) { + int i, k, n, K = p->model->ntopics, N = p->doc->nterms; + double dig[p->model->ntopics]; + + for (k = 0; k < K; k++) { + dig[k] = gsl_sf_psi(vget(p->gamma, k)); + } + + for (n = 0; n < N; n++) { + // compute log phi up to a constant + + int w = p->doc->word[n]; + for (k = 0; k < K; k++) { + mset(p->log_phi, n, k, + dig[k] + mget(p->model->topics, w, k)); + } + + // normalize in log space + + gsl_vector log_phi_row = gsl_matrix_row(p->log_phi, n).vector; + gsl_vector phi_row = gsl_matrix_row(p->phi, n).vector; + log_normalize(&log_phi_row); + for (i = 0; i < K; i++) { + vset(&phi_row, i, exp(vget(&log_phi_row, i))); + } + } +} + + +void update_phi_fixed(int doc_number, int time, + lda_post* p, lda_seq* var, + gsl_matrix* g3_matrix, + gsl_matrix* g4_matrix, + gsl_matrix* g5_matrix) { + // Hate to do this, but I had problems allocating this data + // structure. + if (scaled_influence == NULL) { + scaled_influence = NewScaledInfluence(FLAGS_max_number_time_points); + } + + int i, k, n, K = p->model->ntopics, N = p->doc->nterms; + double dig[p->model->ntopics]; + + double k_sum = 0.0; + for (k = 0; k < K; k++) { + double gamma_k = vget(p->gamma, k); + dig[k] = gsl_sf_psi(gamma_k); + k_sum += gamma_k; + } + double dig_sum = gsl_sf_psi(k_sum); + + gsl_vector_view document_weights; + if (var && var->influence) { + document_weights = gsl_matrix_row( + var->influence->doc_weights[time], doc_number); + } + + for (n=0; n < N; ++n) { + int w = p->doc->word[n]; + // We have info. about the topics. Use them! + // Try two alternate approaches. We compare results of the new + // algorithm with the old to make sure we're not doing anything + // silly. + + for (k = 0; k < K; ++k) { + // Find an estimate for log_phi_nk. + double doc_weight = 0.0; + sslm_var* topic = var->topic[k]; + const double chain_variance = topic->chain_variance; + + // These matrices are already set up for the correct time. + double g3 = mget(g3_matrix, w, k); + double g4 = mget(g4_matrix, w, k); + double g5 = mget(g5_matrix, w, k); + // double w_phi_sum = gsl_matrix_get( + // var->topic[k]->w_phi_sum, w, time); + + // Only set these variables if we are within the correct + // time window. + if (time < var->nseq) { + doc_weight = gsl_vector_get(&document_weights.vector, k); + } + + double term_weight; + if (FLAGS_normalize_docs == "normalize") { + term_weight = ((double) p->doc->count[n] + / (double) p->doc->total); + } else if (FLAGS_normalize_docs == "log") { + term_weight = log(p->doc->count[n] + 1.0); + } else if (FLAGS_normalize_docs == "log_norm") { + term_weight = log(p->doc->count[n] / p->doc->total); + } else if (FLAGS_normalize_docs == "identity") { + term_weight = p->doc->count[n]; + } else if (FLAGS_normalize_docs == "occurrence") { + term_weight = ((double) p->doc->count[n] + / (double) p->doc->total); + } else { + assert(0); + } + + assert(var != NULL); + + double total, term1, term2, term3, term4; + double phi_last = 0.0; + + // It's unnecessary to always multiply by 1/chain_variance + // this deep in a loop, but it's likely not a major + // bottleneck. + term1 = dig[k] + mget(p->model->topics, w, k); + term2 = (g3 + * term_weight + * doc_weight + / chain_variance); + term3 = (term_weight + * doc_weight + * g4 + / chain_variance); + term4 = (term_weight * term_weight + * (phi_last * (doc_weight * doc_weight) + - (doc_weight * doc_weight + + FLAGS_sigma_l * FLAGS_sigma_l)) + * g5 + / chain_variance); + + // Note: we're ignoring term3. + // sgerrish: 20 May 2010: Noticed that + // term2 has a *negative* coefficient. Changing it to + // positive, since it appears that it should be positive. + total = term1 + term2 - term3 + term4; + mset(p->log_phi, n, k, total); + } + + // Normalize in log space. + gsl_vector log_phi_row = gsl_matrix_row(p->log_phi, n).vector; + gsl_vector phi_row = gsl_matrix_row(p->phi, n).vector; + log_normalize(&log_phi_row); + + bool set_min(false); + for (i = 0; i < K; i++) { + if (vget(&log_phi_row, i) < -16) { + vset(&log_phi_row, i, -16); + set_min = true; + } + } + if (set_min) { + log_normalize(&log_phi_row); + } + + for (i = 0; i < K; i++) { + vset(&phi_row, i, exp(vget(&log_phi_row, i))); + } + } +} + + +/* + * comput the likelihood bound + */ + +double compute_lda_lhood(lda_post* p) { + int k, n; + int K = p->model->ntopics, N = p->doc->nterms; + + double gamma_sum = sum(p->gamma); + double lhood = + gsl_sf_lngamma(sum(p->model->alpha)) - + gsl_sf_lngamma(gamma_sum); + vset(p->lhood, K, lhood); + + double influence_term = 0.0; + double digsum = gsl_sf_psi(gamma_sum); + for (k = 0; k < K; k++) { + if (p->doc_weight != NULL) { + // outlog("doc weight size: %d", p->doc_weight->size); + assert (K == p->doc_weight->size); + double influence_topic = gsl_vector_get(p->doc_weight, k); + if (FLAGS_model == "dim" + || FLAGS_model == "multiple" + || FLAGS_model == "fixed") { + influence_term = - ((influence_topic * influence_topic + + FLAGS_sigma_l * FLAGS_sigma_l) + / 2.0 / (FLAGS_sigma_d * FLAGS_sigma_d)); + // Note that these cancel with the entropy. + // - (log(2 * PI) + log(FLAGS_sigma_d)) / 2.0); + } + } + double e_log_theta_k = gsl_sf_psi(vget(p->gamma, k)) - digsum; + double lhood_term = + (vget(p->model->alpha, k) - vget(p->gamma, k)) * e_log_theta_k + + gsl_sf_lngamma(vget(p->gamma, k)) - + gsl_sf_lngamma(vget(p->model->alpha, k)); + + for (n = 0; n < N; n++) { + if (mget(p->phi, n, k) > 0) { + lhood_term += + p->doc->count[n]* + mget(p->phi, n, k) * + (e_log_theta_k + + mget(p->model->topics, p->doc->word[n], k) + - mget(p->log_phi, n, k)); + } + } + vset(p->lhood, k, lhood_term); + lhood += lhood_term; + lhood += influence_term; + } + + return(lhood); +} + + + +/* + * compute expected sufficient statistics for a corpus + * + */ + +double lda_e_step(lda* model, + corpus_t* data, + lda_suff_stats* ss) { + int d, k, n; + + if (ss != NULL) reset_lda_suff_stats(ss); + lda_post* p = new_lda_post(model->ntopics, data->max_unique); + p->model = model; + double lhood = 0; + + // for each document + + for (d = FLAGS_min_doc; d < FLAGS_max_doc; ++d) { + if (((d % 1000) == 0) && (d > 0)) { + outlog( "e-step: processing doc %d", d); + } + + // fit posterior + + p->doc = data->doc[d]; + + lhood += fit_lda_post(d, 0, p, NULL, NULL, NULL, NULL, NULL); + + // update expected sufficient statistics + + if (ss != NULL) + for (k = 0; k < model->ntopics; k++) + for (n = 0; n < p->doc->nterms; n++) + minc(ss->topics_ss, + p->doc->word[n], k, + mget(p->phi, n, k) * p->doc->count[n]); + } + + // !!! FREE POSTERIOR + + return(lhood); +} + + +/* + * compute MLE topics from sufficient statistics + * + */ + +double lda_m_step(lda* model, lda_suff_stats* ss) { + int k, w; + double lhood = 0; + for (k = FLAGS_min_topic; k < FLAGS_max_topic; k++) { + gsl_vector ss_k = gsl_matrix_column(ss->topics_ss, k).vector; + gsl_vector log_p = gsl_matrix_column(model->topics, k).vector; + if (LDA_USE_VAR_BAYES == 0) { + gsl_blas_dcopy(&ss_k, &log_p); + normalize(&log_p); + vct_log(&log_p); + + // Add simple smoothing: anything less than -20 becomes -20. + for (int i=0; i < log_p.size; ++i) { + if (vget(&log_p, i) < -20.0) { + vset(&log_p, i, -20.0); + } + } + } else { + double digsum = (sum(&ss_k) + + model->nterms * LDA_TOPIC_DIR_PARAM); + digsum = gsl_sf_psi(digsum); + double param_sum = 0; + for (w = 0; w < model->nterms; w++) { + double param = vget(&ss_k, w) + LDA_TOPIC_DIR_PARAM; + param_sum += param; + double elogprob = gsl_sf_psi(param) - digsum; + vset(&log_p, w, elogprob); + lhood += ((LDA_TOPIC_DIR_PARAM - param) * elogprob + + gsl_sf_lngamma(param)); + } + lhood -= gsl_sf_lngamma(param_sum); + } + } + return(lhood); +} + + +/* + * read sufficient statistics + * + */ + +void write_lda_suff_stats(lda_suff_stats* ss, const char* name) { + mtx_fprintf(name, ss->topics_ss); +} + +void write_lda_topics(lda* model, const char* name) { + mtx_fprintf(name, model->topics); +} + +lda_suff_stats* read_lda_suff_stats( + const char* filename, + int ntopics, int nterms) { + + lda_suff_stats* ss = (lda_suff_stats*) malloc(sizeof(lda_suff_stats)); + ss->topics_ss = gsl_matrix_alloc(nterms, ntopics); + mtx_fscanf(filename, ss->topics_ss); + return(ss); +} + +void read_lda_topics(lda* model) { + vector<string> topic_boundaries; + SplitStringUsing(FLAGS_topic_boundaries, + ",", + &topic_boundaries); + + string name; + for (int i=0; i + 1 < topic_boundaries.size(); ++i) { + int topic_min = atoi(topic_boundaries[i].c_str()); + int topic_max = atoi(topic_boundaries[i + 1].c_str()); + gsl_matrix_view topics_submatrix = gsl_matrix_submatrix( + model->topics, + 0, + topic_min, + model->topics->size1, + topic_max - topic_min); + name = StringPrintf("%s/lda-ss-topics_%d_%d.dat", + FLAGS_root_directory.c_str(), + topic_min, + topic_max); + mtx_fscanf(name.c_str(), &topics_submatrix.matrix); + } +} + +void read_lda_topics(const vector<int>& topic_boundaries, + lda* model) { + string name; + for (int i=0; i + 1 < topic_boundaries.size(); ++i) { + int topic_min = topic_boundaries[i]; + int topic_max = topic_boundaries[i + 1]; + gsl_matrix_view topics_submatrix = gsl_matrix_submatrix( + model->topics, + 0, + topic_min, + model->topics->size1, + topic_max - topic_min); + name = StringPrintf("%s/lda-ss-topics_%d_%d.dat", + FLAGS_root_directory.c_str(), + topic_min, + topic_max); + mtx_fscanf(name.c_str(), &topics_submatrix.matrix); + } +} + +/* + * new lda model and sufficient statistics + * + */ + +lda* new_lda_model(int ntopics, int nterms) { + lda* m = (lda*) malloc(sizeof(lda)); + m->ntopics = ntopics; + m->nterms = nterms; + m->topics = gsl_matrix_calloc(nterms, ntopics); + m->alpha = gsl_vector_calloc(ntopics); + + return(m); +} + +void free_lda_model(lda* m) { + gsl_matrix_free(m->topics); + gsl_vector_free(m->alpha); + free(m); +} + +lda_suff_stats* new_lda_suff_stats(lda* model) { + lda_suff_stats* ss = (lda_suff_stats*) malloc(sizeof(lda_suff_stats)); + ss->topics_ss = gsl_matrix_calloc(model->nterms, model->ntopics); + + return(ss); +} + +void reset_lda_suff_stats(lda_suff_stats* ss) { + gsl_matrix_set_all(ss->topics_ss, 0.0); +} + +lda_post* new_lda_post(int ntopics, int max_length) { + lda_post* p = (lda_post*) malloc(sizeof(lda_post)); + p->phi = gsl_matrix_calloc(max_length, ntopics); + p->log_phi = gsl_matrix_calloc(max_length, ntopics); + p->gamma = gsl_vector_calloc(ntopics); + p->lhood = gsl_vector_calloc(ntopics + 1); + + return(p); +} + +void free_lda_post(lda_post* p) { + gsl_matrix_free(p->phi); + gsl_matrix_free(p->log_phi); + gsl_vector_free(p->gamma); + gsl_vector_free(p->lhood); + free(p); +} + +/* + * initalize LDA SS from random + * + */ + +void initialize_lda_ss_from_random(lda_suff_stats* ss) { + int k, n; + gsl_rng * r = new_random_number_generator(); + for (k = 0; k < ss->topics_ss->size2; k++) + { + gsl_vector topic = gsl_matrix_column(ss->topics_ss, k).vector; + gsl_vector_set_all(&topic, 0); + for (n = 0; n < topic.size; n++) + { + vset(&topic, n, gsl_rng_uniform(r) + 10); + } + } +} + + +/* + * initialize sufficient statistics from a document collection + * + */ + +void initialize_lda_ss_from_data(corpus_t* data, + lda_suff_stats* ss) { + int k, n, i, w; + gsl_rng* r = new_random_number_generator(); + + for (k = 0; k < ss->topics_ss->size2; k++) { + gsl_vector topic = gsl_matrix_column(ss->topics_ss, k).vector; + for (n = 0; n < LDA_SEED_INIT; n++) { + int d = floor(gsl_rng_uniform(r) * data->ndocs); + doc_t* doc = data->doc[d]; + for (i = 0; i < doc->nterms; i++) { + vinc(&topic, doc->word[n], doc->count[n]); + } + } + for (w = 0; w < topic.size; w++) { + vinc(&topic, w, LDA_INIT_SMOOTH + gsl_rng_uniform(r)); + } + } +} + +/* + * write LDA model + * + */ + +void write_lda(lda* model, const char* name) { + string filename = StringPrintf("%s.beta", name); + mtx_fprintf(filename.c_str(), model->topics); + filename = StringPrintf("%s.alpha", name); + vct_fprintf(filename.c_str(), model->alpha); +} + +/* + * read LDA + * + */ + +lda* read_lda(int ntopics, int nterms, const char* name) { + string filename; + lda* model = new_lda_model(ntopics, nterms); + filename = StringPrintf("%s.beta", name); + mtx_fscanf(filename.c_str(), model->topics); + filename = StringPrintf("%s.alpha", name); + vct_fscanf(filename.c_str(), model->alpha); + + return(model); +} + +void lda_em(lda* model, + lda_suff_stats* ss, + corpus_t* data, + int max_iter, + char* outname) { + int iter = 0; + double lhood = lda_e_step(model, data, ss); + double old_lhood = 0; + double converged = 0; + double m_lhood = lda_m_step(model, ss); + outlog( "initial likelihood = %10.3f\n", lhood); + do { + iter++; + old_lhood = lhood; + lhood = lda_e_step(model, data, ss) + m_lhood; + m_lhood = lda_m_step(model, ss); + converged = (old_lhood - lhood) / (old_lhood); + outlog("iter = %d", iter); + outlog("lhood = % 10.3f", lhood); + outlog("conv = % 5.3e\n", converged); + outlog("max_iter: %d\n", max_iter); + } + while (((converged > LDA_EM_CONVERGED) || (iter <= 5)) + && (iter < max_iter)); + write_lda(model, outname); +} + +} // namespace dtm diff --git a/dtm_release/dtm-parallel/lda.h b/dtm_release/dtm-parallel/lda.h new file mode 100644 index 0000000000000000000000000000000000000000..2f6b8ea56794f31a8e0746cd0af135e2262a01d7 --- /dev/null +++ b/dtm_release/dtm-parallel/lda.h @@ -0,0 +1,133 @@ +#ifndef LDA_H +#define LDA_H + +#include <gsl/gsl_vector.h> +#include <gsl/gsl_matrix.h> +#include <gsl/gsl_sf_gamma.h> +#include <gsl/gsl_sf_psi.h> +#include <gsl/gsl_sf_lambert.h> +#include <gsl/gsl_rng.h> + +#include "param.h" +#include "data.h" +#include "gsl-wrappers.h" + +#include <vector> + +/* + * functions for posterior inference in the latent dirichlet + * allocation model. + * + */ + +#define LDA_INFERENCE_CONVERGED 1e-7 +#define LDA_SEED_INIT 1 +#define LDA_INIT_SMOOTH 1.0 +#define LDA_EM_CONVERGED 5e-5 +#define LDA_USE_VAR_BAYES 0 +#define LDA_TOPIC_DIR_PARAM 0.001 + +namespace dtm { + +// lda model + +typedef struct lda +{ + int ntopics; // number of topics + int nterms; // vocabulary size + gsl_matrix* topics; // each column is a topic (V X K) + gsl_vector* alpha; // dirichlet parameters +} lda; + +// lda posterior + +typedef struct lda_post +{ + doc_t* doc; // document associated to this posterior + lda* model; // lda model + gsl_matrix* phi; // variational mult parameters (nterms x K) + gsl_matrix* log_phi; // convenient for computation (nterms x K) + gsl_vector* gamma; // variational dirichlet parameters (K) + gsl_vector* lhood; // a K+1 vector, sums to the lhood bound + gsl_vector* doc_weight; // Not owned by this structure. + gsl_vector* renormalized_doc_weight; // Not owned by this structure. +} lda_post; + +// lda sufficient statistics + +typedef struct lda_suff_stats { + gsl_matrix* topics_ss; +} lda_suff_stats; + +// Run LDA in parallel. +bool RunParallelLDA(const vector<int>& topic_boundaries); +void AggregateSuffStats(); + +// new lda model and suff stats + +lda* new_lda_model(int ntopics, int nterms); +void free_lda_model(lda* m); +lda_suff_stats* new_lda_suff_stats(lda* model); +void reset_lda_suff_stats(lda_suff_stats* ss); +lda_post* new_lda_post(int ntopics, int max_length); +void free_lda_post(lda_post* p); +void initialize_lda_ss_from_data(corpus_t* data, lda_suff_stats* ss); + +// posterior inference +double fit_lda_post(int doc_number, int time, + lda_post* p, lda_seq* var, + gsl_matrix* g, + gsl_matrix* g3, + gsl_matrix* g4, + gsl_matrix* g5); +void init_lda_post(lda_post* p); +void update_gamma(lda_post* p); +void update_phi(int doc_number, int time, + lda_post* p, lda_seq* var, + gsl_matrix* g); +void update_phi_dim(int doc_number, int time, + lda_post* p, lda_seq* var, + gsl_matrix* g); +void update_phi_fixed(int doc_number, int time, + lda_post* p, lda_seq* var, + gsl_matrix* g3_matrix, + gsl_matrix* g4_matrix, + gsl_matrix* g5_matrix); +void update_phi_multiple(int doc_number, int time, + lda_post* p, lda_seq* var, + gsl_matrix* g); + +// compute the likelihood bound + +double compute_lda_lhood(lda_post* p); + +// EM algorithm + +double RunEStep(); +double RunMStep(); +double lda_e_step(lda* model, corpus_t* data, lda_suff_stats* ss); +double lda_m_step(lda* model, lda_suff_stats* ss); +void lda_em(lda* model, + lda_suff_stats* ss, + corpus_t* data, + int max_iter, + char* outname); + +// reading and writing + +lda_suff_stats* read_lda_suff_stats( + const char* filename, int ntopics, int nterms); +void read_lda_topics(lda* model); +void read_lda_topics(const vector<int>& topic_boundaries, + lda* model); +void write_lda(lda* model, const char* name); +void write_lda_suff_stats(lda_suff_stats* ss, const char* name); +void write_lda_topics(lda_suff_stats* ss, const char* name); +lda* read_lda(int ntopics, int nterms, const char* name); + +void initialize_lda_ss_from_random(lda_suff_stats* ss); + + +} // namespace + +#endif diff --git a/dtm_release/dtm-parallel/main-aggregate-ss.c b/dtm_release/dtm-parallel/main-aggregate-ss.c new file mode 100644 index 0000000000000000000000000000000000000000..cf708fe85a0a4442628b18c0d0b8fc1225357ee8 --- /dev/null +++ b/dtm_release/dtm-parallel/main-aggregate-ss.c @@ -0,0 +1,24 @@ +#include "gflags.h" + +#include "lda.h" +#include "main.h" +#include "c2_lib.h" + +// Note that this is not necessary here. +DEFINE_string(model, "", "Model name."); + +DEFINE_string(sentinel_filename, + "", + "A sentinel filename."); + +using namespace dtm; + +int main(int argc, char* argv[]) { + google::ParseCommandLineFlags(&argc, &argv, 0); + + AggregateSuffStats(); + CreateSentinel(FLAGS_sentinel_filename, + 0.0); + + return(0); +} diff --git a/dtm_release/dtm-parallel/main-fit_seq_docs.c b/dtm_release/dtm-parallel/main-fit_seq_docs.c new file mode 100644 index 0000000000000000000000000000000000000000..0b5d30aea417076f2e670e4ce081cc6bf89b9982 --- /dev/null +++ b/dtm_release/dtm-parallel/main-fit_seq_docs.c @@ -0,0 +1,54 @@ +#include "gflags.h" +#include "lda-seq.h" +#include "main.h" +#include "c2_lib.h" + +DEFINE_string(sentinel_filename, + "", + ""); + +DECLARE_string(outname); +DECLARE_string(root_directory); +DECLARE_double(top_obs_var); +DECLARE_double(top_chain_var); +DECLARE_int32(ntopics); + +DECLARE_string(corpus_prefix); +DECLARE_double(alpha); + +/* + * read the parameters + * + * !!! use the cleaner functions in params.h + * + */ + + +/* + * fit a model from data + * + */ + +using namespace dtm; + +/* + * main function + * + * supports fitting a dynamic topic model + * + */ + +int main(int argc, char* argv[]) +{ + // Initialize the flag objects. + // InitFlags(argc, argv); + google::ParseCommandLineFlags(&argc, &argv, 0); + + double lhood = fit_lda_seq_sd(); + + CreateSentinel(FLAGS_sentinel_filename.c_str(), + lhood); + printf("... Job complete.\n"); + + return(0); +} diff --git a/dtm_release/dtm-parallel/main-fit_seq_topics.c b/dtm_release/dtm-parallel/main-fit_seq_topics.c new file mode 100644 index 0000000000000000000000000000000000000000..ab7b7a00ba18d0c0d4651b1ef4082999f2aae7c5 --- /dev/null +++ b/dtm_release/dtm-parallel/main-fit_seq_topics.c @@ -0,0 +1,46 @@ +#include "gflags.h" + +#include <stdlib.h> +#include <string.h> +#include "data.h" +#include "lda-seq.h" +#include "lda.h" +#include "main.h" +#include <gsl/gsl_matrix.h> + +DEFINE_string(sentinel_filename, + "", + ""); + +DECLARE_string(outname); +DECLARE_string(root_directory); +DECLARE_double(top_obs_var); +DECLARE_double(top_chain_var); +DECLARE_int32(ntopics); + +DECLARE_string(corpus_prefix); +DECLARE_double(alpha); + +// using namespace dtm; + +/* + * main function + * + * supports fitting a dynamic topic model + * + */ + +int main(int argc, char* argv[]) { + // Initialize the flag objects. + // InitFlags(argc, argv); + google::ParseCommandLineFlags(&argc, &argv, 0); + + // mode for fitting a dynamic topic model + double lhood = dtm::fit_lda_seq_st(); + dtm::CreateSentinel(FLAGS_sentinel_filename, + lhood); + printf("... Job complete.\n"); + + + return(0); +} diff --git a/dtm_release/dtm-parallel/main-fit_seq_topics.h b/dtm_release/dtm-parallel/main-fit_seq_topics.h new file mode 100644 index 0000000000000000000000000000000000000000..b7927fcb4c8b0a35bbb9ac4e38c9faa2f19a9213 --- /dev/null +++ b/dtm_release/dtm-parallel/main-fit_seq_topics.h @@ -0,0 +1,18 @@ +#ifndef MAINH +#define MAINH + +typedef struct dtm_fit_params +{ + char* datafile; + char* outname; + char* heldout; + int start; + int end; + int ntopics; + int lda_max_em_iter; + double top_obs_var; + double top_chain_var; + double alpha; +} dtm_fit_params; + +#endif diff --git a/dtm_release/dtm-parallel/main-lda-e-step.c b/dtm_release/dtm-parallel/main-lda-e-step.c new file mode 100644 index 0000000000000000000000000000000000000000..a325b7ee5e7efd47798bb55f447bb6f3f8e323fe --- /dev/null +++ b/dtm_release/dtm-parallel/main-lda-e-step.c @@ -0,0 +1,28 @@ +#include "gflags.h" + +#include "lda.h" +#include "main.h" +#include "c2_lib.h" + +DEFINE_string(model, + "dim", + "The function to perform. " + "Can be dtm or dim."); +DEFINE_string(sentinel_filename, + "", + "A sentinel filename."); + +DEFINE_string(outname, "", ""); + +using namespace dtm; + +int main(int argc, char* argv[]) { + google::ParseCommandLineFlags(&argc, &argv, 0); + + double l_hood = RunEStep(); + + CreateSentinel(FLAGS_sentinel_filename, + l_hood); + + return(0); +} diff --git a/dtm_release/dtm-parallel/main-lda-m-step.c b/dtm_release/dtm-parallel/main-lda-m-step.c new file mode 100644 index 0000000000000000000000000000000000000000..c2f866407753d03df975ae6a0a8a578b8984dd45 --- /dev/null +++ b/dtm_release/dtm-parallel/main-lda-m-step.c @@ -0,0 +1,28 @@ +#include "gflags.h" + +#include "lda.h" +#include "main.h" +#include "c2_lib.h" + + +DEFINE_string(model, + "dim", + "The function to perform. " + "Can be dtm or dim."); +DEFINE_string(sentinel_filename, + "", + "A sentinel filename."); + +DEFINE_string(outname, "", ""); + +using namespace dtm; + +int main(int argc, char* argv[]) { + google::ParseCommandLineFlags(&argc, &argv, 0); + + double l_hood = RunMStep(); + CreateSentinel(FLAGS_sentinel_filename, + l_hood); + + return(0); +} diff --git a/dtm_release/dtm-parallel/main.c b/dtm_release/dtm-parallel/main.c new file mode 100644 index 0000000000000000000000000000000000000000..9a105722fc27dd1171a441dac88d08e9725f3da4 --- /dev/null +++ b/dtm_release/dtm-parallel/main.c @@ -0,0 +1,98 @@ +#include "gflags.h" + +#include "lda.h" +#include "lda-seq.h" +#include "strutil.h" +#include "main.h" + +#include <vector.h> + +DECLARE_string(outname); +DECLARE_string(resume_stage); +DECLARE_int32(ntopics); +DECLARE_int32(number_tasks); + +namespace dtm { + +extern int LDA_INFERENCE_MAX_ITER; + +static void CreateTopicBoundaries(int ntopics, + int number_tasks, + vector<int>* topic_boundaries) { + const int kTopicsPerTask = ((ntopics + + number_tasks - 1) + / number_tasks); + const int kNumberBigTasks = (number_tasks + - (kTopicsPerTask * number_tasks + - ntopics)); + // Be sure to clear topic boundaries since we run this + // multiple times. + topic_boundaries->clear(); + topic_boundaries->push_back(0); + int i=1; + for (int t=kTopicsPerTask; + t < ntopics; + ) { + topic_boundaries->push_back(t); + if (i < kNumberBigTasks) { + t += kTopicsPerTask; + } else { + t += kTopicsPerTask - 1; + } + ++i; + } + topic_boundaries->push_back(ntopics);; +} + +static bool fit_dtm() { + // make the directory for this fit + string run_dir = StringPrintf("%s/", FLAGS_outname.c_str()); + if (!directory_exist(run_dir.c_str())) { + make_directory(run_dir.c_str()); + } + + // Initialize (a few iterations of LDA fitting) + outlog("%s","### INITIALIZING MODEL FROM LDA ###\n"); + bool success = true; + + vector<int> topic_boundaries; + CreateTopicBoundaries(FLAGS_ntopics, + FLAGS_number_tasks, + &topic_boundaries); + + if (FLAGS_resume_stage != "doc" + && FLAGS_resume_stage != "topic") { + success = RunParallelLDA(topic_boundaries); + } + + if (success) { + printf("... Done"); + } else { + printf("... Failed"); + } + + // !!! make this an option + // Read in the corpus so we know how many terms. + if (success) { + success = FitParallelLDASeq(topic_boundaries); + } + + return success; +} + +} // namespace dtm + +using namespace dtm; + +int main(int argc, char* argv[]) +{ + // Initialize the flag objects. + // InitFlags(argc, argv); + google::ParseCommandLineFlags(&argc, &argv, 0); + + // usage: main (sums corpus_sequence|fit param|time params) + + bool success = fit_dtm(); + + return(!success); +} diff --git a/dtm_release/dtm-parallel/main.h b/dtm_release/dtm-parallel/main.h new file mode 100644 index 0000000000000000000000000000000000000000..6c6b938034908b3d59e4027840285a84cfc62c13 --- /dev/null +++ b/dtm_release/dtm-parallel/main.h @@ -0,0 +1,25 @@ +#ifndef MAINH +#define MAINH + +#include <stdlib.h> +#include <string.h> +//#include "data.h" +//#include "lda-seq.h" +#include "lda.h" +#include <gsl/gsl_matrix.h> + +typedef struct dtm_fit_params +{ + char* datafile; + char* outname; + char* heldout; + int start; + int end; + int ntopics; + int lda_max_em_iter; + double top_obs_var; + double top_chain_var; + double alpha; +} dtm_fit_params; + +#endif diff --git a/dtm_release/dtm-parallel/param.c b/dtm_release/dtm-parallel/param.c new file mode 100644 index 0000000000000000000000000000000000000000..b9bd40e018529219f3ac9cf0e9ce9c51fcc8dfc5 --- /dev/null +++ b/dtm_release/dtm-parallel/param.c @@ -0,0 +1,1007 @@ +/*====================================================================*/ +/* A group of routines to extract parameters from scripts and import */ +/* them into C/C++ programs. J. Lafferty 2/2/95 */ +/*====================================================================*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <assert.h> +#include "param.h" +#include "util.h" + +/* #define TRACE 1 */ +#define EOL '\n' +#define EOS '\0' +#define DELIMIT_CHAR '=' +#define ENDMARK_CHAR ';' +#define COMMAND_CHAR '%' +#define EMBEDDED_VAR_CHAR '@' +#define FIXED_CHAR '+' +#define QUOTE_CHAR '\'' +#define DQUOTE_CHAR '"' +#define DDTABLE_SIZE 1001 +#define MAX_SYMBOL_LENGTH 65535 +#define DDINF_DEFAULT_NAME "DDINF" +#define TRUE 1 +#define FALSE 0 + +static int restart_inited = FALSE; +static int restart_is_new = FALSE; +static int checkpointed = FALSE; +static FILE *restart_unit=NULL; +static char *restart_name=NULL; +static char *ddname_buffer; +static char *ddvalue_buffer; +static char *command_buffer; +static char *argument_buffer; +static int nameBufferIndex=0, valueBufferIndex=0; +static int commandBufferIndex, argumentBufferIndex; +static char *begin_restart_header="/***BEGIN_RESTART***/\n"; +static char *end_restart_header="/***END_RESTART***/\n"; +static int NumberOfYesStrings = 3; +static char *YesString[] = {"YES", "TRUE", "1"}; + +/*********************************************************/ +/* Various linked lists: */ +/*********************************************************/ +typedef struct ddlink ddlink; +typedef struct clink clink; +typedef struct ddinf_link ddinf_link; +typedef struct ddpar_link ddpar_link; + +struct ddlink { + char *ddname; + char *ddvalue; + int fixed; + ddlink *next; +}; +struct clink { + char *name; + clink *next; +}; +struct ddinf_link { + char *name; + FILE *stream; + ddinf_link *next; +}; +struct ddpar_link { + char *file_name; + int par_inited; + ddlink **ddtable; + ddpar_link *next; +}; + +static ddinf_link *ddinf=NULL; +static clink *prefix_stack=NULL; +static ddpar_link *ddpar=NULL; +static char *ddinfName; + +/***************************************************/ +/* Internal procedures: */ +/***************************************************/ +int param_init(void); +void param_init_restart(void); +int same_string_upcase_first_arg(char *s, char *t); +void parse_stream(FILE *stream, char *file_name); +ddinf_link *push_last_complete_block (char *iname); +ddinf_link *push_ddinf_stream (FILE* instream, char *inname); +ddinf_link *push_ddinf (char *inname); +void pop_ddinf (void); +ddlink *insert (const char *newddname, const char *newddvalue); +void ddinf_error (char *ermsg); +double safe_atod (const char *name, const char *expr); +long safe_atol (const char *name, const char *expr); + +void param_init_buffers(void) { + static int buffers_inited=FALSE; + + if (buffers_inited) return; + ddname_buffer = (char *) malloc(MAX_SYMBOL_LENGTH); + ddvalue_buffer = (char *) malloc(MAX_SYMBOL_LENGTH); + command_buffer = (char *) malloc(80); + argument_buffer = (char *) malloc(MAX_SYMBOL_LENGTH); + buffers_inited = TRUE; +} + + +/***************************************************/ +int param_init(){ + static int ddinf_inited=FALSE; + + param_init_buffers(); + if (ddinf_inited) return TRUE; + + ddinfName = (char *) malloc(80); + ddinfName = getenv("PARAM"); + ddinf_inited = TRUE; + + if (ddinfName != NULL) param_push_file(ddinfName); + return TRUE; +} + +/***************************************************/ +void param_init_par() { + FILE *stream; + + param_init(); + if ((ddpar == NULL) || (ddpar->par_inited)) return; + printf("filename: %s", ddpar->file_name); + stream = fopen(ddpar->file_name, "r"); + parse_stream(stream, ddpar->file_name); + ddpar->par_inited = TRUE; +} + + + +/*******************************************************/ +/* Initialize ddinf names and values. This is */ +/* organized as a simple finite-state machine. */ +/*******************************************************/ +void parse_stream(FILE *instream, char *inname){ + printf("ddinf: %d\n", 0); + int c, next_c; + /* These are really characters, but the library functions use ints */ + int commentLevel = 0; + + enum buffer_state { + BEGIN_LINE, ENDMARKED, COMMENT, NAME, NAME_ENDED, + VALUE, DIRECTIVE, ARGUMENT, QUOTATION, QUOTATION_ENDED, DQUOTATION, DQUOTATION_ENDED + } state = BEGIN_LINE, prev_state = BEGIN_LINE; + enum character_class { + WHITESPACE, COMMENT_START, COMMENT_END, DELIMITER, ENDMARK, + END_OF_LINE, COMMAND, QUOTE, DQUOTE, OTHER, FIXIT + } cclass; + + ddinf = push_ddinf_stream(instream, inname); + + printf("ddinf: %d\n", ddinf); + + while (ddinf != NULL) { + while ((c=getc(ddinf->stream)) != EOF) { + switch (c) { + case DELIMIT_CHAR: cclass = DELIMITER; break; + case ENDMARK_CHAR: cclass = ENDMARK; break; + case EOL: cclass = END_OF_LINE; break; + case COMMAND_CHAR: cclass = COMMAND; break; + case QUOTE_CHAR: cclass = QUOTE; break; + case DQUOTE_CHAR: cclass = DQUOTE; break; + case FIXED_CHAR: cclass = FIXIT; break; + case '/': + if ((state == QUOTATION) || (state == DQUOTATION)) + cclass = OTHER; + else + if ((next_c = getc(ddinf->stream)) == '*') + cclass = COMMENT_START; + else { + cclass = OTHER; + if (ungetc(next_c, ddinf->stream) == EOF) + error("PARAM: ungetc failed."); + } + break; + case '*': + if ((state == QUOTATION) || (state == DQUOTATION)) + cclass = OTHER; + else + if ((next_c = getc(ddinf->stream)) == '/') + cclass = COMMENT_END; + else { + cclass = OTHER; + if (ungetc(next_c, ddinf->stream) == EOF) + error("PARAM: ungetc failed."); + } + break; + default: + if (isspace(c)) cclass = WHITESPACE; + else cclass = OTHER; + } + switch (state) { + case BEGIN_LINE: + switch (cclass) { + case WHITESPACE: case END_OF_LINE: break; + case COMMENT_START: + prev_state = BEGIN_LINE; + state = COMMENT; + commentLevel++; + break; + case COMMENT_END: ddinf_error("Unmatched comment ending"); + case DELIMITER: ddinf_error("Missing parameter name."); + case QUOTE: ddinf_error("Quotations for values only."); + case DQUOTE: ddinf_error("Quotations for values only."); + case ENDMARK: state = ENDMARKED; break; + case COMMAND: commandBufferIndex = 0; state = DIRECTIVE; break; + case FIXIT: ddname_buffer[nameBufferIndex++] = c; break; + case OTHER: + ddname_buffer[nameBufferIndex++] = c; + state = NAME; + break; + } + break; + case ENDMARKED: + switch (cclass) { + case WHITESPACE: break; + case COMMENT_START: + prev_state = ENDMARKED; + state = COMMENT; + commentLevel++; + break; + case COMMENT_END: ddinf_error("Unmatched comment ending"); + case DELIMITER: ddinf_error("Missing parameter name."); + case QUOTE: ddinf_error("Quotations for values only."); + case DQUOTE: ddinf_error("Quotations for values only."); + case ENDMARK: ddinf_error("Null production"); + case COMMAND: commandBufferIndex = 0; state = DIRECTIVE; break; + case OTHER: + ddname_buffer[nameBufferIndex++] = c; + state = NAME; + break; + case FIXIT: + ddname_buffer[nameBufferIndex++] = c; + state = NAME; + break; + case END_OF_LINE: state = BEGIN_LINE; break; + default: + ddinf_error("Illegal character after end marker."); + } + break; + case COMMENT: + switch (cclass) { + case COMMENT_END: commentLevel--; + if (commentLevel == 0) + state = prev_state; + break; + case COMMENT_START: commentLevel++; break; + default: break; + } + break; + case NAME: + switch (cclass) { + case WHITESPACE: case END_OF_LINE: + state = NAME_ENDED; + break; + case COMMENT_START: + prev_state = NAME_ENDED; + state = COMMENT; + commentLevel++; + break; + case COMMENT_END: ddinf_error("Unmatched comment ending"); + case QUOTE: ddinf_error("Quotes for values only."); + case DQUOTE: ddinf_error("Quotes for values only."); + case DELIMITER: + state = VALUE; + break; + case ENDMARK: ddinf_error("Missing value."); + case COMMAND: /* XXX shouldn't this be allowed if name is begun ?*/ + ddinf_error("Illegal use of COMMAND character."); + case FIXIT: + ddinf_error("Illegal use of FIXIT character."); + case OTHER: ddname_buffer[nameBufferIndex++] = c; + } + break; + case NAME_ENDED: + switch (cclass) { + case WHITESPACE: case END_OF_LINE: break; + case COMMENT_START: + prev_state = NAME_ENDED; + state = COMMENT; + commentLevel++; + break; + case DELIMITER: + state = VALUE; + break; + default: + ddinf_error("Illegal character after parameter name."); + } + break; + case VALUE: + switch (cclass) { + case WHITESPACE: + break; + case COMMENT_START: /* XXX be sure this means not quoted!! */ + prev_state = VALUE; + state = COMMENT; + commentLevel++; + break; + case COMMENT_END: ddinf_error("Unmatched comment ending"); + case DELIMITER: ddinf_error("Missing delimiter or endmark."); + case ENDMARK: + ddname_buffer[nameBufferIndex++] = EOS; + ddvalue_buffer[valueBufferIndex++] = EOS; + if (insert(ddname_buffer, strip(ddvalue_buffer)) == NULL) + ddinf_error("error adding (name,value) pair"); + nameBufferIndex = 0; + valueBufferIndex = 0; + state = ENDMARKED; + break; + /* case END_OF_LINE: ddinf_error("Missing end marker."); */ + case END_OF_LINE: break; + case QUOTE: state = QUOTATION; break; + case DQUOTE: state = DQUOTATION; break; + default: + ddvalue_buffer[valueBufferIndex++] = c; + } + break; + case DIRECTIVE: + switch (cclass) { + case WHITESPACE: + command_buffer[commandBufferIndex] = EOS; + argumentBufferIndex = 0; + state = ARGUMENT; + break; + case OTHER: command_buffer[commandBufferIndex++] = c; break; + default: ddinf_error("Illegal character in ddinf directive"); + } + break; + case ARGUMENT: + switch (cclass) { + case WHITESPACE: break; + case COMMENT_START: + prev_state = ARGUMENT; + state = COMMENT; + commentLevel++; + break; + case COMMENT_END: ddinf_error("Unmatched comment ending"); + case ENDMARK: + argument_buffer[argumentBufferIndex] = EOS; + if (strcmp(command_buffer, "include") == 0) { + ddinf = push_ddinf(argument_buffer); + if (ddinf->stream == NULL) + ddinf_error("Unable to open ddinf"); + state = BEGIN_LINE; + } + else if (strcmp(command_buffer, "include_restart") == 0) { + ddinf = push_last_complete_block(argument_buffer); + if (ddinf->stream == NULL) + ddinf_error("Unable to open ddinf"); + state = BEGIN_LINE; + } + else if (strcmp(command_buffer, "restart")==0) { + if (strstr(argument_buffer,"(new") != 0) { + *strchr(argument_buffer, '(') = EOS; + restart_is_new = TRUE; + } + insert("%restart", argument_buffer); + state = BEGIN_LINE; + } + else ddinf_error("Unrecognized ddinf directive."); + break; + case END_OF_LINE: ddinf_error("Missing end marker"); + default: + argument_buffer[argumentBufferIndex++] = c; + } + break; + case QUOTATION: + if (cclass == QUOTE) state=QUOTATION_ENDED; + else ddvalue_buffer[valueBufferIndex++] = c; + break; + case DQUOTATION: + if (cclass == DQUOTE) state=DQUOTATION_ENDED; + else ddvalue_buffer[valueBufferIndex++] = c; + break; + case QUOTATION_ENDED: + switch (cclass) { + case WHITESPACE: break; + case COMMENT_START: + prev_state = VALUE; + state = COMMENT; + commentLevel++; + break; + case COMMENT_END: ddinf_error("Unmatched comment end."); + case ENDMARK: + ddname_buffer[nameBufferIndex++] = EOS; + ddvalue_buffer[valueBufferIndex++] = EOS; + if (insert(ddname_buffer, ddvalue_buffer) == NULL) + ddinf_error("error adding (name,value) pair"); + nameBufferIndex = 0; + valueBufferIndex = 0; + state = ENDMARKED; + break; + case END_OF_LINE: break; + case QUOTE: + state = QUOTATION; + ddvalue_buffer[valueBufferIndex++] = c; + break; + default: + ddinf_error("Illegal character after quotation."); + } + break; + case DQUOTATION_ENDED: + switch (cclass) { + case WHITESPACE: break; + case COMMENT_START: + prev_state = VALUE; + state = COMMENT; + commentLevel++; + break; + case COMMENT_END: ddinf_error("Unmatched comment end."); + case ENDMARK: + ddname_buffer[nameBufferIndex++] = EOS; + ddvalue_buffer[valueBufferIndex++] = EOS; + if (insert(ddname_buffer, ddvalue_buffer) == NULL) + ddinf_error("error adding (name,value) pair"); + nameBufferIndex = 0; + valueBufferIndex = 0; + state = ENDMARKED; + break; + case END_OF_LINE: break; + case DQUOTE: + ddinf_error("Illegal character after quotation."); + break; + default: + ddinf_error("Illegal character after quotation."); + break; + } + break; + } /* Matches switch on current state */ + } /* Matches while not end-of-file */ + if ((state != ENDMARKED) && (state != BEGIN_LINE)) { + if ((state == QUOTATION) || (state == DQUOTATION)) { + ddinf_error("end of file inside quoted string."); + } + else if (commentLevel != 0) { + ddinf_error("end of file inside comment."); + } + else { + ddinf_error("Not in proper state at end of file."); + } + } + pop_ddinf(); + } /* Matches while ddinf != NULL */ +} + + +/*******************************************************/ +void param_dump (FILE *stream) { + int i; + ddlink *lp; + param_init_par(); + for (i=0; i<DDTABLE_SIZE; ++i) { + for (lp = ddpar->ddtable[i]; lp != NULL; lp = lp->next) { + if (lp->fixed) fputc('+', stream); + fputs(lp->ddname, stream); + fputs(" = ", stream); + fputs(quote(lp->ddvalue), stream); + fputs(";\n", stream); + } + } +} + + +/*******************************************************/ +static unsigned hash (const char *s) { + unsigned hashval; + for (hashval=0; *s != EOS; s++) + hashval = *s + 31*hashval; + return hashval % DDTABLE_SIZE; +} + +/*******************************************************/ +ddlink *lookup (const char *s) { + ddlink *lp; + int i; + i = hash(s); + if (ddpar == NULL) return NULL; + for (lp = ddpar->ddtable[hash(s)]; lp != NULL; lp = lp->next) + if (strcmp(s, lp->ddname) == 0) + return lp; + return NULL; +} + +/*******************************************************/ +ddlink *prefixed_lookup (const char *s) { + static char *prefixed_s=NULL; + if (prefixed_s == NULL) + prefixed_s = (char *) malloc (MAX_SYMBOL_LENGTH); + if (prefix_stack == NULL) return lookup(s); + sprintf(prefixed_s, "%s%s", prefix_stack->name, s); + return lookup(prefixed_s); +} + +/*******************************************************/ + +/* begin ALB 9/96 */ + +char *lookup_ddval(const char *p, int *len) +{ + ddlink *lp; + char ddparm[MAX_SYMBOL_LENGTH]; + int i, nopenparens; + if (p[0] !='(') + { + /* No (), embedded ddparm takes up remainder of p */ + strcpy(ddparm,p); + *len = strlen(p)+1; + } + else + { + nopenparens=1; + for (i=1; p[i] && nopenparens>0; i++) + { + if (p[i]=='(') nopenparens++; + if (p[i]==')') nopenparens--; + } + if (nopenparens>0) error("PARAM: Unmatched ("); + memcpy(ddparm, &p[1], i-2); + ddparm[i-2]=0; + *len = i+1; + } + + /* sanity check: no nested % */ + if (strchr(ddparm, EMBEDDED_VAR_CHAR)!=NULL) + error("PARAM: No nested %% allowed."); + + if ((lp = lookup(ddparm)) == NULL) + error("PARAM: symbol %s not defined (yet)\n", ddparm); + return lp->ddvalue; +} + + +void expand_ddval(const char *ddval_raw, char *ddval_expanded) +{ + char c, *ddval; + int i=0,j=0,len; + while((c=ddval_raw[i])!='\0') + { + if (c == EMBEDDED_VAR_CHAR) + { + ddval = lookup_ddval(&ddval_raw[i+1], &len); + strcpy(&ddval_expanded[j], ddval); + i+= len; + j+= strlen(ddval); + } + else + ddval_expanded[j++] = ddval_raw[i++]; + } + ddval_expanded[j] = 0; +} + +/*******************************************************/ +ddlink *insert (const char *newddname, const char *newddvalue_raw) { + ddlink *lp; + unsigned hashval; + char newddvalue_buff[MAX_SYMBOL_LENGTH]; + char *newddvalue = &newddvalue_buff[0]; + int fixit=FALSE; + + if (newddname[0] == '+') { + fixit = TRUE; + newddname++; + } + + expand_ddval(newddvalue_raw,newddvalue); /* ALB 9/96 */ + + if ((lp = lookup(newddname)) == NULL) { + lp = (ddlink *) malloc (sizeof(*lp)); + lp->ddname = (char *) malloc(strlen(newddname)+1); + lp->ddvalue = (char *) malloc(strlen(newddvalue)+1); + if (lp == NULL || lp->ddname == NULL || lp->ddvalue == NULL) return NULL; + hashval = hash(newddname); + strcpy(lp->ddname, newddname); + strcpy(lp->ddvalue, newddvalue); + lp->next = ddpar->ddtable[hashval]; + lp->fixed = fixit; + ddpar->ddtable[hashval] = lp; + } + else if (!lp->fixed) { + free ((char *) lp->ddvalue); + if ((lp->ddvalue = (char *) malloc(strlen(newddvalue)+1)) == NULL) + return NULL; + strcpy(lp->ddvalue, newddvalue); + } + else if (lp->fixed && fixit) { + if (strcmp(lp->ddvalue, newddvalue) == 0) + printf("PARAM: Warning: Symbol %s fixed more than once\n", lp->ddname); + else + error("PARAM: Error: Symbol %s already fixed", lp->ddname); + } + return lp; +} + + + +/*******************************************************/ +int param_checkpointed(void){ + param_init_par(); + if (checkpointed) return TRUE; + if (restart_is_new || qfilef(param_getc("%restart",""))==0) + return FALSE; + else { + param_init_restart(); + checkpointed = TRUE; + return TRUE; + } +} + + +/*******************************************************/ +void param_checkpoint(void){ + param_init_par(); + if (!param_checkpointed()) param_init_restart(); + fputs(end_restart_header, restart_unit); + fputs(begin_restart_header, restart_unit); + fflush(restart_unit); + checkpointed = TRUE; +} + + +/*******************************************************/ +ddinf_link *push_last_complete_block (char *inname) { + int i, j; + int last_restart_rec, next_to_last_restart_rec; + FILE *unit; + ddinf_link *dl; + char *buffer; + + dl = (ddinf_link *) malloc(sizeof(*dl)); + dl->next = ddinf; + dl->name = (char *) malloc(strlen(inname)+1); + strcpy(dl->name, inname); + buffer = (char *) malloc(MAX_SYMBOL_LENGTH); + if (!(unit = fopen(inname, "r"))) + error("PARAM: Unable to open restart %s", inname); + j = last_restart_rec = next_to_last_restart_rec = 0; + while(fgets(buffer, 100, unit)) { + j++; + if (strcmp(buffer,begin_restart_header)==0){ + next_to_last_restart_rec = last_restart_rec; + last_restart_rec = j; + } + } + fclose(unit); + dl->stream = fopen(inname, "r"); + if (next_to_last_restart_rec != 0) /* reposition manually */ + for (i=0; i<next_to_last_restart_rec; ++i) + fgets(buffer, MAX_SYMBOL_LENGTH, dl->stream); + free(buffer); + return dl; +} + + +/*******************************************************/ +void param_init_restart(void){ + ddinf_link *dl; + + param_init_par(); + if (restart_inited) return; + + if (restart_name==NULL) + { + restart_name = (char *) malloc(strlen(param_getc("%restart",""))+1); + strcpy(restart_name, param_getc("%restart","")); + } + + if (restart_is_new || qfilef(restart_name)==0) { + if (!(restart_unit = fopen(restart_name, "w"))) + error("PARAM: Unable to open restart %s", restart_name); + fputs(begin_restart_header, restart_unit); + fflush(restart_unit); + } + else { + dl = push_last_complete_block(restart_name); + parse_stream(dl->stream, restart_name); + if (!(restart_unit = fopen(restart_name, "a"))) + error("PARAM: Unable to open restart %s", restart_name); + } + restart_inited = TRUE; +} + + +/*******************************************************/ +ddinf_link *push_ddinf_stream (FILE* instream, char *inname) { + ddinf_link *dl; + dl = (ddinf_link *) malloc(sizeof(*dl)); + dl->next = ddinf; + dl->name = (char *) malloc(strlen(inname)+1); + strcpy(dl->name, inname); + dl->stream = instream; + return dl; +} + +/*******************************************************/ +ddinf_link *push_ddinf (char *inname) { + ddinf_link *dl; + dl = (ddinf_link *) malloc(sizeof(*dl)); + dl->next = ddinf; + dl->name = (char *) malloc(strlen(inname)+1); + strcpy(dl->name, inname); + if ((dl->stream = fopen(dl->name, "r")) == NULL) + error("PARAM: Unable to open ddinf %s", dl->name); + return dl; +} + +/*******************************************************/ +void pop_ddinf (void) { + if (ddinf == NULL) return; + free (ddinf->name); + fclose (ddinf->stream); + ddinf = ddinf->next; +} + +/*******************************************************/ +int param_set_file (char *fn) { + return 0; +} + +/*******************************************************/ +void param_unset_file (char *fn) { +} + + +/*******************************************************/ +void param_push_prefix (const char *hot_prefix) { + clink *pp; + pp = (clink *) malloc(sizeof(*pp)); + pp->next = prefix_stack; + pp->name = (char *) malloc(strlen(hot_prefix)+1); + strcpy(pp->name, hot_prefix); + prefix_stack = pp; +} + + +/*******************************************************/ +void param_pop_prefix (void) { + if (prefix_stack == NULL) return; + free ((char *) prefix_stack->name); + prefix_stack = prefix_stack->next; +} + + +/*******************************************************/ +void param_set_restart_file(const char *restart_name_p) +{ + restart_name = (char *) malloc (strlen(restart_name_p)+1); + strcpy(restart_name, restart_name_p); +} + +/*******************************************************/ +void param_puti(const char *var_name, int val){ + param_init_restart(); + fprintf(restart_unit, "%s = %d;\n", var_name, val); + fflush(restart_unit); +} + + +/*******************************************************/ +void param_putf(const char *var_name, double val){ + param_init_restart(); + fprintf(restart_unit, "%s = %18.11e;\n", var_name, val); + fflush(restart_unit); +} + + +/*******************************************************/ +void param_putc(const char *var_name, char *val){ + param_init_restart(); + fprintf(restart_unit, "%s = %s;\n", var_name, quote(val)); + fflush(restart_unit); +} + + +/*******************************************************/ +void param_fwritei(FILE *fp, char *var_name, int val){ + fprintf(fp, "%s = %d;\n", var_name, val); +} + + +/*******************************************************/ +void param_fwritef(FILE *fp, char *var_name, double val){ + fprintf(fp, "%s = %18.11e;\n", var_name, val); +} + +/*******************************************************/ +void param_fwritec(FILE *fp, char *var_name, char *val) { + fprintf(fp, "%s = %s;\n", var_name, quote(val)); +} + + +/*******************************************************/ +void param_set(const char *parameter_name, char *new_value) { + param_init_par(); + insert(parameter_name, new_value); +} + + +/*******************************************************/ +int param_geti(const char *var_name, int dflt){ + ddlink *lp; + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) return dflt; + else return safe_atol(var_name, lp->ddvalue); +} + + +/*******************************************************/ +int param_symvarie(const char *var_name, int *var){ + ddlink *lp; + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) return FALSE; + else *var = safe_atol(var_name, lp->ddvalue); + return TRUE; +} + +/*******************************************************/ +void param_symvari(char *var_name, int *var){ + ddlink *lp; + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) + { + printf("\nddinf var %s not defined.\n",var_name); + assert(0); + } + else *var = safe_atol(var_name, lp->ddvalue); + } + +/*******************************************************/ +double param_getf(const char *var_name, double dflt){ + ddlink *lp; + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) return dflt; + else return safe_atod(var_name, lp->ddvalue); + } + + +/*******************************************************/ +int param_symvarfe(const char *var_name, double *var){ + ddlink *lp; + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) return FALSE; + else *var = safe_atod(var_name, lp->ddvalue); + return TRUE; +} + + +/*******************************************************/ +void param_symvarf(char *var_name, double *var){ + ddlink *lp; + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) + { + printf("\nddinf var %s not defined.\n",var_name); + assert(0); + } + else *var = safe_atod(var_name, lp->ddvalue); + } + + +/*******************************************************/ +char *param_getc(const char *var_name, char *dflt){ + ddlink *lp; + printf("getc\n"); + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) return dflt; + else return lp->ddvalue; + } + +/*******************************************************/ +char *param_gets(const char *var_name){ + ddlink *lp; + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) { + error("PARAM: variable %s not found.", var_name); + return NULL; + } + else return lp->ddvalue; + } + +/*******************************************************/ +int param_symvarce(const char *var_name, char *var){ + ddlink *lp; + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) return FALSE; + else strcpy(var, lp->ddvalue); + return TRUE; +} + + +/*******************************************************/ +void param_symvarc(char *var_name, char *var){ + ddlink *lp; + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) + { + printf("\nddinf var %s not defined.\n",var_name); + assert(0); + } + else strcpy(var, lp->ddvalue); + } + +/*******************************************************/ +int param_getb(const char *var_name, int dflt) { + ddlink *lp; + int i; + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) return dflt; + else for (i=0; i< NumberOfYesStrings; i++) + if (same_string_upcase_first_arg(lp->ddvalue, YesString[i])) + return TRUE; + return FALSE; +} + + +/*******************************************************/ +int same_string_upcase_first_arg(char *s, char *t) { + while ((*s != EOS) && (toupper(*s) == *t)) { + s++; + t++; + } + return *s == *t; +} + + +/*******************************************************/ +void ddinf_error (char *ermsg) { + error("ERROR IN DDINF=%s: %s", ddinf->name, ermsg); +} + + +/*******************************************************/ +double safe_atod (const char *name, const char *expr) { + double f = atof(expr); + /* if (strcmp(suffix,"") != 0) + error("PARAM: Unable to convert value \"%s\" for ddname \"%s\"", expr, name); */ + return f; +} + +/*******************************************************/ +long safe_atol (const char *name, const char *expr) { + long d; + char *suffix; + d = strtol(expr, &suffix, 0); + if (strcmp(suffix,"") != 0) + error("PARAM: Unable to convert value \"%s\" for ddname \"%s\"", + expr, name); + return d; +} + + +/*******************************************************/ +int param_push_file (const char *fn) { + ddpar_link *d, *e; + const char *pname=fn; + + param_init(); + + if (strcmp(DDINF_DEFAULT_NAME, fn)==0) pname = ddinfName; + + for (e=ddpar; e != NULL; e = e->next) + if (strcmp(e->file_name, pname)==0) break; + + /* If not found, initialize */ + if (e == NULL) { + if (!qfilef(fn)) return FALSE; + d = (ddpar_link *) malloc(sizeof(ddpar_link)); + d->file_name = (char *) malloc(strlen(fn)+1); + strcpy(d->file_name, fn); + d->ddtable = (ddlink **) calloc(DDTABLE_SIZE, sizeof(ddlink *)); + d->par_inited = FALSE; + d->next = ddpar; + ddpar = d; + /* stream = fopen(fn, "r"); */ + /* parse_stream(stream, fn); */ + } + /* If already found, use its table */ + else { + d = (ddpar_link *) malloc(sizeof(ddpar_link)); + d->file_name = (char *) malloc(strlen(fn)+1); + strcpy(d->file_name, fn); + d->ddtable = e->ddtable; + d->par_inited = e->par_inited; + d->next = ddpar; + ddpar = d; + } + return TRUE; +} + + +/*******************************************************/ +char * param_pop_file (void) { + ddpar_link *d; + + d = ddpar; + if ((d != NULL) && (d->next == NULL)) return NULL; /* Don't allow the stack to be */ + else if (ddpar != NULL) ddpar = ddpar->next; /* completely cleared */ + + free (d->ddtable); + return d->file_name; +} diff --git a/dtm_release/dtm-parallel/param.h b/dtm_release/dtm-parallel/param.h new file mode 100644 index 0000000000000000000000000000000000000000..1337a2ef644887517b2efff4715bcf929440f7c1 --- /dev/null +++ b/dtm_release/dtm-parallel/param.h @@ -0,0 +1,78 @@ +#include <stdio.h> +#include "util.h" + +int param_geti(const char *parameter_name, int default_value); + +double param_getf(const char *parameter_name, double default_value); + +char *param_getc(const char *parameter_name, char *default_value); + +char *param_gets(const char *parameter_name); + +int param_getb(const char *parameter_name, int default_value); + /* Returns true if the value of <parameter_name> is 1, true, or yes, + (case insensitive), false for any other value, and default_value + for no value. */ + +int param_symvarie(const char *parameter_name, int *returned_value); + /* Returns true if a value was found, false otherwise */ + +int param_symvarfe(const char *parameter_name, double *returned_value); + /* Ditto */ + +int param_symvarce(const char *parameter_name, char *returned_value); + /* Ditto. Note that the second argument is a "pointer to a char *", + i.e., approximately a pointer to a string. */ + +void param_set(const char *parameter_name, char *new_value); + /* Changes the value of ddinf parameter <parameter_name>. This can be + used to communicate with subroutines which expect ddinf + parameters without having to make sure they exist in the ddinf file. + Note, however, that values assigned in the ddinf file are + OVERRIDDEN by a call to param_set. */ + /* One might want to implement a param_add which would allow adding + new ddinf parameters within a program, but which could not + override values from the ddinf file. */ + +/* if the following isn't called, param.c looks for a %restart +binding in the param file */ +void param_set_restart_file(const char *restart_name_p); + +/* The following three calls write values to the restart file: */ +void param_puti(const char *parameter_name, int value); + +void param_putf(const char *parameter_name, double value); + +void param_putc(const char *parameter_name, char *value); + + +int param_checkpointed(void); + /* If there is a restart file, reads it in and returns TRUE. Otherwise + returns false. */ + +void param_checkpoint(void); + /* Commits all of the param_put calls so far, are starts a new + checkpoint. (I.e., subsequent `param_put's supersede earlier ones.) */ + + +void param_dump (FILE *stream); + /* Writes the current ddinf bindings to a stream */ + +void param_push_prefix (const char *hot_prefix); + /* Push the current prefix to be applied to all ddnames */ + +void param_pop_prefix (void); + /* Pop the current prefix */ + +int param_push_file (const char *fn); + /* Use the file for all bindings */ + +char *param_pop_file (void); + /* Pop current bindings */ + + + + + + + diff --git a/dtm_release/dtm-parallel/params.c b/dtm_release/dtm-parallel/params.c new file mode 100644 index 0000000000000000000000000000000000000000..8e57ff02f845dcc75cf65c92b48107dbb10cae86 --- /dev/null +++ b/dtm_release/dtm-parallel/params.c @@ -0,0 +1,142 @@ +#include "params.h" + +/* + * check label + * + */ + +void check_label(FILE* f, char* name) +{ + char label[400]; + fscanf(f, "%s", label); + assert(strcmp(label, name) == 0); +} + + +/* + * read and write strings + * + */ + +void params_read_string(FILE* f, char* name, char* x) +{ + check_label(f, name); + fscanf(f, "%s", x); + outlog("%-10s READ NAME=%-10s STRING=%s", "[PARAMS]", name, x); +} + +/* + * read and write integers + * + */ + +void params_read_int(FILE* f, char* name, int* x) +{ + check_label(f, name); + assert(fscanf(f, "%d", x) > 0); + outlog("%-10s READ NAME=%-10s INT=%d", "[PARAMS]", name, *x); +} + +void params_write_int(FILE* f, char* name, int x) +{ + fprintf(f, "%s %d\n", name, x); +} + + +/* + * read and write doubles + * + */ + +void params_read_double(FILE* f, char* name, double* x) +{ + check_label(f, name); + assert(fscanf(f, "%lf", x) > 0); + outlog("%-10s READ NAME=%-10s DBL=%1.14e", "[PARAMS]", name, *x); +} + +void params_write_double(FILE* f, char* name, double x) +{ + fprintf(f, "%s %17.14f\n", name, x); +} + + +/* + * read and write gsl vectors and matrices. + * + */ + +void params_read_gsl_vector(FILE* f, char* name, gsl_vector** x) +{ + int size, i; + double val; + + check_label(f, name); + assert(fscanf(f, "%d", &size) > 0); + *x = gsl_vector_calloc(size); + for (i = 0; i < size; i++) + { + assert(fscanf(f, "%lf", &val) > 0); + gsl_vector_set(*x, i, val); + } +} + + +void params_write_gsl_vector(FILE* f, char* name, gsl_vector* x) +{ + fprintf(f, "%s %d", name, (int) x->size); + int i; + for (i = 0; i < x->size; i++) + fprintf(f, " %17.14f", gsl_vector_get(x, i)); + fprintf(f, "\n"); +} + + +//void params_write_doc_ + +void params_write_gsl_vector_multiline(FILE* f, char* name, gsl_vector* x) +{ + fprintf(f, "%s %d\n", name, (int) x->size); + int i; + if (x->size) { + fprintf(f, "%17.14f", gsl_vector_get(x, 0)); + } + for (i = 1; i < x->size; i++) + fprintf(f, ",%17.14f", gsl_vector_get(x, i)); + fprintf(f, "\n"); +} + + +void params_write_gsl_matrix(FILE* f, char* name, gsl_matrix* x) +{ + fprintf(f, "%s %ld %ld\n", name, x->size1, x->size2); + int i, j; + if (x->size1 == 0) { + return; + } + for (i = 0; i < x->size1; i++) { + fprintf(f, "%17.14f", gsl_matrix_get(x, i, 0)); + for (j = 1; j < x->size2; j++) { + fprintf(f, ",%17.14f", gsl_matrix_get(x, i, j)); + } + fprintf(f, "\n"); + } +} + +void params_write_sparse_gsl_matrix(FILE* f, char* name, gsl_matrix* x) +{ + fprintf(f, "%s %ld %ld\n", name, x->size1, x->size2); + int i, j; + if (x->size1 == 0) { + return; + } + for (i = 0; i < x->size1; i++) { + for (j = 0; j < x->size2; j++) { + // outlog("%d %d %d %d", i, j, x->size1, x->size2); + double value = gsl_matrix_get(x, i, j); + if (fabs(value) > 1e-12) { + fprintf(f, "%d,%d,%17.14f\n", i, j, value); + } + } + } +} diff --git a/dtm_release/dtm-parallel/params.h b/dtm_release/dtm-parallel/params.h new file mode 100644 index 0000000000000000000000000000000000000000..03c0fe164e318fa0f1de9ad41841b3c63ca2067f --- /dev/null +++ b/dtm_release/dtm-parallel/params.h @@ -0,0 +1,32 @@ +#ifndef PARAMSH +#define PARAMSH + +#define MAX_LINE_LENGTH 100000; + +#include "gsl-wrappers.h" +#include <stdlib.h> +#include <stdio.h> +#include <gsl/gsl_vector.h> +#include <string.h> + +void params_read_string(FILE* f, char* name, char* x); + +void params_read_int(FILE* f, char* name, int* x); + +void params_write_int(FILE *, char *, int); + +void params_read_double(FILE* f, char* name, double* x); + +void params_write_double(FILE *, char *, double); + +void params_read_gsl_vector(FILE* f, char* name, gsl_vector** x); + +void params_write_gsl_vector(FILE *, char* , gsl_vector *); + +void params_write_gsl_vector_multiline(FILE *, char* , gsl_vector *); + +void params_write_gsl_matrix(FILE *, char* , gsl_matrix *); + +void params_write_sparse_gsl_matrix(FILE *, char* , gsl_matrix *); + +#endif diff --git a/dtm_release/dtm-parallel/ss-lm-fit_seq_topics.h b/dtm_release/dtm-parallel/ss-lm-fit_seq_topics.h new file mode 100644 index 0000000000000000000000000000000000000000..e01370b60c8d7b7c40964dc59ad2dfb28c708837 --- /dev/null +++ b/dtm_release/dtm-parallel/ss-lm-fit_seq_topics.h @@ -0,0 +1,102 @@ +/* + * state space language model variational inference + * + */ + +#ifndef SSLM_H +#define SSLM_H + +#include "gsl-wrappers.h" +#include "params.h" +#include <gsl/gsl_vector.h> +#include <gsl/gsl_matrix.h> +#include <assert.h> +#include <math.h> + +#include "data.h" + +#define SSLM_MAX_ITER 2 // maximum number of optimization iters +#define SSLM_FIT_THRESHOLD 1e-6 // convergence criterion for fitting sslm +#define INIT_MULT 1000 // multiplier to variance for first obs +// #define OBS_NORM_CUTOFF 10 // norm cutoff after which we use all 0 obs +//#define OBS_NORM_CUTOFF 8 // norm cutoff after which we use all 0 obs +#define OBS_NORM_CUTOFF 2 // norm cutoff after which we use all 0 obs + +namespace dtm { + +/* + * functions for variational inference + * + */ + +// allocate new state space language model variational posterior +sslm_var* sslm_var_alloc(int W, int T); + +// allocate extra parameters for inference +void sslm_inference_alloc(sslm_var* var); + +// free extra parameters for inference +void sslm_inference_free(sslm_var* var); + +// initialize with zero observations +void sslm_zero_init(sslm_var* var, + double obs_variance, + double chain_variance); + +// initialize with counts +void sslm_counts_init(sslm_var* var, + double obs_variance, + double chain_variance, + const gsl_vector* counts); + +// initialize from variational observations +void sslm_obs_file_init(sslm_var* var, + double obs_variance, + double chain_variance, + const char* filename); + + +// compute E[\beta_{w,t}] for t = 1:T +void compute_post_mean(int w, sslm_var* var, double chain_variance); + +// compute Var[\beta_{w,t}] for t = 1:T +void compute_post_variance(int w, sslm_var* var, double chain_variance); + +// optimize \hat{beta} +void optimize_var_obs(sslm_var* var); + +// compute dE[\beta_{w,t}]/d\obs_{w,s} for t = 1:T +void compute_mean_deriv(int word, int time, sslm_var* var, + gsl_vector* deriv); + +// compute d bound/d obs_{w, t} for t=1:T. +void compute_obs_deriv(int word, gsl_vector* word_counts, + gsl_vector* total_counts, sslm_var* var, + gsl_matrix* mean_deriv_mtx, gsl_vector* deriv); + +// update observations +void update_obs(gsl_matrix* word_counts, gsl_vector* totals, + sslm_var* var); + +// log probability bound +double compute_bound(gsl_matrix* word_counts, gsl_vector* totals, + sslm_var* var); + + +// fit variational distribution +double fit_sslm(sslm_var* var, gsl_matrix* word_counts); + +// read and write variational distribution +void write_sslm_var(sslm_var* var, const char* out); +sslm_var* read_sslm_var(char* in); + +void compute_expected_log_prob(sslm_var* var); +// !!! old function (from doc mixture...) +double expected_log_prob(int w, int t, sslm_var* var); + +// update zeta +void update_zeta(sslm_var* var); + +} // namespace dtm + +#endif diff --git a/dtm_release/dtm-parallel/ss-lm.c b/dtm_release/dtm-parallel/ss-lm.c new file mode 100644 index 0000000000000000000000000000000000000000..6c77dff61152d170e5f699eab931ff2c19258eb8 --- /dev/null +++ b/dtm_release/dtm-parallel/ss-lm.c @@ -0,0 +1,1145 @@ +#include "ss-lm.h" +#include "strutil.h" + +#include "gflags.h" + +DECLARE_string(model); +DECLARE_int32(max_number_time_points); + +namespace dtm { + +const double kMinLogFrequency = -14.0; + +// local functions + +static double* scaled_influence = NULL; + +void fdf_obs(const gsl_vector *x, + void *params, + double *f, + gsl_vector *df); +void df_obs(const gsl_vector *x, + void *params, + gsl_vector *df); +double f_obs(const gsl_vector *x, void *params); +double f_obs_fixed(const gsl_vector *x, void *params); + +/* + * allocate a new state space language model variational posterior + * + */ + +sslm_var* sslm_var_alloc(int W, int T) { + if (scaled_influence == NULL) { + scaled_influence = NewScaledInfluence(FLAGS_max_number_time_points); + } + + + sslm_var* var = (sslm_var*) malloc(sizeof(sslm_var)); + var->W = W; + var->T = T; + + // TODO(sgerrish): Free these parameters. + var->obs = gsl_matrix_calloc(W, T); + var->e_log_prob = gsl_matrix_calloc(W, T); + var->mean = gsl_matrix_calloc(W, T+1); + var->variance = gsl_matrix_calloc(W, T+1); + + var->w_phi_l = gsl_matrix_calloc(W, T); + var->m_update_coeff = gsl_matrix_calloc(W, T); + var->m_update_coeff_g = gsl_matrix_calloc(W, T); + // var->zeta = gsl_vector_calloc(W); + + return(var); +} + +void sslm_inference_alloc(sslm_var* var) { + int W = var->W; + int T = var->T; + var->fwd_mean = gsl_matrix_calloc(W, T+1); + var->fwd_variance = gsl_matrix_calloc(W, T+1); + var->zeta = gsl_vector_calloc(T); + var->T_vct = gsl_vector_calloc(T); + // var->mean = gsl_matrix_calloc(W, T+1); + //var->variance = gsl_matrix_calloc(W, T+1); +} + + +void sslm_inference_free(sslm_var* var) { + gsl_matrix_free(var->fwd_mean); + gsl_matrix_free(var->fwd_variance); + // gsl_matrix_free(var->mean); + // gsl_matrix_free(var->variance); + gsl_vector_free(var->zeta); + gsl_vector_free(var->T_vct); +} + + +/* + * initialize with zero observations + * + */ + +void sslm_zero_init(sslm_var* var, + double obs_variance, + double chain_variance) +{ + int w, W = var->W; + + gsl_matrix_set_zero(var->obs); + var->obs_variance = obs_variance; + var->chain_variance = chain_variance; + + for (w = 0; w < W; w++) { + compute_post_variance(w, var, var->chain_variance); + } + + for (w = 0; w < W; w++) { + // Run the forward-backward algorithm + compute_post_mean(w, var, var->chain_variance); + } + + update_zeta(var); +} + + +/* + * initialize with counts + * + */ + +void sslm_counts_init(sslm_var* var, + double obs_variance, + double chain_variance, + const gsl_vector* counts) { + int w, t, W = var->W, T = var->T; + gsl_vector* log_norm_counts = gsl_vector_alloc(counts->size); + sslm_inference_alloc(var); + + // normalize and take logs of the counts + + gsl_vector_memcpy(log_norm_counts, counts); + gsl_vector_add_constant(log_norm_counts, 1.0/W); + normalize(log_norm_counts); + vct_log(log_norm_counts); + + // set variational observations to transformed counts + + for (t = 0; t < T; t++) { + msetcol(var->obs, t, log_norm_counts); + } + + // set variational parameters + + var->obs_variance = obs_variance; + var->chain_variance = chain_variance; + + for (w = 0; w < W; w++) { + compute_post_variance(w, var, var->chain_variance); + } + + for (w = 0; w < W; w++) { + // Run the forward-backward algorithm + compute_post_mean(w, var, var->chain_variance); + } + + update_zeta(var); + compute_expected_log_prob(var); + gsl_vector_free(log_norm_counts); + sslm_inference_free(var); +} + + +/* + * initialize from file of variational observations + * + */ + +void sslm_obs_file_init(sslm_var* var, + double obs_variance, + double chain_variance, + const char* filename) { + int w, W = var->W; + mtx_fscanf(filename, var->obs); + // set variational parameters + var->obs_variance = obs_variance; + var->chain_variance = chain_variance; + for (w = 0; w < W; w++) { + compute_post_variance(w, var, var->chain_variance); + } + for (w = 0; w < W; w++) { + // Run the forward-backward algorithm + compute_post_mean(w, var, var->chain_variance); + } + update_zeta(var); +} + + +// Compute the expected log probability given values of m. +void compute_expected_log_prob(sslm_var* var) { + int t, w, W = var->W; + for (t = 0; t < var->T; t++) { + for (w = 0; w < W; w++) { + mset(var->e_log_prob, w, t, + mget(var->mean,w,t+1) + - log(vget(var->zeta, t))); + if (mget(var->e_log_prob, w, t) < kMinLogFrequency) { + mset(var->e_log_prob, w, t, kMinLogFrequency); + } + } + } +} + +double expected_log_prob(int w, int t, sslm_var* var) { + return(mget(var->mean,w,t+1) + - log(vget(var->zeta, t))); +} + +/* + * forward-backward to compute E[\beta_{t,w}] for t = 1:T + * + */ + +void compute_post_mean(int word, + sslm_var* var, + double chain_variance) { + int t; + double w; + + // get the vectors for word w + gsl_vector obs = gsl_matrix_row(var->obs, word).vector; + gsl_vector mean = gsl_matrix_row(var->mean, word).vector; + gsl_vector fwd_mean = gsl_matrix_row(var->fwd_mean, word).vector; + gsl_vector fwd_variance = gsl_matrix_row(var->fwd_variance, word).vector; + int T = var->T; + + // forward + // (note, the observation corresponding to mean t is at t-1) + vset(&fwd_mean, 0, 0); + for (t = 1; t < T+1; t++) + { + // Eq. 1.14 + assert(fabs(vget(&fwd_variance, t-1) + + chain_variance + var->obs_variance) > 0.0); + w = var->obs_variance / + (vget(&fwd_variance, t-1) + + chain_variance + var->obs_variance); + vset(&fwd_mean, t, + w * vget(&fwd_mean, t-1) + (1 - w) * vget(&obs, t-1)); + if (isnan(vget(&fwd_mean, t))) { + outlog("t %d word %d w %f %f %f", t, word, w, vget(&fwd_mean, t - 1), vget(&obs, t-1)); + outlog("%f %f %f", var->obs_variance, vget(&fwd_variance, t-1), + var->obs_variance); + } + + } + + // backward + vset(&mean, T, vget(&fwd_mean, T)); + for (t = T-1; t >= 0; t--) + { + // Eq. 1.18 + if (chain_variance == 0.0) { + w = 0.0; + } else { + w = chain_variance / + (vget(&fwd_variance, t) + chain_variance); + } + vset(&mean, t, w * vget(&fwd_mean, t) + (1 - w) * vget(&mean, t+1)); + if (isnan(vget(&mean, t))) { + outlog("t %d w %f %f %f", t, w, vget(&fwd_mean, t), vget(&mean, t+1)); + } + assert(!isnan(vget(&mean, t))); + } +} + + +/* + * update zeta variational parameter + * + */ + +void update_zeta(sslm_var* var) +{ + int word; + int t; + + gsl_vector_set_zero(var->zeta); + // gsl_matrix_set_zero(var->zeta_terms); + for (word = 0; word < var->obs->size1; word++) + { + for (t = 0; t < var->obs->size2; t++) + { + double m = mget(var->mean, word, t+1); + double v = mget(var->variance, word, t+1); + double val = exp(m + v/2.0); + // mset(var->zeta_terms, word, t, val); + vinc(var->zeta, t, val); + } + } +} + + +/* + * compute Var[\beta_{t,w}] for t = 1:T + * + */ + +void compute_post_variance(int word, + sslm_var* var, + double chain_variance) { + int t, T = var->T; + double w; + + // get the variance vector for word + gsl_vector variance = gsl_matrix_row(var->variance, word).vector; + gsl_vector fwd_variance = gsl_matrix_row(var->fwd_variance, word).vector; + + // forward + // note, initial variance set very large + vset(&fwd_variance, 0, chain_variance * INIT_MULT); + for (t = 1; t < T+1; t++) + { + // Eq. 1.16 + if (var->obs_variance) { + w = var->obs_variance / + (vget(&fwd_variance, t-1) + + chain_variance + var->obs_variance); + } else { + w = 0.0; + } + vset(&fwd_variance, t, w * (vget(&fwd_variance, t-1) + + chain_variance)); + } + + // backward + vset(&variance, T, vget(&fwd_variance, T)); + for (t = T-1; t >= 0; t--) + { + // Eq. 1.21 + if (vget(&fwd_variance, t) > 0.0) { + w = pow(vget(&fwd_variance, t) / + (vget(&fwd_variance, t) + chain_variance), 2); + } else { + w = 0.0; + } + vset(&variance, t, + w * (vget(&variance, t+1) - chain_variance) + + (1 - w) * vget(&fwd_variance, t)); + } +} + + +/* + * compute d E[\beta_{t,w}]/d obs_{s,w} for t = 1:T. + * put the result in deriv, allocated T+1 vector + * + */ + +void compute_mean_deriv(int word, + int time, + sslm_var* var, + gsl_vector* deriv) +{ + int t, T = var->T; + double w, val; + + // get the vectors for word + gsl_vector fwd_variance = gsl_matrix_row(var->variance, word).vector; + assert(deriv->size == T+1); + + // forward + // (note, we don't need to store the forward pass in this case.) + vset(deriv, 0, 0); + for (t = 1; t <= T; t++) { + // Eq. 1.37 + if (var->obs_variance > 0.0) { + w = var->obs_variance / + (vget(&fwd_variance, t-1) + + var->chain_variance + var->obs_variance); + } else { + w = 0.0; + } + val = w * vget(deriv, t-1); + // note that observations are indexed 1 from the means/variances + if (time == t-1) { + val += (1 - w); + } + vset(deriv, t, val); + } + + // backward + for (t = T-1; t >= 0; t--) + { + // Eq. 1.39 + if (var->chain_variance == 0.0) { + w = 0.0; + } else { + w = var->chain_variance / + (vget(&fwd_variance, t) + var->chain_variance); + } + vset(deriv, t, w * vget(deriv, t) + (1 - w) * vget(deriv, t+1)); + } +} + + +/* + * compute d bound/d obs_{w, t} for t=1:T. + * put the result in deriv, allocated T vector + * + */ + +void compute_obs_deriv(int word, + gsl_vector* word_counts, + gsl_vector* totals, + sslm_var* var, + gsl_matrix* mean_deriv_mtx, + gsl_vector* deriv) { + // Note: We found a seg fault in this function at + // the string compare FLAGS_model == "dim". + // We suspect there is memory corruption occurring + // at some point. + int t, u, T = var->T; + + gsl_vector mean = gsl_matrix_row(var->mean, word).vector; + gsl_vector variance = gsl_matrix_row(var->variance, word).vector; + + // here the T vector in var is the zeta terms + for (u = 0; u < T; u++) { + vset(var->T_vct, u, + exp(vget(&mean, u+1) + vget(&variance, u+1)/2)); + } + + gsl_vector w_phi_l = gsl_matrix_row(var->w_phi_l, word).vector; + gsl_vector m_update_coeff = gsl_matrix_row(var->m_update_coeff, word).vector; + + for (t = 0; t < T; t++) { + gsl_vector mean_deriv = gsl_matrix_row(mean_deriv_mtx, t).vector; + double term1 = 0.0; + double term2 = 0.0; + double term3 = 0.0; + double term4 = 0.0; + for (u = 1; u <= T; u++) { + double mean_u = vget(&mean, u); + double var_u_prev = vget(&variance, u - 1); + double mean_u_prev = vget(&mean, u - 1); + double dmean_u = vget(&mean_deriv, u); + double dmean_u_prev = vget(&mean_deriv, u - 1); + + double dmean_u_window_prev = 0.0; + double var_u_window_prev = 0.0; + double mean_u_window_prev = 0.0; + + term1 += (mean_u - mean_u_prev) * (dmean_u - dmean_u_prev); + + // note, observations indexed -1 from mean and variance + term2 += + (vget(word_counts, u-1) - + (vget(totals, u-1) * + vget(var->T_vct, u-1) / + vget(var->zeta, u-1))) * dmean_u; + + if ((FLAGS_model == "dim" + || FLAGS_model == "fixed") + && u >= 1 + && var->chain_variance > 0.0) { + double dmean_u_window_prev = vget(&mean_deriv, u - 1); + double var_u_window_prev = vget(&variance, u - 1); + double mean_u_window_prev = vget(&mean, u - 1); + + term3 += (exp(- (mean_u_window_prev - 0.0 * vget(var->zeta, u-1)) + var_u_window_prev / 2.0) + * ((- mean_u + mean_u_window_prev - var_u_window_prev - 1) + * (dmean_u_window_prev) + + (dmean_u)) + * vget(&w_phi_l, u - 1) + / var->chain_variance); + term4 += (exp( -2.0 * (mean_u_window_prev - 0.0 * vget(var->zeta, u-1)) + 2.0 * var_u_window_prev) + * (vget(&m_update_coeff, u - 1)) + / var->chain_variance + * dmean_u_window_prev); + } + } + if (var->chain_variance) { + term1 = -term1/var->chain_variance; + term1 = term1 - + vget(&mean, 0) * vget(&mean_deriv, 0) / + (INIT_MULT * var->chain_variance); + } else { + term1 = 0.0; + } + + // Enforce a hinge penalty for straying too low. + double m = term1 + term2 + term3 + term4; + vset(deriv, t, m); + } +} + +void compute_obs_deriv_fixed(int word, + gsl_vector* word_counts, + gsl_vector* totals, + sslm_var* var, + gsl_matrix* mean_deriv_mtx, + gsl_vector* deriv) +{ + // Note: We found a seg fault in this function at + // the string compare FLAGS_model == "dim". + // We suspect there is memory corruption occurring + // at some point. + int t, u, T = var->T; + + gsl_vector mean = gsl_matrix_row(var->mean, word).vector; + gsl_vector variance = gsl_matrix_row(var->variance, word).vector; + + // here the T vector in var is the zeta terms + for (u = 0; u < T; u++) { + vset(var->T_vct, u, + exp(vget(&mean, u+1) + vget(&variance, u+1)/2)); + } + + gsl_vector m_update_coeff_g = gsl_matrix_row( + var->m_update_coeff_g, word).vector; + gsl_vector m_update_coeff_h = gsl_matrix_row( + var->m_update_coeff, word).vector; + + for (t = 0; t < T; t++) { + gsl_vector mean_deriv = gsl_matrix_row(mean_deriv_mtx, t).vector; + double term1 = 0.0; + double term2 = 0.0; + double term3 = 0.0; + double term4 = 0.0; + double min_penalty = 0.0; + for (u = 1; u <= T; u++) { + double mean_u = vget(&mean, u); + double var_u_prev = vget(&variance, u - 1); + double mean_u_prev = vget(&mean, u - 1); + double dmean_u = vget(&mean_deriv, u); + double dmean_u_prev = vget(&mean_deriv, u - 1); + + double dmean_u_window_prev = 0.0; + double var_u_window_prev = 0.0; + double mean_u_window_prev = 0.0; + + if (mean_u < kMinLogFrequency) { + min_penalty += (kMinLogFrequency - mean_u) * 1000.0; + } + + term1 -= ((mean_u - mean_u_prev) + * (dmean_u - dmean_u_prev) + / var->chain_variance); + + // note, observations indexed -1 from mean and variance + term2 += + (vget(word_counts, u-1) - + (vget(totals, u-1) * + vget(var->T_vct, u-1) / + vget(var->zeta, u-1))) * dmean_u; + + if ((FLAGS_model == "fixed") + && u >= 1 + && var->chain_variance > 0.0) { + double dmean_u_window_prev = vget(&mean_deriv, u - 1); + double var_u_window_prev = vget(&variance, u - 1); + double mean_u_window_prev = vget(&mean, u - 1); + + term3 += - (exp(- (mean_u_window_prev - 0.0 * vget(var->zeta, u-1)) + var_u_window_prev / 2.0) + * ((mean_u - mean_u_window_prev + var_u_window_prev - 1) + * (dmean_u_window_prev) + + (dmean_u)) + * vget(&m_update_coeff_g, u - 1) + / var->chain_variance); + term4 += (exp( -2.0 * (mean_u_window_prev - 0.0 * vget(var->zeta, u-1)) + 2.0 * var_u_window_prev) + * (vget(&m_update_coeff_h, u - 1)) + / var->chain_variance + * dmean_u_window_prev); + } + } + if (var->chain_variance) { + term1 = term1 - + vget(&mean, 0) * vget(&mean_deriv, 0) / + (INIT_MULT * var->chain_variance); + } else { + term1 = 0.0; + } + + // min_penalty = 0.0; + double m = term1 + term2 + term3 + term4 + min_penalty; + vset(deriv, t, m); + } +} + + +/* + * log probability bound + * + */ + +double compute_bound(gsl_matrix* word_counts, + gsl_vector* totals, + sslm_var* var) { + int t, T = var->T, w, W = var->W; + double term1 = 0, term2 = 0, term3 = 0; + double val = 0, m, v, prev_m, prev_v; + double w_phi_l, exp_i; + double ent = 0; + + const double chain_variance = var->chain_variance; + + for (w = 0; w < W; w++) { + // Run the forward-backward algorithm + compute_post_mean(w, var, chain_variance); + } + update_zeta(var); + + for (w = 0; w < W; w++) + { + val += + (mget(var->variance, w, 0) - + mget(var->variance, w, T))/ + 2 * chain_variance; + } + + outlog("Computing bound, all times.%s", ""); + for (t = 1; t <= T; t++) + { + term1 = term2 = ent = 0.0; + for (w = 0; w < W; w++) + { + m = mget(var->mean, w, t); + prev_m = mget(var->mean, w, t - 1); + v = mget(var->variance, w, t); + + // Values specifically related to document influence: + // Note that our indices are off by 1 here. + w_phi_l = mget(var->w_phi_l, w, t - 1); + exp_i = exp(-prev_m); + + term1 += + pow(m - prev_m - w_phi_l * exp_i, 2) / (2 * chain_variance) - + v/chain_variance - + log(chain_variance); + + term2 += mget(word_counts, w, t-1) * m; + ent += log(v) / 2; // note the 2pi's cancel with term1 (see doc) + } + term3 = -vget(totals, t-1) * log(vget(var->zeta,t-1)); + + // printf("time %d contribute: %20f\n", t, + // -term1/(2.0*var->chain_variance) + term2 + term3 + ent); + /* outlog("contributions: %f %f %f %f %f", + term1, + term2, + term3, + term4, + term5); + */ + val += - term1 + term2 + term3 + ent; + } + return(val); +} + +double compute_bound_fixed(gsl_matrix* word_counts, + gsl_vector* totals, + sslm_var* var) { + int t, T = var->T, w, W = var->W; + double term1 = 0, term2 = 0, term3 = 0, term4 = 0, term5 = 0; + double val = 0, m, v, prev_m, prev_v; + double m_update_coeff_g, m_update_coeff_h, exp_i, exp_2i; + double ent = 0; + + const double chain_variance = var->chain_variance; + + for (w = 0; w < W; w++) { + // Run the forward-backward algorithm + compute_post_mean(w, var, chain_variance); + } + update_zeta(var); + + for (w = 0; w < W; w++) + { + val += + (mget(var->variance, w, 0) - + mget(var->variance, w, T))/ + 2 * chain_variance; + } + + outlog("Computing bound, all times.%s", ""); + for (t = 1; t <= T; t++) + { + term1 = term2 = term4 = term5 = ent = 0.0; + for (w = 0; w < W; w++) + { + m = mget(var->mean, w, t); + prev_m = mget(var->mean, w, t - 1); + if (m < kMinLogFrequency) { + m = kMinLogFrequency; + } + if (prev_m < kMinLogFrequency) { + prev_m = kMinLogFrequency; + } + v = mget(var->variance, w, t); + + // Values specifically related to document influence: + // Note that our indices are off by 1 here. + m_update_coeff_g = mget(var->m_update_coeff_g, w, t - 1); + m_update_coeff_h = mget(var->m_update_coeff, w, t - 1); + exp_i = exp(-prev_m + v / 2.0); + exp_2i = exp(2.0 * (-prev_m + v)); + + term1 += + - pow(m - prev_m, 2) / (2.0 * chain_variance) + - v / chain_variance + - log(chain_variance); + + term2 += mget(word_counts, w, t-1) * m; + + term4 += + ((m - prev_m + v) * m_update_coeff_g * exp_i + / (chain_variance)); + + term5 += -exp_2i * m_update_coeff_h / (2.0 * chain_variance); + + ent += log(v) / 2; // note the 2pi's cancel with term1 (see doc) + } + + term3 = -vget(totals, t-1) * log(vget(var->zeta,t-1)); + + val += term1 + term2 + term3 + term4 + ent; + } + return(val); +} + +/* + * update obs + * + */ + +// parameters object +struct opt_params +{ + sslm_var* var; + gsl_vector* word_counts; + gsl_vector* totals; + gsl_matrix* mean_deriv_mtx; + int word; +}; + +// objective function +double f_obs(const gsl_vector *x, void *params) +{ + int t, T = x->size; + double val = 0, term1 = 0, term2 = 0, term3 = 0, term4 = 0; + struct opt_params * p = (struct opt_params *) params; + gsl_vector mean, variance, w_phi_l, m_update_coeff; + + msetrow(p->var->obs, p->word, x); + + // Run the forward-backward algorithm + compute_post_mean(p->word, p->var, p->var->chain_variance); + mean = gsl_matrix_row(p->var->mean, p->word).vector; + variance = gsl_matrix_row(p->var->variance, p->word).vector; + w_phi_l = gsl_matrix_row(p->var->w_phi_l, p->word).vector; + m_update_coeff = gsl_matrix_row(p->var->m_update_coeff, p->word).vector; + + // Only compute the objective if the chain variance + for (t = 1; t <= T; t++) { + double mean_t = vget(&mean, t); + double mean_t_prev = vget(&mean, t-1); + double var_t_prev = vget(&variance, t - 1); + val = mean_t - mean_t_prev; + term1 += - (val * val) / (2.0 * p->var->chain_variance); + + // note, badly indexed counts + term2 += (vget(p->word_counts, t-1) * mean_t - + vget(p->totals, t-1) * + (exp(mean_t + vget(&variance, t)/2) + / vget(p->var->zeta, t-1))); + // log(vget(p->var->zeta, t-1))); + + if (FLAGS_model != "fixed") { + assert(0); + } + + if ((FLAGS_model == "dim" + || FLAGS_model == "fixed") + && t >= 1 + && p->var->chain_variance > 0.0) { + double mean_t_window_prev = vget(&mean, t - 1); + double var_t_window_prev = vget(&variance, t - 1); + term3 += (exp(- (mean_t_window_prev - 0.0 * vget(p->var->zeta, t-1)) + var_t_window_prev / 2.0) + * (mean_t - mean_t_window_prev + var_t_window_prev) + * vget(&w_phi_l, t - 1) + / p->var->chain_variance); + + term4 -= (exp( -2.0 * (mean_t_window_prev + - 0.0 * vget(p->var->zeta, t-1)) + + 2.0 * var_t_window_prev) + * (vget(&m_update_coeff, t - 1)) + / (2.0 * p->var->chain_variance)); + } + } + // note that we multiply the initial variance by INIT_MULT + if (p->var->chain_variance > 0.0) { + term1 = (term1 - + vget(&mean, 0) * vget(&mean, 0) / + (2 * INIT_MULT * p->var->chain_variance)); + } else { + term1 = 0.0; + } + + return(-(term1 + term2 + term3 + term4)); +} + +// Objective function for fixed model. +double f_obs_fixed(const gsl_vector *x, void *params) +{ + int t, T = x->size; + double val = 0, term1 = 0, term2 = 0, term3 = 0, term4 = 0, min_penalty = 0; + struct opt_params * p = (struct opt_params *) params; + gsl_vector mean, variance, w_phi_l, m_update_coeff_h, m_update_coeff_g; + + msetrow(p->var->obs, p->word, x); + + // Run the forward-backward algorithm + compute_post_mean(p->word, p->var, p->var->chain_variance); + mean = gsl_matrix_row(p->var->mean, p->word).vector; + variance = gsl_matrix_row(p->var->variance, p->word).vector; + m_update_coeff_h = gsl_matrix_row( + p->var->m_update_coeff, p->word).vector; + m_update_coeff_g = gsl_matrix_row( + p->var->m_update_coeff_g, p->word).vector; + + // Only compute the objective if the chain variance + for (t = 1; t <= T; t++) { + double mean_t = vget(&mean, t); + double mean_t_prev = vget(&mean, t-1); + double var_t_prev = vget(&variance, t - 1); + + if (mean_t < kMinLogFrequency) { + double x = (kMinLogFrequency - mean_t); + min_penalty += -(x * x) * 1000.0 / 2.0; + } + + val = mean_t - mean_t_prev; + term1 += -(val * val / (2.0 * p->var->chain_variance)); + + // note, badly indexed counts + term2 += (vget(p->word_counts, t-1) * mean_t - + vget(p->totals, t-1) * + (exp(mean_t + vget(&variance, t) / 2.0) + / vget(p->var->zeta, t-1))); + // log(vget(p->var->zeta, t-1))); + if (FLAGS_model != "fixed") { + assert(0); + } + + if (t >= 1 + && p->var->chain_variance > 0.0) { + double mean_t_window_prev = vget(&mean, t - 1); + double var_t_window_prev = vget(&variance, t - 1); + term3 += (exp(-mean_t_window_prev + var_t_window_prev / 2.0) + * (mean_t - mean_t_window_prev + var_t_window_prev) + * vget(&m_update_coeff_g, t - 1) + / p->var->chain_variance); + + term4 -= (exp( -2.0 * mean_t_window_prev + + 2.0 * var_t_window_prev) + * (vget(&m_update_coeff_h, t - 1)) + / (2.0 * p->var->chain_variance)); + } + } + // note that we multiply the initial variance by INIT_MULT + term1 = (term1 - + vget(&mean, 0) * vget(&mean, 0) / + (2 * INIT_MULT * p->var->chain_variance)); + // min_penalty = 0.0; + double m = term1 + term2 + term3 + term4 + min_penalty; + return(-m); +} + +// derivative +void df_obs(const gsl_vector *x, void *params, gsl_vector *df) +{ + struct opt_params * p = (struct opt_params *) params; + int i; + + msetrow(p->var->obs, p->word, x); + + // Run the forward-backward algorithm + compute_post_mean(p->word, p->var, p->var->chain_variance); + + if (FLAGS_model == "fixed") { + compute_obs_deriv_fixed(p->word, + p->word_counts, + p->totals, + p->var, + p->mean_deriv_mtx, + df); + } else { + compute_obs_deriv(p->word, + p->word_counts, + p->totals, + p->var, + p->mean_deriv_mtx, + df); + } + + for (i = 0; i < df->size; i++) { + vset(df, i, -vget(df, i)); + } +} + +// function and derivative +void fdf_obs(const gsl_vector *x, void *params, double *f, gsl_vector *df) +{ + struct opt_params * p = (struct opt_params *) params; + int i; + + if (FLAGS_model == "fixed") { + *f = f_obs_fixed(x, params); + compute_obs_deriv_fixed(p->word, + p->word_counts, + p->totals, + p->var, + p->mean_deriv_mtx, + df); + } else { + *f = f_obs(x, params); + compute_obs_deriv(p->word, + p->word_counts, + p->totals, + p->var, + p->mean_deriv_mtx, + df); + } + + for (i = 0; i < df->size; i++) { + vset(df, i, -vget(df, i)); + } +} + + +// function to perform optimization +void update_obs(gsl_matrix* word_counts, + gsl_vector* totals, + sslm_var* var) +{ + int t, w, T = var->T, W = var->W, runs = 0; + double f_val, conv_val; int niter; + gsl_vector obs, w_counts, mean_deriv; + gsl_vector * norm_cutoff_obs = NULL; + struct opt_params params; + // Matrix of mean derivatives: + // Row ~ s + gsl_matrix* mean_deriv_mtx = gsl_matrix_alloc(T, T+1); + + params.var = var; + params.totals = totals; + + for (w = 0; w < W; w++) + { + if (w % 5000 == 0) { + outlog("Updating term %d", w); + } + w_counts = gsl_matrix_row(word_counts, w).vector; + if (((w % 500) == 0) && (w > 0)) + { + // outlog( "[SSLM] optimized %05d words (%05d cg runs)", w, runs); + } + + // check norm of observation + + double counts_norm = norm(&w_counts); + if ((counts_norm < OBS_NORM_CUTOFF) && (norm_cutoff_obs != NULL)) + { + obs = gsl_matrix_row(var->obs, w).vector; + gsl_vector_memcpy(&obs, norm_cutoff_obs); + } + else + { + if (counts_norm < OBS_NORM_CUTOFF) + gsl_vector_set_all(&w_counts, 0); + + // compute mean deriv + for (t = 0; t < T; t++) { + mean_deriv = gsl_matrix_row(mean_deriv_mtx, t).vector; + compute_mean_deriv(w, t, var, &mean_deriv); + } + // set parameters + params.word_counts = &w_counts; + params.word = w; + params.mean_deriv_mtx = mean_deriv_mtx; + obs = gsl_matrix_row(var->obs, w).vector; + // optimize + if (FLAGS_model == "fixed") { + optimize_fdf(T, &obs, ¶ms, &fdf_obs, &df_obs, &f_obs_fixed, + &f_val, &conv_val, &niter); + } else { + optimize_fdf(T, &obs, ¶ms, &fdf_obs, &df_obs, &f_obs, + &f_val, &conv_val, &niter); + } + runs++; + // outlog( + // "w: %04d f: %1.15e c: %5.3e n: %04d", + // w, f_val, conv_val, niter); + if (counts_norm < OBS_NORM_CUTOFF) + { + norm_cutoff_obs = gsl_vector_alloc(T); + // !!! this can be BLASified for speed + gsl_vector_memcpy(norm_cutoff_obs, &obs); + } + } + } + update_zeta(var); + gsl_matrix_free(mean_deriv_mtx); + if (norm_cutoff_obs != NULL) + { + gsl_vector_free(norm_cutoff_obs); + } +} + + +/* + * initialize variational observations + * + */ + +void initialize_obs(sslm_var* var, gsl_matrix* counts) +{ + gsl_matrix_set_zero(var->obs); +#if 0 + int t; + + gsl_matrix_memcpy(var->obs, counts); + for (t = 0; t < counts->size2; t++) + { + gsl_vector time_slice = gsl_matrix_column(var->obs, t).vector; + gsl_vector_add_constant(&time_slice, 1.0); + normalize(&time_slice); + vct_log(&time_slice); + } +#endif +} + + +/* + * fit variational distribution + * + */ + +double fit_sslm(sslm_var* var, gsl_matrix* counts) { + int iter, w, W = var->W; + double bound = 0, old_bound = 0; + double converged = SSLM_FIT_THRESHOLD+1; + gsl_vector* totals = gsl_vector_alloc(counts->size2); + + // Allocate variational data. + sslm_inference_alloc(var); + for (w = 0; w < W; w++) { + compute_post_variance(w, var, var->chain_variance); + } + + col_sum(counts, totals); + + iter = 0; + if (FLAGS_model == "fixed") { + bound = compute_bound_fixed(counts, totals, var); + // bound = compute_bound(counts, totals, var); + } else { + bound = compute_bound(counts, totals, var); + } + outlog( "initial sslm bound = %10.5f", bound); + + while ((converged > SSLM_FIT_THRESHOLD) + && (iter < SSLM_MAX_ITER)) { + iter++; + old_bound = bound; + update_obs(counts, totals, var); + if (FLAGS_model == "fixed") { + bound = compute_bound_fixed(counts, totals, var); + } else { + bound = compute_bound(counts, totals, var); + } + converged = fabs((bound - old_bound) / old_bound); + outlog( "(%02d) sslm bound = % 10.5f; conv = % 10.5e", + iter, bound, converged); + } + + // compute expected log probability + + compute_expected_log_prob(var); + + // free convenience parameters (there are a lot of them) + + free(totals); + sslm_inference_free(var); + + return(bound); +} + + +/* + * read and write variational distribution + * + */ + +void write_sslm_var(sslm_var* var, const char* out) { + string filename = StringPrintf("%s-var-obs.dat", out); + mtx_fprintf(filename.c_str(), var->obs); + + filename = StringPrintf("%s-var-e-log-prob.dat", out); + mtx_fprintf(filename.c_str(), var->e_log_prob); + + // sprintf(filename, "%s-zeta.dat", out); + // vct_fprintf(filename, var->zeta); + + filename = StringPrintf("%s-info.dat", out); + FILE* f = fopen(filename.c_str(), "w"); + params_write_int(f, "SEQ_LENGTH", var->T); + params_write_int(f, "NUM_TERMS", var->W); + params_write_double(f, "OBS_VARIANCE", var->obs_variance); + params_write_double(f, "CHAIN_VARIANCE", var->chain_variance); + + fclose(f); +} + + +// Read in a set of pre-computed topics from a file whose +// prefix is "in". +sslm_var* read_sslm_var(const char* in) { + outlog("READING LM FROM %s", in); + + string filename; + int W, T; + + // read number of words and sequence length; allocate distribution + + filename = StringPrintf("%s-info.dat", in); + FILE* f = fopen(filename.c_str(), "r"); + if (f == NULL) { + printf("Error. Could not open file %s\nFailing.\n", filename.c_str()); + exit(1); + } + + params_read_int(f, "SEQ_LENGTH", &T); + params_read_int(f, "NUM_TERMS", &W); + sslm_var* var = sslm_var_alloc(W, T); + + // read the variance parameters + + params_read_double(f, "OBS_VARIANCE", &(var->obs_variance)); + params_read_double(f, "CHAIN_VARIANCE", &(var->chain_variance)); + + // read the variational observations and expected log probabilities + + filename = StringPrintf("%s-var-obs.dat", in); + mtx_fscanf(filename.c_str(), var->obs); + filename = StringPrintf("%s-var-e-log-prob.dat", in); + mtx_fscanf(filename.c_str(), var->e_log_prob); + + // sprintf(filename, "%s-zeta.dat", in); + // vct_fscanf(filename, var->zeta); + + return(var); +} + +} // namespace dtm diff --git a/dtm_release/dtm-parallel/ss-lm.h b/dtm_release/dtm-parallel/ss-lm.h new file mode 100644 index 0000000000000000000000000000000000000000..bb3dd77aa444dfcd9200ad962938e109449a6f62 --- /dev/null +++ b/dtm_release/dtm-parallel/ss-lm.h @@ -0,0 +1,102 @@ +/* + * state space language model variational inference + * + */ + +#ifndef SSLM_H +#define SSLM_H + +#include "gsl-wrappers.h" +#include "params.h" +#include <gsl/gsl_vector.h> +#include <gsl/gsl_matrix.h> +#include <assert.h> +#include <math.h> + +#include "data.h" + +#define SSLM_MAX_ITER 2 // maximum number of optimization iters +#define SSLM_FIT_THRESHOLD 1e-6 // convergence criterion for fitting sslm +#define INIT_MULT 1000 // multiplier to variance for first obs +// #define OBS_NORM_CUTOFF 10 // norm cutoff after which we use all 0 obs +//#define OBS_NORM_CUTOFF 8 // norm cutoff after which we use all 0 obs +#define OBS_NORM_CUTOFF 2 // norm cutoff after which we use all 0 obs + +namespace dtm { + +/* + * functions for variational inference + * + */ + +// allocate new state space language model variational posterior +sslm_var* sslm_var_alloc(int W, int T); + +// allocate extra parameters for inference +void sslm_inference_alloc(sslm_var* var); + +// free extra parameters for inference +void sslm_inference_free(sslm_var* var); + +// initialize with zero observations +void sslm_zero_init(sslm_var* var, + double obs_variance, + double chain_variance); + +// initialize with counts +void sslm_counts_init(sslm_var* var, + double obs_variance, + double chain_variance, + const gsl_vector* counts); + +// initialize from variational observations +void sslm_obs_file_init(sslm_var* var, + double obs_variance, + double chain_variance, + const char* filename); + + +// compute E[\beta_{w,t}] for t = 1:T +void compute_post_mean(int w, sslm_var* var, double chain_variance); + +// compute Var[\beta_{w,t}] for t = 1:T +void compute_post_variance(int w, sslm_var* var, double chain_variance); + +// optimize \hat{beta} +void optimize_var_obs(sslm_var* var); + +// compute dE[\beta_{w,t}]/d\obs_{w,s} for t = 1:T +void compute_mean_deriv(int word, int time, sslm_var* var, + gsl_vector* deriv); + +// compute d bound/d obs_{w, t} for t=1:T. +void compute_obs_deriv(int word, gsl_vector* word_counts, + gsl_vector* total_counts, sslm_var* var, + gsl_matrix* mean_deriv_mtx, gsl_vector* deriv); + +// update observations +void update_obs(gsl_matrix* word_counts, gsl_vector* totals, + sslm_var* var); + +// log probability bound +double compute_bound(gsl_matrix* word_counts, gsl_vector* totals, + sslm_var* var); + + +// fit variational distribution +double fit_sslm(sslm_var* var, gsl_matrix* word_counts); + +// read and write variational distribution +void write_sslm_var(sslm_var* var, const char* out); +sslm_var* read_sslm_var(const char* in); + +void compute_expected_log_prob(sslm_var* var); +// !!! old function (from doc mixture...) +double expected_log_prob(int w, int t, sslm_var* var); + +// update zeta +void update_zeta(sslm_var* var); + +} // namespace dtm + +#endif diff --git a/dtm_release/dtm-parallel/strutil.c b/dtm_release/dtm-parallel/strutil.c new file mode 100644 index 0000000000000000000000000000000000000000..c9d0e107fa1ae60553dd40f7b3ede395788ca975 --- /dev/null +++ b/dtm_release/dtm-parallel/strutil.c @@ -0,0 +1,56 @@ +// Copyright 2010 Sean Gerrish +// All Rights Reserved +// +// Author: Sean Gerrish +// +// Defines a number of string functions. + +#include <vector.h> +#include <string.h> +#include <stdarg.h> + +using namespace std; + +string StringPrintf(const char* format, ...) { + char result[4000]; + va_list arg; + va_start(arg, format); + vsprintf (result, format, arg ); + va_end(arg); + + return result; +} + +// Split a string on some given delimiter. +void SplitStringUsing(const string& s1, + const char* delimiter, + vector<string>* result) { + // First, count the number of parts after the split. + int i=0; + while (i < s1.size()) { + size_t n = s1.find_first_of(delimiter, i); + if (n == string::npos) { + result->push_back(s1.substr(i, s1.length() - i)); + return; + } + result->push_back(s1.substr(i, n - i)); + + i = n + 1; + } +} + +// Split a string on some given delimiter. +string JoinStringUsing(const vector<string>& parts, + const char* delimiter) { + string result; + // First, count the number of parts after the split. + for (vector<string>::const_iterator it=parts.begin(); + it != parts.end(); + ++it) { + if (it == parts.begin()) { + result = *it; + } else { + result += "," + *it; + } + } +} diff --git a/dtm_release/dtm-parallel/strutil.h b/dtm_release/dtm-parallel/strutil.h new file mode 100644 index 0000000000000000000000000000000000000000..d32a930f1e911f92ad902a21aafb91e60ebd5862 --- /dev/null +++ b/dtm_release/dtm-parallel/strutil.h @@ -0,0 +1,28 @@ +// Copyright 2010 Sean Gerrish +// All Rights Reserved +// +// Author: Sean Gerrish +// +// Defines a number of string functions. + +#ifndef _STRUTIL_H__ +#define _STRUTIL_H__ + +#include <string> +#include <vector> +//class string; +//template <class T> +//class vector<T>; + +using namespace std; + +string StringPrintf(const char* format, ...); + +void SplitStringUsing(const string& s1, + const char* delimiter, + vector<string>* result); + +string JoinStringUsing(const vector<string>& parts, + const char* delimiter); + +#endif diff --git a/dtm_release/dtm-parallel/util.c b/dtm_release/dtm-parallel/util.c new file mode 100644 index 0000000000000000000000000000000000000000..477e0686f0c201175afc2d6ccaba25e79301dcf2 --- /dev/null +++ b/dtm_release/dtm-parallel/util.c @@ -0,0 +1,289 @@ +#define ABNORMAL_RETURN_CODE 1 +#define MAX_STRING_LENGTH 65535 + +#include <stdio.h> +#include <string.h> +#include <assert.h> +#include <sys/wait.h> +#include <sys/stat.h> +#include <errno.h> +#include <ctype.h> +#include "util.h" + +#ifdef __alpha__ + +#include <sys/mount.h> +#include <malloc.h> +#include <stdlib.h> +#include <unistd.h> + +#else + +/*#include <malloc.h>*/ +#include <stdlib.h> +#include <unistd.h> +/*#include <sys/vfs.h>*/ + +#endif + +char buf[1024]; +static int space_in_use=0; +static int pointers_in_use=0; +int display_allocs=FALSE; + + +void error(char *fmt, ...){ + va_list args; + va_start(args, fmt); + vfprintf(stderr, fmt, args); CRLF; + va_end(args); + fprintf(stderr, "\n"); + if (errno > 0) { + perror(buf); + fprintf(stderr, "errno=%d\n", errno); + fprintf(stderr, buf); + fprintf(stderr, "\n"); + } + fflush(stderr); + fflush(stdout); + assert(0); +} + +void bomb(char *fmt, ...) +{ + /* just break out, with error code =1 (fail) */ + + va_list args; + va_start(args, fmt); + vfprintf(stderr, fmt, args); CRLF; + va_end(args); + fprintf(stderr, "\n"); + fflush(stderr); + fflush(stdout); + exit(1); +} + + +void bail(char *fmt, ...) +{ + /* just break out, with error code =0 (success) */ + + va_list args; + va_start(args, fmt); + vfprintf(stderr, fmt, args); CRLF; + va_end(args); + fprintf(stderr, "\n"); + fflush(stderr); + fflush(stdout); + exit(0); +} + + + +char *dequote (char *s) { + static char *sbuf=NULL; + char *t; + int i; + if (s[0] != '\'') return s; + else if ((i=strlen(s)) < 2) return s; + else if (s[i-1] != '\'') + error("Illegal string passed to dequote: %s", s); + if (sbuf == NULL) + sbuf = (char *) malloc(MAX_STRING_LENGTH); + t = sbuf; + s++; + while(*s != EOS) { + if (*s == '\'') s++; + *t = *s; + s++; t++; + } + *t = EOS; + return sbuf; +} + +void quote_no_matter_what (const char *s, char *t) { + *t = '\''; + t++; + while((*s != EOS)) { + *t = *s; + if (*s == '\'') { + t++; *t = '\''; + } + s++; t++; + } + *t = '\''; t++; + *t = EOS; +} + + +const char *quote (const char *s) { + static char *sbuf=NULL; + if (sbuf == NULL) + sbuf = (char *) malloc(MAX_STRING_LENGTH); + if ( strchr(s,' ') == NULL && + strstr(s,"/*") == NULL && strstr(s,"*/") == NULL ) return s; + else { + quote_no_matter_what(s, sbuf); + return sbuf; + } +} + + + + +/* returns TRUE iff string only contains chars in valid. */ +int verify(char *string, char *valid) +{ + int i; + for(i=0;i<strlen(string);i++) + if (!strchr(valid, string[i])) return TRUE; + return FALSE; +} + + +/* strips leading and trailing white space */ +char * strip(char *s) { + int i,j; + int hit_char; + + j = 0; + hit_char = FALSE; + for (i=0; i<=strlen(s); ++i) { + if (s[i] != ' ') hit_char = TRUE; + if (hit_char) s[j++] = s[i]; + } + for (i=strlen(s)-1; i>0; --i) + if (s[i] != ' ') break; + s[i+1] = '\0'; + return s; +} + + +/* converts s to upper case */ +char * upper(char *s) { + int i; + for (i=0; i<strlen(s); ++i) s[i] = toupper(s[i]); + return s; +} + +/* converts s to lower case */ +char * lower(char *s) { + int i; + for (i=0; i<strlen(s); ++i) s[i] = tolower(s[i]); + return s; +} + + +/* queries existence of file */ +int qfilef(const char *fname) { + if (fname == FALSE) return FALSE; + if (access(fname, F_OK)==0) return TRUE; + else return FALSE; +} + + +/* returns free storage in file system */ +int free_storage (char *fn) +{ + /* uses a defunct function call. Also, not ever called */ + abort(); + /* + struct statfs sfs; + if (statfs(fn, &sfs) == -1) + return -1; + return sfs.f_bsize * sfs.f_bfree; +*/ +} + +/* Return the size of file named filename */ +int file_size(char *filename) +{ + struct stat status; + + if (stat(filename,&status) != 0) + return -1; + return (int)status.st_size; +} + +/* Return an allocated duplicate of string */ +char *util_strdup(char *string) +{ + int len = strlen(string); + char *dup = (char *)malloc(len+1); + + if (dup == NULL) + { + perror("malloc"); + return NULL; + } + strcpy(dup, string); + return dup; +} + + +void * util_malloc (int size) +{ + char * p = (char *) malloc(size+sizeof(int)); + if (p == NULL) error("UTIL_MALLOC: Ran out of space. Space in use: %d (%d pointers)\n", + space_in_use, pointers_in_use); + space_in_use += size; + ++pointers_in_use; + *((int *) p) = size; + if (display_allocs) + fprintf(stderr, "UTIL_MALLOC: Allocated %d bytes, %d bytes total, %d pointers\n", + size, space_in_use, pointers_in_use); + return (void *) (p+sizeof(int)); +} + +void * util_calloc (int num, int size) +{ + char * p = (char *) calloc(num*size+sizeof(int), 1); + if (p == NULL) error("UTIL_CALLOC: Ran out of space. Space in use: %d (%d pointers)\n", + space_in_use, pointers_in_use); + space_in_use += num*size; + ++pointers_in_use; + *((int *) p) = num*size; + if (display_allocs) + fprintf(stderr, "UTIL_CALLOC: Allocated %d bytes, %d bytes total, %d pointers\n", + num*size, space_in_use, pointers_in_use); + return (void *) (p+sizeof(int)); +} + +void * util_realloc (void * p, int size) +{ + int oldsize; + char *realp; + realp = ((char *)p)-sizeof(int); + oldsize = *((int *)(realp)); + realp = (char *) realloc(realp, size+sizeof(int)); + if (realp == NULL) error("UTIL_REALLOC: Ran out of space. Space in use: %d (%d pointers)\n", + space_in_use, pointers_in_use); + *((int *)(realp)) = size; + space_in_use += (size-oldsize); + if (display_allocs) + fprintf(stderr, "UTIL_REALLOC: Allocated %d bytes, %d bytes total, %d pointers\n", + size, space_in_use, pointers_in_use); + return (realp+sizeof(int)); +} + +void util_free (void * p) +{ + int size; + size = *((int *) (((char *) p)-sizeof(int))); + space_in_use -= size; + --pointers_in_use; + free(((char *)p)-sizeof(int)); + if (display_allocs) + fprintf(stderr, "UTIL_FREE: Freed up %d bytes, %d bytes remaining, %d pointers\n", + size, space_in_use, pointers_in_use); +} + +int util_space_in_use (void) +{ + return space_in_use; +} + +int util_pointers_in_use (void) +{ + return pointers_in_use; +} diff --git a/dtm_release/dtm-parallel/util.h b/dtm_release/dtm-parallel/util.h new file mode 100644 index 0000000000000000000000000000000000000000..0db3cd29679037729e757ff644e7aa461d21229c --- /dev/null +++ b/dtm_release/dtm-parallel/util.h @@ -0,0 +1,29 @@ +#ifndef _UTIL_INCLUDED +#define _UTIL_INCLUDED 1 + +#include <stdarg.h> + +#define EOS '\0' +#define CRLF printf("\n") +#define TRUE 1 +#define FALSE 0 + +extern const char* quote (const char *s); +extern char* dequote (char *s); +extern void quote_no_matter_what (const char *s, char *t); +extern int verify (char *s, char *t); +extern char* strip (char *s); +extern char* upper (char *s); +extern char* lower (char *s); +extern int qfilef (const char *fname); /* TRUE if file exists */ +extern int free_storage (char *fn); /* returns free storage in file system of fn */ +extern char* util_strdup(char *string); +extern void* util_malloc (int size); +extern void* util_realloc (void *p, int size); +extern void* util_calloc (int num, int size); +extern void util_free (void *p); +extern int util_space_in_use (void); +extern int util_pointers_in_use (void); +extern void error(char *fmt, ...); + +#endif diff --git a/dtm_release/dtm/Makefile b/dtm_release/dtm/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..42216fa9a7306cfe8042697e373cee38a821279f --- /dev/null +++ b/dtm_release/dtm/Makefile @@ -0,0 +1,40 @@ +.SUFFIXES: .c .u +CC= g++ + +LIB=../lib +GSLWRAP_LIB=../gslwrap +LOCAL_DIR=../local + +CFLAGS = -I ${LIB} -I ${LIB}/math -I ${GSLWRAP_LIB}/include -I \ + ${GSLWRAP_LIB}/include/gslwrap -I ${LOCAL_DIR}/include -I \ + ${LIB}/util/gflags-1.1/src/gflags + +GDB_CFLAGS = -ggdb -I ${LIB} -I ${LIB}/math -I ${GSLWRAP_LIB}/include \ + -I ${GSLWRAP_LIB}/include/gslwrap -I ${LOCAL_DIR}/include -I \ + ${LIB}/util/gflags-1.1/src/gflags + +BASE_INCLUDES = -I ${LIB} + +LDFLAGS = -L${LOCAL_DIR}/lib -L${LOCAL_DIR}/lib/stl -lgsl -lm -lgslcblas +LOBJECTS = ss-lm.o gsl-wrappers.o data.o param.o util.o lda-seq.o \ + lda.o params.o main.o + +GFLAGS = gflags.o gflags_reporting.o gflags_completions.o + +all: main + +gflags: ${LIB}/util/gflags-1.1/src/gflags.cc + $(CC) -c $(CFLAGS) \ + ${LIB}/util/gflags-1.1/src/gflags.cc \ + ${LIB}/util/gflags-1.1/src/gflags_reporting.cc \ + ${LIB}/util/gflags-1.1/src/gflags_completions.cc + +main: $(LOBJECTS) gflags + $(CC) $(CFLAGS) $(LOBJECTS) $(GFLAGS) -o main $(LDFLAGS) + +dbg: $(LOBJECTS) gflags + $(CC) $(GDB_CFLAGS) $(LOBJECTS) $(GFLAGS) -o main $(LDFLAGS) + +clean: + -rm -f *.o + -rm -f main \ No newline at end of file diff --git a/dtm_release/dtm/data.c b/dtm_release/dtm/data.c new file mode 100644 index 0000000000000000000000000000000000000000..0d6e3fbbbe106f6edcc04e8183de4385e95e6b79 --- /dev/null +++ b/dtm_release/dtm/data.c @@ -0,0 +1,394 @@ +// Authors: David Blei (blei@cs.princeton.edu) +// Sean Gerrish (sgerrish@cs.princeton.edu) +// +// Copyright 2011 Sean Gerrish and David Blei +// All Rights Reserved. +// +// See the README for this package for details about modifying or +// distributing this software. + +#include "gflags.h" + +#include "data.h" + +DEFINE_double(sigma_l, + 0.05, + "If true, use the new phi calculation."); +DEFINE_double(sigma_d, + 0.05, + "If true, use the new phi calculation."); +DEFINE_double(sigma_c, + 0.05, + "c stdev."); +DEFINE_double(sigma_cv, + 1e-6, + "Variational c stdev."); +DEFINE_double(resolution, + 1, + "The resolution. Used to determine how far out the beta mean should be."); +DEFINE_int32(max_number_time_points, + 200, + "Used for the influence window."); +DEFINE_double(time_resolution, + 0.5, + "This is the number of years per time slice."); +DEFINE_double(influence_mean_years, + 20.0, + "How many years is the mean number of citations?"); +DEFINE_double(influence_stdev_years, + 15.0, + "How many years is the stdev number of citations?"); +DEFINE_int32(influence_flat_years, + -1, + "How many years is the influence nonzero?" + "If nonpositive, a lognormal distribution is used."); + +DECLARE_string(normalize_docs); + +/* + * seq corpus range: [start, end) + * + * creates a subset of time slices + * + */ + +corpus_seq_t* make_corpus_seq_subset(corpus_seq_t* all, int start, int end) +{ + int n; + corpus_seq_t* subset_corpus = (corpus_seq_t*) malloc(sizeof(corpus_seq_t)); + subset_corpus->nterms = all->nterms; + subset_corpus->len = end - start; + subset_corpus->ndocs = 0; + subset_corpus->corpus = (corpus_t**) malloc(sizeof(corpus_t*) * subset_corpus->len); + for (n = start; n < end; n++) + { + subset_corpus->corpus[n - start] = all->corpus[n]; + subset_corpus->ndocs += all->corpus[n]->ndocs; + } + return(subset_corpus); +} + + +/* + * collapse a sequential corpus to a flat corpus + * + */ + +corpus_t* collapse_corpus_seq(corpus_seq_t* c) +{ + corpus_t* collapsed = (corpus_t*) malloc(sizeof(corpus_t)); + collapsed->ndocs = c->ndocs; + collapsed->nterms = c->nterms; + collapsed->doc = (doc_t**) malloc(sizeof(doc_t*) * c->ndocs); + collapsed->max_unique = 0; + int t, n, doc_idx = 0; + for (t = 0; t < c->len; t++) + { + for (n = 0; n < c->corpus[t]->ndocs; n++) + { + collapsed->doc[doc_idx] = c->corpus[t]->doc[n]; + if (collapsed->doc[doc_idx]->nterms > collapsed->max_unique) + collapsed->max_unique = collapsed->doc[doc_idx]->nterms; + doc_idx++; + } + } + assert(doc_idx == collapsed->ndocs); + return(collapsed); +} + +/* + * read corpus + * + */ + +corpus_t* read_corpus(const char* name) +{ + int length, count, word, n; + corpus_t* c; + char filename[400]; + sprintf(filename, "%s-mult.dat", name); + outlog("reading corpus from %s", filename); + c = (corpus_t*) malloc(sizeof(corpus_t)); + c->max_unique = 0; + FILE* fileptr = fopen(filename, "r"); + if (fileptr == NULL) { + outlog("Error reading corpus prefix %s. Failing.", + filename); + exit(1); + } + c->ndocs = 0; c->nterms = 0; + c->doc = (doc_t**) malloc(sizeof(doc_t*)); + int grand_total = 0; + while ((fscanf(fileptr, "%10d", &length) != EOF)) + { + if (length > c->max_unique) c->max_unique = length; + c->doc = (doc_t**) realloc(c->doc, sizeof(doc_t*)*(c->ndocs+1)); + c->doc[c->ndocs] = (doc_t*) malloc(sizeof(doc_t)); + c->doc[c->ndocs]->nterms = length; + c->doc[c->ndocs]->total = 0; + c->doc[c->ndocs]->log_likelihood = 0.0; + + c->doc[c->ndocs]->word = (int*) malloc(sizeof(int)*length); + c->doc[c->ndocs]->count = (int*) malloc(sizeof(int)*length); + c->doc[c->ndocs]->lambda = (double*) malloc(sizeof(double)*length); + c->doc[c->ndocs]->log_likelihoods = (double*) malloc(sizeof(double)*length); + for (n = 0; n < length; n++) + { + fscanf(fileptr, "%10d:%10d", &word, &count); + word = word - OFFSET; + if (FLAGS_normalize_docs == "occurrence") { + count = 1; + } + c->doc[c->ndocs]->word[n] = word; + c->doc[c->ndocs]->count[n] = count; + c->doc[c->ndocs]->total += count; + // Is there a better value for initializing lambda? + c->doc[c->ndocs]->lambda[n] = 0.0; + c->doc[c->ndocs]->log_likelihoods[n] = 0.0; + if (word >= c->nterms) { c->nterms = word + 1; } + } + grand_total += c->doc[c->ndocs]->total; + c->ndocs = c->ndocs + 1; + } + fclose(fileptr); + outlog("read corpus (ndocs = %d; nterms = %d; nwords = %d)\n", + c->ndocs, c->nterms, grand_total); + return(c); +} + +/* + * read corpus sequence + * + */ + +corpus_seq_t* read_corpus_seq(const char* name) +{ + char filename[400]; + corpus_seq_t* corpus_seq = (corpus_seq_t*) malloc(sizeof(corpus_seq_t)); + + // read corpus + corpus_t* raw_corpus = read_corpus(name); + corpus_seq->nterms = raw_corpus->nterms; + // read sequence information + sprintf(filename, "%s-seq.dat", name); + outlog("Reading corpus sequence %s.", filename); + FILE* fileptr = fopen(filename, "r"); + if (!fileptr) { + outlog("Error opening dtm sequence file %s.\n", + filename); + exit(1); + } + fscanf(fileptr, "%d", &(corpus_seq->len)); + corpus_seq->corpus = (corpus_t**) malloc(sizeof(corpus_t*) * corpus_seq->len); + // allocate corpora + int doc_idx = 0; + int ndocs, i, j; + corpus_seq->ndocs = 0; + for (i = 0; i < corpus_seq->len; ++i) + { + fscanf(fileptr, "%d", &ndocs); + corpus_seq->ndocs += ndocs; + corpus_seq->corpus[i] = (corpus_t*) malloc(sizeof(corpus_t)); + corpus_seq->corpus[i]->ndocs = ndocs; + corpus_seq->corpus[i]->doc = (doc_t**) malloc(sizeof(doc_t*) * ndocs); + for (j = 0; j < ndocs; j++) + { + if (doc_idx >= raw_corpus->ndocs) { + outlog("Error: too few documents listed in dtm sequence file %s.\n" + "Current line: %d %d %d.\n", + filename, + doc_idx, + ndocs, + j); + exit(1); + } + // outlog("%d %d %d %d\n", i, j, doc_idx, raw_corpus->ndocs); + corpus_seq->corpus[i]->doc[j] = raw_corpus->doc[doc_idx]; + doc_idx++; + } + } + corpus_seq->max_nterms = compute_max_nterms(corpus_seq); + outlog("read corpus of length %d\n", corpus_seq->len); + return(corpus_seq); +} + + +/* + * write sequential corpus + * + */ + +void write_corpus_seq(corpus_seq_t* c, char* name) +{ + char tmp_string[400]; + int n; + + outlog("writing %d slices to %s (%d total docs)", c->len, name, c->ndocs); + sprintf(tmp_string, "%s-seq.dat", name); + FILE* seq_file = fopen(tmp_string, "w"); + fprintf(seq_file, "%d", c->len); + for (n = 0; n < c->len; n++) + fprintf(seq_file, " %d", c->corpus[n]->ndocs); + fclose(seq_file); + + corpus_t* flat = collapse_corpus_seq(c); + sprintf(tmp_string, "%s-mult.dat", name); + write_corpus(flat, tmp_string); +} + +/* + * write corpus + * + */ + +void write_corpus(corpus_t* c, char* filename) +{ + int i, j; + FILE * fileptr; + doc_t * d; + outlog("writing %d docs to %s\n", c->ndocs, filename); + fileptr = fopen(filename, "w"); + for (i = 0; i < c->ndocs; i++) + { + d = c->doc[i]; + fprintf(fileptr, "%d", d->nterms); + for (j = 0; j < d->nterms; j++) + { + fprintf(fileptr, " %d:%d", d->word[j], d->count[j]); + } + fprintf(fileptr, "\n"); + } + fclose(fileptr); +} + + +/* + * compute the maximum nterms in a corpus sequence + * + */ + +int compute_max_nterms(const corpus_seq_t* c) +{ + int i,j; + int max = 0; + for (i = 0; i < c->len; i++) + { + corpus_t* corpus = c->corpus[i]; + for (j = 0; j < corpus->ndocs; j++) + if (corpus->doc[j]->nterms > max) + max = corpus->doc[j]->nterms; + } + return(max); +} + + +/* + * compute the total matrix of counts (W x T) + * + */ + +gsl_matrix* compute_total_counts(const corpus_seq_t* c) +{ + int t, d, n; + gsl_matrix* ret = gsl_matrix_alloc(c->nterms, c->len); + + for (t = 0; t < c->len; t++) + { + corpus_t* corpus = c->corpus[t]; + for (d = 0; d < corpus->ndocs; d++) + { + doc_t* doc = corpus->doc[d]; + for (n = 0; n < doc->nterms; n++) + { + minc(ret, doc->word[n], t, (double) doc->count[n]); + } + } + } + return(ret); +} + +// Creates a new array of doubles with kScaledBetaMax +// elements. +double* NewScaledInfluence(int size) { + double* scaled_influence = new double[size]; + + if (FLAGS_influence_flat_years > 0) { + // Note that we round up, to make sure we have at least one epoch. + int number_epochs = FLAGS_influence_flat_years * FLAGS_time_resolution; + double epoch_weight = 1.0 / number_epochs; + for (int i=0; i < number_epochs; ++i) { + scaled_influence[i] = epoch_weight; + } + for (int i=number_epochs; i < size; ++i) { + scaled_influence[i] = 0.0; + } + return scaled_influence; + } + + + /* + // Use the simple distribution: 1 at [0], 0 everywhere else. + for (int i=0; i < size; ++i) { + scaled_influence[i] = 0.0; + } + scaled_influence[0] = 1.0; + // scaled_beta[1] = 0; + return scaled_influence; + */ + + /* + // Simulate a beta distribution with specified mean and variance. + double total = 0.0; + double tmp = (scaled_beta_mean + * (1 - scaled_beta_mean) + / scaled_beta_variance) - 1.0; + double beta_alpha = scaled_beta_mean * tmp; + double beta_beta = (1 - scaled_beta_mean) * tmp; + for (int i=0; i < scaled_beta_max; ++i) { + // Offset tmp by 0.5 so we get a centered distribution + // and don't run into degeneracy issues. + tmp = (i + 0.5) / (scaled_beta_max); + scaled_beta[i] = (pow(tmp, beta_alpha - 1.0) + * pow(1 - tmp, beta_beta - 1.0)); + total += scaled_beta[i]; + } + */ + + + // Handle the log-normal distribution. + double total = 0.0; + + // Here, we're interested more in the median. + // So we treat the variable mean as median and note this in + // our paper. + double scaled_influence_mean = FLAGS_influence_mean_years; + double scaled_influence_variance = (FLAGS_influence_stdev_years + * FLAGS_influence_stdev_years); + double tmp = (1.0 + + (scaled_influence_variance + / (scaled_influence_mean + * scaled_influence_mean))); + double lognormal_sigma_squared = log(tmp); + double lognormal_mu = (log(scaled_influence_mean) + - 0.5 * lognormal_sigma_squared); + printf("Median: %.2f\n", exp(lognormal_mu)); + for (int i = 0; i < size; ++i) { + // Shift right by half a timeframe to avoid corner cases. + double x = (i / FLAGS_time_resolution) + (1.0 / FLAGS_time_resolution) / 2; + double tmp2 = (log(x) - lognormal_mu); + scaled_influence[i] = (1.0 + / (x * sqrt(lognormal_sigma_squared * 2 * 3.1415926)) + * exp(-tmp2 * tmp2 + / (2.0 + * lognormal_sigma_squared))); + total += scaled_influence[i]; + } + + for (int i = 0; i < kScaledInfluenceMax; ++i) { + scaled_influence[i] /= total; + } + + return scaled_influence; + +} + diff --git a/dtm_release/dtm/data.h b/dtm_release/dtm/data.h new file mode 100644 index 0000000000000000000000000000000000000000..c58ffa4be3841d438109437e9517e09ed9e39115 --- /dev/null +++ b/dtm_release/dtm/data.h @@ -0,0 +1,171 @@ +// Authors: David Blei (blei@cs.princeton.edu) +// Sean Gerrish (sgerrish@cs.princeton.edu) +// +// Copyright 2011 Sean Gerrish and David Blei +// All Rights Reserved. +// +// See the README for this package for details about modifying or +// distributing this software. + +#ifndef DATA_H +#define DATA_H + +#include "gsl-wrappers.h" +#include "param.h" +#include <stdio.h> +#include <stdlib.h> +#include <utility> + +#define OFFSET 0 + +// Create the scaled beta distribution, which describes +// how much weight documents have after n years. +const int kScaledInfluenceMax = 200; +// This mean and variance are relative to the interval [0, 1.0]. +const double kScaledInfluenceMean = 10.0 / kScaledInfluenceMax; +const double kScaledInfluenceVariance = ((10.0 / kScaledInfluenceMax) + * (10.0 / kScaledInfluenceMax)); + +/* + * a document is a collection of counts and terms + * + */ + +typedef struct doc_t { + int total; + int nterms; + int* word; + int* count; + // A parameter for finding phi. + double* lambda; + + // Used for measuring perplexity. + double log_likelihood; + double* log_likelihoods; +} doc_t; + + +/* + * a corpus is a collection of documents + * + */ + +typedef struct corpus_t { + doc_t** doc; + int ndocs; + int nterms; + int max_unique; // maximum number of unique terms in a document +} corpus_t; + + +/* + * a sequence is a sequence of corpora + * + */ + +typedef struct corpus_seq_t { + corpus_t** corpus; + int nterms; + int max_nterms; + int len; + int ndocs; +} corpus_seq_t; + + +typedef struct inf_var { + gsl_matrix** doc_weights; // T matrices of document weights. + // each matrix is d_t x K. + gsl_matrix** renormalized_doc_weights; // T matrices of document weights. + // each matrix is d_t x K. + int ntime; +} inf_var; + +/* + * variational posterior structure + * + */ + + +typedef struct sslm_var { + // properties + + int W; // vocabulary size + int T; // sequence length + + // variational parameters + + gsl_matrix* obs; // observations, W x T + + // biproducts of the variational parameters + + double obs_variance; // observation variance + double chain_variance; // chain variance + gsl_vector* zeta; // extra variational parameter, T + gsl_matrix* e_log_prob; // E log prob(w | t), W x T + + // convenient quantities for inference + + gsl_matrix* fwd_mean; // forward posterior mean, W x T + gsl_matrix* fwd_variance; // forward posterior variance, W x T + gsl_matrix* mean; // posterior mean, W x T + gsl_matrix* variance; // posterior variance, W x T + + gsl_matrix* mean_t; // W x T + gsl_matrix* variance_t; + + gsl_matrix* influence_sum_lgl; // The sum exp * w_phi_l + + // Recent copy of w_phi_l. + gsl_matrix* w_phi_l; // W x T + gsl_matrix* w_phi_sum; // W x T + gsl_matrix* w_phi_l_sq; // Square term involving various + gsl_matrix* m_update_coeff; // Terms involving squares of + // W, l, and phi. + gsl_matrix* m_update_coeff_g; // \sum_i=0..t phi_l(t) r(i-t) + + // useful temporary vector + gsl_vector* T_vct; +} sslm_var; + + +typedef struct lda_seq { + int ntopics; // number of topics + int nterms; // number of terms + int nseq; // length of sequence + gsl_vector* alpha; // dirichlet parameters + + sslm_var** topic; // topic chains. + + inf_var* influence; // document weights + + gsl_matrix** influence_sum_lgl; // Sum of document weights at time t (see g in the regression formula) + + // gsl_vector** influence_sum_g; // Sum of document weights at time t. + // gsl_vector** influence_sum_h; // Sum of document weights at time t. + + inf_var* renormalized_influence; // document weights + + // gsl_matrix** w_phi_l; // Product term for the \beta update. + // gsl_matrix** w_phi_l_sq; // Square term involving various + // coefficients for the \beta update. + + std::pair<int, float>**** top_doc_phis; // T x D_t x n of document phis. +} lda_seq; + +/* + * functions + * + */ + +corpus_t* read_corpus(const char* name); +corpus_seq_t* read_corpus_seq(const char* name); +int compute_max_nterms(const corpus_seq_t* c); +gsl_matrix * compute_total_counts(const corpus_seq_t* c); +corpus_seq_t* make_seq_corpus_subset(corpus_seq_t* all, int start, int end); +void write_corpus(corpus_t* c, char* filename); +void write_corpus_seq(corpus_seq_t* c, char* name); +corpus_seq_t* make_corpus_seq_subset(corpus_seq_t* all, int start, int end); +corpus_t* collapse_corpus_seq(corpus_seq_t* c); +double* NewScaledInfluence(int size); + +#endif diff --git a/dtm_release/dtm/gsl-wrappers.c b/dtm_release/dtm/gsl-wrappers.c new file mode 100644 index 0000000000000000000000000000000000000000..109cdbf21a3064ea75d7ae60352909ae8219e725 --- /dev/null +++ b/dtm_release/dtm/gsl-wrappers.c @@ -0,0 +1,528 @@ +#include "gflags.h" +#include "gsl-wrappers.h" + +static gsl_rng* RANDOM_NUMBER_GENERATOR = NULL; + +DEFINE_int64(rng_seed, + 0, + "Specifies the random seed. If 0, seeds pseudo-randomly."); + +// The maximum number of iterations for each update. +const double MAX_ITER = 15; + +/* + * safe logarithm function + * + */ + +double safe_log(double x) +{ + if (x == 0) + { + return(-1000); + } + else + { + return(log(x)); + } +} + + +/* + * given log(a) and log(b), return log(a+b) + * + */ + +double log_sum(double log_a, double log_b) +{ + double v; + + if (log_a == -1) return(log_b); + + if (log_a < log_b) + { + v = log_b+log(1 + exp(log_a-log_b)); + } + else + { + v = log_a+log(1 + exp(log_b-log_a)); + } + return(v); +} + + +void vinc(gsl_vector* v, int i, double x) +{ + vset(v, i, vget(v, i) + x); +} + +void minc(gsl_matrix* m, int i, int j, double x) +{ + mset(m, i, j, mget(m, i, j) + x); +} + + +void msetrow(gsl_matrix* m, int r, const gsl_vector* val) +{ + int i; + gsl_vector v = gsl_matrix_row(m, r).vector; + for (i = 0; i < v.size; i++) + vset(&v, i, vget(val, i)); +} + + +void msetcol(gsl_matrix* m, int r, const gsl_vector* val) +{ + int i; + gsl_vector v = gsl_matrix_column(m, r).vector; + for (i = 0; i < v.size; i++) + vset(&v, i, vget(val, i)); +} + + +/* + * compute the column sums of a matrix + * + */ + +void col_sum(gsl_matrix* m, gsl_vector* val) +{ + int i, j; + gsl_vector_set_all(val, 0); + + for (i = 0; i < m->size1; i++) + for (j = 0; j < m->size2; j++) + vinc(val, j, mget(m, i, j)); +} + + +/* + * print a vector to standard out + * + */ + +void vct_printf(const gsl_vector * v) +{ + int i; + for (i = 0; i < v->size; i++) + printf("%5.5f ", vget(v, i)); + printf("\n\n"); +} + + +/* + * print a matrix to standard out + * + */ + +void mtx_printf(const gsl_matrix * m) +{ + int i, j; + for (i = 0; i < m->size1; i++) + { + for (j = 0; j < m->size2; j++) + printf("%5.5f ", mget(m, i, j)); + printf("\n"); + } +} + + +/* + * read/write a vector/matrix from a file + * + */ + +void vct_fscanf(const char* filename, gsl_vector* v) +{ + outlog("reading %ld vector from %s", v->size, filename); + FILE* fileptr; + if (!fileptr) { + outlog("Error opening file %s. Failing.", filename); + exit(1); + } + fileptr = fopen(filename, "r"); + gsl_vector_fscanf(fileptr, v); + fclose(fileptr); +} + +void mtx_fscanf(const char* filename, gsl_matrix * m) +{ + FILE* fileptr = fopen(filename, "r"); + + outlog("reading %ld x %ld matrix from %s", + m->size1, m->size2, filename); + if (!fileptr) { + outlog("Error opening file %s. Failing.", filename); + exit(1); + } + + gsl_matrix_fscanf(fileptr, m); + fclose(fileptr); +} + +void vct_fprintf(const char* filename, gsl_vector* v) +{ + outlog( "writing %ld vector to %s", v->size, filename); + FILE* fileptr; + fileptr = fopen(filename, "w"); + if (!fileptr) { + outlog("Error opening file %s. Failing.", filename); + exit(1); + } + gsl_vector_fprintf(fileptr, v, "%20.17e"); + fclose(fileptr); +} + + +void mtx_fprintf(const char* filename, const gsl_matrix * m) +{ + outlog( "writing %ld x %ld matrix to %s", + m->size1, m->size2, filename); + FILE* fileptr; + fileptr = fopen(filename, "w"); + if (!fileptr) { + outlog("Error opening file: %s", filename); + exit(1); + } + gsl_matrix_fprintf(fileptr, m, "%20.17e"); + fclose(fileptr); +} + + +/* + * matrix inversion using blas + * + */ + +void matrix_inverse(gsl_matrix* m, gsl_matrix* inverse) +{ + gsl_matrix *lu; + gsl_permutation* p; + int signum; + + p = gsl_permutation_alloc(m->size1); + lu = gsl_matrix_alloc(m->size1, m->size2); + + gsl_matrix_memcpy(lu, m); + gsl_linalg_LU_decomp(lu, p, &signum); + gsl_linalg_LU_invert(lu, p, inverse); + + gsl_matrix_free(lu); + gsl_permutation_free(p); +} + + +/* + * log determinant using blas + * + */ + +double log_det(gsl_matrix* m) +{ + gsl_matrix* lu; + gsl_permutation* p; + double result; + int signum; + + p = gsl_permutation_alloc(m->size1); + lu = gsl_matrix_alloc(m->size1, m->size2); + + gsl_matrix_memcpy(lu, m); + gsl_linalg_LU_decomp(lu, p, &signum); + result = gsl_linalg_LU_lndet(lu); + + gsl_matrix_free(lu); + gsl_permutation_free(p); + + return(result); +} + + +/* + * eigenvalues of a symmetric matrix using blas + * + */ + +void sym_eigen(gsl_matrix* m, gsl_vector* vals, gsl_matrix* vects) +{ + gsl_eigen_symmv_workspace* wk; + gsl_matrix* mcpy; + int r; + + mcpy = gsl_matrix_alloc(m->size1, m->size2); + wk = gsl_eigen_symmv_alloc(m->size1); + gsl_matrix_memcpy(mcpy, m); + r = gsl_eigen_symmv(mcpy, vals, vects, wk); + gsl_eigen_symmv_free(wk); + gsl_matrix_free(mcpy); +} + + +/* + * sum of a vector + * + */ + +double sum(const gsl_vector* v) +{ + double val = 0; + int i, size = v->size; + for (i = 0; i < size; i++) + val += vget(v, i); + return(val); +} + + +/* + * take log of each element + * + */ + +void vct_log(gsl_vector* v) +{ + int i, size = v->size; + for (i = 0; i < size; i++) + vset(v, i, safe_log(vget(v, i))); +} + + +/* + * l2 norm of a vector + * + */ + +// !!! this can be BLASified + +double norm(gsl_vector *v) +{ + double val = 0; + int i; + + for (i = 0; i < v->size; i++) + val += vget(v, i) * vget(v, i); + return(sqrt(val)); +} + + +/* + * draw K random integers from 0..N-1 + * + */ + +void choose_k_from_n(int k, int n, int* result) +{ + int i, x[n]; + + if (RANDOM_NUMBER_GENERATOR == NULL) + RANDOM_NUMBER_GENERATOR = gsl_rng_alloc(gsl_rng_taus); + for (i = 0; i < n; i++) + x[i] = i; + + gsl_ran_choose (RANDOM_NUMBER_GENERATOR, (void *) result, k, + (void *) x, n, sizeof(int)); +} + + +/* + * normalize a vector in log space + * + * x_i = log(a_i) + * v = log(a_1 + ... + a_k) + * x_i = x_i - v + * + */ + +void log_normalize(gsl_vector* x) +{ + double v = vget(x, 0); + int i; + + for (i = 1; i < x->size; i++) + v = log_sum(v, vget(x, i)); + + for (i = 0; i < x->size; i++) + vset(x, i, vget(x,i)-v); +} + + +/* + * normalize a positive vector + * + */ + +void normalize(gsl_vector* x) +{ + double v = 0; + int i; + + for (i = 0; i < x->size; i++) + v += vget(x, i); + + for (i = 0; i < x->size; i++) + vset(x, i, vget(x, i) / v); +} + + +/* + * exponentiate a vector + * + */ + +void vct_exp(gsl_vector* x) +{ + int i; + + for (i = 0; i < x->size; i++) + vset(x, i, exp(vget(x, i))); +} + + +/* + * maximize a function using its derivative + * + */ + +void optimize_fdf(int dim, + gsl_vector* x, + void* params, + void (*fdf)(const gsl_vector*, void*, double*, gsl_vector*), + void (*df)(const gsl_vector*, void*, gsl_vector*), + double (*f)(const gsl_vector*, void*), + double* f_val, + double* conv_val, + int* niter) +{ + gsl_multimin_function_fdf obj; + obj.f = f; + obj.df = df; + obj.fdf = fdf; + obj.n = dim; + obj.params = params; + +// const gsl_multimin_fdfminimizer_type * method = +// gsl_multimin_fdfminimizer_vector_bfgs; + const gsl_multimin_fdfminimizer_type * method = + gsl_multimin_fdfminimizer_conjugate_fr; + + gsl_multimin_fdfminimizer * opt = + gsl_multimin_fdfminimizer_alloc(method, dim); + + gsl_multimin_fdfminimizer_set(opt, &obj, x, 0.01, 1e-3); + + int iter = 0, status; + double converged, f_old = 0; + do + { + iter++; + status = gsl_multimin_fdfminimizer_iterate(opt); + // assert(status==0); + converged = fabs((f_old - opt->f) / (dim * f_old)); + // status = gsl_multimin_test_gradient(opt->gradient, 1e-3); + // printf("f = %1.15e; conv = %5.3e; norm = %5.3e; niter = %03d\n", + // opt->f, converged, norm(opt->gradient), iter); + f_old = opt->f; + } + while (converged > 1e-8 && iter < MAX_ITER); + // while (status == GSL_CONTINUE); + *f_val = opt->f; + *conv_val = converged; + *niter = iter; + gsl_multimin_fdfminimizer_free(opt); +} + + + +/* + * maximize a function + * + */ + +void optimize_f(int dim, + gsl_vector* x, + void* params, + double (*f)(const gsl_vector*, void*)) +{ + gsl_multimin_function obj; + obj.f = f; + obj.n = dim; + obj.params = params; + + const gsl_multimin_fminimizer_type * method = + gsl_multimin_fminimizer_nmsimplex; + + gsl_multimin_fminimizer * opt = + gsl_multimin_fminimizer_alloc(method, dim); + + gsl_vector * step_size = gsl_vector_alloc(dim); + gsl_vector_set_all(step_size, 1); + gsl_multimin_fminimizer_set(opt, &obj, x, step_size); + + int iter = 0, status; + double converged, f_old; + do + { + iter++; + f_old = opt->fval; + status = gsl_multimin_fminimizer_iterate(opt); + converged = fabs((f_old - opt->fval) / f_old); + printf("f = %1.15e; conv = %5.3e; size = %5.3e; niter = %03d\n", + opt->fval, converged, opt->size, iter); + } + while ((converged > 1e-10) || (iter < 10000)); + // while (status == GSL_CONTINUE); + printf("f = %1.15e; conv = %5.3e; niter = %03d\n", + opt->fval, converged, iter); + + gsl_multimin_fminimizer_free(opt); + gsl_vector_free(step_size); +} + + +/* + * check if a directory exists + * + * !!! shouldn't be here + */ + +int directory_exist(const char *dname) +{ + struct stat st; + int ret; + + if (stat(dname,&st) != 0) + { + return 0; + } + + ret = S_ISDIR(st.st_mode); + + if(!ret) + { + errno = ENOTDIR; + } + + return ret; +} + +void make_directory(char* name) +{ + mkdir(name, S_IRUSR|S_IWUSR|S_IXUSR); +} + +gsl_rng* new_random_number_generator() +{ + gsl_rng* random_number_generator = gsl_rng_alloc(gsl_rng_taus); + long t1; + (void) time(&t1); + + if (FLAGS_rng_seed) { + t1 = FLAGS_rng_seed; + } + + // !!! DEBUG + // t1 = 1147530551; + printf("RANDOM SEED = %ld\n", t1); + gsl_rng_set(random_number_generator, t1); + return(random_number_generator); +} + diff --git a/dtm_release/dtm/gsl-wrappers.h b/dtm_release/dtm/gsl-wrappers.h new file mode 100644 index 0000000000000000000000000000000000000000..02956b0c5ea2da80c20b865be7b6e33c136ac6ba --- /dev/null +++ b/dtm_release/dtm/gsl-wrappers.h @@ -0,0 +1,99 @@ +#ifndef GSL_WRAPPERS_H +#define GSL_WRAPPERS_H + +// #include <gsl/gsl_check_range.h> +#include <gsl/gsl_vector.h> +#include <gsl/gsl_matrix.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_linalg.h> +#include <gsl/gsl_eigen.h> +#include <gsl/gsl_rng.h> +#include <gsl/gsl_randist.h> +#include <gsl/gsl_multimin.h> +#include <gsl/gsl_math.h> +#include <gsl/gsl_blas.h> +#include <math.h> +#include <assert.h> +#include <time.h> +#include <sys/stat.h> +#include <sys/types.h> + +#define outlog(format, args...) \ + fprintf(stderr, format, args); \ + fprintf(stderr, "\n"); + +double safe_log(double); +double log_sum(double, double); + +static inline double vget(const gsl_vector* v, int i) +{ return(gsl_vector_get(v, i)); }; + +static inline void vset(gsl_vector* v, int i, double x) +{ gsl_vector_set(v, i, x); }; + +// Increment a vector element by a double. +void vinc(gsl_vector*, int, double); + +static inline double mget(const gsl_matrix* m, int i, int j) +{ return(gsl_matrix_get(m, i, j)); }; + +static inline void mset(gsl_matrix* m, int i, int j, double x) +{ gsl_matrix_set(m, i, j, x); }; + +void msetcol(gsl_matrix* m, int r, const gsl_vector* val); + +// Increment a matrix element by a double. +void minc(gsl_matrix*, int, int, double); +void msetrow(gsl_matrix*, int, const gsl_vector*); + +void col_sum(gsl_matrix*, gsl_vector*); + +void vct_printf(const gsl_vector* v); +void mtx_printf(const gsl_matrix* m); +void vct_fscanf(const char*, gsl_vector* v); +void mtx_fscanf(const char*, gsl_matrix* m); +void vct_fprintf(const char* filename, gsl_vector* v); +void mtx_fprintf(const char* filename, const gsl_matrix* m); + +double log_det(gsl_matrix*); + +void matrix_inverse(gsl_matrix*, gsl_matrix*); + +void sym_eigen(gsl_matrix*, gsl_vector*, gsl_matrix*); + +double sum(const gsl_vector* v); + +double norm(gsl_vector * v); + +void vct_log(gsl_vector* v); +void vct_exp(gsl_vector* x); + +void choose_k_from_n(int k, int n, int* result); + +void log_normalize(gsl_vector* x); +void normalize(gsl_vector* x); + +void optimize(int dim, + gsl_vector* x, + void* params, + void (*fdf)(const gsl_vector*, void*, double*, gsl_vector*), + void (*df)(const gsl_vector*, void*, gsl_vector*), + double (*f)(const gsl_vector*, void*)); + +void optimize_fdf(int dim, + gsl_vector* x, + void* params, + void (*fdf)(const gsl_vector*, void*, double*, gsl_vector*), + void (*df)(const gsl_vector*, void*, gsl_vector*), + double (*f)(const gsl_vector*, void*), + double* f_val, + double* conv_val, + int* niter); + +void log_write(FILE* f, char* string); +int directory_exist(const char *dname); +void make_directory(char* name); + +gsl_rng* new_random_number_generator(); + +#endif diff --git a/dtm_release/dtm/lda-seq.c b/dtm_release/dtm/lda-seq.c new file mode 100644 index 0000000000000000000000000000000000000000..256d320a4727041030c9af457f58117b4f84ca46 --- /dev/null +++ b/dtm_release/dtm/lda-seq.c @@ -0,0 +1,1370 @@ +// Authors: David Blei (blei@cs.princeton.edu) +// Sean Gerrish (sgerrish@cs.princeton.edu) +// +// Copyright 2011 Sean Gerrish and David Blei +// All Rights Reserved. +// +// See the README for this package for details about modifying or +// distributing this software. + +#include "lda-seq.h" + +#include "gflags.h" +#include <gsl/gsl_linalg.h> +#include <gsl/gsl_blas.h> +#include <gsl/gsl_vector_double.h> + +extern int LDA_INFERENCE_MAX_ITER; + +static double* scaled_influence = NULL; + +// const int TIME = 61; +const int TIME = -3; +const double PI = 3.141592654; + +DEFINE_int32(lda_sequence_max_iter, + 20, + "The maximum number of iterations."); +DEFINE_int32(lda_sequence_min_iter, + 1, + "The maximum number of iterations."); + +DEFINE_int32(forward_window, + 1, + "The forward window for deltas. " + "If negative, we use a beta with mean " + "5."); + +DEFINE_string(normalize_docs, + "normalize", + "Describes how documents's wordcounts " + "are considered for finding influence. " + "Options are \"normalize\", \"none\", " + "\"occurrence\", \"log\", or \"log_norm\"."); + +DEFINE_int32(save_time, + 1e20, + "Save a specific time. If -1, save all times."); + +DEFINE_int32(fix_topics, + 0, + "Fix a set of this many topics. This amounts " + "to fixing these topics' variance at 1e-10."); + + +DECLARE_string(model); +DECLARE_int32(max_number_time_points); +DECLARE_double(sigma_d); +DECLARE_double(sigma_l); +DECLARE_double(sigma_c); +DECLARE_double(sigma_cv); + +/* + * populate an LDA model at a particular time point + * + */ + +inf_var* inf_var_alloc(int number_topics, + corpus_seq_t* corpus_seq) { + // Hate to do this, but I had trouble using it before. This should + // be the first place we use it; otherwise we'll get a sigsev nil. + if (scaled_influence == NULL) { + scaled_influence = NewScaledInfluence(FLAGS_max_number_time_points); + } + + inf_var* inf_var_ptr = (inf_var*) malloc(sizeof(inf_var)); + inf_var_ptr->doc_weights = (gsl_matrix**) malloc(sizeof(gsl_matrix*) + * corpus_seq->len); + inf_var_ptr->renormalized_doc_weights = (gsl_matrix**) malloc( + sizeof(gsl_matrix*) + * corpus_seq->len); + inf_var_ptr->ntime = corpus_seq->len; + int i=0; + for (i=0; i < corpus_seq->len; ++i) { + corpus_t* corpus = corpus_seq->corpus[i]; + outlog("creating matrix. %d %d", corpus->ndocs, number_topics); + if (corpus->ndocs == 0) { + inf_var_ptr->doc_weights[i] = (gsl_matrix*) malloc(sizeof(gsl_matrix)); + inf_var_ptr->doc_weights[i]->size1 = 0; + inf_var_ptr->doc_weights[i]->size2 = number_topics; + inf_var_ptr->renormalized_doc_weights[i] = (gsl_matrix*) malloc(sizeof(gsl_matrix)); + inf_var_ptr->renormalized_doc_weights[i]->size1 = 0; + inf_var_ptr->renormalized_doc_weights[i]->size2 = number_topics; + } else { + inf_var_ptr->doc_weights[i] = gsl_matrix_calloc(corpus->ndocs, + number_topics); + inf_var_ptr->renormalized_doc_weights[i] = gsl_matrix_calloc(corpus->ndocs, + number_topics); + } + } + return inf_var_ptr; +} + +void inf_var_free(inf_var* ptr) { + // TODO. +} + +// Solves the linear system Ax = b for x. +// Assumes that x is already allocated. +void Solve(gsl_matrix* A, + const gsl_vector* b, + gsl_vector* x) { + int permutation_sign; + gsl_permutation* permutation = gsl_permutation_alloc(b->size); + gsl_linalg_LU_decomp(A, permutation, &permutation_sign); + gsl_linalg_LU_solve(A, permutation, b, x); + gsl_permutation_free(permutation); +} + + +// Find the sums of influence of all documents in advance. +// g has scores for everything *up to but not including* g. +void InfluenceTotalFixed(lda_seq* seq, + const corpus_seq_t* data) { + gsl_vector* exp_tmp = gsl_vector_alloc(seq->nterms); + + for (int k=0; k < seq->ntopics; ++k) { + + for (int s=0; s < seq->nseq; ++s) { + // Pull out elements of g, and make sure to set them to 0! + gsl_vector_view g = gsl_matrix_column( + seq->influence_sum_lgl[k], s); + gsl_vector_set_zero(&g.vector); + + for (int t=0; t <= s; ++t) { + gsl_vector_view w_phi_l = + gsl_matrix_column(seq->topic[k]->w_phi_l, t); + gsl_vector_memcpy(exp_tmp, &w_phi_l.vector); + gsl_vector_scale(exp_tmp, scaled_influence[s - t]); + gsl_vector_add(&g.vector, exp_tmp); + } + } + } + gsl_vector_free(exp_tmp); +} + + +void DumpTimeDocTopicStats(const char* root, + size_t t, + corpus_t* corpus, + gsl_matrix** phi) { + // For all documents, dump the top topics. + + char name[400]; + // Dump the top topics for each word. + sprintf(name, "%s%ld_doc_term_topics.dat", root, t); + FILE* f = fopen(name, "w"); + for (unsigned int d=0; d < corpus->ndocs; ++d) { + gsl_matrix* phi_d = phi[d]; + doc_t* doc = corpus->doc[d]; + for (unsigned int n=0; n < doc->nterms; ++n) { + + unsigned int w = doc->word[n]; + + // First, find the max topic weight. + unsigned int max_topic_index = 0; + double max_topic_weight = gsl_matrix_get(phi_d, n, 0); + for (unsigned int k=0; k < phi_d->size2; ++k) { + double phi_d_n_k = gsl_matrix_get(phi_d, n, k); + if (phi_d_n_k > max_topic_weight) { + max_topic_weight = phi_d_n_k; + max_topic_index = k; + } + } + + fprintf(f, "%d:%d:%.3f", w, max_topic_index, max_topic_weight); + + if (n < doc->nterms - 1) { + fprintf(f, " "); + } + } + fprintf(f, "\n"); + } + fclose(f); +} + +void PrepareRegressionComponents( + corpus_t* corpus, + lda_seq* seq, + unsigned int k, + gsl_matrix* W_phi, + gsl_matrix* W_phi_var, + gsl_vector* d_phi_var_tmp, + gsl_vector* response, + gsl_vector* d_tmp, + gsl_matrix* dd_tmp, + gsl_vector* document_weights, + gsl_matrix* W_phi_tmp, + gsl_vector* exp_h_tmp) { + + // Then left-multiply this by W_phi: + gsl_blas_dgemv(CblasTrans, + 1.0, + W_phi, + response, + 0.0, + d_tmp); + + // Set up the transformation matrix. + // First, set up W_phi^T \Lambda W_phi. + gsl_matrix_memcpy(W_phi_tmp, W_phi); + for (unsigned int d=0; d < corpus->ndocs; ++d) { + gsl_vector_view col = gsl_matrix_column(W_phi_tmp, d); + gsl_vector_mul(&col.vector, exp_h_tmp); + } + + // Yuck. Maybe we should do this sparsely? + // Probably won't be too bad, at least for now. + gsl_blas_dgemm(CblasTrans, + CblasNoTrans, + 1.0, + W_phi_tmp, + W_phi, + 0.0, + dd_tmp); + + gsl_blas_dgemv(CblasTrans, + 1.0, + W_phi_var, + exp_h_tmp, + 0.0, + d_phi_var_tmp); + + // Next, add elements to the diagonal of dd_tmp. + for (unsigned int d=0; d < corpus->ndocs; ++d) { + double value = gsl_matrix_get(dd_tmp, d, d); + value += (seq->topic[k]->chain_variance + / (FLAGS_sigma_d * FLAGS_sigma_d)); + // sgerrish: Is this supposed to be multiplied by anything? + value += gsl_vector_get(d_phi_var_tmp, d); + gsl_matrix_set(dd_tmp, d, d, value); + } +} + +void SetExpHTmp(lda_seq* seq, + const corpus_seq_t* data, + unsigned int t, + unsigned int k, + unsigned int n, + gsl_vector* exp_h_tmp, + gsl_vector* zw_tmp, + gsl_vector** exp_i_tmp) { + gsl_vector_set_zero(exp_h_tmp); + for (int i = t; i < seq->nseq; ++i) { + gsl_vector_view mean_i_current = + gsl_matrix_column(seq->topic[k]->e_log_prob, i); + gsl_vector_view var_i_current = + gsl_matrix_column(seq->topic[k]->variance, i + 1); + + // Set up exp_h_tmp. + gsl_vector_memcpy(zw_tmp, &var_i_current.vector); + gsl_vector_sub(zw_tmp, &mean_i_current.vector); + gsl_vector_scale(zw_tmp, 2.0); + for (n=0; n < data->nterms; ++n) { + gsl_vector_set(zw_tmp, n, + exp(gsl_vector_get(zw_tmp, n))); + } + gsl_vector_scale(zw_tmp, + scaled_influence[i - t] + * scaled_influence[i - t]); + gsl_vector_add(exp_h_tmp, zw_tmp); + + // Set up exp_i_tmp. + gsl_vector_memcpy(exp_i_tmp[i], &var_i_current.vector); + gsl_vector_scale(exp_i_tmp[i], 0.5); + gsl_vector_sub(exp_i_tmp[i], &mean_i_current.vector); + for (n=0; n < data->nterms; ++n) { + gsl_vector_set(exp_i_tmp[i], n, + exp(gsl_vector_get(exp_i_tmp[i], n))); + } + } +} + +double update_inf_var_fixed(lda_seq* seq, + const corpus_seq_t* data, + gsl_matrix** phi, + size_t t, + const char* root, + int dump_doc_stats) { + double lhood = 0.0; + // Note that we're missing a suspicious factor of -2 on the document + // weights currently. We won't worry about that for now (since + // we're still experimenting), but it should soon be fixed. + corpus_t* corpus = data->corpus[t]; + if (!corpus->ndocs) { + return lhood; + } + inf_var* influence = seq->influence; + if (t != TIME && 0) { + return lhood; + } + + // We need access to the following: + gsl_matrix* documents_topics_t = influence->doc_weights[t]; + gsl_matrix* renormalized_documents_topics_t = influence->renormalized_doc_weights[t]; + + size_t k; + + gsl_matrix* W_phi = gsl_matrix_calloc( + seq->nterms, corpus->ndocs); + gsl_matrix* W2_phi2 = gsl_matrix_calloc( + seq->nterms, corpus->ndocs); + gsl_matrix* W_phi_var = + gsl_matrix_calloc(seq->nterms, corpus->ndocs); + gsl_matrix* W_phi_tmp = gsl_matrix_alloc( + seq->nterms, corpus->ndocs); + gsl_matrix* dd_tmp = gsl_matrix_alloc( + corpus->ndocs, corpus->ndocs); + gsl_vector* xd_tmp = gsl_vector_calloc( + corpus->ndocs); + gsl_vector* yw_tmp = gsl_vector_calloc( + seq->nterms); + gsl_vector* zw_tmp = gsl_vector_calloc( + seq->nterms); + gsl_vector* terms_inc_tmp = gsl_vector_calloc( + seq->nterms); + gsl_vector** exp_i_tmp = new gsl_vector*[seq->nseq]; + for (int i=0; i < seq->nseq; ++i) { + exp_i_tmp[i] = gsl_vector_calloc(seq->nterms); + } + + int n; + + gsl_vector* response = gsl_vector_calloc(seq->nterms); + gsl_vector* exp_h_tmp = gsl_vector_calloc(seq->nterms); + gsl_vector* d_tmp = gsl_vector_calloc(corpus->ndocs); + gsl_vector* d_phi_var_tmp = gsl_vector_calloc(corpus->ndocs); + + // assert(post->phi->size2 == documents_topics_t->size2); + double* total_terms = (double*) malloc(sizeof(double) * corpus->ndocs); + double* renormalization_totals = (double*) malloc(sizeof(double) * corpus->ndocs); + for (k=0; k < documents_topics_t->size2; ++k) { + // Set up W_phi and W_phi_var. + for (int d=0; d < corpus->ndocs; ++d) { + doc_t* doc = corpus->doc[d]; + total_terms[d] = 0.0; + renormalization_totals[d] = 0.0; + double log_norm_sum = 0.0; + for (n=0; n < doc->nterms; ++n) { + total_terms[d] += doc->count[n]; + if (FLAGS_normalize_docs == "normalize") { + renormalization_totals[d] = 1.0; + } else if (FLAGS_normalize_docs == "log") { + renormalization_totals[d] += log(doc->count[n] + 1); + } else if (FLAGS_normalize_docs == "log_norm") { + double weight = log(doc->count[n] / doc->total); + renormalization_totals[d] += weight; + } else if (FLAGS_normalize_docs == "identity") { + renormalization_totals[d] += doc->count[n]; + } else if (FLAGS_normalize_docs == "occurrence") { + renormalization_totals[d] = 1.0; + } + } + assert(doc->total == total_terms[d]); + + for (n=0; n < doc->nterms; ++n) { + // Phi, for the doc's term n and topic k. + double phi_d_n_k = gsl_matrix_get(phi[d], n, k); + + // This cast should happen automatically because total_terms is a double, + // but we make the cast here to be explicit and to avoid bugs later. + double number_terms; + if (FLAGS_normalize_docs == "normalize") { + number_terms = ((double) doc->count[n] + / (double) total_terms[d]); + } else if (FLAGS_normalize_docs == "log") { + number_terms = log(doc->count[n] + 1.0); + } else if (FLAGS_normalize_docs == "log_norm") { + number_terms = log(doc->count[n] / total_terms[d]); + renormalization_totals[d] += log(doc->count[n] / total_terms[d]); + } else if (FLAGS_normalize_docs == "identity") { + number_terms = doc->count[n]; + } else if (FLAGS_normalize_docs == "occurrence") { + number_terms = ((double) doc->count[n] / (double) total_terms[d]); + assert(doc->count[n] == 1); + } else { + assert(0); + } + + gsl_matrix_set(W_phi, doc->word[n], d, + number_terms * phi_d_n_k); + gsl_matrix_set(W2_phi2, doc->word[n], d, + number_terms * number_terms + * phi_d_n_k * phi_d_n_k); + gsl_matrix_set(W_phi_var, doc->word[n], d, + number_terms * number_terms + * (phi_d_n_k - phi_d_n_k * phi_d_n_k)); + } + } + + gsl_vector_view document_weights = gsl_matrix_column( + documents_topics_t, + k); + gsl_vector_view renormalized_document_weights = gsl_matrix_column( + renormalized_documents_topics_t, + k); + assert(seq->topic[k]->e_log_prob->size2 == data->len); + + // Now, with w_phi_var, etc. set, determine + // \sum_{i=t}^{T-1} r(...) h(t, i) + SetExpHTmp(seq, + data, + t, + k, + n, + exp_h_tmp, + zw_tmp, + exp_i_tmp); + + // Next, set up the weighted response, + // \exp_{-m + v / 2) \circ (m_{t+1} - m_t + v_t}). + // Here we also subtract the current l's contribution to influence_sum_lgl. + gsl_vector_view w_phi_l_t = gsl_matrix_column(seq->topic[k]->w_phi_l, t); + gsl_vector_set_zero(response); + for (int i = t; i < seq->nseq - 1; ++i) { + gsl_vector_view total_influence_time_i = + gsl_matrix_column(seq->influence_sum_lgl[k], i); + gsl_vector_memcpy(zw_tmp, &w_phi_l_t.vector); + gsl_vector_scale(zw_tmp, scaled_influence[i - t]); + gsl_vector_sub(&total_influence_time_i.vector, zw_tmp); + + // Now, copy this total influence at time i back into zw_tmp. + gsl_vector_memcpy(zw_tmp, &total_influence_time_i.vector); + gsl_vector_mul(zw_tmp, exp_i_tmp[i]); + + gsl_vector_view mean_i_current = + gsl_matrix_column(seq->topic[k]->e_log_prob, i); + gsl_vector_view mean_i_next = + gsl_matrix_column(seq->topic[k]->e_log_prob, i + 1); + gsl_vector_view var_i_current = + gsl_matrix_column(seq->topic[k]->variance, i + 1); + gsl_vector_memcpy(terms_inc_tmp, &mean_i_next.vector); + gsl_vector_sub(terms_inc_tmp, &mean_i_current.vector); + gsl_vector_add(terms_inc_tmp, &var_i_current.vector); + gsl_vector_sub(terms_inc_tmp, zw_tmp); + assert(data->nterms == terms_inc_tmp->size); + gsl_vector_mul(terms_inc_tmp, exp_i_tmp[i]); + gsl_vector_scale(terms_inc_tmp, scaled_influence[i - t]); + + gsl_vector_add(response, terms_inc_tmp); + } + + PrepareRegressionComponents(corpus, + seq, + k, + W_phi, + W_phi_var, + d_phi_var_tmp, + response, + d_tmp, + dd_tmp, + &document_weights.vector, + W_phi_tmp, + exp_h_tmp); + // Finally, solve for the document weights d! + Solve(dd_tmp, + d_tmp, + &document_weights.vector); + + // Keep track of the iteration so we can dump certain stats + // occasionally (but not always). + static int dump_count = 0; + ++dump_count; + + if (FLAGS_save_time == t) { + outlog("Updating topic %ld, time %ld.", k, t); + char name[400]; + sprintf(name, "%s%ld_%ld_weighted_document_terms.dat", root, k, t); + FILE* f = fopen(name, "w"); + params_write_sparse_gsl_matrix(f, "W_phi", W_phi); + fclose(f); + + sprintf(name, "%s%ld_%ld_weighted_document_terms_var.dat", root, k, t); + f = fopen(name, "w"); + params_write_sparse_gsl_matrix(f, "W_phi_var", W_phi_var); + fclose(f); + + sprintf(name, "%s%ld_%ld_phi.dat", root, k, t); + f = fopen(name, "w"); + params_write_gsl_matrix(f, "phi 0", phi[0]); + // params_write_gsl_matrix(f, "phi 2", phi[1]); + // params_write_gsl_matrix(f, "phi 2", phi[7]); + fclose(f); + + sprintf(name, "%s%ld_%ld_weighted_document_terms_sq.dat", root, k, t); + f = fopen(name, "w"); + params_write_sparse_gsl_matrix(f, "W2_phi2", W2_phi2); + fclose(f); + + sprintf(name, "%s%ld_%ld_weighted_response.dat", root, k, t); + f = fopen(name, "w"); + params_write_gsl_vector_multiline(f, "weighted_response", d_tmp); + fclose(f); + + sprintf(name, "%s%ld_%ld_response.dat", root, k, t); + f = fopen(name, "w"); + params_write_gsl_vector_multiline(f, "response", response); + fclose(f); + + sprintf(name, "%s%ld_%ld_exp_h.dat", root, k, t); + f = fopen(name, "w"); + params_write_gsl_vector_multiline(f, "exp_h", exp_h_tmp); + fclose(f); + + if (dump_doc_stats || dump_count % 4 == 0) { + sprintf(name, "%s%ld_%ld_document_document_matrix.dat", root, k, t); + f = fopen(name, "w"); + params_write_gsl_matrix(f, "document_document_matrix", dd_tmp); + fclose(f); + + sprintf(name, "%s%ld_%ld_exp_h.dat", root, k, t); + f = fopen(name, "w"); + params_write_gsl_vector_multiline(f, "exp_h", exp_h_tmp); + fclose(f); + } + } + + if (FLAGS_save_time == -1) { + // First, dump phi's for the top topics. + DumpTimeDocTopicStats(root, t, corpus, phi); + } + outlog("Done updating topic %ld, time %ld.", k, t); + + for (int d = 0; d < document_weights.vector.size; ++d) { + gsl_vector_set(&renormalized_document_weights.vector, d, + vget(&document_weights.vector, d) + * renormalization_totals[d]); + } + + // Now copy this and several products to + // the sslm_var object. + gsl_vector_view w_phi_l = + gsl_matrix_column(seq->topic[k]->w_phi_l, t); + gsl_blas_dgemv(CblasNoTrans, + 1.0, + W_phi, + &document_weights.vector, + 0.0, + &w_phi_l.vector); + + // Copy this value back into lgl. + for (int i=t; i < seq->nseq - 1; ++i) { + gsl_vector_view total_influence_time_i = + gsl_matrix_column(seq->influence_sum_lgl[k], i); + gsl_vector_memcpy(zw_tmp, &w_phi_l.vector); + gsl_vector_scale(zw_tmp, scaled_influence[i - t]); + gsl_vector_add(&total_influence_time_i.vector, zw_tmp); + } + + // Keep track of the term we need to add to m_update_coeff. + gsl_vector_memcpy(terms_inc_tmp, &w_phi_l.vector); + gsl_vector_mul(terms_inc_tmp, &w_phi_l.vector); + + // Copy and square the document weights vector. + for (int i = 0; i < xd_tmp->size; ++i) { + double value = gsl_vector_get(&document_weights.vector, i); + value = value * value + FLAGS_sigma_l * FLAGS_sigma_l; + gsl_vector_set(xd_tmp, i, value); + } + gsl_blas_dgemv(CblasNoTrans, + 1.0, + W_phi_var, + xd_tmp, + 0.0, + yw_tmp); + gsl_vector_add(terms_inc_tmp, yw_tmp); + + for (int i = 0; i < xd_tmp->size; ++i) { + gsl_vector_set(xd_tmp, i, FLAGS_sigma_l * FLAGS_sigma_l); + } + gsl_blas_dgemv(CblasNoTrans, + 1.0, + W2_phi2, + xd_tmp, + 0.0, + yw_tmp); + gsl_vector_add(terms_inc_tmp, yw_tmp); + + // Store an update coefficient for the beta updates. + for (int i = t; i < seq->nseq; ++i) { + gsl_vector_view m_update_coeff_h = + gsl_matrix_column(seq->topic[k]->m_update_coeff, i); + if (t == 0) { + gsl_vector_set_zero(&m_update_coeff_h.vector); + } + gsl_vector_memcpy(yw_tmp, terms_inc_tmp); + gsl_vector_scale(yw_tmp, scaled_influence[i - t]); + gsl_vector_add(&m_update_coeff_h.vector, yw_tmp); + } + + for (int i = t; i < seq->nseq; ++i) { + gsl_vector_view m_update_coeff_g = + gsl_matrix_column(seq->topic[k]->m_update_coeff_g, i); + if (t == 0) { + gsl_vector_set_zero(&m_update_coeff_g.vector); + } + gsl_vector_memcpy(yw_tmp, &w_phi_l.vector); + gsl_vector_scale(yw_tmp, scaled_influence[i - t]); + gsl_vector_add(&m_update_coeff_g.vector, yw_tmp); + } + + for (int i = 0; i < corpus->ndocs; ++i) { + double value = gsl_vector_get(&document_weights.vector, i); + + // While we're here, increment the likelihood. + lhood += (-(value * value + FLAGS_sigma_l * FLAGS_sigma_l) + / (2.0 * FLAGS_sigma_d * FLAGS_sigma_d) + - 0.5 * log(2 * PI) + - log(FLAGS_sigma_d * FLAGS_sigma_d)); + } + } + free(total_terms); + free(renormalization_totals); + gsl_matrix_free(W_phi); + gsl_matrix_free(W_phi_tmp); + gsl_matrix_free(W2_phi2); + gsl_matrix_free(W_phi_var); + gsl_matrix_free(dd_tmp); + gsl_vector_free(exp_h_tmp); + gsl_vector_free(response); + gsl_vector_free(terms_inc_tmp); + for (int i=0; i < seq->nseq; ++i) { + gsl_vector_free(exp_i_tmp[i]); + } + delete[] exp_i_tmp; + gsl_vector_free(d_tmp); + gsl_vector_free(d_phi_var_tmp); + gsl_vector_free(xd_tmp); + gsl_vector_free(yw_tmp); + gsl_vector_free(zw_tmp); + + return lhood; +} + + +void make_lda_from_seq_slice(lda* lda_m, + lda_seq* lda_seq_m, + int time) { + // set lda model topics + // !!! note: we should be able to point to the view... + + int k; + for (k = 0; k < lda_seq_m->ntopics; k++) + { + // get topic + gsl_vector s = + gsl_matrix_column(lda_seq_m->topic[k]->e_log_prob, + time).vector; + gsl_vector d = + gsl_matrix_column(lda_m->topics, k).vector; + gsl_blas_dcopy(&s, &d); + } + gsl_blas_dcopy(lda_seq_m->alpha, lda_m->alpha); + } + +static gsl_matrix* g_alloc(lda_seq* model, + const corpus_seq_t* data, + int time) { + gsl_matrix* g = gsl_matrix_calloc(model->nterms, + model->ntopics); + double exp_m, m, m_next; + for (int k = 0; k < model->ntopics; ++k) { + for (int w=0; w < model->nterms; ++w) { + double variance_first = mget(model->topic[k]->variance, w, time); + double m = mget(model->topic[k]->e_log_prob, w, time); + double m_next; + exp_m = exp(-m + variance_first / 2.0); + gsl_matrix_set(g, w, k, + (scaled_influence[0] + * -variance_first + * exp_m)); + + for (int i=time; i < model->nseq - 1; ++i) { + // This loop is kind of going overboard, but at least we + // do this once per E-M iteration. + double influence_other_times = 0.0; + for (int j = 0; j < i; ++j) { + exp_m = exp(-mget(model->topic[k]->e_log_prob, w, j) + + mget(model->topic[k]->variance, w, j) / 2.0); + // Note that we skip the other docs in this time period. + // Those get special treatment below. + if (j != time) { + influence_other_times += ( + mget(model->topic[k]->w_phi_l, w, j) + * scaled_influence[i - j] + * exp_m); + } + } + + m = mget(model->topic[k]->e_log_prob, w, i); + m_next = mget(model->topic[k]->e_log_prob, w, i + 1); + // Increment the current count by this value. + gsl_matrix_set(g, w, k, + mget(g, w, k) + + (scaled_influence[i - time] + * (m_next - m - influence_other_times))); + } + exp_m = exp(-m + + mget(model->topic[k]->variance, w, time) / 2.0); + gsl_matrix_set(g, w, k, mget(g, w, k) * exp_m); + } + } + return g; +} + +static gsl_matrix* g3_alloc(lda_seq* model, + const corpus_seq_t* data, + int time) { + gsl_matrix* g = gsl_matrix_calloc(model->nterms, + model->ntopics); + double exp_m, m, m_next, variance, total; + for (int k = 0; k < model->ntopics; ++k) { + for (int w=0; w < model->nterms; ++w) { + total = 0.0; + for (int i=time; i < model->nseq - 1; ++i) { + // This loop is kind of going overboard, but at least we + // do this once per E-M iteration. + variance = mget(model->topic[k]->variance, w, i + 1); + m = mget(model->topic[k]->e_log_prob, w, i); + m_next = mget(model->topic[k]->e_log_prob, w, i + 1); + exp_m = exp(-m + variance / 2.0); + total += (scaled_influence[i - time] + * exp_m + * (m_next - m + variance)); + } + gsl_matrix_set(g, w, k, total); + } + } + return g; +} + +static gsl_matrix* g4_alloc(lda_seq* model, + const corpus_seq_t* data, + int time) { + gsl_matrix* g = gsl_matrix_calloc(model->nterms, + model->ntopics); + double exp_m, exp_m_scaled, m, total, variance, w_phi_l; + for (int k = 0; k < model->ntopics; ++k) { + for (int w=0; w < model->nterms; ++w) { + total = 0.0; + for (int i=time; i < model->nseq - 1; ++i) { + // This loop is kind of going overboard, but at least we + // do this once per E-M iteration. + variance = mget(model->topic[k]->variance, w, i + 1); + m = mget(model->topic[k]->e_log_prob, w, i); + exp_m = exp(-2.0 * m + 2.0 * variance); + exp_m_scaled = exp_m * scaled_influence[i - time]; + for (int j=0; j <= i; ++j) { + w_phi_l = mget(model->topic[k]->w_phi_l, w, j); + total += exp_m_scaled * w_phi_l * scaled_influence[i - j]; + } + } + gsl_matrix_set(g, w, k, total); + } + } + return g; +} + +static gsl_matrix* g5_alloc(lda_seq* model, + const corpus_seq_t* data, + int time) { + gsl_matrix* g = gsl_matrix_calloc(model->nterms, + model->ntopics); + double exp_m, m, total, variance; + for (int k = 0; k < model->ntopics; ++k) { + for (int w=0; w < model->nterms; ++w) { + total = 0.0; + for (int i=time; i < model->nseq - 1; ++i) { + // This loop is kind of going overboard, but at least we + // do this once per E-M iteration. + variance = mget(model->topic[k]->variance, w, i + 1); + m = mget(model->topic[k]->e_log_prob, w, i); + exp_m = exp(-2.0 * m + 2.0 * variance); + total += exp_m * (scaled_influence[i - time] + * scaled_influence[i - time]); + } + gsl_matrix_set(g, w, k, total); + } + } + return g; +} + + /* + * compute the likelihood of a sequential corpus under an LDA seq + * model. return the likelihood bound. + * + */ + +static void InferDTMSeq(const int K, + unsigned int iter, + unsigned int last_iter, + const corpus_seq_t* data, + gsl_matrix* gammas, + gsl_matrix* lhoods, + lda* lda_model, + lda_post* post, + lda_seq* model, + gsl_matrix** suffstats, + double* bound) { + int doc_index = 0; + for (int t = 0; t < data->len; t++) { + // Prepare coefficients for the phi updates. This change is + // relatively painless. + make_lda_from_seq_slice(lda_model, model, t); + int ndocs = data->corpus[t]->ndocs; + for (int d = 0; d < ndocs; d++) { + gsl_vector gam = gsl_matrix_row(gammas, doc_index).vector; + gsl_vector lhood = gsl_matrix_row(lhoods, doc_index).vector; + post->gamma = &gam; + post->doc = data->corpus[t]->doc[d]; + post->lhood = &lhood; + double doc_lhood; + // For now, only do the standard, phi-based update. + if (iter == 0) { + doc_lhood = fit_lda_post(d, t, + post, NULL, + NULL, + NULL, + NULL, + NULL); + } else { + doc_lhood = fit_lda_post(d, t, post, model, NULL, + NULL, NULL, NULL); + } + if (suffstats != NULL) { + update_lda_seq_ss(t, + data->corpus[t]->doc[d], + post, + suffstats); + } + *bound += doc_lhood; + doc_index++; + } + } +} + +static void InferDIMSeq(const int K, + unsigned int iter, + unsigned int last_iter, + const char* file_root, + const corpus_seq_t* data, + gsl_matrix* gammas, + gsl_matrix* lhoods, + lda* lda_model, + lda_post* post, + lda_seq* model, + gsl_matrix** suffstats, + double* bound) { + int doc_index = 0; + for (int t = 0; t < data->len; t++) { + // Prepare coefficients for the phi updates. This change is + // relatively painless. + gsl_matrix* g = g_alloc(model, data, t); + + gsl_matrix* g3_matrix = g3_alloc(model, data, t); + gsl_matrix* g4_matrix = g4_alloc(model, data, t); + gsl_matrix* g5_matrix = g5_alloc(model, data, t); + + make_lda_from_seq_slice(lda_model, model, t); + int ndocs = data->corpus[t]->ndocs; + gsl_matrix** phi_t = (gsl_matrix**) malloc(ndocs + * sizeof(gsl_matrix*)); + for (int d = 0; d < ndocs; d++) { + gsl_vector gam = gsl_matrix_row(gammas, doc_index).vector; + gsl_vector lhood = gsl_matrix_row(lhoods, doc_index).vector; + post->gamma = &gam; + post->doc = data->corpus[t]->doc[d]; + post->lhood = &lhood; + double doc_lhood; + // For now, only do the standard, phi-based update. + if (iter == 0) { + doc_lhood = fit_lda_post(d, t, + post, NULL, + NULL, + NULL, + NULL, + NULL); + } else { + doc_lhood = fit_lda_post(d, t, post, model, g, + g3_matrix, g4_matrix, g5_matrix); + } + if (suffstats != NULL) { + update_lda_seq_ss(t, + data->corpus[t]->doc[d], + post, + suffstats); + } + phi_t[d] = gsl_matrix_alloc(post->doc->nterms, K); + gsl_matrix_view phi_view = gsl_matrix_submatrix( + post->phi, + 0, 0, post->doc->nterms, K); + gsl_matrix_memcpy(phi_t[d], &phi_view.matrix); + *bound += doc_lhood; + doc_index++; + } + + if (t < data->len - 1) { + if (FLAGS_model == "fixed") { + double l_bound = update_inf_var_fixed( + model, + data, + // Also want a copy of phi for each doc. + // Can keep this as a vector for now. + phi_t, + t, + file_root, + last_iter || iter >= FLAGS_lda_sequence_min_iter); + *bound += l_bound; + } + } + + for (int d=0; d < ndocs; ++d) { + gsl_matrix_free(phi_t[d]); + } + free(phi_t); + gsl_matrix_free(g); + gsl_matrix_free(g3_matrix); + gsl_matrix_free(g4_matrix); + gsl_matrix_free(g5_matrix); + } +} + +double lda_seq_infer(lda_seq* model, + const corpus_seq_t* data, + gsl_matrix** suffstats, + gsl_matrix* gammas, + gsl_matrix* lhoods, + unsigned int iter, + unsigned int last_iter, + const char* file_root) { + int K = model->ntopics; int W = model->nterms; + double bound = 0.0; + lda* lda_model = new_lda_model(K, W); + lda_post post; + post.phi = gsl_matrix_calloc(data->max_nterms, K); + post.log_phi = gsl_matrix_calloc(data->max_nterms, K); + post.model = lda_model; + + if (FLAGS_model == "fixed") { + // First, pre-compute the functions f and g. + InfluenceTotalFixed(model, data); + InferDIMSeq(K, + iter, + last_iter, + file_root, + data, + gammas, + lhoods, + lda_model, + &post, + model, + suffstats, + &bound); + } else if (FLAGS_model == "dtm") { + InferDTMSeq(K, + iter, + last_iter, + data, + gammas, + lhoods, + lda_model, + &post, + model, + suffstats, + &bound); + } else { + printf("Error. Unknown model.\n"); + exit(1); + } + + gsl_matrix_free(post.phi); + gsl_matrix_free(post.log_phi); + free_lda_model(lda_model); + return(bound); +} + + + /* + * fit an lda sequence model: + * + * . for each time period + * . set up lda model with E[log p(w|z)] and \alpha + * . for each document + * . perform posterior inference + * . update sufficient statistics/likelihood + * . + * . maximize topics + * + */ + +double fit_lda_seq(lda_seq* m, const corpus_seq_t* data, + const corpus_seq_t* heldout, const char* file_root) { + int K = m->ntopics, W = m->nterms; + int k; + + // initialize sufficient statistics + + gsl_matrix* topic_suffstats[K]; + for (k = 0; k < K; k++) { + topic_suffstats[k] = gsl_matrix_calloc(W, data->len); + } + + // set up variables + + char name[400]; + gsl_matrix* gammas = gsl_matrix_calloc(data->ndocs, K); + gsl_matrix* lhoods = gsl_matrix_calloc(data->ndocs, K+1); + gsl_matrix* heldout_gammas = NULL; + gsl_matrix* heldout_lhoods = NULL; + if (heldout != NULL) + { + heldout_gammas = gsl_matrix_calloc(heldout->ndocs, K); + heldout_lhoods = gsl_matrix_calloc(heldout->ndocs, K+1); + } + + double bound = 0, heldout_bound = 0, old_bound; + double convergence = LDA_SEQ_EM_THRESH + 1; + + char root[400]; + sprintf(root, "%s/lda-seq/", file_root); + make_directory(root); + + char em_log_filename[400]; + sprintf(em_log_filename, "%s/em_log.dat", file_root); + FILE* em_log = fopen(em_log_filename, "w"); + + // run EM + + int iter = 0; + // LDA_INFERENCE_MAX_ITER = 1; + short final_iters_flag = 0; + unsigned int last_iter = 0; + while (iter < FLAGS_lda_sequence_min_iter || + ((final_iters_flag == 0 || convergence > LDA_SEQ_EM_THRESH) + && iter <= FLAGS_lda_sequence_max_iter) + && !last_iter) { + + if (!(iter < FLAGS_lda_sequence_min_iter || + ((final_iters_flag == 0 || convergence > LDA_SEQ_EM_THRESH) + && iter <= FLAGS_lda_sequence_max_iter))) { + last_iter = 1; + } + outlog("\nEM iter %3d\n", iter); + outlog("%s", "E step\n"); + fprintf(em_log, "%17.14e %5.3e\n", bound, convergence); + + old_bound = bound; + gsl_matrix_set_zero(gammas); + gsl_matrix_set_zero(lhoods); + if (heldout != NULL) { + gsl_matrix_set_zero(heldout_gammas); + gsl_matrix_set_zero(heldout_lhoods); + } + + for (k = 0; k < K; k++) { + gsl_matrix_set_zero(topic_suffstats[k]); + } + + // compute the likelihood of a sequential corpus under an LDA + // seq model and find the evidence lower bound. + bound = lda_seq_infer(m, + data, + topic_suffstats, + gammas, + lhoods, + iter, + last_iter, + file_root); + if (heldout != NULL) { + heldout_bound = lda_seq_infer(m, + heldout, + NULL, + heldout_gammas, + heldout_lhoods, + iter, + last_iter, + file_root); + } + + // print out the gammas and likelihoods. + sprintf(name, "%s/gam.dat", root); + mtx_fprintf(name, gammas); + sprintf(name, "%s/lhoods.dat", root); + mtx_fprintf(name, lhoods); + if (heldout != NULL) + { + sprintf(name, "%s/heldout_lhoods.dat", root); + mtx_fprintf(name, heldout_lhoods); + sprintf(name, "%s/heldout_gam.dat", root); + mtx_fprintf(name, heldout_gammas); + } + outlog("%s", "\nM step"); + + // fit the variational distribution + double topic_bnd = fit_lda_seq_topics(m, topic_suffstats); + bound += topic_bnd; + + write_lda_seq(m, root); + if ((bound - old_bound) < 0) + { + if (LDA_INFERENCE_MAX_ITER == 1) + LDA_INFERENCE_MAX_ITER = 2; + if (LDA_INFERENCE_MAX_ITER == 2) + LDA_INFERENCE_MAX_ITER = 5; + if (LDA_INFERENCE_MAX_ITER == 5) + LDA_INFERENCE_MAX_ITER = 10; + if (LDA_INFERENCE_MAX_ITER == 10) + LDA_INFERENCE_MAX_ITER = 20; + + outlog( "\nWARNING: bound went down %18.14f; " + "increasing var iter to %d\n", + bound-old_bound, LDA_INFERENCE_MAX_ITER); + } + + // check for convergence + convergence = fabs((bound - old_bound) / old_bound); + if (convergence < LDA_SEQ_EM_THRESH) { + final_iters_flag = 1; + LDA_INFERENCE_MAX_ITER = 500; + outlog("starting final iterations : max iter = %d\n", + LDA_INFERENCE_MAX_ITER); + convergence = 1.0; + } + outlog("\n(%02d) lda seq bound=% 15.7f; " + "heldout bound=% 15.7f, conv=% 15.7e\n", + iter, bound, heldout_bound, convergence); + iter++; + } + return(bound); +} + + +/* + * read and write lda sequence variational distribution + * + */ + +void write_lda_seq(const lda_seq* model, const char* root) { + char name[400]; + sprintf(name, "%sinfo.dat", root); + FILE* f = fopen(name, "w"); + + params_write_int(f, "NUM_TOPICS", model->ntopics); + params_write_int(f, "NUM_TERMS", model->nterms); + params_write_int(f, "SEQ_LENGTH", model->nseq); + params_write_gsl_vector(f, "ALPHA", model->alpha); + + fclose(f); + + int k; + for (k = 0; k < model->ntopics; k++) { + const int tmp = k; + outlog("\nwriting topic %03d", tmp); + sprintf(name, "%stopic-%03d", root, tmp); + write_sslm_var(model->topic[tmp], name); + } + + if (FLAGS_model == "fixed") { + for (int t=0; t < model->influence->ntime; ++t) { + sprintf(name, "%sinfluence_time-%03d", root, t); + outlog("\nwriting influence weights for time %d to %s", t, name); + gsl_matrix* influence_t = model->influence->doc_weights[t]; + assert(model->ntopics == influence_t->size2); + mtx_fprintf(name, influence_t); + + sprintf(name, "%srenormalized_influence_time-%03d", root, t); + outlog("\nwriting influence weights for time %d to %s", t, name); + influence_t = model->influence->renormalized_doc_weights[t]; + assert(model->ntopics == influence_t->size2); + mtx_fprintf(name, influence_t); + } + } +} + +// Read information about a particular model. +// This model should be named "{root}info.dat" +// and should contain the following rows: +// number_topics +// number_times +// alpha, as a gsl vector +lda_seq* read_lda_seq(const char* root, corpus_seq_t* data) { + char name[400]; + lda_seq* model = (lda_seq*) malloc(sizeof(lda_seq)); + + sprintf(name, "%sinfo.dat", root); + FILE* f = fopen(name, "r"); + if (f == NULL) { + outlog("Unable to open file %s. Failing.", name); + exit(1); + } + params_read_int(f, "NUM_TOPICS", &(model->ntopics)); + params_read_int(f, "NUM_TERMS", &(model->nterms)); + params_read_int(f, "SEQ_LENGTH", &(model->nseq)); + params_read_gsl_vector(f, "ALPHA", &(model->alpha)); + fclose(f); + + model->topic = (sslm_var**) malloc(sizeof(sslm_var*) * model->ntopics); + + for (int k = 0; k < model->ntopics; k++) { + outlog( "reading topic %d", k); + sprintf(name, "%stopic-%03d", root, k); + model->topic[k] = read_sslm_var(name); + + model->topic[k]->w_phi_l = + gsl_matrix_alloc(model->nterms, model->nseq); + model->topic[k]->w_phi_sum = + gsl_matrix_alloc(model->nterms, model->nseq); + model->topic[k]->w_phi_l_sq = + gsl_matrix_alloc(model->nterms, model->nseq); + + if (FLAGS_model == "dim" + || FLAGS_model == "regression") { + sprintf(name, "%sw_phi_l-%d", root, k); + mtx_fscanf(name, model->topic[k]->w_phi_l); + + sprintf(name, "%sw_phi_sum-%d", root, k); + mtx_fscanf(name, model->topic[k]->w_phi_sum); + + sprintf(name, "%sw_phi_l_sq-%d", root, k); + mtx_fscanf(name, model->topic[k]->w_phi_l_sq); + } + } + + if (FLAGS_model == "dim" + || FLAGS_model == "regression" + && data != NULL) { + model->influence = (inf_var*) malloc(sizeof(inf_var)); + model->influence->doc_weights = + (gsl_matrix**) malloc(sizeof(gsl_matrix*)); + int t; + model->influence->ntime = model->nseq; + for (t=0; t < model->nseq; ++t) { + // outlog("%d %d", t, model->influence->ntime); + sprintf(name, "%sinfluence_time-%03d", root, t); + outlog("\n reading influence weights for time %d from %s", t, name); + model->influence->doc_weights[t] = + gsl_matrix_alloc(data->corpus[t]->ndocs, + model->ntopics); + mtx_fscanf(name, model->influence->doc_weights[t]); + } + } else { + model->influence = NULL; + } + + return(model); +} + +/* + * update lda sequence sufficient statistics from an lda posterior + * + */ + +void update_lda_seq_ss(int time, + const doc_t* doc, + const lda_post* post, + gsl_matrix** ss) { + int K = post->phi->size2, N = doc->nterms; + int k, n; + + for (k = 0; k < K; k++) + { + gsl_matrix* topic_ss = ss[k]; + for (n = 0; n < N; n++) + { + int w = doc->word[n]; + int c = doc->count[n]; + minc(topic_ss, w, time, c * mget(post->phi, n, k)); + } + } +} + + +/* + * fit lda sequence + * + */ + +double fit_lda_seq_topics(lda_seq* model, + gsl_matrix** ss) { + double lhood = 0, lhood_term = 0; + int k; + + for (k = 0; k < model->ntopics; k++) + { + outlog( "\nfitting topic %02d", k); + lhood_term = fit_sslm(model->topic[k], ss[k]); + lhood += lhood_term; + } + return(lhood); +} + + +/* + * allocate lda seq + * + */ + +lda_seq* new_lda_seq(corpus_seq_t* data, + int W, int T, int K) { + lda_seq* model = (lda_seq*) malloc(sizeof(lda_seq)); + + model->ntopics = K; + model->nterms = W; + model->nseq = T; + + model->alpha = gsl_vector_alloc(K); + model->topic = (sslm_var**) malloc(sizeof(sslm_var*) * K); + + // Create the vectors of total counts for each time. + model->influence_sum_lgl = (gsl_matrix**) malloc(sizeof(gsl_matrix*) * K); + + for (int k = 0; k < K; k++) { + // model->w_phi_l = (gsl_matrix*) malloc(sizeof(gsl_matrix)); + // model->w_phi_l_sq = (gsl_matrix*) malloc(sizeof(gsl_matrix*)); + model->influence_sum_lgl[k] = gsl_matrix_calloc(W, T); + + model->topic[k] = sslm_var_alloc(W, T); + if (k < FLAGS_fix_topics) { + model->topic[k]->chain_variance = 1e-10; + } + model->topic[k]->w_phi_l = gsl_matrix_calloc(W, T); + model->topic[k]->w_phi_sum = gsl_matrix_calloc(W, T); + model->topic[k]->w_phi_l_sq = gsl_matrix_calloc(W, T); + } + model->influence = inf_var_alloc(K, data); + + return(model); +} + + +/* + * initialize from sufficient statistics (expected counts). + * + */ + +void init_lda_seq_from_ss(lda_seq* model, + double topic_chain_variance, + double topic_obs_variance, + double alpha, + gsl_matrix* init_suffstats) { + gsl_vector_set_all(model->alpha, alpha); + + for (int k = 0; k < model->ntopics; k++) + { + gsl_vector slice = gsl_matrix_column(init_suffstats, k).vector; + sslm_counts_init(model->topic[k], + topic_obs_variance, + topic_chain_variance, + &slice); + if (k < FLAGS_fix_topics) { + model->topic[k]->chain_variance = 1e-10; + } + model->topic[k]->w_phi_l = gsl_matrix_calloc(model->nterms, + model->nseq); + model->topic[k]->w_phi_sum = gsl_matrix_calloc(model->nterms, + model->nseq); + model->topic[k]->w_phi_l_sq = gsl_matrix_calloc(model->nterms, + model->nseq); + } + +} diff --git a/dtm_release/dtm/lda-seq.h b/dtm_release/dtm/lda-seq.h new file mode 100644 index 0000000000000000000000000000000000000000..23df02e61b42540d91327b5afdd9ef2dae29fd43 --- /dev/null +++ b/dtm_release/dtm/lda-seq.h @@ -0,0 +1,128 @@ +// Authors: David Blei (blei@cs.princeton.edu) +// Sean Gerrish (sgerrish@cs.princeton.edu) +// +// Copyright 2011 Sean Gerrish and David Blei +// All Rights Reserved. +// +// See the README for this package for details about modifying or +// distributing this software. + +#ifndef LDASEQ_H +#define LDASEQ_H + +#include <sys/stat.h> +#include <sys/types.h> + +#include "gsl-wrappers.h" +#include "lda.h" + +#define LDA_SEQ_EM_THRESH 1e-4 +#define SAVE_LAG 10 + +/* + * an lda sequence is a collection of simplex sequences for K topics + * and an alpha vector + * + */ + +#include <gsl/gsl_vector.h> +#include <gsl/gsl_matrix.h> +#include <stdlib.h> +#include <assert.h> + +#include "param.h" +#include "ss-lm.h" +#include "data.h" +#include "lda.h" + +#define LDA_SEQ_EM_THRESHOLD 1e-5; + +// lda sequence variational posterior distribution + + +// === allocation and initialization === + +inf_var* inf_var_alloc(int number_topics, + corpus_seq_t* corpus_seq); +void inf_var_free(inf_var* ptr); + +// initialize lda sequence from lda model topics + +void init_lda_seq_from_ss(lda_seq* model, + double topic_chain_variance, + double topic_obs_variance, + double alpha, + gsl_matrix* init_suffstats); + +// === fitting === + + +// infer a corpus with an lda-seq + +double update_inf_var(lda_seq* seq, + const corpus_seq_t* data, + gsl_matrix** phi, + size_t t, + const char* root); +double update_inf_var_multiple(lda_seq* seq, + const corpus_seq_t* data, + gsl_matrix** phi, + size_t t, + const char* root); +void update_inf_reg(lda_seq* seq, + const corpus_seq_t* data, + gsl_matrix** phi, + size_t t, + const char* root); + +double lda_seq_infer(lda_seq* model, + const corpus_seq_t* data, + gsl_matrix** suffstats, + gsl_matrix* gammas, + gsl_matrix* lhoods, + int iter, + const char* file_root); + +// fit lda sequence from sufficient statistics + +double fit_lda_seq(lda_seq* m, + const corpus_seq_t* data, + const corpus_seq_t* heldout, + const char* file_root); + +void update_lda_seq_ss(int time, + const doc_t* doc, + const lda_post* post, + gsl_matrix** ss); + +double fit_lda_seq_topics(lda_seq* model, + gsl_matrix** ss); + + +// === reading and writing === + + +// read and write a lda sequence + +void write_lda_seq(const lda_seq* m, const char* root); + +lda_seq* read_lda_seq(const char* root, corpus_seq_t* data); + +// write lda sequence sufficient statistics + +void write_lda_seq_suffstats(lda_seq* m, + gsl_matrix** topic_ss, + const char* root); + +// new lda sequence + +lda_seq* new_lda_seq(corpus_seq_t* data, + int W, + int T, + int K); + +void make_lda_from_seq_slice(lda* lda_m, + lda_seq* lda_seq_m, + int time); + +#endif diff --git a/dtm_release/dtm/lda.c b/dtm_release/dtm/lda.c new file mode 100644 index 0000000000000000000000000000000000000000..9026866077127db52773762557ab3c9bebccd3e5 --- /dev/null +++ b/dtm_release/dtm/lda.c @@ -0,0 +1,598 @@ +// Authors: David Blei (blei@cs.princeton.edu) +// Sean Gerrish (sgerrish@cs.princeton.edu) +// +// Copyright 2011 Sean Gerrish and David Blei +// All Rights Reserved. +// +// See the README for this package for details about modifying or +// distributing this software. + +#include "gflags.h" + +#include "lda.h" + +int LDA_INFERENCE_MAX_ITER=25; + +// Used for the phi update: how small can the smallest phi be? +// We assert around 1e-10, since that is around the smallest beta +// for a term. +static const double kSmallLogNumber = -100.0; +static const double kSmallNumber = exp(kSmallLogNumber); + +static double* scaled_influence = NULL; + +DEFINE_double(lambda_convergence, + 0.01, + "Specifies the level of convergence required for " + "lambda in the phi updates."); + +DECLARE_string(normalize_docs); +DECLARE_int32(max_number_time_points); +DECLARE_string(model); +DECLARE_string(mode); +DECLARE_double(sigma_d); +DECLARE_double(sigma_l); +DECLARE_int32(forward_window); + +/* + * posterior inference for lda + * time and doc_number are only necessary if + * var is not NULL. + */ + +double fit_lda_post(int doc_number, int time, + lda_post* p, lda_seq* var, + gsl_matrix* g, + gsl_matrix* g3_matrix, + gsl_matrix* g4_matrix, + gsl_matrix* g5_matrix) { + init_lda_post(p); + gsl_vector_view topic_view; + gsl_vector_view renormalized_topic_view; + if (FLAGS_model == "fixed" && var && var->influence) { + // Make sure this stays in scope while the posterior is in + // use! + topic_view = gsl_matrix_row( + var->influence->doc_weights[time], doc_number); + renormalized_topic_view = gsl_matrix_row( + var->influence->renormalized_doc_weights[time], doc_number); + p->doc_weight = &topic_view.vector; + p->renormalized_doc_weight = &renormalized_topic_view.vector; + } + + double lhood = compute_lda_lhood(p); + double lhood_old = 0; + double converged = 0; + int iter = 0; + + do { + iter++; + lhood_old = lhood; + update_gamma(p); + if (FLAGS_model == "fixed" && var != NULL) { + update_phi_fixed(doc_number, + time, + p, + var, + g3_matrix, + g4_matrix, + g5_matrix); + } else if (FLAGS_model == "dtm" || var == NULL) { + update_phi(doc_number, time, p, var, g); + } else { + printf("Error. Unhandled model.\n"); + exit(1); + } + // TODO(sgerrish): Remove this. + // output_phi(p); + lhood = compute_lda_lhood(p); + converged = fabs((lhood_old - lhood) / + (lhood_old * p->doc->total)); + } while ((converged > LDA_INFERENCE_CONVERGED) && + (iter <= LDA_INFERENCE_MAX_ITER)); + + return(lhood); +} + + +/* + * initialize variational posterior + * + */ + +void init_lda_post(lda_post* p) { + int k, n, K = p->model->ntopics, N = p->doc->nterms; + + for (k = 0; k < K; k++) + { + vset(p->gamma, k, + vget(p->model->alpha,k) + ((double) p->doc->total)/K); + for (n = 0; n < N; n++) + mset(p->phi, n, k, 1.0/K); + } + p->doc_weight = NULL; +} + +/* + * update variational dirichlet parameters + * + */ + +void update_gamma(lda_post* p) { + int k, n, K = p->model->ntopics, N = p->doc->nterms; + + gsl_vector_memcpy(p->gamma, p->model->alpha); + for (n = 0; n < N; n++) + { + gsl_vector phi_row = gsl_matrix_row(p->phi, n).vector; + int count = p->doc->count[n]; + for (k = 0; k < K; k++) + vinc(p->gamma, k, vget(&phi_row, k) * count); + } +} + +/* + * update variational multinomial parameters + * + */ + +void update_phi(int doc_number, int time, + lda_post* p, lda_seq* var, + gsl_matrix* g) { + int i, k, n, K = p->model->ntopics, N = p->doc->nterms; + double dig[p->model->ntopics]; + + for (k = 0; k < K; k++) { + dig[k] = gsl_sf_psi(vget(p->gamma, k)); + } + + for (n = 0; n < N; n++) { + // compute log phi up to a constant + + int w = p->doc->word[n]; + for (k = 0; k < K; k++) { + mset(p->log_phi, n, k, + dig[k] + mget(p->model->topics, w, k)); + } + + // normalize in log space + + gsl_vector log_phi_row = gsl_matrix_row(p->log_phi, n).vector; + gsl_vector phi_row = gsl_matrix_row(p->phi, n).vector; + log_normalize(&log_phi_row); + for (i = 0; i < K; i++) { + vset(&phi_row, i, exp(vget(&log_phi_row, i))); + } + } +} + + +void update_phi_fixed(int doc_number, int time, + lda_post* p, lda_seq* var, + gsl_matrix* g3_matrix, + gsl_matrix* g4_matrix, + gsl_matrix* g5_matrix) { + // Hate to do this, but I had problems allocating this data + // structure. + if (scaled_influence == NULL) { + scaled_influence = NewScaledInfluence(FLAGS_max_number_time_points); + } + + int i, k, n, K = p->model->ntopics, N = p->doc->nterms; + double dig[p->model->ntopics]; + + double k_sum = 0.0; + for (k = 0; k < K; k++) { + double gamma_k = vget(p->gamma, k); + dig[k] = gsl_sf_psi(gamma_k); + k_sum += gamma_k; + } + double dig_sum = gsl_sf_psi(k_sum); + + gsl_vector_view document_weights; + if (var && var->influence) { + document_weights = gsl_matrix_row( + var->influence->doc_weights[time], doc_number); + } + + for (n=0; n < N; ++n) { + int w = p->doc->word[n]; + // We have info. about the topics. Use them! + // Try two alternate approaches. We compare results of the new + // algorithm with the old to make sure we're not doing anything + // silly. + + for (k = 0; k < K; ++k) { + // Find an estimate for log_phi_nk. + double doc_weight = 0.0; + sslm_var* topic = var->topic[k]; + const double chain_variance = topic->chain_variance; + + // These matrices are already set up for the correct time. + double g3 = mget(g3_matrix, w, k); + double g4 = mget(g4_matrix, w, k); + double g5 = mget(g5_matrix, w, k); + double w_phi_sum = gsl_matrix_get( + var->topic[k]->w_phi_sum, w, time); + + // Only set these variables if we are within the correct + // time window. + if (time < var->nseq) { + doc_weight = gsl_vector_get(&document_weights.vector, k); + } + + double term_weight; + if (FLAGS_normalize_docs == "normalize") { + term_weight = ((double) p->doc->count[n] + / (double) p->doc->total); + } else if (FLAGS_normalize_docs == "log") { + term_weight = log(p->doc->count[n] + 1.0); + } else if (FLAGS_normalize_docs == "log_norm") { + term_weight = log(p->doc->count[n] / p->doc->total); + } else if (FLAGS_normalize_docs == "identity") { + term_weight = p->doc->count[n]; + } else if (FLAGS_normalize_docs == "occurrence") { + term_weight = ((double) p->doc->count[n] + / (double) p->doc->total); + } else { + assert(0); + } + + assert(var != NULL); + + double total, term1, term2, term3, term4; + double phi_last = 0.0; + + // It's unnecessary to always multiply by 1/chain_variance + // this deep in a loop, but it's likely not a major + // bottleneck. + term1 = dig[k] + mget(p->model->topics, w, k); + term2 = (g3 + * term_weight + * doc_weight + / chain_variance); + term3 = (term_weight + * doc_weight + * g4 + / chain_variance); + term4 = (term_weight * term_weight + * (phi_last * (doc_weight * doc_weight) + - (doc_weight * doc_weight + + FLAGS_sigma_l * FLAGS_sigma_l)) + * g5 + / chain_variance); + + // Note: we're ignoring term3. sgerrish: 18 July 2010: + // Changing term2 to have a positive coefficient (instead of + // negative) to be consistent with parallel version. + // sgerrish: 23 July 2010: changing term2 back to negative, + // to try to reproduce earlier results. + total = term1 - term2 - term3 + term4; + mset(p->log_phi, n, k, total); + } + + // Normalize in log space. + gsl_vector log_phi_row = gsl_matrix_row(p->log_phi, n).vector; + gsl_vector phi_row = gsl_matrix_row(p->phi, n).vector; + log_normalize(&log_phi_row); + + for (i = 0; i < K; i++) { + vset(&phi_row, i, exp(vget(&log_phi_row, i))); + } + } +} + + +/* + * comput the likelihood bound + */ + +double compute_lda_lhood(lda_post* p) { + int k, n; + int K = p->model->ntopics, N = p->doc->nterms; + + double gamma_sum = sum(p->gamma); + double lhood = + gsl_sf_lngamma(sum(p->model->alpha)) - + gsl_sf_lngamma(gamma_sum); + vset(p->lhood, K, lhood); + + double influence_term = 0.0; + double digsum = gsl_sf_psi(gamma_sum); + for (k = 0; k < K; k++) { + if (p->doc_weight != NULL) { + // outlog("doc weight size: %d", p->doc_weight->size); + assert (K == p->doc_weight->size); + double influence_topic = gsl_vector_get(p->doc_weight, k); + if (FLAGS_model == "dim" + || FLAGS_model == "fixed") { + influence_term = - ((influence_topic * influence_topic + + FLAGS_sigma_l * FLAGS_sigma_l) + / 2.0 / (FLAGS_sigma_d * FLAGS_sigma_d)); + // Note that these cancel with the entropy. + // - (log(2 * PI) + log(FLAGS_sigma_d)) / 2.0); + } + } + double e_log_theta_k = gsl_sf_psi(vget(p->gamma, k)) - digsum; + double lhood_term = + (vget(p->model->alpha, k)-vget(p->gamma, k)) * e_log_theta_k + + gsl_sf_lngamma(vget(p->gamma, k)) - + gsl_sf_lngamma(vget(p->model->alpha, k)); + + for (n = 0; n < N; n++) { + if (mget(p->phi, n, k) > 0) { + lhood_term += + p->doc->count[n]* + mget(p->phi, n, k) * + (e_log_theta_k + + mget(p->model->topics, p->doc->word[n], k) + - mget(p->log_phi, n, k)); + } + } + vset(p->lhood, k, lhood_term); + lhood += lhood_term; + lhood += influence_term; + } + + return(lhood); +} + + + +/* + * compute expected sufficient statistics for a corpus + * + */ + +double lda_e_step(lda* model, + corpus_t* data, + lda_suff_stats* ss) { + int d, k, n; + + if (ss != NULL) reset_lda_suff_stats(ss); + lda_post* p = new_lda_post(model->ntopics, data->max_unique); + p->model = model; + double lhood = 0; + + // for each document + + for (d = 0; d < data->ndocs; d++) + { + if (((d % 1000) == 0) && (d > 0)) + { + outlog( "e-step: processing doc %d", d); + } + + // fit posterior + + p->doc = data->doc[d]; + lhood += fit_lda_post(d, 0, p, NULL, NULL, NULL, NULL, NULL); + + // update expected sufficient statistics + + if (ss != NULL) + for (k = 0; k < model->ntopics; k++) + for (n = 0; n < p->doc->nterms; n++) + minc(ss->topics_ss, + p->doc->word[n], k, + mget(p->phi, n, k) * p->doc->count[n]); + } + + // !!! FREE POSTERIOR + + return(lhood); +} + + +/* + * compute MLE topics from sufficient statistics + * + */ + +double lda_m_step(lda* model, lda_suff_stats* ss) { + int k, w; + double lhood = 0; + for (k = 0; k < model->ntopics; k++) + { + gsl_vector ss_k = gsl_matrix_column(ss->topics_ss, k).vector; + gsl_vector log_p = gsl_matrix_column(model->topics, k).vector; + if (LDA_USE_VAR_BAYES == 0) + { + gsl_blas_dcopy(&ss_k, &log_p); + normalize(&log_p); + vct_log(&log_p); + } + else + { + double digsum = sum(&ss_k)+model->nterms*LDA_TOPIC_DIR_PARAM; + digsum = gsl_sf_psi(digsum); + double param_sum = 0; + for (w = 0; w < model->nterms; w++) + { + double param = vget(&ss_k, w) + LDA_TOPIC_DIR_PARAM; + param_sum += param; + double elogprob = gsl_sf_psi(param) - digsum; + vset(&log_p, w, elogprob); + lhood += (LDA_TOPIC_DIR_PARAM - param) * elogprob + gsl_sf_lngamma(param); + } + lhood -= gsl_sf_lngamma(param_sum); + } + } + return(lhood); +} + + +/* + * read sufficient statistics + * + */ + +void write_lda_suff_stats(lda_suff_stats* ss, char* name) { + mtx_fprintf(name, ss->topics_ss); +} + +lda_suff_stats* read_lda_suff_stats(char* filename, int ntopics, int nterms) { + lda_suff_stats* ss = (lda_suff_stats*) malloc(sizeof(lda_suff_stats)); + ss->topics_ss = gsl_matrix_alloc(nterms, ntopics); + mtx_fscanf(filename, ss->topics_ss); + return(ss); +} + +/* + * new lda model and sufficient statistics + * + */ + +lda* new_lda_model(int ntopics, int nterms) { + lda* m = (lda*) malloc(sizeof(lda)); + m->ntopics = ntopics; + m->nterms = nterms; + m->topics = gsl_matrix_calloc(nterms, ntopics); + m->alpha = gsl_vector_calloc(ntopics); + + return(m); +} + +void free_lda_model(lda* m) { + gsl_matrix_free(m->topics); + gsl_vector_free(m->alpha); + free(m); +} + +lda_suff_stats* new_lda_suff_stats(lda* model) { + lda_suff_stats* ss = (lda_suff_stats*) malloc(sizeof(lda_suff_stats)); + ss->topics_ss = gsl_matrix_calloc(model->nterms, model->ntopics); + + return(ss); +} + +void reset_lda_suff_stats(lda_suff_stats* ss) { + gsl_matrix_set_all(ss->topics_ss, 0.0); +} + +lda_post* new_lda_post(int ntopics, int max_length) { + lda_post* p = (lda_post*) malloc(sizeof(lda_post)); + p->phi = gsl_matrix_calloc(max_length, ntopics); + p->log_phi = gsl_matrix_calloc(max_length, ntopics); + p->gamma = gsl_vector_calloc(ntopics); + p->lhood = gsl_vector_calloc(ntopics + 1); + + return(p); +} + +void free_lda_post(lda_post* p) { + gsl_matrix_free(p->phi); + gsl_matrix_free(p->log_phi); + gsl_vector_free(p->gamma); + gsl_vector_free(p->lhood); + free(p); +} + +/* + * initalize LDA SS from random + * + */ + +void initialize_lda_ss_from_random(corpus_t* data, lda_suff_stats* ss) { + int k, n; + gsl_rng * r = new_random_number_generator(); + for (k = 0; k < ss->topics_ss->size2; k++) + { + gsl_vector topic = gsl_matrix_column(ss->topics_ss, k).vector; + gsl_vector_set_all(&topic, 0); + for (n = 0; n < topic.size; n++) + { + vset(&topic, n, gsl_rng_uniform(r) + 0.5 / data->ndocs + 4.0); + } + } +} + + +/* + * initialize sufficient statistics from a document collection + * + */ + +void initialize_lda_ss_from_data(corpus_t* data, lda_suff_stats* ss) { + int k, n, i, w; + gsl_rng * r = new_random_number_generator(); + + for (k = 0; k < ss->topics_ss->size2; k++) + { + gsl_vector topic = gsl_matrix_column(ss->topics_ss, k).vector; + for (n = 0; n < LDA_SEED_INIT; n++) + { + int d = floor(gsl_rng_uniform(r) * data->ndocs); + doc_t* doc = data->doc[d]; + for (i = 0; i < doc->nterms; i++) + { + vinc(&topic, doc->word[n], doc->count[n]); + } + } + for (w = 0; w < topic.size; w++) + { + vinc(&topic, w, LDA_INIT_SMOOTH + gsl_rng_uniform(r)); + } + } +} + +/* + * write LDA model + * + */ + +void write_lda(lda* model, char* name) { + char filename[400]; + sprintf(filename, "%s.beta", name); + mtx_fprintf(filename, model->topics); + sprintf(filename, "%s.alpha", name); + vct_fprintf(filename, model->alpha); +} + +/* + * read LDA + * + */ + +lda* read_lda(int ntopics, int nterms, char* name) { + char filename[400]; + + lda* model = new_lda_model(ntopics, nterms); + sprintf(filename, "%s.beta", name); + mtx_fscanf(filename, model->topics); + sprintf(filename, "%s.alpha", name); + vct_fscanf(filename, model->alpha); + + return(model); +} + +void lda_em(lda* model, + lda_suff_stats* ss, + corpus_t* data, + int max_iter, + char* outname) { + int iter = 0; + double lhood = lda_e_step(model, data, ss); + double old_lhood = 0; + double converged = 0; + double m_lhood = lda_m_step(model, ss); + outlog( "initial likelihood = %10.3f\n", lhood); + do + { + iter++; + old_lhood = lhood; + double e_lhood = lda_e_step(model, data, ss); + + m_lhood = lda_m_step(model, ss); + lhood = e_lhood + m_lhood; + converged = (old_lhood - lhood) / (old_lhood); + outlog("iter = %d", iter); + outlog("lhood = % 10.3f", lhood); + outlog("m, e lhood = % 10.3f, % 10.3f", m_lhood, e_lhood); + outlog("conv = % 5.3e\n", converged); + outlog("max_iter: %d\n", max_iter); + } + while (((converged > LDA_EM_CONVERGED) || (iter <= 5)) + && (iter < max_iter)); + write_lda(model, outname); +} diff --git a/dtm_release/dtm/lda.h b/dtm_release/dtm/lda.h new file mode 100644 index 0000000000000000000000000000000000000000..ea2ba7629ce9a88e88b1e3bcfe3c98710412c742 --- /dev/null +++ b/dtm_release/dtm/lda.h @@ -0,0 +1,125 @@ +// Authors: David Blei (blei@cs.princeton.edu) +// Sean Gerrish (sgerrish@cs.princeton.edu) +// +// Copyright 2011 Sean Gerrish and David Blei +// All Rights Reserved. +// +// See the README for this package for details about modifying or +// distributing this software. + +#ifndef LDA_H +#define LDA_H + +#include <gsl/gsl_vector.h> +#include <gsl/gsl_matrix.h> +#include <gsl/gsl_sf_gamma.h> +#include <gsl/gsl_sf_psi.h> +#include <gsl/gsl_sf_lambert.h> +#include <gsl/gsl_rng.h> + +#include "param.h" +#include "data.h" +#include "gsl-wrappers.h" + +/* + * functions for posterior inference in the latent dirichlet + * allocation model. + * + */ + +#define LDA_INFERENCE_CONVERGED 1e-8 +#define LDA_SEED_INIT 1 +#define LDA_INIT_SMOOTH 1.0 +#define LDA_EM_CONVERGED 5e-5 +#define LDA_USE_VAR_BAYES 0 +#define LDA_TOPIC_DIR_PARAM 0.001 + +// lda model + +typedef struct lda { + int ntopics; // number of topics + int nterms; // vocabulary size + gsl_matrix* topics; // each column is a topic (V X K) + gsl_vector* alpha; // dirichlet parameters +} lda; + +// lda posterior + +typedef struct lda_post { + doc_t* doc; // document associated to this posterior + lda* model; // lda model + gsl_matrix* phi; // variational mult parameters (nterms x K) + gsl_matrix* log_phi; // convenient for computation (nterms x K) + gsl_vector* gamma; // variational dirichlet parameters (K) + gsl_vector* lhood; // a K+1 vector, sums to the lhood bound + gsl_vector* doc_weight; // Not owned by this structure. + gsl_vector* renormalized_doc_weight; // Not owned by this structure. +} lda_post; + +// lda sufficient statistics + +typedef struct lda_suff_stats { + gsl_matrix* topics_ss; +} lda_suff_stats; + + +// new lda model and suff stats + +lda* new_lda_model(int ntopics, int nterms); +void free_lda_model(lda* m); +lda_suff_stats* new_lda_suff_stats(lda* model); +void reset_lda_suff_stats(lda_suff_stats* ss); +lda_post* new_lda_post(int ntopics, int max_length); +void free_lda_post(lda_post* p); +void initialize_lda_ss_from_data(corpus_t* data, lda_suff_stats* ss); + +// posterior inference + +double fit_lda_post(int doc_number, int time, + lda_post* p, lda_seq* var, + gsl_matrix* g, + gsl_matrix* g3, + gsl_matrix* g4, + gsl_matrix* g5); +void init_lda_post(lda_post* p); +void update_gamma(lda_post* p); +void update_phi(int doc_number, int time, + lda_post* p, lda_seq* var, + gsl_matrix* g); +void update_phi_dim(int doc_number, int time, + lda_post* p, lda_seq* var, + gsl_matrix* g); +void update_phi_fixed(int doc_number, int time, + lda_post* p, lda_seq* var, + gsl_matrix* g3_matrix, + gsl_matrix* g4_matrix, + gsl_matrix* g5_matrix); +void update_phi_multiple(int doc_number, int time, + lda_post* p, lda_seq* var, + gsl_matrix* g); + +// compute the likelihood bound + +double compute_lda_lhood(lda_post* p); + +// EM algorithm + +double lda_e_step(lda* model, corpus_t* data, lda_suff_stats* ss); +double lda_m_step(lda* model, lda_suff_stats* ss); +void lda_em(lda* model, + lda_suff_stats* ss, + corpus_t* data, + int max_iter, + char* outname); + +// reading and writing + +lda_suff_stats* read_lda_suff_stats(char* filename, int ntopics, int nterms); +void write_lda(lda* model, char* name); +void write_lda_suff_stats(lda_suff_stats* ss, char* name); +lda* read_lda(int ntopics, int nterms, char* name); + + +void initialize_lda_ss_from_random(corpus_t* data, lda_suff_stats* ss); + +#endif diff --git a/dtm_release/dtm/main.c b/dtm_release/dtm/main.c new file mode 100644 index 0000000000000000000000000000000000000000..69bef613fa978655cdad7cb6b0cf7284bbb67326 --- /dev/null +++ b/dtm_release/dtm/main.c @@ -0,0 +1,303 @@ +// Authors: David Blei (blei@cs.princeton.edu) +// Sean Gerrish (sgerrish@cs.princeton.edu) +// +// Copyright 2011 Sean Gerrish and David Blei +// All Rights Reserved. +// +// See the README for this package for details about modifying or +// distributing this software. + +#include "gflags.h" + +#include "main.h" + +DEFINE_string(mode, + "fit", + "The function to perform. " + "Can be fit, est, or time."); +DEFINE_string(model, + "dtm", + "The function to perform. " + "Can be dtm or dim."); +DEFINE_string(corpus_prefix, + "", + "The function to perform. " + "Can be dtm or dim."); +DEFINE_string(lda_model_prefix, + "", + "The name of a fit model to be " + "used for testing likelihood. Appending \"info.dat\" " + "to this should give the name of the file."); +DEFINE_int32(heldout_time, + -1, + "A time up to (but not including) which we wish to train, " + "and at which we wish to test."); +DEFINE_string(output_table, "", ""); +DEFINE_string(params_file, + "settings.txt", + "A file containing parameters for this run."); +DEFINE_bool(initialize_lda, + false, + "If true, initialize the model with lda."); + +DEFINE_string(outname, "", ""); +DEFINE_double(top_obs_var, 0.5, ""); +DEFINE_double(top_chain_var, 0.005, ""); +DEFINE_double(alpha, -10.0, ""); +DEFINE_double(ntopics, -1.0, ""); +DEFINE_int32(lda_max_em_iter, 20, ""); +DEFINE_string(heldout_corpus_prefix, "", ""); +DEFINE_int32(start, -1, ""); +DEFINE_int32(end, -1, ""); + +extern int LDA_INFERENCE_MAX_ITER; + +/* + * read the parameters + * + * !!! use the cleaner functions in params.h + * + */ + + +/* + * fit a model from data + * + */ + +void fit_dtm(int min_time, int max_time) +{ + char name[400]; + + // make the directory for this fit + char run_dir[400]; + sprintf(run_dir, "%s/", FLAGS_outname.c_str()); + if (!directory_exist(run_dir)) { + make_directory(run_dir); + } + + // initialize (a few iterations of LDA fitting) + outlog("%s","### INITIALIZING MODEL FROM LDA ###\n"); + + printf("data file: %s\n", FLAGS_corpus_prefix.c_str()); + corpus_t* initial_lda_data = read_corpus(FLAGS_corpus_prefix.c_str()); + + gsl_matrix* topics_ss; + // !!! make this an option + if (FLAGS_initialize_lda) { + lda* lda_model = new_lda_model(FLAGS_ntopics, initial_lda_data->nterms); + gsl_vector_set_all(lda_model->alpha, FLAGS_alpha); + + lda_suff_stats* lda_ss = new_lda_suff_stats(lda_model); + // initialize_lda_ss_from_data(initial_lda_data, lda_ss); + initialize_lda_ss_from_random(initial_lda_data, lda_ss); + // sgerrish: Why do we only define the topics once? + lda_m_step(lda_model, lda_ss); + + sprintf(name, "%s/initial-lda", run_dir); + // TODO(sgerrish): Fix this. This was originally hardcoded to 1. + LDA_INFERENCE_MAX_ITER = 25; + lda_em(lda_model, lda_ss, initial_lda_data, FLAGS_lda_max_em_iter, name); + sprintf(name, "%s/initial-lda-ss.dat", run_dir); + + write_lda_suff_stats(lda_ss, name); + topics_ss = lda_ss->topics_ss; + } else { + printf("loading %d terms..\n", initial_lda_data->nterms); + topics_ss = gsl_matrix_calloc(initial_lda_data->nterms, FLAGS_ntopics); + sprintf(name, "%s/initial-lda-ss.dat", FLAGS_outname.c_str()); + mtx_fscanf(name, topics_ss); + } + + printf("fitting.. \n"); + // estimate dynamic topic model + + outlog("\n%s\n","### FITTING DYNAMIC TOPIC MODEL ###"); + + corpus_seq_t* data_full = read_corpus_seq(FLAGS_corpus_prefix.c_str()); + + corpus_seq_t* data_subset; + if (max_time >= 0) { + // We are training on a subset of the data. + assert(max_time > min_time + && min_time >= 0 + && max_time < data_full->len); + data_subset = (corpus_seq_t*) malloc(sizeof(corpus_seq_t)); + data_subset->len = max_time - min_time + 1; + data_subset->nterms = data_full->nterms; + data_subset->corpus = (corpus_t**) malloc( + sizeof(corpus_t*) * data_subset->len); + int max_nterms = 0; + int ndocs = 0; + for (int i=min_time; i < max_time; ++i) { + corpus_t* corpus = data_full->corpus[i]; + max_nterms = max_nterms > corpus->nterms ? max_nterms : corpus->nterms; + data_subset->corpus[i - min_time] = corpus; + ndocs += corpus->ndocs; + } + data_subset->max_nterms = max_nterms; + data_subset->ndocs = ndocs; + } else { + // Use the entire dataset. + data_subset = data_full; + } + + lda_seq* model_seq = new_lda_seq(data_subset, + data_subset->nterms, + data_subset->len, + FLAGS_ntopics); + init_lda_seq_from_ss(model_seq, + FLAGS_top_chain_var, + FLAGS_top_obs_var, + FLAGS_alpha, + topics_ss); + + fit_lda_seq(model_seq, data_subset, NULL, run_dir); + + if (max_time < 0) { + return; + } + + // Now find the posterior likelihood of the next time slice + // using the most-recently-known time slice. + lda* lda_model = new_lda_model(model_seq->ntopics, model_seq->nterms); + make_lda_from_seq_slice(lda_model, model_seq, max_time - 1); + + lda_post post; + int max_nterms = compute_max_nterms(data_full); + post.phi = gsl_matrix_calloc(max_nterms, model_seq->ntopics); + post.log_phi = gsl_matrix_calloc(max_nterms, model_seq->ntopics); + post.gamma = gsl_vector_calloc(model_seq->ntopics); + post.lhood = gsl_vector_calloc(model_seq->ntopics); + post.model = lda_model; + post.doc_weight = NULL; + + int d; + double* table = (double*) malloc(sizeof(double) * data_full->corpus[max_time]->ndocs); + + for (d = 0; d < data_full->corpus[max_time]->ndocs; d++) + { + post.doc = data_full->corpus[max_time]->doc[d]; + table[d] = fit_lda_post(d, max_time, &post, NULL, NULL, + NULL, NULL, NULL); + } + char tmp_string[400]; + sprintf(tmp_string, "%s-heldout_post_%d.dat", FLAGS_outname.c_str(), + max_time); + FILE* post_file = fopen(tmp_string, "w"); + for (int d = 0; d < data_full->corpus[max_time]->ndocs; ++d) + { + fprintf(post_file, "%f\n", table[d]); + } +} + +/* + * main function + * + * supports fitting a dynamic topic model + * + */ + +int main(int argc, char* argv[]) +{ + // Initialize the flag objects. + // InitFlags(argc, argv); + google::ParseCommandLineFlags(&argc, &argv, 0); + + // usage: main (sums corpus_sequence|fit param|time params) + + // mode for spitting out document sums + if (FLAGS_mode == "sums") + { + corpus_seq_t* c = read_corpus_seq(FLAGS_corpus_prefix.c_str()); + outlog("Tried to read corpus %s", FLAGS_corpus_prefix.c_str()); + int d, t; + for (t = 0; t < c->len; t++) + { + int sum = 0; + for (d = 0; d < c->corpus[t]->ndocs; d++) + { + sum += c->corpus[t]->doc[d]->total; + } + printf("%d\n\n", sum); + } + } + + // mode for fitting a dynamic topic model + + if (FLAGS_mode == "fit") { + fit_dtm(0, FLAGS_heldout_time - 1); + } + + // mode for analyzing documents through time according to a DTM + + if (FLAGS_mode == "time") + { + // read parameters + + // load corpus and model based on information from params + + corpus_seq_t* data = read_corpus_seq(FLAGS_heldout_corpus_prefix.c_str()); + lda_seq* model = read_lda_seq(FLAGS_lda_model_prefix.c_str(), + data); + + // initialize the table (D X OFFSETS) + + int d; + double** table = (double**) malloc(sizeof(double*) * data->len); + + for (int t = 0; t < data->len; t++) + { + table[t] = (double*) malloc(sizeof(double) * data->corpus[t]->ndocs); + for (d = 0; d < data->corpus[t]->ndocs; d++) + { + table[t][d] = -1; // this should be NAN + } + } + + // set up the LDA model to be populated + + lda* lda_model = new_lda_model(model->ntopics, model->nterms); + + lda_post post; + int max_nterms = compute_max_nterms(data); + post.phi = gsl_matrix_calloc(max_nterms, model->ntopics); + post.log_phi = gsl_matrix_calloc(max_nterms, model->ntopics); + post.gamma = gsl_vector_calloc(model->ntopics); + post.lhood = gsl_vector_calloc(model->ntopics); + post.model = lda_model; + + // compute likelihoods for each model + + for (int t = 0; t < data->len; t++) { + make_lda_from_seq_slice(lda_model, model, t); + for (d = 0; d < data->corpus[t]->ndocs; d++) { + post.doc = data->corpus[t]->doc[d]; + double likelihood = fit_lda_post(d, t, &post, model, + NULL, + NULL, NULL, NULL); + table[t][d] = post.doc->log_likelihood; + } + } + char tmp_string[400]; + sprintf(tmp_string, "%s-heldout_post.dat", FLAGS_outname.c_str()); + FILE* post_file = fopen(tmp_string, "w"); + for (int t=0; t < data->len; ++t) + { + if (data->corpus[t]->ndocs >= 0) { + fprintf(post_file, "%f", table[t][0]); + } + for (int d = 1; d < data->corpus[t]->ndocs; ++d) + { + fprintf(post_file, ",%f", table[t][d]); + } + fprintf(post_file, "\n"); + } + // !!! write out table + } + + return(0); +} + + + diff --git a/dtm_release/dtm/main.h b/dtm_release/dtm/main.h new file mode 100644 index 0000000000000000000000000000000000000000..cb843c0b343f15df0dc11dcf821ee3594c8674c5 --- /dev/null +++ b/dtm_release/dtm/main.h @@ -0,0 +1,25 @@ +#ifndef MAINH +#define MAINH + +#include <stdlib.h> +#include <string.h> +#include "data.h" +#include "lda-seq.h" +#include "lda.h" +#include <gsl/gsl_matrix.h> + +typedef struct dtm_fit_params +{ + char* datafile; + char* outname; + char* heldout; + int start; + int end; + int ntopics; + int lda_max_em_iter; + double top_obs_var; + double top_chain_var; + double alpha; +} dtm_fit_params; + +#endif diff --git a/dtm_release/dtm/param.c b/dtm_release/dtm/param.c new file mode 100644 index 0000000000000000000000000000000000000000..b9bd40e018529219f3ac9cf0e9ce9c51fcc8dfc5 --- /dev/null +++ b/dtm_release/dtm/param.c @@ -0,0 +1,1007 @@ +/*====================================================================*/ +/* A group of routines to extract parameters from scripts and import */ +/* them into C/C++ programs. J. Lafferty 2/2/95 */ +/*====================================================================*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <assert.h> +#include "param.h" +#include "util.h" + +/* #define TRACE 1 */ +#define EOL '\n' +#define EOS '\0' +#define DELIMIT_CHAR '=' +#define ENDMARK_CHAR ';' +#define COMMAND_CHAR '%' +#define EMBEDDED_VAR_CHAR '@' +#define FIXED_CHAR '+' +#define QUOTE_CHAR '\'' +#define DQUOTE_CHAR '"' +#define DDTABLE_SIZE 1001 +#define MAX_SYMBOL_LENGTH 65535 +#define DDINF_DEFAULT_NAME "DDINF" +#define TRUE 1 +#define FALSE 0 + +static int restart_inited = FALSE; +static int restart_is_new = FALSE; +static int checkpointed = FALSE; +static FILE *restart_unit=NULL; +static char *restart_name=NULL; +static char *ddname_buffer; +static char *ddvalue_buffer; +static char *command_buffer; +static char *argument_buffer; +static int nameBufferIndex=0, valueBufferIndex=0; +static int commandBufferIndex, argumentBufferIndex; +static char *begin_restart_header="/***BEGIN_RESTART***/\n"; +static char *end_restart_header="/***END_RESTART***/\n"; +static int NumberOfYesStrings = 3; +static char *YesString[] = {"YES", "TRUE", "1"}; + +/*********************************************************/ +/* Various linked lists: */ +/*********************************************************/ +typedef struct ddlink ddlink; +typedef struct clink clink; +typedef struct ddinf_link ddinf_link; +typedef struct ddpar_link ddpar_link; + +struct ddlink { + char *ddname; + char *ddvalue; + int fixed; + ddlink *next; +}; +struct clink { + char *name; + clink *next; +}; +struct ddinf_link { + char *name; + FILE *stream; + ddinf_link *next; +}; +struct ddpar_link { + char *file_name; + int par_inited; + ddlink **ddtable; + ddpar_link *next; +}; + +static ddinf_link *ddinf=NULL; +static clink *prefix_stack=NULL; +static ddpar_link *ddpar=NULL; +static char *ddinfName; + +/***************************************************/ +/* Internal procedures: */ +/***************************************************/ +int param_init(void); +void param_init_restart(void); +int same_string_upcase_first_arg(char *s, char *t); +void parse_stream(FILE *stream, char *file_name); +ddinf_link *push_last_complete_block (char *iname); +ddinf_link *push_ddinf_stream (FILE* instream, char *inname); +ddinf_link *push_ddinf (char *inname); +void pop_ddinf (void); +ddlink *insert (const char *newddname, const char *newddvalue); +void ddinf_error (char *ermsg); +double safe_atod (const char *name, const char *expr); +long safe_atol (const char *name, const char *expr); + +void param_init_buffers(void) { + static int buffers_inited=FALSE; + + if (buffers_inited) return; + ddname_buffer = (char *) malloc(MAX_SYMBOL_LENGTH); + ddvalue_buffer = (char *) malloc(MAX_SYMBOL_LENGTH); + command_buffer = (char *) malloc(80); + argument_buffer = (char *) malloc(MAX_SYMBOL_LENGTH); + buffers_inited = TRUE; +} + + +/***************************************************/ +int param_init(){ + static int ddinf_inited=FALSE; + + param_init_buffers(); + if (ddinf_inited) return TRUE; + + ddinfName = (char *) malloc(80); + ddinfName = getenv("PARAM"); + ddinf_inited = TRUE; + + if (ddinfName != NULL) param_push_file(ddinfName); + return TRUE; +} + +/***************************************************/ +void param_init_par() { + FILE *stream; + + param_init(); + if ((ddpar == NULL) || (ddpar->par_inited)) return; + printf("filename: %s", ddpar->file_name); + stream = fopen(ddpar->file_name, "r"); + parse_stream(stream, ddpar->file_name); + ddpar->par_inited = TRUE; +} + + + +/*******************************************************/ +/* Initialize ddinf names and values. This is */ +/* organized as a simple finite-state machine. */ +/*******************************************************/ +void parse_stream(FILE *instream, char *inname){ + printf("ddinf: %d\n", 0); + int c, next_c; + /* These are really characters, but the library functions use ints */ + int commentLevel = 0; + + enum buffer_state { + BEGIN_LINE, ENDMARKED, COMMENT, NAME, NAME_ENDED, + VALUE, DIRECTIVE, ARGUMENT, QUOTATION, QUOTATION_ENDED, DQUOTATION, DQUOTATION_ENDED + } state = BEGIN_LINE, prev_state = BEGIN_LINE; + enum character_class { + WHITESPACE, COMMENT_START, COMMENT_END, DELIMITER, ENDMARK, + END_OF_LINE, COMMAND, QUOTE, DQUOTE, OTHER, FIXIT + } cclass; + + ddinf = push_ddinf_stream(instream, inname); + + printf("ddinf: %d\n", ddinf); + + while (ddinf != NULL) { + while ((c=getc(ddinf->stream)) != EOF) { + switch (c) { + case DELIMIT_CHAR: cclass = DELIMITER; break; + case ENDMARK_CHAR: cclass = ENDMARK; break; + case EOL: cclass = END_OF_LINE; break; + case COMMAND_CHAR: cclass = COMMAND; break; + case QUOTE_CHAR: cclass = QUOTE; break; + case DQUOTE_CHAR: cclass = DQUOTE; break; + case FIXED_CHAR: cclass = FIXIT; break; + case '/': + if ((state == QUOTATION) || (state == DQUOTATION)) + cclass = OTHER; + else + if ((next_c = getc(ddinf->stream)) == '*') + cclass = COMMENT_START; + else { + cclass = OTHER; + if (ungetc(next_c, ddinf->stream) == EOF) + error("PARAM: ungetc failed."); + } + break; + case '*': + if ((state == QUOTATION) || (state == DQUOTATION)) + cclass = OTHER; + else + if ((next_c = getc(ddinf->stream)) == '/') + cclass = COMMENT_END; + else { + cclass = OTHER; + if (ungetc(next_c, ddinf->stream) == EOF) + error("PARAM: ungetc failed."); + } + break; + default: + if (isspace(c)) cclass = WHITESPACE; + else cclass = OTHER; + } + switch (state) { + case BEGIN_LINE: + switch (cclass) { + case WHITESPACE: case END_OF_LINE: break; + case COMMENT_START: + prev_state = BEGIN_LINE; + state = COMMENT; + commentLevel++; + break; + case COMMENT_END: ddinf_error("Unmatched comment ending"); + case DELIMITER: ddinf_error("Missing parameter name."); + case QUOTE: ddinf_error("Quotations for values only."); + case DQUOTE: ddinf_error("Quotations for values only."); + case ENDMARK: state = ENDMARKED; break; + case COMMAND: commandBufferIndex = 0; state = DIRECTIVE; break; + case FIXIT: ddname_buffer[nameBufferIndex++] = c; break; + case OTHER: + ddname_buffer[nameBufferIndex++] = c; + state = NAME; + break; + } + break; + case ENDMARKED: + switch (cclass) { + case WHITESPACE: break; + case COMMENT_START: + prev_state = ENDMARKED; + state = COMMENT; + commentLevel++; + break; + case COMMENT_END: ddinf_error("Unmatched comment ending"); + case DELIMITER: ddinf_error("Missing parameter name."); + case QUOTE: ddinf_error("Quotations for values only."); + case DQUOTE: ddinf_error("Quotations for values only."); + case ENDMARK: ddinf_error("Null production"); + case COMMAND: commandBufferIndex = 0; state = DIRECTIVE; break; + case OTHER: + ddname_buffer[nameBufferIndex++] = c; + state = NAME; + break; + case FIXIT: + ddname_buffer[nameBufferIndex++] = c; + state = NAME; + break; + case END_OF_LINE: state = BEGIN_LINE; break; + default: + ddinf_error("Illegal character after end marker."); + } + break; + case COMMENT: + switch (cclass) { + case COMMENT_END: commentLevel--; + if (commentLevel == 0) + state = prev_state; + break; + case COMMENT_START: commentLevel++; break; + default: break; + } + break; + case NAME: + switch (cclass) { + case WHITESPACE: case END_OF_LINE: + state = NAME_ENDED; + break; + case COMMENT_START: + prev_state = NAME_ENDED; + state = COMMENT; + commentLevel++; + break; + case COMMENT_END: ddinf_error("Unmatched comment ending"); + case QUOTE: ddinf_error("Quotes for values only."); + case DQUOTE: ddinf_error("Quotes for values only."); + case DELIMITER: + state = VALUE; + break; + case ENDMARK: ddinf_error("Missing value."); + case COMMAND: /* XXX shouldn't this be allowed if name is begun ?*/ + ddinf_error("Illegal use of COMMAND character."); + case FIXIT: + ddinf_error("Illegal use of FIXIT character."); + case OTHER: ddname_buffer[nameBufferIndex++] = c; + } + break; + case NAME_ENDED: + switch (cclass) { + case WHITESPACE: case END_OF_LINE: break; + case COMMENT_START: + prev_state = NAME_ENDED; + state = COMMENT; + commentLevel++; + break; + case DELIMITER: + state = VALUE; + break; + default: + ddinf_error("Illegal character after parameter name."); + } + break; + case VALUE: + switch (cclass) { + case WHITESPACE: + break; + case COMMENT_START: /* XXX be sure this means not quoted!! */ + prev_state = VALUE; + state = COMMENT; + commentLevel++; + break; + case COMMENT_END: ddinf_error("Unmatched comment ending"); + case DELIMITER: ddinf_error("Missing delimiter or endmark."); + case ENDMARK: + ddname_buffer[nameBufferIndex++] = EOS; + ddvalue_buffer[valueBufferIndex++] = EOS; + if (insert(ddname_buffer, strip(ddvalue_buffer)) == NULL) + ddinf_error("error adding (name,value) pair"); + nameBufferIndex = 0; + valueBufferIndex = 0; + state = ENDMARKED; + break; + /* case END_OF_LINE: ddinf_error("Missing end marker."); */ + case END_OF_LINE: break; + case QUOTE: state = QUOTATION; break; + case DQUOTE: state = DQUOTATION; break; + default: + ddvalue_buffer[valueBufferIndex++] = c; + } + break; + case DIRECTIVE: + switch (cclass) { + case WHITESPACE: + command_buffer[commandBufferIndex] = EOS; + argumentBufferIndex = 0; + state = ARGUMENT; + break; + case OTHER: command_buffer[commandBufferIndex++] = c; break; + default: ddinf_error("Illegal character in ddinf directive"); + } + break; + case ARGUMENT: + switch (cclass) { + case WHITESPACE: break; + case COMMENT_START: + prev_state = ARGUMENT; + state = COMMENT; + commentLevel++; + break; + case COMMENT_END: ddinf_error("Unmatched comment ending"); + case ENDMARK: + argument_buffer[argumentBufferIndex] = EOS; + if (strcmp(command_buffer, "include") == 0) { + ddinf = push_ddinf(argument_buffer); + if (ddinf->stream == NULL) + ddinf_error("Unable to open ddinf"); + state = BEGIN_LINE; + } + else if (strcmp(command_buffer, "include_restart") == 0) { + ddinf = push_last_complete_block(argument_buffer); + if (ddinf->stream == NULL) + ddinf_error("Unable to open ddinf"); + state = BEGIN_LINE; + } + else if (strcmp(command_buffer, "restart")==0) { + if (strstr(argument_buffer,"(new") != 0) { + *strchr(argument_buffer, '(') = EOS; + restart_is_new = TRUE; + } + insert("%restart", argument_buffer); + state = BEGIN_LINE; + } + else ddinf_error("Unrecognized ddinf directive."); + break; + case END_OF_LINE: ddinf_error("Missing end marker"); + default: + argument_buffer[argumentBufferIndex++] = c; + } + break; + case QUOTATION: + if (cclass == QUOTE) state=QUOTATION_ENDED; + else ddvalue_buffer[valueBufferIndex++] = c; + break; + case DQUOTATION: + if (cclass == DQUOTE) state=DQUOTATION_ENDED; + else ddvalue_buffer[valueBufferIndex++] = c; + break; + case QUOTATION_ENDED: + switch (cclass) { + case WHITESPACE: break; + case COMMENT_START: + prev_state = VALUE; + state = COMMENT; + commentLevel++; + break; + case COMMENT_END: ddinf_error("Unmatched comment end."); + case ENDMARK: + ddname_buffer[nameBufferIndex++] = EOS; + ddvalue_buffer[valueBufferIndex++] = EOS; + if (insert(ddname_buffer, ddvalue_buffer) == NULL) + ddinf_error("error adding (name,value) pair"); + nameBufferIndex = 0; + valueBufferIndex = 0; + state = ENDMARKED; + break; + case END_OF_LINE: break; + case QUOTE: + state = QUOTATION; + ddvalue_buffer[valueBufferIndex++] = c; + break; + default: + ddinf_error("Illegal character after quotation."); + } + break; + case DQUOTATION_ENDED: + switch (cclass) { + case WHITESPACE: break; + case COMMENT_START: + prev_state = VALUE; + state = COMMENT; + commentLevel++; + break; + case COMMENT_END: ddinf_error("Unmatched comment end."); + case ENDMARK: + ddname_buffer[nameBufferIndex++] = EOS; + ddvalue_buffer[valueBufferIndex++] = EOS; + if (insert(ddname_buffer, ddvalue_buffer) == NULL) + ddinf_error("error adding (name,value) pair"); + nameBufferIndex = 0; + valueBufferIndex = 0; + state = ENDMARKED; + break; + case END_OF_LINE: break; + case DQUOTE: + ddinf_error("Illegal character after quotation."); + break; + default: + ddinf_error("Illegal character after quotation."); + break; + } + break; + } /* Matches switch on current state */ + } /* Matches while not end-of-file */ + if ((state != ENDMARKED) && (state != BEGIN_LINE)) { + if ((state == QUOTATION) || (state == DQUOTATION)) { + ddinf_error("end of file inside quoted string."); + } + else if (commentLevel != 0) { + ddinf_error("end of file inside comment."); + } + else { + ddinf_error("Not in proper state at end of file."); + } + } + pop_ddinf(); + } /* Matches while ddinf != NULL */ +} + + +/*******************************************************/ +void param_dump (FILE *stream) { + int i; + ddlink *lp; + param_init_par(); + for (i=0; i<DDTABLE_SIZE; ++i) { + for (lp = ddpar->ddtable[i]; lp != NULL; lp = lp->next) { + if (lp->fixed) fputc('+', stream); + fputs(lp->ddname, stream); + fputs(" = ", stream); + fputs(quote(lp->ddvalue), stream); + fputs(";\n", stream); + } + } +} + + +/*******************************************************/ +static unsigned hash (const char *s) { + unsigned hashval; + for (hashval=0; *s != EOS; s++) + hashval = *s + 31*hashval; + return hashval % DDTABLE_SIZE; +} + +/*******************************************************/ +ddlink *lookup (const char *s) { + ddlink *lp; + int i; + i = hash(s); + if (ddpar == NULL) return NULL; + for (lp = ddpar->ddtable[hash(s)]; lp != NULL; lp = lp->next) + if (strcmp(s, lp->ddname) == 0) + return lp; + return NULL; +} + +/*******************************************************/ +ddlink *prefixed_lookup (const char *s) { + static char *prefixed_s=NULL; + if (prefixed_s == NULL) + prefixed_s = (char *) malloc (MAX_SYMBOL_LENGTH); + if (prefix_stack == NULL) return lookup(s); + sprintf(prefixed_s, "%s%s", prefix_stack->name, s); + return lookup(prefixed_s); +} + +/*******************************************************/ + +/* begin ALB 9/96 */ + +char *lookup_ddval(const char *p, int *len) +{ + ddlink *lp; + char ddparm[MAX_SYMBOL_LENGTH]; + int i, nopenparens; + if (p[0] !='(') + { + /* No (), embedded ddparm takes up remainder of p */ + strcpy(ddparm,p); + *len = strlen(p)+1; + } + else + { + nopenparens=1; + for (i=1; p[i] && nopenparens>0; i++) + { + if (p[i]=='(') nopenparens++; + if (p[i]==')') nopenparens--; + } + if (nopenparens>0) error("PARAM: Unmatched ("); + memcpy(ddparm, &p[1], i-2); + ddparm[i-2]=0; + *len = i+1; + } + + /* sanity check: no nested % */ + if (strchr(ddparm, EMBEDDED_VAR_CHAR)!=NULL) + error("PARAM: No nested %% allowed."); + + if ((lp = lookup(ddparm)) == NULL) + error("PARAM: symbol %s not defined (yet)\n", ddparm); + return lp->ddvalue; +} + + +void expand_ddval(const char *ddval_raw, char *ddval_expanded) +{ + char c, *ddval; + int i=0,j=0,len; + while((c=ddval_raw[i])!='\0') + { + if (c == EMBEDDED_VAR_CHAR) + { + ddval = lookup_ddval(&ddval_raw[i+1], &len); + strcpy(&ddval_expanded[j], ddval); + i+= len; + j+= strlen(ddval); + } + else + ddval_expanded[j++] = ddval_raw[i++]; + } + ddval_expanded[j] = 0; +} + +/*******************************************************/ +ddlink *insert (const char *newddname, const char *newddvalue_raw) { + ddlink *lp; + unsigned hashval; + char newddvalue_buff[MAX_SYMBOL_LENGTH]; + char *newddvalue = &newddvalue_buff[0]; + int fixit=FALSE; + + if (newddname[0] == '+') { + fixit = TRUE; + newddname++; + } + + expand_ddval(newddvalue_raw,newddvalue); /* ALB 9/96 */ + + if ((lp = lookup(newddname)) == NULL) { + lp = (ddlink *) malloc (sizeof(*lp)); + lp->ddname = (char *) malloc(strlen(newddname)+1); + lp->ddvalue = (char *) malloc(strlen(newddvalue)+1); + if (lp == NULL || lp->ddname == NULL || lp->ddvalue == NULL) return NULL; + hashval = hash(newddname); + strcpy(lp->ddname, newddname); + strcpy(lp->ddvalue, newddvalue); + lp->next = ddpar->ddtable[hashval]; + lp->fixed = fixit; + ddpar->ddtable[hashval] = lp; + } + else if (!lp->fixed) { + free ((char *) lp->ddvalue); + if ((lp->ddvalue = (char *) malloc(strlen(newddvalue)+1)) == NULL) + return NULL; + strcpy(lp->ddvalue, newddvalue); + } + else if (lp->fixed && fixit) { + if (strcmp(lp->ddvalue, newddvalue) == 0) + printf("PARAM: Warning: Symbol %s fixed more than once\n", lp->ddname); + else + error("PARAM: Error: Symbol %s already fixed", lp->ddname); + } + return lp; +} + + + +/*******************************************************/ +int param_checkpointed(void){ + param_init_par(); + if (checkpointed) return TRUE; + if (restart_is_new || qfilef(param_getc("%restart",""))==0) + return FALSE; + else { + param_init_restart(); + checkpointed = TRUE; + return TRUE; + } +} + + +/*******************************************************/ +void param_checkpoint(void){ + param_init_par(); + if (!param_checkpointed()) param_init_restart(); + fputs(end_restart_header, restart_unit); + fputs(begin_restart_header, restart_unit); + fflush(restart_unit); + checkpointed = TRUE; +} + + +/*******************************************************/ +ddinf_link *push_last_complete_block (char *inname) { + int i, j; + int last_restart_rec, next_to_last_restart_rec; + FILE *unit; + ddinf_link *dl; + char *buffer; + + dl = (ddinf_link *) malloc(sizeof(*dl)); + dl->next = ddinf; + dl->name = (char *) malloc(strlen(inname)+1); + strcpy(dl->name, inname); + buffer = (char *) malloc(MAX_SYMBOL_LENGTH); + if (!(unit = fopen(inname, "r"))) + error("PARAM: Unable to open restart %s", inname); + j = last_restart_rec = next_to_last_restart_rec = 0; + while(fgets(buffer, 100, unit)) { + j++; + if (strcmp(buffer,begin_restart_header)==0){ + next_to_last_restart_rec = last_restart_rec; + last_restart_rec = j; + } + } + fclose(unit); + dl->stream = fopen(inname, "r"); + if (next_to_last_restart_rec != 0) /* reposition manually */ + for (i=0; i<next_to_last_restart_rec; ++i) + fgets(buffer, MAX_SYMBOL_LENGTH, dl->stream); + free(buffer); + return dl; +} + + +/*******************************************************/ +void param_init_restart(void){ + ddinf_link *dl; + + param_init_par(); + if (restart_inited) return; + + if (restart_name==NULL) + { + restart_name = (char *) malloc(strlen(param_getc("%restart",""))+1); + strcpy(restart_name, param_getc("%restart","")); + } + + if (restart_is_new || qfilef(restart_name)==0) { + if (!(restart_unit = fopen(restart_name, "w"))) + error("PARAM: Unable to open restart %s", restart_name); + fputs(begin_restart_header, restart_unit); + fflush(restart_unit); + } + else { + dl = push_last_complete_block(restart_name); + parse_stream(dl->stream, restart_name); + if (!(restart_unit = fopen(restart_name, "a"))) + error("PARAM: Unable to open restart %s", restart_name); + } + restart_inited = TRUE; +} + + +/*******************************************************/ +ddinf_link *push_ddinf_stream (FILE* instream, char *inname) { + ddinf_link *dl; + dl = (ddinf_link *) malloc(sizeof(*dl)); + dl->next = ddinf; + dl->name = (char *) malloc(strlen(inname)+1); + strcpy(dl->name, inname); + dl->stream = instream; + return dl; +} + +/*******************************************************/ +ddinf_link *push_ddinf (char *inname) { + ddinf_link *dl; + dl = (ddinf_link *) malloc(sizeof(*dl)); + dl->next = ddinf; + dl->name = (char *) malloc(strlen(inname)+1); + strcpy(dl->name, inname); + if ((dl->stream = fopen(dl->name, "r")) == NULL) + error("PARAM: Unable to open ddinf %s", dl->name); + return dl; +} + +/*******************************************************/ +void pop_ddinf (void) { + if (ddinf == NULL) return; + free (ddinf->name); + fclose (ddinf->stream); + ddinf = ddinf->next; +} + +/*******************************************************/ +int param_set_file (char *fn) { + return 0; +} + +/*******************************************************/ +void param_unset_file (char *fn) { +} + + +/*******************************************************/ +void param_push_prefix (const char *hot_prefix) { + clink *pp; + pp = (clink *) malloc(sizeof(*pp)); + pp->next = prefix_stack; + pp->name = (char *) malloc(strlen(hot_prefix)+1); + strcpy(pp->name, hot_prefix); + prefix_stack = pp; +} + + +/*******************************************************/ +void param_pop_prefix (void) { + if (prefix_stack == NULL) return; + free ((char *) prefix_stack->name); + prefix_stack = prefix_stack->next; +} + + +/*******************************************************/ +void param_set_restart_file(const char *restart_name_p) +{ + restart_name = (char *) malloc (strlen(restart_name_p)+1); + strcpy(restart_name, restart_name_p); +} + +/*******************************************************/ +void param_puti(const char *var_name, int val){ + param_init_restart(); + fprintf(restart_unit, "%s = %d;\n", var_name, val); + fflush(restart_unit); +} + + +/*******************************************************/ +void param_putf(const char *var_name, double val){ + param_init_restart(); + fprintf(restart_unit, "%s = %18.11e;\n", var_name, val); + fflush(restart_unit); +} + + +/*******************************************************/ +void param_putc(const char *var_name, char *val){ + param_init_restart(); + fprintf(restart_unit, "%s = %s;\n", var_name, quote(val)); + fflush(restart_unit); +} + + +/*******************************************************/ +void param_fwritei(FILE *fp, char *var_name, int val){ + fprintf(fp, "%s = %d;\n", var_name, val); +} + + +/*******************************************************/ +void param_fwritef(FILE *fp, char *var_name, double val){ + fprintf(fp, "%s = %18.11e;\n", var_name, val); +} + +/*******************************************************/ +void param_fwritec(FILE *fp, char *var_name, char *val) { + fprintf(fp, "%s = %s;\n", var_name, quote(val)); +} + + +/*******************************************************/ +void param_set(const char *parameter_name, char *new_value) { + param_init_par(); + insert(parameter_name, new_value); +} + + +/*******************************************************/ +int param_geti(const char *var_name, int dflt){ + ddlink *lp; + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) return dflt; + else return safe_atol(var_name, lp->ddvalue); +} + + +/*******************************************************/ +int param_symvarie(const char *var_name, int *var){ + ddlink *lp; + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) return FALSE; + else *var = safe_atol(var_name, lp->ddvalue); + return TRUE; +} + +/*******************************************************/ +void param_symvari(char *var_name, int *var){ + ddlink *lp; + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) + { + printf("\nddinf var %s not defined.\n",var_name); + assert(0); + } + else *var = safe_atol(var_name, lp->ddvalue); + } + +/*******************************************************/ +double param_getf(const char *var_name, double dflt){ + ddlink *lp; + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) return dflt; + else return safe_atod(var_name, lp->ddvalue); + } + + +/*******************************************************/ +int param_symvarfe(const char *var_name, double *var){ + ddlink *lp; + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) return FALSE; + else *var = safe_atod(var_name, lp->ddvalue); + return TRUE; +} + + +/*******************************************************/ +void param_symvarf(char *var_name, double *var){ + ddlink *lp; + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) + { + printf("\nddinf var %s not defined.\n",var_name); + assert(0); + } + else *var = safe_atod(var_name, lp->ddvalue); + } + + +/*******************************************************/ +char *param_getc(const char *var_name, char *dflt){ + ddlink *lp; + printf("getc\n"); + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) return dflt; + else return lp->ddvalue; + } + +/*******************************************************/ +char *param_gets(const char *var_name){ + ddlink *lp; + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) { + error("PARAM: variable %s not found.", var_name); + return NULL; + } + else return lp->ddvalue; + } + +/*******************************************************/ +int param_symvarce(const char *var_name, char *var){ + ddlink *lp; + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) return FALSE; + else strcpy(var, lp->ddvalue); + return TRUE; +} + + +/*******************************************************/ +void param_symvarc(char *var_name, char *var){ + ddlink *lp; + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) + { + printf("\nddinf var %s not defined.\n",var_name); + assert(0); + } + else strcpy(var, lp->ddvalue); + } + +/*******************************************************/ +int param_getb(const char *var_name, int dflt) { + ddlink *lp; + int i; + param_init_par(); + if ((lp = prefixed_lookup(var_name)) == NULL) return dflt; + else for (i=0; i< NumberOfYesStrings; i++) + if (same_string_upcase_first_arg(lp->ddvalue, YesString[i])) + return TRUE; + return FALSE; +} + + +/*******************************************************/ +int same_string_upcase_first_arg(char *s, char *t) { + while ((*s != EOS) && (toupper(*s) == *t)) { + s++; + t++; + } + return *s == *t; +} + + +/*******************************************************/ +void ddinf_error (char *ermsg) { + error("ERROR IN DDINF=%s: %s", ddinf->name, ermsg); +} + + +/*******************************************************/ +double safe_atod (const char *name, const char *expr) { + double f = atof(expr); + /* if (strcmp(suffix,"") != 0) + error("PARAM: Unable to convert value \"%s\" for ddname \"%s\"", expr, name); */ + return f; +} + +/*******************************************************/ +long safe_atol (const char *name, const char *expr) { + long d; + char *suffix; + d = strtol(expr, &suffix, 0); + if (strcmp(suffix,"") != 0) + error("PARAM: Unable to convert value \"%s\" for ddname \"%s\"", + expr, name); + return d; +} + + +/*******************************************************/ +int param_push_file (const char *fn) { + ddpar_link *d, *e; + const char *pname=fn; + + param_init(); + + if (strcmp(DDINF_DEFAULT_NAME, fn)==0) pname = ddinfName; + + for (e=ddpar; e != NULL; e = e->next) + if (strcmp(e->file_name, pname)==0) break; + + /* If not found, initialize */ + if (e == NULL) { + if (!qfilef(fn)) return FALSE; + d = (ddpar_link *) malloc(sizeof(ddpar_link)); + d->file_name = (char *) malloc(strlen(fn)+1); + strcpy(d->file_name, fn); + d->ddtable = (ddlink **) calloc(DDTABLE_SIZE, sizeof(ddlink *)); + d->par_inited = FALSE; + d->next = ddpar; + ddpar = d; + /* stream = fopen(fn, "r"); */ + /* parse_stream(stream, fn); */ + } + /* If already found, use its table */ + else { + d = (ddpar_link *) malloc(sizeof(ddpar_link)); + d->file_name = (char *) malloc(strlen(fn)+1); + strcpy(d->file_name, fn); + d->ddtable = e->ddtable; + d->par_inited = e->par_inited; + d->next = ddpar; + ddpar = d; + } + return TRUE; +} + + +/*******************************************************/ +char * param_pop_file (void) { + ddpar_link *d; + + d = ddpar; + if ((d != NULL) && (d->next == NULL)) return NULL; /* Don't allow the stack to be */ + else if (ddpar != NULL) ddpar = ddpar->next; /* completely cleared */ + + free (d->ddtable); + return d->file_name; +} diff --git a/dtm_release/dtm/param.h b/dtm_release/dtm/param.h new file mode 100644 index 0000000000000000000000000000000000000000..1337a2ef644887517b2efff4715bcf929440f7c1 --- /dev/null +++ b/dtm_release/dtm/param.h @@ -0,0 +1,78 @@ +#include <stdio.h> +#include "util.h" + +int param_geti(const char *parameter_name, int default_value); + +double param_getf(const char *parameter_name, double default_value); + +char *param_getc(const char *parameter_name, char *default_value); + +char *param_gets(const char *parameter_name); + +int param_getb(const char *parameter_name, int default_value); + /* Returns true if the value of <parameter_name> is 1, true, or yes, + (case insensitive), false for any other value, and default_value + for no value. */ + +int param_symvarie(const char *parameter_name, int *returned_value); + /* Returns true if a value was found, false otherwise */ + +int param_symvarfe(const char *parameter_name, double *returned_value); + /* Ditto */ + +int param_symvarce(const char *parameter_name, char *returned_value); + /* Ditto. Note that the second argument is a "pointer to a char *", + i.e., approximately a pointer to a string. */ + +void param_set(const char *parameter_name, char *new_value); + /* Changes the value of ddinf parameter <parameter_name>. This can be + used to communicate with subroutines which expect ddinf + parameters without having to make sure they exist in the ddinf file. + Note, however, that values assigned in the ddinf file are + OVERRIDDEN by a call to param_set. */ + /* One might want to implement a param_add which would allow adding + new ddinf parameters within a program, but which could not + override values from the ddinf file. */ + +/* if the following isn't called, param.c looks for a %restart +binding in the param file */ +void param_set_restart_file(const char *restart_name_p); + +/* The following three calls write values to the restart file: */ +void param_puti(const char *parameter_name, int value); + +void param_putf(const char *parameter_name, double value); + +void param_putc(const char *parameter_name, char *value); + + +int param_checkpointed(void); + /* If there is a restart file, reads it in and returns TRUE. Otherwise + returns false. */ + +void param_checkpoint(void); + /* Commits all of the param_put calls so far, are starts a new + checkpoint. (I.e., subsequent `param_put's supersede earlier ones.) */ + + +void param_dump (FILE *stream); + /* Writes the current ddinf bindings to a stream */ + +void param_push_prefix (const char *hot_prefix); + /* Push the current prefix to be applied to all ddnames */ + +void param_pop_prefix (void); + /* Pop the current prefix */ + +int param_push_file (const char *fn); + /* Use the file for all bindings */ + +char *param_pop_file (void); + /* Pop current bindings */ + + + + + + + diff --git a/dtm_release/dtm/params.c b/dtm_release/dtm/params.c new file mode 100644 index 0000000000000000000000000000000000000000..201e795456e66b556a62438c27c70a62cc68dd8a --- /dev/null +++ b/dtm_release/dtm/params.c @@ -0,0 +1,150 @@ +// Author: David Blei (blei@cs.princeton.edu) +// +// Copyright 2006 David Blei +// All Rights Reserved. +// +// See the README for this package for details about modifying or +// distributing this software. + +#include "params.h" + +/* + * check label + * + */ + +void check_label(FILE* f, char* name) +{ + char label[400]; + fscanf(f, "%s", label); + assert(strcmp(label, name) == 0); +} + + +/* + * read and write strings + * + */ + +void params_read_string(FILE* f, char* name, char* x) +{ + check_label(f, name); + fscanf(f, "%s", x); + outlog("%-10s READ NAME=%-10s STRING=%s", "[PARAMS]", name, x); +} + +/* + * read and write integers + * + */ + +void params_read_int(FILE* f, char* name, int* x) +{ + check_label(f, name); + assert(fscanf(f, "%d", x) > 0); + outlog("%-10s READ NAME=%-10s INT=%d", "[PARAMS]", name, *x); +} + +void params_write_int(FILE* f, char* name, int x) +{ + fprintf(f, "%s %d\n", name, x); +} + + +/* + * read and write doubles + * + */ + +void params_read_double(FILE* f, char* name, double* x) +{ + check_label(f, name); + assert(fscanf(f, "%lf", x) > 0); + outlog("%-10s READ NAME=%-10s DBL=%1.14e", "[PARAMS]", name, *x); +} + +void params_write_double(FILE* f, char* name, double x) +{ + fprintf(f, "%s %17.14f\n", name, x); +} + + +/* + * read and write gsl vectors and matrices. + * + */ + +void params_read_gsl_vector(FILE* f, char* name, gsl_vector** x) +{ + int size, i; + double val; + + check_label(f, name); + assert(fscanf(f, "%d", &size) > 0); + *x = gsl_vector_calloc(size); + for (i = 0; i < size; i++) + { + assert(fscanf(f, "%lf", &val) > 0); + gsl_vector_set(*x, i, val); + } +} + + +void params_write_gsl_vector(FILE* f, char* name, gsl_vector* x) +{ + fprintf(f, "%s %d", name, (int) x->size); + int i; + for (i = 0; i < x->size; i++) + fprintf(f, " %17.14f", gsl_vector_get(x, i)); + fprintf(f, "\n"); +} + + +//void params_write_doc_ + +void params_write_gsl_vector_multiline(FILE* f, char* name, gsl_vector* x) +{ + fprintf(f, "%s %d\n", name, (int) x->size); + int i; + if (x->size) { + fprintf(f, "%17.14f", gsl_vector_get(x, 0)); + } + for (i = 1; i < x->size; i++) + fprintf(f, ",%17.14f", gsl_vector_get(x, i)); + fprintf(f, "\n"); +} + + +void params_write_gsl_matrix(FILE* f, char* name, gsl_matrix* x) +{ + fprintf(f, "%s %ld %ld\n", name, x->size1, x->size2); + int i, j; + if (x->size1 == 0) { + return; + } + for (i = 0; i < x->size1; i++) { + fprintf(f, "%17.14f", gsl_matrix_get(x, i, 0)); + for (j = 1; j < x->size2; j++) { + fprintf(f, ",%17.14f", gsl_matrix_get(x, i, j)); + } + fprintf(f, "\n"); + } +} + +void params_write_sparse_gsl_matrix(FILE* f, char* name, gsl_matrix* x) +{ + fprintf(f, "%s %ld %ld\n", name, x->size1, x->size2); + int i, j; + if (x->size1 == 0) { + return; + } + for (i = 0; i < x->size1; i++) { + for (j = 0; j < x->size2; j++) { + // outlog("%d %d %d %d", i, j, x->size1, x->size2); + double value = gsl_matrix_get(x, i, j); + if (fabs(value) > 1e-12) { + fprintf(f, "%d,%d,%17.14f\n", i, j, value); + } + } + } +} diff --git a/dtm_release/dtm/params.h b/dtm_release/dtm/params.h new file mode 100644 index 0000000000000000000000000000000000000000..c78d8fef156a6526663948cfeab7d6477520c48d --- /dev/null +++ b/dtm_release/dtm/params.h @@ -0,0 +1,40 @@ +// Author: David Blei (blei@cs.princeton.edu) +// +// Copyright 2006 David Blei +// All Rights Reserved. +// +// See the README for this package for details about modifying or +// distributing this software. + +#ifndef PARAMSH +#define PARAMSH + +#define MAX_LINE_LENGTH 100000; + +#include "gsl-wrappers.h" +#include <stdlib.h> +#include <stdio.h> +#include <gsl/gsl_vector.h> +#include <string.h> + +void params_read_string(FILE* f, char* name, char* x); + +void params_read_int(FILE* f, char* name, int* x); + +void params_write_int(FILE *, char *, int); + +void params_read_double(FILE* f, char* name, double* x); + +void params_write_double(FILE *, char *, double); + +void params_read_gsl_vector(FILE* f, char* name, gsl_vector** x); + +void params_write_gsl_vector(FILE *, char* , gsl_vector *); + +void params_write_gsl_vector_multiline(FILE *, char* , gsl_vector *); + +void params_write_gsl_matrix(FILE *, char* , gsl_matrix *); + +void params_write_sparse_gsl_matrix(FILE *, char* , gsl_matrix *); + +#endif diff --git a/dtm_release/dtm/sample.sh b/dtm_release/dtm/sample.sh new file mode 100755 index 0000000000000000000000000000000000000000..7aaf841a70390a70dce3261b329e57305fb813d7 --- /dev/null +++ b/dtm_release/dtm/sample.sh @@ -0,0 +1,107 @@ +This file provides information about running the Dynamic Topic Model +or the Document Influence Model. It gives two command-line examples +for running the software and several example commands in R for reading +output files. + +Dynamic topic models and the influence model have been implemented +here in c / c++. This implementation takes two input files: + + (a) foo-mult.dat, which is one-doc-per-line, each line of the form + + unique_word_count index1:count1 index2:count2 ... indexn:counnt + + where each index is an integer corresponding to a unique word. + + (b) foo-seq.dat, which is of the form + + Number_Timestamps + number_docs_time_1 + ... + number_docs_time_i + ... + number_docs_time_NumberTimestamps + + - The docs in foo-mult.dat should be ordered by date, with the first + docs from time1, the next from time2, ..., and the last docs from + timen. + +When working with data like this, I've found it helpful to create +the following files: + - the mult.dat file (described in (a) above) + - the seq.dat file (described in (b) above) + - a file with all of the words in the vocabulary, arranged in + the same order as the word indices + - a file with information on each of the documents, arranged in + the same order as the docs in the mult file. + +The code creates at least the following files: + + - topic-???-var-e-log-prob.dat: the e-betas (word distributions) for + topic ??? for all times. This is in row-major form, i.e.: + + > a = scan("topic-002-var-e-log-prob.dat") + > b = matrix(a, ncol=10, byrow=TRUE) + + # The probability of term 100 in topic 2 at time 3: + exp(b[100, 3]) + + - gam.dat: The gammas associated with each document. Divide these by + the sum for each document to get expected topic mixtures. + + > a = scan("gam.dat") + > b = matrix(a, ncol=10, byrow=TRUE) + > rs = rowSums(b) + > e.theta = b / rs + # Proportion of topic 5 in document 3: + e.theta[3, 5] + +If you are running this software in "dim" mode to find document +influence, it will also create the following files: + + - influence_time-??? : the influence of documents at time ??? for + each topic, where time is based on in your -seq.dat file and the + document index is given by the ordering of documents in the mult + file. + + For example, in R: + > a = scan("influence-time-010") + > b = matrix(a, ncol=10, byrow=TRUE) + # The influence of the 2nd document on topic 5: + > b[2, 5] + +# Here are some example commands: +# Run the dynamic topic model. +./main \ + --ntopics=20 \ + --mode=fit \ + --rng_seed=0 \ + --initialize_lda=true \ + --corpus_prefix=example/test \ + --outname=example/model_run \ + --top_chain_var=0.005 \ + --alpha=0.01 \ + --lda_sequence_min_iter=6 \ + --lda_sequence_max_iter=20 \ + --lda_max_em_iter=10 + +# Run the influence model. +./main \ + --mode=fit \ + --rng_seed=0 \ + --model=fixed \ + --initialize_lda=true \ + --corpus_prefix=example/test \ + --outname=example/output \ + --time_resolution=2 \ + --influence_flat_years=5 \ + --top_obs_var=0.5 \ + --top_chain_var=0.005 \ + --sigma_d=0.0001 \ + --sigma_l=0.0001 \ + --alpha=0.01 \ + --lda_sequence_min_iter=6 \ + --lda_sequence_max_iter=20 \ + --save_time=-1 \ + --ntopics=10 \ + --lda_max_em_iter=10 + diff --git a/dtm_release/dtm/ss-lm.c b/dtm_release/dtm/ss-lm.c new file mode 100644 index 0000000000000000000000000000000000000000..2680e2cdb23bba750268d009af528a224d068293 --- /dev/null +++ b/dtm_release/dtm/ss-lm.c @@ -0,0 +1,1335 @@ +// Authors: David Blei (blei@cs.princeton.edu) +// Sean Gerrish (sgerrish@cs.princeton.edu) +// +// Copyright 2011 Sean Gerrish and David Blei +// All Rights Reserved. +// +// See the README for this package for details about modifying or +// distributing this software. + +#include "ss-lm.h" + +#include "gflags.h" + +DECLARE_string(model); +DECLARE_int32(forward_window); +DECLARE_int32(max_number_time_points); + +// local functions + +static double* scaled_influence = NULL; + +void fdf_obs(const gsl_vector *x, + void *params, + double *f, + gsl_vector *df); +void df_obs(const gsl_vector *x, + void *params, + gsl_vector *df); +double f_obs(const gsl_vector *x, void *params); +double f_obs_multiple(const gsl_vector *x, void *params); +double f_obs_fixed(const gsl_vector *x, void *params); + +/* + * allocate a new state space language model variational posterior + * + */ + +sslm_var* sslm_var_alloc(int W, int T) +{ + if (scaled_influence == NULL) { + scaled_influence = NewScaledInfluence(FLAGS_max_number_time_points); + } + + + sslm_var* var = (sslm_var*) malloc(sizeof(sslm_var)); + var->W = W; + var->T = T; + + // TODO(sgerrish): Free these parameters. + var->obs = gsl_matrix_calloc(W, T); + var->e_log_prob = gsl_matrix_calloc(W, T); + var->mean = gsl_matrix_calloc(W, T+1); + var->variance = gsl_matrix_calloc(W, T+1); + + var->w_phi_l = gsl_matrix_calloc(W, T); + var->m_update_coeff = gsl_matrix_calloc(W, T); + var->m_update_coeff_g = gsl_matrix_calloc(W, T); + + return(var); +} + +void sslm_inference_alloc(sslm_var* var) +{ + int W = var->W; + int T = var->T; + var->fwd_mean = gsl_matrix_calloc(W, T+1); + var->fwd_variance = gsl_matrix_calloc(W, T+1); + var->zeta = gsl_vector_calloc(T); + var->T_vct = gsl_vector_calloc(T); + // var->mean = gsl_matrix_calloc(W, T+1); + //var->variance = gsl_matrix_calloc(W, T+1); +} + + +void sslm_inference_free(sslm_var* var) +{ + gsl_matrix_free(var->fwd_mean); + gsl_matrix_free(var->fwd_variance); + // gsl_matrix_free(var->mean); + // gsl_matrix_free(var->variance); + gsl_vector_free(var->zeta); + gsl_vector_free(var->T_vct); +} + + +/* + * initialize with zero observations + * + */ + +void sslm_zero_init(sslm_var* var, + double obs_variance, + double chain_variance) +{ + int w, W = var->W; + + gsl_matrix_set_zero(var->obs); + var->obs_variance = obs_variance; + var->chain_variance = chain_variance; + + for (w = 0; w < W; w++) { + compute_post_variance(w, var, var->chain_variance); + } + + for (w = 0; w < W; w++) { + // Run the forward-backward algorithm + compute_post_mean(w, var, var->chain_variance); + } + + update_zeta(var); +} + + +/* + * initialize with counts + * + */ + +void sslm_counts_init(sslm_var* var, + double obs_variance, + double chain_variance, + const gsl_vector* counts) +{ + int w, t, W = var->W, T = var->T; + gsl_vector* log_norm_counts = gsl_vector_alloc(counts->size); + sslm_inference_alloc(var); + + // normalize and take logs of the counts + + gsl_vector_memcpy(log_norm_counts, counts); + normalize(log_norm_counts); + gsl_vector_add_constant(log_norm_counts, 1.0/W); + normalize(log_norm_counts); + vct_log(log_norm_counts); + + // set variational observations to transformed counts + + for (t = 0; t < T; t++) { + msetcol(var->obs, t, log_norm_counts); + } + + // set variational parameters + + var->obs_variance = obs_variance; + var->chain_variance = chain_variance; + + for (w = 0; w < W; w++) { + compute_post_variance(w, var, var->chain_variance); + } + + for (w = 0; w < W; w++) { + // Run the forward-backward algorithm + compute_post_mean(w, var, var->chain_variance); + } + + update_zeta(var); + compute_expected_log_prob(var); + gsl_vector_free(log_norm_counts); + sslm_inference_free(var); +} + + +/* + * initialize from file of variational observations + * + */ + +void sslm_obs_file_init(sslm_var* var, + double obs_variance, + double chain_variance, + const char* filename) +{ + int w, W = var->W; + mtx_fscanf(filename, var->obs); + // set variational parameters + var->obs_variance = obs_variance; + var->chain_variance = chain_variance; + for (w = 0; w < W; w++) { + compute_post_variance(w, var, var->chain_variance); + } + for (w = 0; w < W; w++) { + // Run the forward-backward algorithm + compute_post_mean(w, var, var->chain_variance); + } + update_zeta(var); +} + + +// Compute the expected log probability given values of m. +void compute_expected_log_prob(sslm_var* var) +{ + int t, w, W = var->W; + for (t = 0; t < var->T; t++) { + for (w = 0; w < W; w++) { + mset(var->e_log_prob, w, t, + mget(var->mean,w,t+1) + - log(vget(var->zeta, t))); + } + } +} + +double expected_log_prob(int w, int t, sslm_var* var) +{ + return(mget(var->mean,w,t+1) + - log(vget(var->zeta, t))); +} + +/* + * forward-backward to compute E[\beta_{t,w}] for t = 1:T + * + */ + +void compute_post_mean(int word, + sslm_var* var, + double chain_variance) +{ + int t; + double w; + + // get the vectors for word w + gsl_vector obs = gsl_matrix_row(var->obs, word).vector; + gsl_vector mean = gsl_matrix_row(var->mean, word).vector; + gsl_vector fwd_mean = gsl_matrix_row(var->fwd_mean, word).vector; + gsl_vector fwd_variance = gsl_matrix_row(var->fwd_variance, word).vector; + int T = var->T; + + // forward + // (note, the observation corresponding to mean t is at t-1) + vset(&fwd_mean, 0, 0); + for (t = 1; t < T+1; t++) + { + // Eq. 1.14 + assert(fabs(vget(&fwd_variance, t-1) + + chain_variance + var->obs_variance) > 0.0); + w = var->obs_variance / + (vget(&fwd_variance, t-1) + + chain_variance + var->obs_variance); + vset(&fwd_mean, t, + w * vget(&fwd_mean, t-1) + (1 - w) * vget(&obs, t-1)); + if (isnan(vget(&fwd_mean, t))) { + outlog("t %d word %d w %f %f %f", t, word, w, vget(&fwd_mean, t - 1), vget(&obs, t-1)); + outlog("%f %f %f", var->obs_variance, vget(&fwd_variance, t-1), + var->obs_variance); + } + + } + + // backward + vset(&mean, T, vget(&fwd_mean, T)); + for (t = T-1; t >= 0; t--) + { + // Eq. 1.18 + if (chain_variance == 0.0) { + w = 0.0; + } else { + w = chain_variance / + (vget(&fwd_variance, t) + chain_variance); + } + vset(&mean, t, w * vget(&fwd_mean, t) + (1 - w) * vget(&mean, t+1)); + if (isnan(vget(&mean, t))) { + outlog("t %d w %f %f %f", t, w, vget(&fwd_mean, t), vget(&mean, t+1)); + } + assert(!isnan(vget(&mean, t))); + } +} + + +/* + * update zeta variational parameter + * + */ + +void update_zeta(sslm_var* var) +{ + int word; + int t; + + gsl_vector_set_zero(var->zeta); + // gsl_matrix_set_zero(var->zeta_terms); + for (word = 0; word < var->obs->size1; word++) + { + for (t = 0; t < var->obs->size2; t++) + { + double m = mget(var->mean, word, t+1); + double v = mget(var->variance, word, t+1); + double val = exp(m + v/2.0); + // mset(var->zeta_terms, word, t, val); + vinc(var->zeta, t, val); + } + } +} + + +/* + * compute Var[\beta_{t,w}] for t = 1:T + * + */ + +void compute_post_variance(int word, + sslm_var* var, + double chain_variance) +{ + int t, T = var->T; + double w; + + // get the variance vector for word + gsl_vector variance = gsl_matrix_row(var->variance, word).vector; + gsl_vector fwd_variance = gsl_matrix_row(var->fwd_variance, word).vector; + + // forward + // note, initial variance set very large + vset(&fwd_variance, 0, chain_variance * INIT_MULT); + for (t = 1; t < T+1; t++) + { + // Eq. 1.16 + if (var->obs_variance) { + w = var->obs_variance / + (vget(&fwd_variance, t-1) + + chain_variance + var->obs_variance); + } else { + w = 0.0; + } + vset(&fwd_variance, t, w * (vget(&fwd_variance, t-1) + + chain_variance)); + } + + // backward + vset(&variance, T, vget(&fwd_variance, T)); + for (t = T-1; t >= 0; t--) + { + // Eq. 1.21 + if (vget(&fwd_variance, t) > 0.0) { + w = pow(vget(&fwd_variance, t) / + (vget(&fwd_variance, t) + chain_variance), 2); + } else { + w = 0.0; + } + vset(&variance, t, + w * (vget(&variance, t+1) - chain_variance) + + (1 - w) * vget(&fwd_variance, t)); + } +} + + +/* + * compute d E[\beta_{t,w}]/d obs_{s,w} for t = 1:T. + * put the result in deriv, allocated T+1 vector + * + */ + +void compute_mean_deriv(int word, + int time, + sslm_var* var, + gsl_vector* deriv) +{ + int t, T = var->T; + double w, val; + + // get the vectors for word + gsl_vector fwd_variance = gsl_matrix_row(var->variance, word).vector; + assert(deriv->size == T+1); + + // forward + // (note, we don't need to store the forward pass in this case.) + vset(deriv, 0, 0); + for (t = 1; t <= T; t++) { + // Eq. 1.37 + if (var->obs_variance > 0.0) { + w = var->obs_variance / + (vget(&fwd_variance, t-1) + + var->chain_variance + var->obs_variance); + } else { + w = 0.0; + } + val = w * vget(deriv, t-1); + // note that observations are indexed 1 from the means/variances + if (time == t-1) { + val += (1 - w); + } + vset(deriv, t, val); + } + + // backward + for (t = T-1; t >= 0; t--) + { + // Eq. 1.39 + if (var->chain_variance == 0.0) { + w = 0.0; + } else { + w = var->chain_variance / + (vget(&fwd_variance, t) + var->chain_variance); + } + vset(deriv, t, w * vget(deriv, t) + (1 - w) * vget(deriv, t+1)); + } +} + + +/* + * compute d bound/d obs_{w, t} for t=1:T. + * put the result in deriv, allocated T vector + * + */ + +void compute_obs_deriv(int word, + gsl_vector* word_counts, + gsl_vector* totals, + sslm_var* var, + gsl_matrix* mean_deriv_mtx, + gsl_vector* deriv) { + int t, u, T = var->T; + + gsl_vector mean = gsl_matrix_row(var->mean, word).vector; + gsl_vector variance = gsl_matrix_row(var->variance, word).vector; + + // here the T vector in var is the zeta terms + for (u = 0; u < T; u++) { + vset(var->T_vct, u, + exp(vget(&mean, u+1) + vget(&variance, u+1)/2)); + } + + gsl_vector w_phi_l = gsl_matrix_row(var->w_phi_l, word).vector; + gsl_vector m_update_coeff = gsl_matrix_row(var->m_update_coeff, word).vector; + + for (t = 0; t < T; t++) { + gsl_vector mean_deriv = gsl_matrix_row(mean_deriv_mtx, t).vector; + double term1 = 0.0; + double term2 = 0.0; + double term3 = 0.0; + double term4 = 0.0; + for (u = 1; u <= T; u++) { + double mean_u = vget(&mean, u); + double var_u_prev = vget(&variance, u - 1); + double mean_u_prev = vget(&mean, u - 1); + double dmean_u = vget(&mean_deriv, u); + double dmean_u_prev = vget(&mean_deriv, u - 1); + + double dmean_u_window_prev = 0.0; + double var_u_window_prev = 0.0; + double mean_u_window_prev = 0.0; + + term1 += (mean_u - mean_u_prev) * (dmean_u - dmean_u_prev); + + // note, observations indexed -1 from mean and variance + term2 += + (vget(word_counts, u-1) - + (vget(totals, u-1) * + vget(var->T_vct, u-1) / + vget(var->zeta, u-1))) * dmean_u; + + if (FLAGS_model == "fixed" + && u >= FLAGS_forward_window + && var->chain_variance > 0.0) { + double dmean_u_window_prev = vget(&mean_deriv, u - FLAGS_forward_window); + double var_u_window_prev = vget(&variance, u - FLAGS_forward_window); + double mean_u_window_prev = vget(&mean, u - FLAGS_forward_window); + + term3 += (exp(- (mean_u_window_prev - 0.0 * vget(var->zeta, u-1)) + var_u_window_prev / 2.0) + * ((- mean_u + mean_u_window_prev - var_u_window_prev - 1) + * (dmean_u_window_prev) + + (dmean_u)) + * vget(&w_phi_l, u - 1) + / var->chain_variance); + term4 += (exp( -2.0 * (mean_u_window_prev - 0.0 * vget(var->zeta, u-1)) + 2.0 * var_u_window_prev) + * (vget(&m_update_coeff, u - 1)) + / var->chain_variance + * dmean_u_window_prev); + } + } + if (var->chain_variance) { + term1 = -term1/var->chain_variance; + term1 = term1 - + vget(&mean, 0) * vget(&mean_deriv, 0) / + (INIT_MULT * var->chain_variance); + } else { + term1 = 0.0; + } + + vset(deriv, t, term1 + term2 + term3 + term4); + } +} + +void compute_obs_deriv_fixed(int word, + gsl_vector* word_counts, + gsl_vector* totals, + sslm_var* var, + gsl_matrix* mean_deriv_mtx, + gsl_vector* deriv) { + int t, u, T = var->T; + + gsl_vector mean = gsl_matrix_row(var->mean, word).vector; + gsl_vector variance = gsl_matrix_row(var->variance, word).vector; + + // here the T vector in var is the zeta terms + for (u = 0; u < T; u++) { + vset(var->T_vct, u, + exp(vget(&mean, u+1) + vget(&variance, u+1)/2)); + } + + gsl_vector m_update_coeff_g = gsl_matrix_row(var->m_update_coeff_g, word).vector; + gsl_vector m_update_coeff_h = gsl_matrix_row(var->m_update_coeff, word).vector; + + for (t = 0; t < T; t++) { + gsl_vector mean_deriv = gsl_matrix_row(mean_deriv_mtx, t).vector; + double term1 = 0.0; + double term2 = 0.0; + double term3 = 0.0; + double term4 = 0.0; + for (u = 1; u <= T; u++) { + double mean_u = vget(&mean, u); + double var_u_prev = vget(&variance, u - 1); + double mean_u_prev = vget(&mean, u - 1); + double dmean_u = vget(&mean_deriv, u); + double dmean_u_prev = vget(&mean_deriv, u - 1); + + double dmean_u_window_prev = 0.0; + double var_u_window_prev = 0.0; + double mean_u_window_prev = 0.0; + + term1 += (mean_u - mean_u_prev) * (dmean_u - dmean_u_prev); + + // note, observations indexed -1 from mean and variance + term2 += + (vget(word_counts, u-1) - + (vget(totals, u-1) * + vget(var->T_vct, u-1) / + vget(var->zeta, u-1))) * dmean_u; + + if ((FLAGS_model == "fixed") + && u >= 1 + && var->chain_variance > 0.0) { + double dmean_u_window_prev = vget(&mean_deriv, u - FLAGS_forward_window); + double var_u_window_prev = vget(&variance, u - FLAGS_forward_window); + double mean_u_window_prev = vget(&mean, u - FLAGS_forward_window); + + term3 += (exp(- (mean_u_window_prev - 0.0 * vget(var->zeta, u-1)) + var_u_window_prev / 2.0) + * ((- mean_u + mean_u_window_prev - var_u_window_prev - 1) + * (dmean_u_window_prev) + + (dmean_u)) + * vget(&m_update_coeff_g, u - 1) + / var->chain_variance); + term4 += (exp( -2.0 * (mean_u_window_prev - 0.0 * vget(var->zeta, u-1)) + 2.0 * var_u_window_prev) + * (vget(&m_update_coeff_h, u - 1)) + / var->chain_variance + * dmean_u_window_prev); + } + } + if (var->chain_variance) { + term1 = -term1/var->chain_variance; + term1 = term1 - + vget(&mean, 0) * vget(&mean_deriv, 0) / + (INIT_MULT * var->chain_variance); + } else { + term1 = 0.0; + } + + vset(deriv, t, term1 + term2 + term3 + term4); + } +} + + +void compute_obs_deriv_multiple(int word, + gsl_vector* word_counts, + gsl_vector* totals, + sslm_var* var, + gsl_matrix* mean_deriv_mtx, + gsl_vector* deriv) { + int t, u, T = var->T; + + gsl_vector mean = gsl_matrix_row(var->mean, word).vector; + gsl_vector variance = gsl_matrix_row(var->variance, word).vector; + + // here the T vector in var is the zeta terms + for (u = 0; u < T; u++) { + vset(var->T_vct, u, + exp(vget(&mean, u+1) + vget(&variance, u+1)/2)); + } + + gsl_vector w_phi_l = gsl_matrix_row(var->w_phi_l, word).vector; + gsl_vector m_update_coeff = gsl_matrix_row(var->m_update_coeff, word).vector; + + gsl_vector* g = gsl_vector_calloc(T); + gsl_vector* h = gsl_vector_calloc(T); + for (int i = 0; i < T; ++i) { + gsl_vector_set(g, + i, + exp(-vget(&mean, i) + + vget(&variance, i) / 2.0) + * vget(&w_phi_l, i)); + gsl_vector_set(h, + i, + exp(-2.0 * vget(&mean, i) + + 2.0 * vget(&variance, i)) + * vget(&m_update_coeff, i)); + } + + for (t = 0; t < T; t++) { + gsl_vector mean_deriv = gsl_matrix_row(mean_deriv_mtx, t).vector; + double term1 = 0.0; + double term2 = 0.0; + double term3 = 0.0; + double term4 = 0.0; + for (u = 1; u <= T; u++) { + double mean_u = vget(&mean, u); + double var_u_prev = vget(&variance, u - 1); + double mean_u_prev = vget(&mean, u - 1); + double dmean_u = vget(&mean_deriv, u); + double dmean_u_prev = vget(&mean_deriv, u - 1); + + double term1a = mean_u - mean_u_prev; + double term1b = dmean_u - dmean_u_prev; + for (int i = 0; i <= u - 1; ++i) { + term1a -= (scaled_influence[u - i - 1] + * vget(g, u - i - 1)); + term1b += (scaled_influence[u - i - 1] + * vget(g, u - i - 1) + * vget(&mean_deriv, u - i - 1)); + } + term1 += term1a * term1b; + + // We divide by chain_variance at the end + // to avoid replicating unnecessary work. + // note, observations indexed -1 from mean and variance + term2 += + (vget(word_counts, u-1) - + (vget(totals, u-1) * + vget(var->T_vct, u-1) / + vget(var->zeta, u-1))) * dmean_u; + + term3 -= (scaled_influence[0] + * vget(g, u - 1) + * var_u_prev + * dmean_u_prev); + + // Compute the term involving h(t) and g(t). + for (int i = 0; i <= u - 1; ++i) { + term4 += (vget(&mean_deriv, u - i - 1) + * scaled_influence[i] + * scaled_influence[i] + * (vget(h, u - i - 1) + - vget(g, u - i - 1) + * vget(g, u - i - 1))); + } + } + term1 = -term1 / var->chain_variance; + term1 = term1 - + vget(&mean, 0) * vget(&mean_deriv, 0) / + (INIT_MULT * var->chain_variance); + + vset(deriv, t, (term1 + + term2 + + term3 / var->chain_variance + + term4 / var->chain_variance)); + } + gsl_vector_free(g); + gsl_vector_free(h); +} + + +/* + * log probability bound + * + */ + +double compute_bound(gsl_matrix* word_counts, + gsl_vector* totals, + sslm_var* var) { + int t, T = var->T, w, W = var->W; + double term1 = 0, term2 = 0, term3 = 0; + double val = 0, m, v, prev_m, prev_v; + double w_phi_l, exp_i; + double ent = 0; + + const double chain_variance = var->chain_variance; + + for (w = 0; w < W; w++) { + // Run the forward-backward algorithm + compute_post_mean(w, var, chain_variance); + } + update_zeta(var); + + for (w = 0; w < W; w++) { + val += + (mget(var->variance, w, 0) - + mget(var->variance, w, T))/ + 2 * chain_variance; + } + + outlog("Computing bound, all times.%s", ""); + for (t = 1; t <= T; t++) { + term1 = term2 = ent = 0.0; + for (w = 0; w < W; w++) { + m = mget(var->mean, w, t); + prev_m = mget(var->mean, w, t - 1); + v = mget(var->variance, w, t); + + // Values specifically related to document influence: + // Note that our indices are off by 1 here. + w_phi_l = mget(var->w_phi_l, w, t - 1); + exp_i = exp(-prev_m); + + term1 += + pow(m - prev_m - w_phi_l * exp_i, 2) / (2 * chain_variance) - + v/chain_variance - + log(chain_variance); + + term2 += mget(word_counts, w, t-1) * m; + ent += log(v) / 2; // note the 2pi's cancel with term1 (see doc) + } + term3 = -vget(totals, t-1) * log(vget(var->zeta,t-1)); + + val += - term1 + term2 + term3 + ent; + } + return(val); +} + +double compute_bound_fixed(gsl_matrix* word_counts, + gsl_vector* totals, + sslm_var* var) { + int t, T = var->T, w, W = var->W; + double term1 = 0, term2 = 0, term3 = 0, term4 = 0, term5 = 0; + double val = 0, m, v, prev_m, prev_v; + double m_update_coeff_g, m_update_coeff_h, exp_i; + double ent = 0; + + const double chain_variance = var->chain_variance; + + for (w = 0; w < W; w++) { + // Run the forward-backward algorithm + compute_post_mean(w, var, chain_variance); + } + update_zeta(var); + + for (w = 0; w < W; w++) { + val += + (mget(var->variance, w, 0) - + mget(var->variance, w, T))/ + 2 * chain_variance; + } + + outlog("Computing bound, all times.%s", ""); + for (t = 1; t <= T; t++) { + term1 = term2 = term4 = term5 = ent = 0.0; + for (w = 0; w < W; w++) { + m = mget(var->mean, w, t); + prev_m = mget(var->mean, w, t - 1); + v = mget(var->variance, w, t); + + // Values specifically related to document influence: + // Note that our indices are off by 1 here. + m_update_coeff_g = mget(var->m_update_coeff_g, w, t - 1); + m_update_coeff_h = mget(var->m_update_coeff, w, t - 1); + exp_i = exp(-prev_m + v / 2.0); + + term1 += + pow(m - prev_m, 2) / (2.0 * chain_variance) + - v / chain_variance + - log(chain_variance); + + term4 += + (-(m - prev_m + v) * m_update_coeff_g * exp_i + / (2.0 * chain_variance)); + + term5 += -m_update_coeff_h / (2.0 * chain_variance); + + term2 += mget(word_counts, w, t-1) * m; + ent += log(v) / 2; // note the 2pi's cancel with term1 (see doc) + } + + term3 = -vget(totals, t-1) * log(vget(var->zeta,t-1)); + + val += - term1 + term2 + term3 + term4 + ent; + } + return(val); +} + +double compute_bound_multiple(gsl_matrix* word_counts, + gsl_vector* totals, + sslm_var* var) { + int t, T = var->T, w, W = var->W; + double term1 = 0, term2 = 0, term3 = 0; + double val = 0, m, v, prev_m, prev_v, window_prev_m, window_prev_v; + double w_phi_l, m_update_coeff, exp_i; + double ent = 0; + + for (w = 0; w < W; w++) { + // Run the forward-backward algorithm + compute_post_mean(w, var, var->chain_variance); + } + update_zeta(var); + + const double chain_variance = var->chain_variance; + + for (w = 0; w < W; w++) { + val += + (mget(var->variance, w, 0) - + mget(var->variance, w, T)) / + 2 * chain_variance; + } + + outlog("Computing bound, all times.%s", ""); + for (t = 1; t <= T; t++) { + term1 = term2 = ent = 0.0; + for (w = 0; w < W; w++) { + m = mget(var->mean, w, t); + prev_m = mget(var->mean, w, t - 1); + v = mget(var->variance, w, t); + + double delta = m - prev_m; + for (int i = 0; i <= t - 1; ++i) { + exp_i = exp(-mget(var->mean, w, t - i - 1)); + w_phi_l = mget(var->w_phi_l, w, t - i - 1); + delta -= scaled_influence[i] * w_phi_l * exp_i; + } + term1 += + - pow(delta, 2) / (2 * chain_variance) + + v / chain_variance + + log(chain_variance); + + term2 += mget(word_counts, w, t - 1) * m; + ent += log(v) / 2; // note the 2pi's cancel with term1 (see doc) + } + term3 = -vget(totals, t-1) * log(vget(var->zeta,t-1)); + + val += term1 + term2 + term3 + ent; + } + return(val); +} + +/* + * update obs + * + */ + +// parameters object +struct opt_params +{ + sslm_var* var; + gsl_vector* word_counts; + gsl_vector* totals; + gsl_matrix* mean_deriv_mtx; + int word; +}; + +// objective function +double f_obs(const gsl_vector *x, void *params) +{ + int t, T = x->size; + double val = 0, term1 = 0, term2 = 0, term3 = 0, term4 = 0; + struct opt_params * p = (struct opt_params *) params; + gsl_vector mean, variance, w_phi_l, m_update_coeff; + + msetrow(p->var->obs, p->word, x); + + // Run the forward-backward algorithm + compute_post_mean(p->word, p->var, p->var->chain_variance); + mean = gsl_matrix_row(p->var->mean, p->word).vector; + variance = gsl_matrix_row(p->var->variance, p->word).vector; + w_phi_l = gsl_matrix_row(p->var->w_phi_l, p->word).vector; + m_update_coeff = gsl_matrix_row(p->var->m_update_coeff, p->word).vector; + + // Only compute the objective if the chain variance + for (t = 1; t <= T; t++) { + double mean_t = vget(&mean, t); + double mean_t_prev = vget(&mean, t-1); + double var_t_prev = vget(&variance, t - 1); + val = mean_t - mean_t_prev; + term1 += val * val; + + // note, badly indexed counts + term2 += + vget(p->word_counts, t-1) * mean_t - + vget(p->totals, t-1) * + (exp(mean_t + vget(&variance, t)/2) / vget(p->var->zeta, t-1)); + // log(vget(p->var->zeta, t-1))); + + if (FLAGS_model == "fixed" + && t >= FLAGS_forward_window + && p->var->chain_variance > 0.0) { + double mean_t_window_prev = vget(&mean, t - FLAGS_forward_window); + double var_t_window_prev = vget(&variance, t - FLAGS_forward_window); + term3 += (exp(- (mean_t_window_prev - 0.0 * vget(p->var->zeta, t-1)) + var_t_window_prev / 2.0) + * (mean_t - mean_t_window_prev + var_t_window_prev) + * vget(&w_phi_l, t - 1) + / p->var->chain_variance); + + term4 -= (exp( -2.0 * (mean_t_window_prev + - 0.0 * vget(p->var->zeta, t-1)) + + 2.0 * var_t_window_prev) + * (vget(&m_update_coeff, t - 1)) + / (2.0 * p->var->chain_variance)); + } + } + // note that we multiply the initial variance by INIT_MULT + if (p->var->chain_variance > 0.0) { + term1 = - term1 / (2 * p->var->chain_variance); + term1 = (term1 - + vget(&mean, 0) * vget(&mean, 0) / + (2 * INIT_MULT * p->var->chain_variance)); + } else { + term1 = 0.0; + } + + return(-(term1 + term2 + term3 + term4)); +} + +// Objective function for fixed model. +double f_obs_fixed(const gsl_vector *x, void *params) { + int t, T = x->size; + double val = 0, term1 = 0, term2 = 0, term3 = 0, term4 = 0; + struct opt_params * p = (struct opt_params *) params; + gsl_vector mean, variance, w_phi_l, m_update_coeff_h, m_update_coeff_g; + + msetrow(p->var->obs, p->word, x); + + // Run the forward-backward algorithm + compute_post_mean(p->word, p->var, p->var->chain_variance); + mean = gsl_matrix_row(p->var->mean, p->word).vector; + variance = gsl_matrix_row(p->var->variance, p->word).vector; + m_update_coeff_h = gsl_matrix_row(p->var->m_update_coeff, p->word).vector; + m_update_coeff_g = gsl_matrix_row(p->var->m_update_coeff_g, p->word).vector; + + + // Only compute the objective if the chain variance + for (t = 1; t <= T; t++) { + double mean_t = vget(&mean, t); + double mean_t_prev = vget(&mean, t-1); + double var_t_prev = vget(&variance, t - 1); + val = mean_t - mean_t_prev; + term1 += val * val; + + // note, badly indexed counts + term2 += + vget(p->word_counts, t-1) * mean_t - + vget(p->totals, t-1) * + (exp(mean_t + vget(&variance, t)/2) / vget(p->var->zeta, t-1)); + // log(vget(p->var->zeta, t-1))); + if (FLAGS_model != "fixed") { + assert(0); + } + + if (t >= 1 + && p->var->chain_variance > 0.0) { + double mean_t_window_prev = vget(&mean, t - 1); + double var_t_window_prev = vget(&variance, t - 1); + term3 += (exp(-mean_t_window_prev + var_t_window_prev / 2.0) + * (mean_t - mean_t_window_prev + var_t_window_prev) + * vget(&m_update_coeff_g, t - 1) + / p->var->chain_variance); + + term4 -= (exp( -2.0 * mean_t_window_prev + + 2.0 * var_t_window_prev) + * (vget(&m_update_coeff_h, t - 1)) + / (2.0 * p->var->chain_variance)); + } + } + // note that we multiply the initial variance by INIT_MULT + if (p->var->chain_variance > 0.0) { + term1 = - term1 / (2 * p->var->chain_variance); + term1 = (term1 - + vget(&mean, 0) * vget(&mean, 0) / + (2 * INIT_MULT * p->var->chain_variance)); + } else { + term1 = 0.0; + } + + return(-(term1 + term2 + term3 + term4)); +} + +// objective function +double f_obs_multiple(const gsl_vector *x, void *params) { + int t, T = x->size; + double val = 0, term1 = 0, term2 = 0, term3 = 0, term4 = 0; + struct opt_params * p = (struct opt_params *) params; + gsl_vector mean, variance, w_phi_l, m_update_coeff; + + msetrow(p->var->obs, p->word, x); + + // Run the forward-backward algorithm + compute_post_mean(p->word, p->var, p->var->chain_variance); + mean = gsl_matrix_row(p->var->mean, p->word).vector; + variance = gsl_matrix_row(p->var->variance, p->word).vector; + w_phi_l = gsl_matrix_row(p->var->w_phi_l, p->word).vector; + m_update_coeff = gsl_matrix_row(p->var->m_update_coeff, p->word).vector; + + // Should we pre-compute exp means? + gsl_vector* g = gsl_vector_calloc(T); + gsl_vector* h = gsl_vector_calloc(T); + for (int i = 0; i < T; ++i) { + gsl_vector_set(g, + i, + exp(-vget(&mean, i) + + vget(&variance, i) / 2.0) + * vget(&w_phi_l, i)); + gsl_vector_set(h, + i, + exp(-2.0 * vget(&mean, i) + + 2.0 * vget(&variance, i)) + * vget(&m_update_coeff, i)); + } + + for (t = 1; t <= T; t++) { + double mean_t = vget(&mean, t); + double mean_t_prev = vget(&mean, t-1); + double var_t_prev = vget(&variance, t - 1); + val = mean_t - mean_t_prev; + for (int i=0; i <= t - 1; ++i) { + val -= scaled_influence[i] * vget(g, t - i - 1); + } + term1 += val * val; + + // note, badly indexed counts + term2 += + vget(p->word_counts, t-1) * mean_t - + vget(p->totals, t-1) * + (exp(mean_t + vget(&variance, t)/2) / vget(p->var->zeta, t-1)); + // log(vget(p->var->zeta, t-1))); + + // Add the term involving variance alone. + term3 += (scaled_influence[0] + * vget(g, t - 1) + * var_t_prev); + + // Compute the term involving h(t) and g(t). + for (int i = 0; i <= t - 1; ++i) { + term4 -= ((scaled_influence[i] + * scaled_influence[i]) + * (vget(h, t - i - 1) + - vget(g, t - i - 1) + * vget(g, t - i - 1))); + } + } + // note that we multiply the initial variance by INIT_MULT + term1 = - term1 / (2 * p->var->chain_variance); + term1 = (term1 - + vget(&mean, 0) * vget(&mean, 0) / + (2 * INIT_MULT * p->var->chain_variance)); + + gsl_vector_free(g); + gsl_vector_free(h); + + double result = -(term1 + term2 + + term3 / p->var->chain_variance + + term4 / (2.0 * p->var->chain_variance)); + return(result); +} + +// derivative +void df_obs(const gsl_vector *x, void *params, gsl_vector *df) { + struct opt_params * p = (struct opt_params *) params; + int i; + + msetrow(p->var->obs, p->word, x); + + // Run the forward-backward algorithm + compute_post_mean(p->word, p->var, p->var->chain_variance); + + if (FLAGS_model == "fixed") { + compute_obs_deriv_fixed(p->word, + p->word_counts, + p->totals, + p->var, + p->mean_deriv_mtx, + df); + } else if (FLAGS_model == "dtm") { + compute_obs_deriv(p->word, + p->word_counts, + p->totals, + p->var, + p->mean_deriv_mtx, + df); + } else { + printf("Error. Unhandled model %s.\n", FLAGS_model.c_str()); + exit(1); + } + + for (i = 0; i < df->size; i++) { + vset(df, i, -vget(df, i)); + } +} + +// function and derivative +void fdf_obs(const gsl_vector *x, void *params, double *f, gsl_vector *df) +{ + struct opt_params * p = (struct opt_params *) params; + int i; + + if (FLAGS_model == "fixed") { + *f = f_obs_multiple(x, params); + compute_obs_deriv_fixed(p->word, + p->word_counts, + p->totals, + p->var, + p->mean_deriv_mtx, + df); + } else if (FLAGS_model == "dtm") { + *f = f_obs(x, params); + compute_obs_deriv(p->word, + p->word_counts, + p->totals, + p->var, + p->mean_deriv_mtx, + df); + } else { + printf("Error. Unhandled model %s.\n", FLAGS_model.c_str()); + exit(1); + } + + for (i = 0; i < df->size; i++) { + vset(df, i, -vget(df, i)); + } +} + + +// function to perform optimization +void update_obs(gsl_matrix* word_counts, + gsl_vector* totals, + sslm_var* var) +{ + int t, w, T = var->T, W = var->W, runs = 0; + double f_val, conv_val; int niter; + gsl_vector obs, w_counts, mean_deriv; + gsl_vector * norm_cutoff_obs = NULL; + struct opt_params params; + // Matrix of mean derivatives: + // Row ~ s + gsl_matrix* mean_deriv_mtx = gsl_matrix_alloc(T, T+1); + + params.var = var; + params.totals = totals; + + for (w = 0; w < W; w++) + { + if (w % 5000 == 0) { + outlog("Updating term %d", w); + } + w_counts = gsl_matrix_row(word_counts, w).vector; + if (((w % 500) == 0) && (w > 0)) + { + // outlog( "[SSLM] optimized %05d words (%05d cg runs)", w, runs); + } + + // check norm of observation + + double counts_norm = norm(&w_counts); + if ((counts_norm < OBS_NORM_CUTOFF) && (norm_cutoff_obs != NULL)) + { + obs = gsl_matrix_row(var->obs, w).vector; + gsl_vector_memcpy(&obs, norm_cutoff_obs); + } + else + { + if (counts_norm < OBS_NORM_CUTOFF) + gsl_vector_set_all(&w_counts, 0); + + // compute mean deriv + for (t = 0; t < T; t++) { + mean_deriv = gsl_matrix_row(mean_deriv_mtx, t).vector; + compute_mean_deriv(w, t, var, &mean_deriv); + } + // set parameters + params.word_counts = &w_counts; + params.word = w; + params.mean_deriv_mtx = mean_deriv_mtx; + obs = gsl_matrix_row(var->obs, w).vector; + // optimize + if (FLAGS_model == "fixed") { + optimize_fdf(T, &obs, ¶ms, &fdf_obs, &df_obs, &f_obs_fixed, + &f_val, &conv_val, &niter); + } else if (FLAGS_model == "dtm") { + optimize_fdf(T, &obs, ¶ms, &fdf_obs, &df_obs, &f_obs, + &f_val, &conv_val, &niter); + } else { + printf("Error. Unhandled model %s.\n", FLAGS_model.c_str()); + exit(1); + } + + runs++; + // outlog( + // "w: %04d f: %1.15e c: %5.3e n: %04d", + // w, f_val, conv_val, niter); + if (counts_norm < OBS_NORM_CUTOFF) + { + norm_cutoff_obs = gsl_vector_alloc(T); + // !!! this can be BLASified for speed + gsl_vector_memcpy(norm_cutoff_obs, &obs); + } + } + } + update_zeta(var); + gsl_matrix_free(mean_deriv_mtx); + if (norm_cutoff_obs != NULL) + { + gsl_vector_free(norm_cutoff_obs); + } +} + + +/* + * initialize variational observations + * + */ + +void initialize_obs(sslm_var* var, gsl_matrix* counts) +{ + gsl_matrix_set_zero(var->obs); +#if 0 + int t; + + gsl_matrix_memcpy(var->obs, counts); + for (t = 0; t < counts->size2; t++) + { + gsl_vector time_slice = gsl_matrix_column(var->obs, t).vector; + gsl_vector_add_constant(&time_slice, 1.0); + normalize(&time_slice); + vct_log(&time_slice); + } +#endif +} + + +/* + * fit variational distribution + * + */ + +double fit_sslm(sslm_var* var, gsl_matrix* counts) { + int iter, w, W = var->W; + double bound = 0, old_bound = 0; + double converged = SSLM_FIT_THRESHOLD+1; + gsl_vector* totals = gsl_vector_alloc(counts->size2); + + sslm_inference_alloc(var); + for (w = 0; w < W; w++) { + compute_post_variance(w, var, var->chain_variance); + } + + col_sum(counts, totals); + + iter = 0; + if (FLAGS_model == "fixed") { + // bound = compute_bound_fixed(counts, totals, var); + bound = compute_bound(counts, totals, var); + } else if (FLAGS_model == "dtm") { + bound = compute_bound(counts, totals, var); + } else { + printf("Error. Unhandled model %s.\n", FLAGS_model.c_str()); + exit(1); + } + outlog( "initial sslm bound = %10.5f", bound); + + while ((converged > SSLM_FIT_THRESHOLD) && (iter < SSLM_MAX_ITER)) { + iter++; + old_bound = bound; + update_obs(counts, totals, var); + if (FLAGS_model == "fixed") { + bound = compute_bound(counts, totals, var); + } else if (FLAGS_model == "dtm") { + bound = compute_bound(counts, totals, var); + } else { + printf("Error. Unhandled model %s.\n", FLAGS_model.c_str()); + exit(1); + } + converged = fabs((bound - old_bound) / old_bound); + outlog( "(%02d) sslm bound = % 10.5f; conv = % 10.5e", + iter, bound, converged); + } + + // compute expected log probability + compute_expected_log_prob(var); + + // free convenience parameters (there are a lot of them) + + free(totals); + sslm_inference_free(var); + + return(bound); +} + + +/* + * read and write variational distribution + * + */ + +void write_sslm_var(sslm_var* var, char* out) { + char filename[400]; + + sprintf(filename, "%s-var-obs.dat", out); + mtx_fprintf(filename, var->obs); + + sprintf(filename, "%s-var-e-log-prob.dat", out); + mtx_fprintf(filename, var->e_log_prob); + + sprintf(filename, "%s-info.dat", out); + FILE* f = fopen(filename, "w"); + params_write_int(f, "SEQ_LENGTH", var->T); + params_write_int(f, "NUM_TERMS", var->W); + params_write_double(f, "OBS_VARIANCE", var->obs_variance); + params_write_double(f, "CHAIN_VARIANCE", var->chain_variance); + + fclose(f); +} + + +// Read in a set of pre-computed topics from a file whose +// prefix is "in". + +sslm_var* read_sslm_var(char* in) { + outlog("READING LM FROM %s", in); + + char filename[400]; + int W, T; + + // read number of words and sequence length; allocate distribution + + sprintf(filename, "%s-info.dat", in); + FILE* f = fopen(filename, "r"); + params_read_int(f, "SEQ_LENGTH", &T); + params_read_int(f, "NUM_TERMS", &W); + sslm_var* var = sslm_var_alloc(W, T); + + // read the variance parameters + + params_read_double(f, "OBS_VARIANCE", &(var->obs_variance)); + params_read_double(f, "CHAIN_VARIANCE", &(var->chain_variance)); + + // read the variational observations and expected log probabilities + + sprintf(filename, "%s-var-obs.dat", in); + mtx_fscanf(filename, var->obs); + sprintf(filename, "%s-var-e-log-prob.dat", in); + mtx_fscanf(filename, var->e_log_prob); + + return(var); +} diff --git a/dtm_release/dtm/ss-lm.h b/dtm_release/dtm/ss-lm.h new file mode 100644 index 0000000000000000000000000000000000000000..0ee90569c0f02744e89bbf68daeeddbc4395594c --- /dev/null +++ b/dtm_release/dtm/ss-lm.h @@ -0,0 +1,107 @@ +// Authors: David Blei (blei@cs.princeton.edu) +// Sean Gerrish (sgerrish@cs.princeton.edu) +// +// Copyright 2011 Sean Gerrish and David Blei +// All Rights Reserved. +// +// See the README for this package for details about modifying or +// distributing this software. + +/* + * state space language model variational inference + * + */ + +#ifndef SSLM_H +#define SSLM_H + +#include "gsl-wrappers.h" +#include "params.h" +#include <gsl/gsl_vector.h> +#include <gsl/gsl_matrix.h> +#include <assert.h> +#include <math.h> + +#include "data.h" + +#define SSLM_MAX_ITER 2 // maximum number of optimization iters +#define SSLM_FIT_THRESHOLD 1e-6 // convergence criterion for fitting sslm +#define INIT_MULT 1000 // multiplier to variance for first obs +// #define OBS_NORM_CUTOFF 10 // norm cutoff after which we use all 0 obs +//#define OBS_NORM_CUTOFF 8 // norm cutoff after which we use all 0 obs +#define OBS_NORM_CUTOFF 2 // norm cutoff after which we use all 0 obs + +/* + * functions for variational inference + * + */ + +// allocate new state space language model variational posterior +sslm_var* sslm_var_alloc(int W, int T); + +// allocate extra parameters for inference +void sslm_inference_alloc(sslm_var* var); + +// free extra parameters for inference +void sslm_inference_free(sslm_var* var); + +// initialize with zero observations +void sslm_zero_init(sslm_var* var, + double obs_variance, + double chain_variance); + +// initialize with counts +void sslm_counts_init(sslm_var* var, + double obs_variance, + double chain_variance, + const gsl_vector* counts); + +// initialize from variational observations +void sslm_obs_file_init(sslm_var* var, + double obs_variance, + double chain_variance, + const char* filename); + + +// compute E[\beta_{w,t}] for t = 1:T +void compute_post_mean(int w, sslm_var* var, double chain_variance); + +// compute Var[\beta_{w,t}] for t = 1:T +void compute_post_variance(int w, sslm_var* var, double chain_variance); + +// optimize \hat{beta} +void optimize_var_obs(sslm_var* var); + +// compute dE[\beta_{w,t}]/d\obs_{w,s} for t = 1:T +void compute_mean_deriv(int word, int time, sslm_var* var, + gsl_vector* deriv); + +// compute d bound/d obs_{w, t} for t=1:T. +void compute_obs_deriv(int word, gsl_vector* word_counts, + gsl_vector* total_counts, sslm_var* var, + gsl_matrix* mean_deriv_mtx, gsl_vector* deriv); + +// update observations +void update_obs(gsl_matrix* word_counts, gsl_vector* totals, + sslm_var* var); + +// log probability bound +double compute_bound(gsl_matrix* word_counts, gsl_vector* totals, + sslm_var* var); + + +// fit variational distribution +double fit_sslm(sslm_var* var, gsl_matrix* word_counts); + +// read and write variational distribution +void write_sslm_var(sslm_var* var, char* out); +sslm_var* read_sslm_var(char* in); + +void compute_expected_log_prob(sslm_var* var); +// !!! old function (from doc mixture...) +double expected_log_prob(int w, int t, sslm_var* var); + +// update zeta +void update_zeta(sslm_var* var); + +#endif diff --git a/dtm_release/dtm/util.c b/dtm_release/dtm/util.c new file mode 100644 index 0000000000000000000000000000000000000000..c74a7cd3e80f28a528aae411316a1b515c68ad9d --- /dev/null +++ b/dtm_release/dtm/util.c @@ -0,0 +1,297 @@ +// Author: David Blei (blei@cs.princeton.edu) +// +// Copyright 2006 David Blei +// All Rights Reserved. +// +// See the README for this package for details about modifying or +// distributing this software. + +#define ABNORMAL_RETURN_CODE 1 +#define MAX_STRING_LENGTH 65535 + +#include <stdio.h> +#include <string.h> +#include <assert.h> +#include <sys/wait.h> +#include <sys/stat.h> +#include <errno.h> +#include <ctype.h> +#include "util.h" + +#ifdef __alpha__ + +#include <sys/mount.h> +#include <malloc.h> +#include <stdlib.h> +#include <unistd.h> + +#else + +/*#include <malloc.h>*/ +#include <stdlib.h> +#include <unistd.h> +/*#include <sys/vfs.h>*/ + +#endif + +char buf[1024]; +static int space_in_use=0; +static int pointers_in_use=0; +int display_allocs=FALSE; + + +void error(char *fmt, ...){ + va_list args; + va_start(args, fmt); + vfprintf(stderr, fmt, args); CRLF; + va_end(args); + fprintf(stderr, "\n"); + if (errno > 0) { + perror(buf); + fprintf(stderr, "errno=%d\n", errno); + fprintf(stderr, buf); + fprintf(stderr, "\n"); + } + fflush(stderr); + fflush(stdout); + assert(0); +} + +void bomb(char *fmt, ...) +{ + /* just break out, with error code =1 (fail) */ + + va_list args; + va_start(args, fmt); + vfprintf(stderr, fmt, args); CRLF; + va_end(args); + fprintf(stderr, "\n"); + fflush(stderr); + fflush(stdout); + exit(1); +} + + +void bail(char *fmt, ...) +{ + /* just break out, with error code =0 (success) */ + + va_list args; + va_start(args, fmt); + vfprintf(stderr, fmt, args); CRLF; + va_end(args); + fprintf(stderr, "\n"); + fflush(stderr); + fflush(stdout); + exit(0); +} + + + +char *dequote (char *s) { + static char *sbuf=NULL; + char *t; + int i; + if (s[0] != '\'') return s; + else if ((i=strlen(s)) < 2) return s; + else if (s[i-1] != '\'') + error("Illegal string passed to dequote: %s", s); + if (sbuf == NULL) + sbuf = (char *) malloc(MAX_STRING_LENGTH); + t = sbuf; + s++; + while(*s != EOS) { + if (*s == '\'') s++; + *t = *s; + s++; t++; + } + *t = EOS; + return sbuf; +} + +void quote_no_matter_what (const char *s, char *t) { + *t = '\''; + t++; + while((*s != EOS)) { + *t = *s; + if (*s == '\'') { + t++; *t = '\''; + } + s++; t++; + } + *t = '\''; t++; + *t = EOS; +} + + +const char *quote (const char *s) { + static char *sbuf=NULL; + if (sbuf == NULL) + sbuf = (char *) malloc(MAX_STRING_LENGTH); + if ( strchr(s,' ') == NULL && + strstr(s,"/*") == NULL && strstr(s,"*/") == NULL ) return s; + else { + quote_no_matter_what(s, sbuf); + return sbuf; + } +} + + + + +/* returns TRUE iff string only contains chars in valid. */ +int verify(char *string, char *valid) +{ + int i; + for(i=0;i<strlen(string);i++) + if (!strchr(valid, string[i])) return TRUE; + return FALSE; +} + + +/* strips leading and trailing white space */ +char * strip(char *s) { + int i,j; + int hit_char; + + j = 0; + hit_char = FALSE; + for (i=0; i<=strlen(s); ++i) { + if (s[i] != ' ') hit_char = TRUE; + if (hit_char) s[j++] = s[i]; + } + for (i=strlen(s)-1; i>0; --i) + if (s[i] != ' ') break; + s[i+1] = '\0'; + return s; +} + + +/* converts s to upper case */ +char * upper(char *s) { + int i; + for (i=0; i<strlen(s); ++i) s[i] = toupper(s[i]); + return s; +} + +/* converts s to lower case */ +char * lower(char *s) { + int i; + for (i=0; i<strlen(s); ++i) s[i] = tolower(s[i]); + return s; +} + + +/* queries existence of file */ +int qfilef(const char *fname) { + if (fname == FALSE) return FALSE; + if (access(fname, F_OK)==0) return TRUE; + else return FALSE; +} + + +/* returns free storage in file system */ +int free_storage (char *fn) +{ + /* uses a defunct function call. Also, not ever called */ + abort(); + /* + struct statfs sfs; + if (statfs(fn, &sfs) == -1) + return -1; + return sfs.f_bsize * sfs.f_bfree; +*/ +} + +/* Return the size of file named filename */ +int file_size(char *filename) +{ + struct stat status; + + if (stat(filename,&status) != 0) + return -1; + return (int)status.st_size; +} + +/* Return an allocated duplicate of string */ +char *util_strdup(char *string) +{ + int len = strlen(string); + char *dup = (char *)malloc(len+1); + + if (dup == NULL) + { + perror("malloc"); + return NULL; + } + strcpy(dup, string); + return dup; +} + + +void * util_malloc (int size) +{ + char * p = (char *) malloc(size+sizeof(int)); + if (p == NULL) error("UTIL_MALLOC: Ran out of space. Space in use: %d (%d pointers)\n", + space_in_use, pointers_in_use); + space_in_use += size; + ++pointers_in_use; + *((int *) p) = size; + if (display_allocs) + fprintf(stderr, "UTIL_MALLOC: Allocated %d bytes, %d bytes total, %d pointers\n", + size, space_in_use, pointers_in_use); + return (void *) (p+sizeof(int)); +} + +void * util_calloc (int num, int size) +{ + char * p = (char *) calloc(num*size+sizeof(int), 1); + if (p == NULL) error("UTIL_CALLOC: Ran out of space. Space in use: %d (%d pointers)\n", + space_in_use, pointers_in_use); + space_in_use += num*size; + ++pointers_in_use; + *((int *) p) = num*size; + if (display_allocs) + fprintf(stderr, "UTIL_CALLOC: Allocated %d bytes, %d bytes total, %d pointers\n", + num*size, space_in_use, pointers_in_use); + return (void *) (p+sizeof(int)); +} + +void * util_realloc (void * p, int size) +{ + int oldsize; + char *realp; + realp = ((char *)p)-sizeof(int); + oldsize = *((int *)(realp)); + realp = (char *) realloc(realp, size+sizeof(int)); + if (realp == NULL) error("UTIL_REALLOC: Ran out of space. Space in use: %d (%d pointers)\n", + space_in_use, pointers_in_use); + *((int *)(realp)) = size; + space_in_use += (size-oldsize); + if (display_allocs) + fprintf(stderr, "UTIL_REALLOC: Allocated %d bytes, %d bytes total, %d pointers\n", + size, space_in_use, pointers_in_use); + return (realp+sizeof(int)); +} + +void util_free (void * p) +{ + int size; + size = *((int *) (((char *) p)-sizeof(int))); + space_in_use -= size; + --pointers_in_use; + free(((char *)p)-sizeof(int)); + if (display_allocs) + fprintf(stderr, "UTIL_FREE: Freed up %d bytes, %d bytes remaining, %d pointers\n", + size, space_in_use, pointers_in_use); +} + +int util_space_in_use (void) +{ + return space_in_use; +} + +int util_pointers_in_use (void) +{ + return pointers_in_use; +} diff --git a/dtm_release/dtm/util.h b/dtm_release/dtm/util.h new file mode 100644 index 0000000000000000000000000000000000000000..7825b875c347f0e2ebf98413d97cdd9f320ecaf2 --- /dev/null +++ b/dtm_release/dtm/util.h @@ -0,0 +1,37 @@ +// Author: David Blei (blei@cs.princeton.edu) +// +// Copyright 2006 David Blei +// All Rights Reserved. +// +// See the README for this package for details about modifying or +// distributing this software. + +#ifndef _UTIL_INCLUDED +#define _UTIL_INCLUDED 1 + +#include <stdarg.h> + +#define EOS '\0' +#define CRLF printf("\n") +#define TRUE 1 +#define FALSE 0 + +extern const char* quote (const char *s); +extern char* dequote (char *s); +extern void quote_no_matter_what (const char *s, char *t); +extern int verify (char *s, char *t); +extern char* strip (char *s); +extern char* upper (char *s); +extern char* lower (char *s); +extern int qfilef (const char *fname); /* TRUE if file exists */ +extern int free_storage (char *fn); /* returns free storage in file system of fn */ +extern char* util_strdup(char *string); +extern void* util_malloc (int size); +extern void* util_realloc (void *p, int size); +extern void* util_calloc (int num, int size); +extern void util_free (void *p); +extern int util_space_in_use (void); +extern int util_pointers_in_use (void); +extern void error(char *fmt, ...); + +#endif diff --git a/dtm_release/gslwrap/bin/gslwrap-config b/dtm_release/gslwrap/bin/gslwrap-config new file mode 100755 index 0000000000000000000000000000000000000000..6501a34c0dbf23c0c09f861e5d142e5061da14c0 --- /dev/null +++ b/dtm_release/gslwrap/bin/gslwrap-config @@ -0,0 +1,153 @@ +#!/bin/sh + +# this is shamelessly stolen from imlib3d-config :-) which is : +# this is shamelessly stolen from gtkmm-config :-) + +prefix=/n/fs/topics/lib/gslwrap +exec_prefix=${prefix} +top_srcdir=. + +libdir=${exec_prefix}/lib + +bindir=${exec_prefix}/bin +pkglibdir=${libdir}/gslwrap + +transform=s,x,x, + + +gslwrap_libs="-L${exec_prefix}/lib -lgslwrap -L/n/fs/topics/lib/gsl/lib -lgsl -lgslcblas -lm" +gslwrap_cflags="-I${prefix}/include -I${prefix}/include/gslwrap -I/n/fs/topics/lib/gsl/include " + + +usage() +{ + cat <<EOF +Usage: gslwrap-config [OPTION]... [LIBRARY]... + +Generic options + --version output gslwrap version information + --help display this help and exit + +Compilation support options + --cflags print compiler flags + --libs print library linking information + --libs-only-L only print the -L/-R part of --libs + --libs-only-l only print the -l part of --libs + +Known values for LIBRARY are: + + gslwrap + +EOF + + exit $1 +} + +if test $# -eq 0; then + usage 1 +fi + +cflags=false +libs_L=false +libs_l=false + +any=no + +while test $# -gt 0; do + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --version) + echo 0.2 + exit 0 + ;; + --help) + usage 0 + ;; + --prefix=*) + prefix=$optarg + ;; + --cflags) + cflags=true + ;; + --libs) + libs_L=true + libs_l=true + ;; + --libs-only-L) + libs_L=true + ;; + --libs-only-l) + libs_l=true + ;; + gslwrap) + the_libs="-L${exec_prefix}/lib -lgslwrap -L/n/fs/topics/lib/gsl/lib -lgsl -lgslcblas -lm" + the_flags="-I${prefix}/include -I${prefix}/include/gslwrap -I/n/fs/topics/lib/gsl/include " + any=yes + ;; + *) + usage 1 + ;; + esac + shift +done + +# default to gtk-- for backward compatibility +# (should be removed some time in the future) +if test "x$any" = xno; then + the_libs="$the_libs $gslwrap_libs" + the_flags="$the_flags $gslwrap_cflags" +fi + +if $cflags; then + all_flags="$the_flags" +fi + +if $libs_L || $libs_l; then + all_flags="$all_flags $the_libs" +fi + +if test -z "$all_flags" || test "x$all_flags" = "x "; then + exit 1 +fi + +# Straight out any possible duplicates, but be careful to +# get `-lfoo -lbar -lbaz' for `-lfoo -lbaz -lbar -lbaz' +other_flags= +lib_L_flags= +rev_libs= +for i in $all_flags; do + case "$i" in + # a library, save it for later, in reverse order + -l*) rev_libs="$i $rev_libs" ;; + -L*|-R*) + if $libs_L; then + case " $lib_L_flags " in + *\ $i\ *) ;; # already there + *) lib_L_flags="$lib_L_flags $i" ;; # add it to output + esac + fi;; + *) + case " $other_flags " in + *\ $i\ *) ;; # already there + *) other_flags="$other_flags $i" ;; # add it to output + esac ;; + esac +done + +ord_libs= +if $libs_l; then + for i in $rev_libs; do + case " $ord_libs " in + *\ $i\ *) ;; # already there + *) ord_libs="$i $ord_libs" ;; # add it to output in reverse order + esac + done +fi + +echo $other_flags $lib_L_flags $ord_libs + +exit 0 diff --git a/dtm_release/gslwrap/include/gslwrap/histogram.h b/dtm_release/gslwrap/include/gslwrap/histogram.h new file mode 100644 index 0000000000000000000000000000000000000000..61408fac42a672fed949f8a37def05821ff6f8bd --- /dev/null +++ b/dtm_release/gslwrap/include/gslwrap/histogram.h @@ -0,0 +1,107 @@ +// This random generator is a C++ wrapper for the GNU Scientific Library +// Copyright (C) 2001 Torbjorn Vik + +// 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 2 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, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#ifndef __histogram_h +#define __histogram_h + +#include <gsl/gsl_histogram.h> +#include <stdexcept> +#include <exception> + +namespace gsl{ +#ifndef __HP_aCC +using std::string; +using std::runtime_error; +#endif + +//! Encapsulates the histogram object of gsl. Only uniformly spaced bins yet. +class histogram +{ +public: + histogram(int nBins, double xmin, double xmax) + { + h=gsl_histogram_calloc(nBins); + if (!h) + { + throw runtime_error("Couldn't allocate memory for histogram"); + } + gsl_histogram_set_ranges_uniform(h, xmin, xmax); + } + ~histogram(){gsl_histogram_free(h);} + +//@{ Updating and Accessing Methods + int increment(double x){return gsl_histogram_increment(h, x);} + int accumulate(double x, double weight){return gsl_histogram_accumulate(h, x, weight);} + double get(int i) const {return gsl_histogram_get(h, i);} + double& operator[](const uint & i) + { + const uint n = h->n; + + if (i >= n) + { + throw runtime_error("index lies outside valid range of 0 .. n - 1"); +// GSL_ERROR_VAL ("index lies outside valid range of 0 .. n - 1", GSL_EDOM, 0); + } + + return h->bin[i]; + } + const double& operator[](const uint & i) const //{return (*this)[i];/*gsl_histogram_get(h, i);*/} + { + const uint n = h->n; + + if (i >= n) + { + throw runtime_error("index lies outside valid range of 0 .. n - 1"); +// GSL_ERROR_VAL ("index lies outside valid range of 0 .. n - 1", GSL_EDOM, 0); + } + + return h->bin[i]; + } + + void get_range(int i, double& xmin, double& xmax) const {gsl_histogram_get_range(h, i, &xmin, &xmax);} +//@} + +//@{These functions return the maximum upper and minimum lower range limits +// and the number of bins of the histogram h. They provide a way of determining these values without +// accessing the gsl_histogram struct directly. + double max() const {return gsl_histogram_max(h);} + double min() const {return gsl_histogram_min(h);} + int bins()const {return gsl_histogram_bins(h);} + int size()const {return gsl_histogram_bins(h);} + +//@} + +//@{ Histogram statistics + double mean()const {return gsl_histogram_mean(h);} // not in gsl library ? + double max_val() const {return gsl_histogram_max_val(h);} + int max_bin() const {return gsl_histogram_max_bin(h);} + double min_val() const {return gsl_histogram_min_val(h);} + int min_bin() const {return gsl_histogram_min_bin(h);} + double sum() const {return gsl_histogram_sum(h);} +//@} + + +//@{ Accessor for gsl compatibility + gsl_histogram* gslobj() { return h;} + const gsl_histogram* gslobj() const { return h;} +//@} + +protected: + gsl_histogram * h; +}; +} + +#endif // __histogram_h diff --git a/dtm_release/gslwrap/include/gslwrap/matrix_double.h b/dtm_release/gslwrap/include/gslwrap/matrix_double.h new file mode 100644 index 0000000000000000000000000000000000000000..af26ad59dded3181062d3828797e93e42024fdac --- /dev/null +++ b/dtm_release/gslwrap/include/gslwrap/matrix_double.h @@ -0,0 +1,291 @@ +// matrix.h + +// This matrix class is a C++ wrapper for the GNU Scientific Library +// Copyright (C) 2001 Ramin Nakisa + +// 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 2 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, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +#if !defined( _matrix_double_h ) +#define _matrix_double_h + +#ifdef __HP_aCC //for aCC B3910B A.01.27 +#include <iostream.h> +#include <fstream.h> +#include <iomanip.h> +#else //for gcc3 +#include <iostream> +#include <fstream> +#include <iomanip> +#endif + +#include <math.h> +#include <stdlib.h> +#include <assert.h> +/// +#include <gsl/gsl_math.h> +#include <gsl/gsl_matrix.h> +#include <gsl/gsl_linalg.h> +#include <gslwrap/permutation.h> +#include <gslwrap/vector_double.h> + +#define type_is +#ifdef type_is +#define type_is_double +#endif + +namespace gsl +{ + +/// +class matrix +{ +#ifdef type_is_double + friend class matrix_float; + friend class matrix_int; +#endif +public: + typedef double value_type; + typedef vector vector_type; + + /// + matrix(); + /// + matrix( size_t new_rows, size_t new_cols, bool clear = true ); + + template<class oclass> + void copy(const oclass &other) + { + if ( static_cast<const void *>( this ) == static_cast<const void *>( &other ) ) + return; + + set_dimensions( other.get_rows(), other.get_cols() ); + for ( size_t i = 0; i < get_rows(); i++ ) + { + for ( size_t j = 0; j < get_cols(); j++ ) + { + gsl_matrix_set( m, i, j, (double)other(i,j)); + } + } + } +/* template<> */ +/* void copy<matrix>(const matrix &other) */ +/* { */ +/* set_dimensions(other.size1(),other.size2()); */ +/* gsl_matrix_memcpy( m, other.m ); */ +/* } */ + // copy constructor for type matrix + matrix( const matrix &other ):m(NULL) {copy(other);} + /// + template<class oclass> + matrix( const oclass &other ):m(NULL) {copy(other);} + + /// + ~matrix(); + /// +// matrix( const char *Filename ); + /// + size_t get_rows() const {return m->size1;} + /// + size_t get_cols() const {return m->size2;} + /// + size_t size1() const {return m->size1;} + /// + size_t size2() const {return m->size2;} + + + /// + void dimensions( size_t *num_rows, size_t *num_cols ) const; + /// +double get_element ( size_t row, size_t col ) const {return gsl_matrix_get( m, row, col ) ;} + const double &operator()( size_t row, size_t col ) const {return *gsl_matrix_ptr( m, row, col ) ;} +double &operator()( size_t row, size_t col ) {return *gsl_matrix_ptr( m, row, col ) ;} + /// + void set_element( size_t row, size_t col, const double &v ){ gsl_matrix_set( m, row, col, v );} + /// + void set_elements( const double & new_value ); + void set_all ( const double & new_value ) {gsl_matrix_set_all ( m, new_value );} + void set_zero() {gsl_matrix_set_zero( m );} + /// + void set_dimensions( size_t new_rows, size_t new_cols ); + /// + void load( const char *filename ); + /// + void save( const char *filename ) const; + /// + friend ostream& operator<< ( ostream& os, const matrix& m ); + //This function writes the elements of the matrix m to the stream stream in binary format. The return value is 0 for success and GSL_EFAILED if there was a problem writing to the file. Since the data is written in the native binary format it may not be portable between different architectures. + int fwrite (FILE * stream) const {return gsl_matrix_fwrite (stream, m);} + +//This function reads into the matrix m from the open stream stream in binary format. The matrix m must be preallocated with the correct dimensions since the function uses the size of m to determine how many bytes to read. The return value is 0 for success and GSL_EFAILED if there was a problem reading from the file. The data is assumed to have been written in the native binary format on the same architecture. + int fread (FILE * stream) {return gsl_matrix_fread (stream, m);} + + /// + void load_binary( const char *filename ); + /// + void save_binary( const char *filename ) const; + /// + bool operator==( const matrix &other ) const; + bool operator!=( const matrix &other ) const {return !((*this)==other);} + + matrix& operator=( const matrix &other ) {copy( other );return *this;} + /// converts from any other matrix type + template<class omatrix> + matrix &operator=( const omatrix& other ) + { + copy(other); + return *this; + } + /// + matrix operator+( const matrix &other ) const; + /// + matrix operator+( const double &f ) const; + /// + friend matrix operator+( const double &f, const matrix &other ); + /// + matrix &operator+=( const double &f ); + /// + matrix &operator+=( const matrix &other ); + /// + matrix operator-( const matrix &other ) const; + /// + matrix operator-( const double &f ) const; + /// + friend matrix operator-( const double &f, const matrix &other ); + /// + matrix &operator-=( const double &f ); + /// + matrix &operator-=( const matrix &other ); + /// + matrix operator*( const matrix &other ) const; + /// + matrix operator*( const double &f ) const; + /// + friend matrix operator*( const double &f, const matrix &other ); + /// + matrix &operator*=( const double &f ); + /// + matrix &operator*=( const matrix &other ); + /// + matrix operator/( const double &) const; + /// + matrix &operator/=( const double &); + /// + matrix transpose() const; + /// + matrix LU_decomp(gsl::permutation *perm=NULL,int *psign=NULL) const; + /// + matrix LU_invert() const; + + // return a submatrix of the this from row_min to row_max (not included!) + matrix submatrix(size_t row_min, size_t row_max, size_t col_min, size_t col_max) const + { + matrix m(row_max - row_min, col_max - col_min); + for (size_t i = row_min ; i < row_max ; i++) + { + for (size_t j = col_min ; j < col_max ; j++) + { + m(i - row_min,j - col_min) = (*this)(i,j); + } + } + return m; + } +private: + /// + void LU_decomp( gsl_matrix **a, + gsl_permutation **permutation, + int *sign ) const; +public: + /** returns sum of all the matrix elements. */ + double sum() const; + /** returns logarithm of the determinant of the matrix. */ + double LU_lndet() const; + + + /** returns a vector_view of a single row of the matrix. */ + vector_view row( size_t rowindex ); + const vector_view row( size_t rowindex ) const ; + /** returns a vector_view of a single column of the matrix. */ + vector_view column( size_t colindex ); + const vector_view column( size_t colindex ) const; + /** returns a vector_view of the diagonal elements of the matrix. */ + vector_view diagonal(); + const vector_view diagonal() const; + + /** returns a column matrix containing a single row of the matrix. */ + matrix get_row( size_t rowindex ) const; + /** returns a column matrix containing a single column of the matrix. */ + matrix get_col( size_t colindex ) const; + /** calculates sum of rows returned as a column matrix. */ + matrix row_sum() const; + /** calculates sum of columns returned as a row matrix. */ + matrix column_sum() const; + /** returns trace (diagonal sum) of a square matrix. */ + double trace() const; + /** calculates cholesky decomposition of the matrix, returning success if matrix is positive definite. */ + int cholesky_decomp( matrix &a ) const; +// /** returns index of nearest row in matrix to vector argument. */ +// int nearest_row_index( const matrix &v ) const; + /** calculates covariance of the matrix columns. */ + matrix covariance() const; + /** returns 1 if matrix is square, 0 otherwise. */ + bool is_square() const; + /** diag operator (sets the diagonal elements of the matrix to the elements of v */ + void diag(const vector& v); + /** set diagonal elements of a square matrix to f. */ + void set_diagonal( double f ); + /** sets matrix to a k dimensional unit matrix. */ + void identity( size_t k ); + /** returns sum of nth power of all elements. */ + double norm( double n ) const; + +/* Function: double gsl_matrix_max (const gsl_matrix * m) */ +/* This function returns the maximum value in the matrix m. */ + double max() const {return gsl_matrix_max(m);} +/* Function: double gsl_matrix_min (const gsl_matrix * m) */ +/* This function returns the minimum value in the matrix m. */ + double min()const{return gsl_matrix_min(m);} + + /** This function returns 1 if all the elements of the matrix m are zero, and 0 otherwise. */ + bool isnull() const { return gsl_matrix_isnull(m);} +/* Function: void gsl_matrix_minmax (const gsl_matrix * m, double * min_out, double * max_out) */ +/* This function returns the minimum and maximum values in the matrix m, storing them in min_out and max_out. */ + +/* Function: void gsl_matrix_max_index (const gsl_matrix * m, size_t * imax, size_t * jmax) */ +/* This function returns the indices of the maximum value in the matrix m, storing them in imax and jmax. When there are several equal maximum elements then the first element found */ +/* is returned. */ + +/* Function: void gsl_matrix_min_index (const gsl_matrix * m, size_t * imax, size_t * jmax) */ +/* This function returns the indices of the minimum value in the matrix m, storing them in imax and jmax. When there are several equal minimum elements then the first element found */ +/* is returned. */ + +/* Function: void gsl_matrix_minmax_index (const gsl_matrix * m, size_t * imin, size_t * imax) */ +/* This function returns the indices of the minimum and maximum values in the matrix m, storing them in (imin,jmin) and (imax,jmax). When there are several equal minimum or */ +/* maximum elements then the first elements found are returned. */ + + /** for interfacing with gsl c */ +/* gsl_matrix *gslobj() {if (!m){cout << "matrix::gslobj ERROR, data not initialized!! " << endl; exit(-1);}return m;} */ +/* const gsl_matrix *gslobj() const {if (!m){cout << "matrix::gslobj ERROR, data not initialized!! " << endl; exit(-1);}return m;} */ + gsl_matrix *gslobj() {assert(m);return m;} + const gsl_matrix *gslobj() const {assert(m);return m;} +private: + /// + gsl_matrix *m; + +}; +} +#undef type_is +#undef type_is_double + +#endif // _matrix_double_h diff --git a/dtm_release/gslwrap/include/gslwrap/matrix_float.h b/dtm_release/gslwrap/include/gslwrap/matrix_float.h new file mode 100644 index 0000000000000000000000000000000000000000..ea1ecfdd6baef0f4aa0809e50558667f2e89c956 --- /dev/null +++ b/dtm_release/gslwrap/include/gslwrap/matrix_float.h @@ -0,0 +1,291 @@ +// matrix.h + +// This matrix class is a C++ wrapper for the GNU Scientific Library +// Copyright (C) 2001 Ramin Nakisa + +// 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 2 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, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +#if !defined( _matrix_float_h ) +#define _matrix_float_h + +#ifdef __HP_aCC //for aCC B3910B A.01.27 +#include <iostream.h> +#include <fstream.h> +#include <iomanip.h> +#else //for gcc3 +#include <iostream> +#include <fstream> +#include <iomanip> +#endif + +#include <math.h> +#include <stdlib.h> +#include <assert.h> +/// +#include <gsl/gsl_math.h> +#include <gsl/gsl_matrix_float.h> +#include <gsl/gsl_linalg.h> +#include <gslwrap/permutation.h> +#include <gslwrap/vector_float.h> + +#define type_is_float +#ifdef type_is +#define type_is_double +#endif + +namespace gsl +{ + +/// +class matrix_float +{ +#ifdef type_is_double + friend class matrix_float; + friend class matrix_int; +#endif +public: + typedef float value_type; + typedef vector_float vector_type; + + /// + matrix_float(); + /// + matrix_float( size_t new_rows, size_t new_cols, bool clear = true ); + + template<class oclass> + void copy(const oclass &other) + { + if ( static_cast<const void *>( this ) == static_cast<const void *>( &other ) ) + return; + + set_dimensions( other.get_rows(), other.get_cols() ); + for ( size_t i = 0; i < get_rows(); i++ ) + { + for ( size_t j = 0; j < get_cols(); j++ ) + { + gsl_matrix_float_set( m, i, j, (float)other(i,j)); + } + } + } +/* template<> */ +/* void copy<matrix_float>(const matrix_float &other) */ +/* { */ +/* set_dimensions(other.size1(),other.size2()); */ +/* gsl_matrix_float_memcpy( m, other.m ); */ +/* } */ + // copy constructor for type matrix_float + matrix_float( const matrix_float &other ):m(NULL) {copy(other);} + /// + template<class oclass> + matrix_float( const oclass &other ):m(NULL) {copy(other);} + + /// + ~matrix_float(); + /// +// matrix_float( const char *Filename ); + /// + size_t get_rows() const {return m->size1;} + /// + size_t get_cols() const {return m->size2;} + /// + size_t size1() const {return m->size1;} + /// + size_t size2() const {return m->size2;} + + + /// + void dimensions( size_t *num_rows, size_t *num_cols ) const; + /// +float get_element ( size_t row, size_t col ) const {return gsl_matrix_float_get( m, row, col ) ;} + const float &operator()( size_t row, size_t col ) const {return *gsl_matrix_float_ptr( m, row, col ) ;} +float &operator()( size_t row, size_t col ) {return *gsl_matrix_float_ptr( m, row, col ) ;} + /// + void set_element( size_t row, size_t col, const float &v ){ gsl_matrix_float_set( m, row, col, v );} + /// + void set_elements( const float & new_value ); + void set_all ( const float & new_value ) {gsl_matrix_float_set_all ( m, new_value );} + void set_zero() {gsl_matrix_float_set_zero( m );} + /// + void set_dimensions( size_t new_rows, size_t new_cols ); + /// + void load( const char *filename ); + /// + void save( const char *filename ) const; + /// + friend ostream& operator<< ( ostream& os, const matrix_float& m ); + //This function writes the elements of the matrix m to the stream stream in binary format. The return value is 0 for success and GSL_EFAILED if there was a problem writing to the file. Since the data is written in the native binary format it may not be portable between different architectures. + int fwrite (FILE * stream) const {return gsl_matrix_float_fwrite (stream, m);} + +//This function reads into the matrix m from the open stream stream in binary format. The matrix m must be preallocated with the correct dimensions since the function uses the size of m to determine how many bytes to read. The return value is 0 for success and GSL_EFAILED if there was a problem reading from the file. The data is assumed to have been written in the native binary format on the same architecture. + int fread (FILE * stream) {return gsl_matrix_float_fread (stream, m);} + + /// + void load_binary( const char *filename ); + /// + void save_binary( const char *filename ) const; + /// + bool operator==( const matrix_float &other ) const; + bool operator!=( const matrix_float &other ) const {return !((*this)==other);} + + matrix_float& operator=( const matrix_float &other ) {copy( other );return *this;} + /// converts from any other matrix type + template<class omatrix> + matrix_float &operator=( const omatrix& other ) + { + copy(other); + return *this; + } + /// + matrix_float operator+( const matrix_float &other ) const; + /// + matrix_float operator+( const float &f ) const; + /// + friend matrix_float operator+( const float &f, const matrix_float &other ); + /// + matrix_float &operator+=( const float &f ); + /// + matrix_float &operator+=( const matrix_float &other ); + /// + matrix_float operator-( const matrix_float &other ) const; + /// + matrix_float operator-( const float &f ) const; + /// + friend matrix_float operator-( const float &f, const matrix_float &other ); + /// + matrix_float &operator-=( const float &f ); + /// + matrix_float &operator-=( const matrix_float &other ); + /// + matrix_float operator*( const matrix_float &other ) const; + /// + matrix_float operator*( const float &f ) const; + /// + friend matrix_float operator*( const float &f, const matrix_float &other ); + /// + matrix_float &operator*=( const float &f ); + /// + matrix_float &operator*=( const matrix_float &other ); + /// + matrix_float operator/( const float &) const; + /// + matrix_float &operator/=( const float &); + /// + matrix_float transpose() const; + /// + matrix_float LU_decomp(gsl::permutation *perm=NULL,int *psign=NULL) const; + /// + matrix_float LU_invert() const; + + // return a submatrix of the this from row_min to row_max (not included!) + matrix_float submatrix(size_t row_min, size_t row_max, size_t col_min, size_t col_max) const + { + matrix_float m(row_max - row_min, col_max - col_min); + for (size_t i = row_min ; i < row_max ; i++) + { + for (size_t j = col_min ; j < col_max ; j++) + { + m(i - row_min,j - col_min) = (*this)(i,j); + } + } + return m; + } +private: + /// + void LU_decomp( gsl_matrix_float **a, + gsl_permutation **permutation, + int *sign ) const; +public: + /** returns sum of all the matrix elements. */ + float sum() const; + /** returns logarithm of the determinant of the matrix. */ + double LU_lndet() const; + + + /** returns a vector_float_view of a single row of the matrix. */ + vector_float_view row( size_t rowindex ); + const vector_float_view row( size_t rowindex ) const ; + /** returns a vector_float_view of a single column of the matrix. */ + vector_float_view column( size_t colindex ); + const vector_float_view column( size_t colindex ) const; + /** returns a vector_float_view of the diagonal elements of the matrix. */ + vector_float_view diagonal(); + const vector_float_view diagonal() const; + + /** returns a column matrix containing a single row of the matrix. */ + matrix_float get_row( size_t rowindex ) const; + /** returns a column matrix containing a single column of the matrix. */ + matrix_float get_col( size_t colindex ) const; + /** calculates sum of rows returned as a column matrix. */ + matrix_float row_sum() const; + /** calculates sum of columns returned as a row matrix. */ + matrix_float column_sum() const; + /** returns trace (diagonal sum) of a square matrix. */ + double trace() const; + /** calculates cholesky decomposition of the matrix, returning success if matrix is positive definite. */ + int cholesky_decomp( matrix_float &a ) const; +// /** returns index of nearest row in matrix to vector argument. */ +// int nearest_row_index( const matrix_float &v ) const; + /** calculates covariance of the matrix columns. */ + matrix_float covariance() const; + /** returns 1 if matrix is square, 0 otherwise. */ + bool is_square() const; + /** diag operator (sets the diagonal elements of the matrix to the elements of v */ + void diag(const vector_float& v); + /** set diagonal elements of a square matrix to f. */ + void set_diagonal( float f ); + /** sets matrix to a k dimensional unit matrix. */ + void identity( size_t k ); + /** returns sum of nth power of all elements. */ + double norm( double n ) const; + +/* Function: double gsl_matrix_max (const gsl_matrix * m) */ +/* This function returns the maximum value in the matrix m. */ + double max() const {return gsl_matrix_float_max(m);} +/* Function: double gsl_matrix_min (const gsl_matrix * m) */ +/* This function returns the minimum value in the matrix m. */ + double min()const{return gsl_matrix_float_min(m);} + + /** This function returns 1 if all the elements of the matrix m are zero, and 0 otherwise. */ + bool isnull() const { return gsl_matrix_float_isnull(m);} +/* Function: void gsl_matrix_minmax (const gsl_matrix * m, double * min_out, double * max_out) */ +/* This function returns the minimum and maximum values in the matrix m, storing them in min_out and max_out. */ + +/* Function: void gsl_matrix_max_index (const gsl_matrix * m, size_t * imax, size_t * jmax) */ +/* This function returns the indices of the maximum value in the matrix m, storing them in imax and jmax. When there are several equal maximum elements then the first element found */ +/* is returned. */ + +/* Function: void gsl_matrix_min_index (const gsl_matrix * m, size_t * imax, size_t * jmax) */ +/* This function returns the indices of the minimum value in the matrix m, storing them in imax and jmax. When there are several equal minimum elements then the first element found */ +/* is returned. */ + +/* Function: void gsl_matrix_minmax_index (const gsl_matrix * m, size_t * imin, size_t * imax) */ +/* This function returns the indices of the minimum and maximum values in the matrix m, storing them in (imin,jmin) and (imax,jmax). When there are several equal minimum or */ +/* maximum elements then the first elements found are returned. */ + + /** for interfacing with gsl c */ +/* gsl_matrix_float *gslobj() {if (!m){cout << "matrix_float::gslobj ERROR, data not initialized!! " << endl; exit(-1);}return m;} */ +/* const gsl_matrix_float *gslobj() const {if (!m){cout << "matrix_float::gslobj ERROR, data not initialized!! " << endl; exit(-1);}return m;} */ + gsl_matrix_float *gslobj() {assert(m);return m;} + const gsl_matrix_float *gslobj() const {assert(m);return m;} +private: + /// + gsl_matrix_float *m; + +}; +} +#undef type_is_float +#undef type_is_double + +#endif // _matrix_float_h diff --git a/dtm_release/gslwrap/include/gslwrap/matrix_int.h b/dtm_release/gslwrap/include/gslwrap/matrix_int.h new file mode 100644 index 0000000000000000000000000000000000000000..96377d108d9e0ba5b24e88c2e3b867730dfcee97 --- /dev/null +++ b/dtm_release/gslwrap/include/gslwrap/matrix_int.h @@ -0,0 +1,291 @@ +// matrix.h + +// This matrix class is a C++ wrapper for the GNU Scientific Library +// Copyright (C) 2001 Ramin Nakisa + +// 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 2 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, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +#if !defined( _matrix_int_h ) +#define _matrix_int_h + +#ifdef __HP_aCC //for aCC B3910B A.01.27 +#include <iostream.h> +#include <fstream.h> +#include <iomanip.h> +#else //for gcc3 +#include <iostream> +#include <fstream> +#include <iomanip> +#endif + +#include <math.h> +#include <stdlib.h> +#include <assert.h> +/// +#include <gsl/gsl_math.h> +#include <gsl/gsl_matrix_int.h> +#include <gsl/gsl_linalg.h> +#include <gslwrap/permutation.h> +#include <gslwrap/vector_int.h> + +#define type_is_int +#ifdef type_is +#define type_is_double +#endif + +namespace gsl +{ + +/// +class matrix_int +{ +#ifdef type_is_double + friend class matrix_float; + friend class matrix_int; +#endif +public: + typedef int value_type; + typedef vector_int vector_type; + + /// + matrix_int(); + /// + matrix_int( size_t new_rows, size_t new_cols, bool clear = true ); + + template<class oclass> + void copy(const oclass &other) + { + if ( static_cast<const void *>( this ) == static_cast<const void *>( &other ) ) + return; + + set_dimensions( other.get_rows(), other.get_cols() ); + for ( size_t i = 0; i < get_rows(); i++ ) + { + for ( size_t j = 0; j < get_cols(); j++ ) + { + gsl_matrix_int_set( m, i, j, (int)other(i,j)); + } + } + } +/* template<> */ +/* void copy<matrix_int>(const matrix_int &other) */ +/* { */ +/* set_dimensions(other.size1(),other.size2()); */ +/* gsl_matrix_int_memcpy( m, other.m ); */ +/* } */ + // copy constructor for type matrix_int + matrix_int( const matrix_int &other ):m(NULL) {copy(other);} + /// + template<class oclass> + matrix_int( const oclass &other ):m(NULL) {copy(other);} + + /// + ~matrix_int(); + /// +// matrix_int( const char *Filename ); + /// + size_t get_rows() const {return m->size1;} + /// + size_t get_cols() const {return m->size2;} + /// + size_t size1() const {return m->size1;} + /// + size_t size2() const {return m->size2;} + + + /// + void dimensions( size_t *num_rows, size_t *num_cols ) const; + /// +int get_element ( size_t row, size_t col ) const {return gsl_matrix_int_get( m, row, col ) ;} + const int &operator()( size_t row, size_t col ) const {return *gsl_matrix_int_ptr( m, row, col ) ;} +int &operator()( size_t row, size_t col ) {return *gsl_matrix_int_ptr( m, row, col ) ;} + /// + void set_element( size_t row, size_t col, const int &v ){ gsl_matrix_int_set( m, row, col, v );} + /// + void set_elements( const int & new_value ); + void set_all ( const int & new_value ) {gsl_matrix_int_set_all ( m, new_value );} + void set_zero() {gsl_matrix_int_set_zero( m );} + /// + void set_dimensions( size_t new_rows, size_t new_cols ); + /// + void load( const char *filename ); + /// + void save( const char *filename ) const; + /// + friend ostream& operator<< ( ostream& os, const matrix_int& m ); + //This function writes the elements of the matrix m to the stream stream in binary format. The return value is 0 for success and GSL_EFAILED if there was a problem writing to the file. Since the data is written in the native binary format it may not be portable between different architectures. + int fwrite (FILE * stream) const {return gsl_matrix_int_fwrite (stream, m);} + +//This function reads into the matrix m from the open stream stream in binary format. The matrix m must be preallocated with the correct dimensions since the function uses the size of m to determine how many bytes to read. The return value is 0 for success and GSL_EFAILED if there was a problem reading from the file. The data is assumed to have been written in the native binary format on the same architecture. + int fread (FILE * stream) {return gsl_matrix_int_fread (stream, m);} + + /// + void load_binary( const char *filename ); + /// + void save_binary( const char *filename ) const; + /// + bool operator==( const matrix_int &other ) const; + bool operator!=( const matrix_int &other ) const {return !((*this)==other);} + + matrix_int& operator=( const matrix_int &other ) {copy( other );return *this;} + /// converts from any other matrix type + template<class omatrix> + matrix_int &operator=( const omatrix& other ) + { + copy(other); + return *this; + } + /// + matrix_int operator+( const matrix_int &other ) const; + /// + matrix_int operator+( const int &f ) const; + /// + friend matrix_int operator+( const int &f, const matrix_int &other ); + /// + matrix_int &operator+=( const int &f ); + /// + matrix_int &operator+=( const matrix_int &other ); + /// + matrix_int operator-( const matrix_int &other ) const; + /// + matrix_int operator-( const int &f ) const; + /// + friend matrix_int operator-( const int &f, const matrix_int &other ); + /// + matrix_int &operator-=( const int &f ); + /// + matrix_int &operator-=( const matrix_int &other ); + /// + matrix_int operator*( const matrix_int &other ) const; + /// + matrix_int operator*( const int &f ) const; + /// + friend matrix_int operator*( const int &f, const matrix_int &other ); + /// + matrix_int &operator*=( const int &f ); + /// + matrix_int &operator*=( const matrix_int &other ); + /// + matrix_int operator/( const int &) const; + /// + matrix_int &operator/=( const int &); + /// + matrix_int transpose() const; + /// + matrix_int LU_decomp(gsl::permutation *perm=NULL,int *psign=NULL) const; + /// + matrix_int LU_invert() const; + + // return a submatrix of the this from row_min to row_max (not included!) + matrix_int submatrix(size_t row_min, size_t row_max, size_t col_min, size_t col_max) const + { + matrix_int m(row_max - row_min, col_max - col_min); + for (size_t i = row_min ; i < row_max ; i++) + { + for (size_t j = col_min ; j < col_max ; j++) + { + m(i - row_min,j - col_min) = (*this)(i,j); + } + } + return m; + } +private: + /// + void LU_decomp( gsl_matrix_int **a, + gsl_permutation **permutation, + int *sign ) const; +public: + /** returns sum of all the matrix elements. */ + int sum() const; + /** returns logarithm of the determinant of the matrix. */ + double LU_lndet() const; + + + /** returns a vector_int_view of a single row of the matrix. */ + vector_int_view row( size_t rowindex ); + const vector_int_view row( size_t rowindex ) const ; + /** returns a vector_int_view of a single column of the matrix. */ + vector_int_view column( size_t colindex ); + const vector_int_view column( size_t colindex ) const; + /** returns a vector_int_view of the diagonal elements of the matrix. */ + vector_int_view diagonal(); + const vector_int_view diagonal() const; + + /** returns a column matrix containing a single row of the matrix. */ + matrix_int get_row( size_t rowindex ) const; + /** returns a column matrix containing a single column of the matrix. */ + matrix_int get_col( size_t colindex ) const; + /** calculates sum of rows returned as a column matrix. */ + matrix_int row_sum() const; + /** calculates sum of columns returned as a row matrix. */ + matrix_int column_sum() const; + /** returns trace (diagonal sum) of a square matrix. */ + double trace() const; + /** calculates cholesky decomposition of the matrix, returning success if matrix is positive definite. */ + int cholesky_decomp( matrix_int &a ) const; +// /** returns index of nearest row in matrix to vector argument. */ +// int nearest_row_index( const matrix_int &v ) const; + /** calculates covariance of the matrix columns. */ + matrix_int covariance() const; + /** returns 1 if matrix is square, 0 otherwise. */ + bool is_square() const; + /** diag operator (sets the diagonal elements of the matrix to the elements of v */ + void diag(const vector_int& v); + /** set diagonal elements of a square matrix to f. */ + void set_diagonal( int f ); + /** sets matrix to a k dimensional unit matrix. */ + void identity( size_t k ); + /** returns sum of nth power of all elements. */ + double norm( double n ) const; + +/* Function: double gsl_matrix_max (const gsl_matrix * m) */ +/* This function returns the maximum value in the matrix m. */ + double max() const {return gsl_matrix_int_max(m);} +/* Function: double gsl_matrix_min (const gsl_matrix * m) */ +/* This function returns the minimum value in the matrix m. */ + double min()const{return gsl_matrix_int_min(m);} + + /** This function returns 1 if all the elements of the matrix m are zero, and 0 otherwise. */ + bool isnull() const { return gsl_matrix_int_isnull(m);} +/* Function: void gsl_matrix_minmax (const gsl_matrix * m, double * min_out, double * max_out) */ +/* This function returns the minimum and maximum values in the matrix m, storing them in min_out and max_out. */ + +/* Function: void gsl_matrix_max_index (const gsl_matrix * m, size_t * imax, size_t * jmax) */ +/* This function returns the indices of the maximum value in the matrix m, storing them in imax and jmax. When there are several equal maximum elements then the first element found */ +/* is returned. */ + +/* Function: void gsl_matrix_min_index (const gsl_matrix * m, size_t * imax, size_t * jmax) */ +/* This function returns the indices of the minimum value in the matrix m, storing them in imax and jmax. When there are several equal minimum elements then the first element found */ +/* is returned. */ + +/* Function: void gsl_matrix_minmax_index (const gsl_matrix * m, size_t * imin, size_t * imax) */ +/* This function returns the indices of the minimum and maximum values in the matrix m, storing them in (imin,jmin) and (imax,jmax). When there are several equal minimum or */ +/* maximum elements then the first elements found are returned. */ + + /** for interfacing with gsl c */ +/* gsl_matrix_int *gslobj() {if (!m){cout << "matrix_int::gslobj ERROR, data not initialized!! " << endl; exit(-1);}return m;} */ +/* const gsl_matrix_int *gslobj() const {if (!m){cout << "matrix_int::gslobj ERROR, data not initialized!! " << endl; exit(-1);}return m;} */ + gsl_matrix_int *gslobj() {assert(m);return m;} + const gsl_matrix_int *gslobj() const {assert(m);return m;} +private: + /// + gsl_matrix_int *m; + +}; +} +#undef type_is_int +#undef type_is_double + +#endif // _matrix_int_h diff --git a/dtm_release/gslwrap/include/gslwrap/matrix_vector_operators.h b/dtm_release/gslwrap/include/gslwrap/matrix_vector_operators.h new file mode 100644 index 0000000000000000000000000000000000000000..e72182056cbce3af2089324b84a1d4e76629349e --- /dev/null +++ b/dtm_release/gslwrap/include/gslwrap/matrix_vector_operators.h @@ -0,0 +1,47 @@ +// This matrix class is a C++ wrapper for the GNU Scientific Library +// Copyright (C) ULP-IPB Strasbourg + +// 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 2 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, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +#ifndef __matrix_vector_operators_h +#define __matrix_vector_operators_h + +#include "gsl/gsl_blas.h" +#include <gslwrap/matrix_double.h> +#include <gslwrap/matrix_float.h> +#include <gslwrap/vector_double.h> + +namespace gsl +{ + +inline +vector_float operator*(const matrix_float& m, const vector_float& v) +{ + vector_float y(m.get_rows()); + gsl_blas_sgemv(CblasNoTrans, 1.0, m.gslobj(), v.gslobj(), 0.0, y.gslobj()); + return y; +} + +inline +vector operator*(const matrix& m, const vector& v) +{ + vector y(m.get_rows()); + gsl_blas_dgemv(CblasNoTrans, 1.0, m.gslobj(), v.gslobj(), 0.0, y.gslobj()); + return y; +} + +} + +#endif //__matrix_vector_operators_h diff --git a/dtm_release/gslwrap/include/gslwrap/min_fminimizer.h b/dtm_release/gslwrap/include/gslwrap/min_fminimizer.h new file mode 100644 index 0000000000000000000000000000000000000000..a4e4ad37a17b6e87cc9f963534a8b0185229654c --- /dev/null +++ b/dtm_release/gslwrap/include/gslwrap/min_fminimizer.h @@ -0,0 +1,123 @@ +// This random generator is a C++ wrapper for the GNU Scientific Library +// Copyright (C) 2001 Torbjorn Vik + +// 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 2 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, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#ifndef __min_fminimizer_h +#define __min_fminimizer_h + +#include <gsl/gsl_errno.h> +#include <gsl/gsl_min.h> + +namespace gsl{ + +//! Derive this class provide a user defined function for minimisation +struct min_f +{ + //! This operator must be overridden + virtual double operator()(const double& x)=0; + + //! This is the function gsl calls to optimize f + static double f(double x, void *p) + { + return (*(min_f *)p)(x); + } +}; + +//! Class for minimizing one dimensional functions. +/*! + Usage: + - Create with optional minimize type + - Set with function object and inital bounds + - Loop the iterate function until convergence or maxIterations (extra facility) + + - Recover minimum and bounds + */ +class min_fminimizer +{ + public: + //! choose between gsl_min_fminimizer_goldensection and gsl_min_fminimizer_brent + min_fminimizer(const gsl_min_fminimizer_type* type=gsl_min_fminimizer_brent) : s(NULL), maxIterations(100), isSet(false) + { + s=gsl_min_fminimizer_alloc(type); + nIterations=0; + if (!s) + { + //error + //cout << "ERROR Couldn't allocate memory for minimizer" << endl; + //throw ? + exit(-1); + } + } + ~min_fminimizer(){if (s) gsl_min_fminimizer_free(s);} + //! returns GSL_FAILURE if the interval does not contain a minimum + int set(min_f& function, double minimum, double x_lower, double x_upper) + { + isSet=false; + f.function = &function.f; + f.params = &function; + int status= gsl_min_fminimizer_set(s, &f, minimum, x_lower, x_upper); + if (!status) + { + isSet=true; + nIterations=0; + } + return status; + } + int set_with_values(min_f& function, + double minimum, double f_minimum, + double x_lower,double f_lower, + double x_upper, double f_upper) + { + isSet=false; + f.function = &function.f; + f.params = &function; + int status= gsl_min_fminimizer_set_with_values(s, &f, minimum, f_minimum, x_lower, f_lower, x_upper, f_upper); + if (!status) + { + isSet=true; + nIterations=0; + } + return status; + } + int iterate() + { + assert_set(); + int status=gsl_min_fminimizer_iterate(s); + nIterations++; + if (status==GSL_FAILURE) + isConverged=true; + return status; + } + double minimum(){assert_set();return gsl_min_fminimizer_minimum(s);} + double x_upper(){assert_set();return gsl_min_fminimizer_x_upper(s);} + double x_lower(){assert_set();return gsl_min_fminimizer_x_lower(s);} + void SetMaxIterations(int n){maxIterations=n;} + int GetNIterations(){return nIterations;} + bool is_converged(){if (nIterations>=maxIterations) return true; if (isConverged) return true; return false;} + //string name() const; + + private: + void assert_set(){if (!isSet)exit(-1);} // Old problem of error handling: TODO + + bool isSet; + bool isConverged; + int nIterations; + int maxIterations; + gsl_min_fminimizer* s; + gsl_function f; +}; +}; // namespace gsl + +#endif //__min_fminimizer_h diff --git a/dtm_release/gslwrap/include/gslwrap/multimin_fdfminimizer.h b/dtm_release/gslwrap/include/gslwrap/multimin_fdfminimizer.h new file mode 100644 index 0000000000000000000000000000000000000000..3a4718d5697bbc4eb119c9024f99e7faf7e71dc3 --- /dev/null +++ b/dtm_release/gslwrap/include/gslwrap/multimin_fdfminimizer.h @@ -0,0 +1,171 @@ +// This random generator is a C++ wrapper for the GNU Scientific Library +// Copyright (C) 2001 Torbjorn Vik + +// 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 2 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, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#ifndef __multimin_fdfminimizer_h +#define __multimin_fdfminimizer_h + +#include <gsl/gsl_errno.h> +#include <gsl/gsl_multimin.h> +#include <gslwrap/vector_double.h> + +namespace gsl{ + +//! Create an instance of this class with a user defined function +/*! + A template class with the function operator()(const vector& x) + and derivative(const vector&, vector&), as well as a reference to an object of this class must be fournished + + User is responsible for deleting this reference ! + + */ +template <class fdf_function> +class multimin_fdf +{ + public: + fdf_function* fct; + + //! These operators can be overridden + virtual double operator()(const vector& x) + { + return (*fct)(x); + } + virtual void derivative(const vector& x, vector& g) + { + (*fct).derivative(x, g); + } + + //! This operator can be overridden to gain performance in calculating the value and its derivative in a scoop + virtual double fval_and_derivative(const vector&x, vector& g ) + { + derivative(x, g); + return (*this)(x); + } + + + //! This is the function gsl calls to calculate the value of f at x + static double f(const gsl_vector* x, void *p) + { + vector_view x_view(*x); + return (*(multimin_fdf *)p)(x_view); + } + + //! This is the function gsl calls to calculate the value of g=f' at x + static void df(const gsl_vector* x, void *p, gsl_vector* g) + { + vector_view x_view(*x); + vector_view g_view(*g); + (*(multimin_fdf *)p).derivative(x_view, g_view); + } + + //! This is the function gsl calls to calculate the value of g=f' at x + static void fdf(const gsl_vector* x, void *p, double* f, gsl_vector* g) + { + vector_view x_view(*x); + vector_view g_view(*g); + *f=(*(multimin_fdf *)p).fval_and_derivative(x_view, g_view); + } + + //! Constructor (User is responsible for deleting the fdf_function object) + multimin_fdf(fdf_function* _fct):fct(_fct){assert (fct!=NULL);} +}; + +//! Class for multiminimizing one dimensional functions. +/*! + Usage: + - Create with optional multiminimize type + - Set with function object and inital bounds + - Loop the iterate function until convergence or maxIterations (extra facility) + + - Recover multiminimum and bounds + */ +class multimin_fdfminimizer +{ + public: +//! +/*! Choose between : + - gsl_multimin_fdfminimizer_conjugate_fr + - gsl_multimin_fdfminimizer_conjugate_pr + - gsl_multimin_fdfminimizer_vector_bfgs + - gsl_multimin_fdfminimizer_steepest_descent + + */ + multimin_fdfminimizer(uint _dim, + const gsl_multimin_fdfminimizer_type* type=gsl_multimin_fdfminimizer_conjugate_fr) : + dim(_dim), isSet(false), maxIterations(100), s(NULL) + { + s=gsl_multimin_fdfminimizer_alloc(type, dim); + nIterations=0; + if (!s) + { + //error + //cout << "ERROR Couldn't allocate memory for multiminimizer" << endl; + //throw ? + exit(-1); + } + } + ~multimin_fdfminimizer(){if (s) gsl_multimin_fdfminimizer_free(s);} + //! returns GSL_FAILURE if the interval does not contain a multiminimum + template <class fdf_function> + int set(multimin_fdf<fdf_function>& function, const vector& initial_x, double step_size, double tol) + { + isSet=false; + f.f = &function.f; + f.df = &function.df; + f.fdf = &function.fdf; + f.n = dim; + f.params = &function; + int status= gsl_multimin_fdfminimizer_set(s, &f, initial_x.gslobj(), step_size, tol); + if (!status) + { + isSet=true; + nIterations=0; + } + return status; + } + int iterate() + { + assert_set(); + int status=gsl_multimin_fdfminimizer_iterate(s); + nIterations++; + if (status==GSL_FAILURE) + isConverged=true; + return status; + } + int restart(){return gsl_multimin_fdfminimizer_restart(s);} + double minimum(){assert_set();return gsl_multimin_fdfminimizer_minimum(s);} + vector x_value(){assert_set();return vector_view(*gsl_multimin_fdfminimizer_x(s));} + vector gradient(){assert_set();return vector_view(*gsl_multimin_fdfminimizer_gradient(s));} + + + void SetMaxIterations(int n){maxIterations=n;} + int GetNIterations(){return nIterations;} + bool is_converged(){if (nIterations>=maxIterations) return true; if (isConverged) return true; return false;} + //string name() const; + + private: + void assert_set(){if (!isSet)exit(-1);} // Old problem of error handling: TODO + + uint dim; + bool isSet; + bool isConverged; + int nIterations; + int maxIterations; + gsl_multimin_fdfminimizer* s; + gsl_multimin_function_fdf f; +}; +}; // namespace gsl + +#endif //__multimin_fdfminimizer_h diff --git a/dtm_release/gslwrap/include/gslwrap/permutation.h b/dtm_release/gslwrap/include/gslwrap/permutation.h new file mode 100644 index 0000000000000000000000000000000000000000..22b4974934984da8de653ff701b900383ff8f4f6 --- /dev/null +++ b/dtm_release/gslwrap/include/gslwrap/permutation.h @@ -0,0 +1,41 @@ +// This matrix class is a C++ wrapper for the GNU Scientific Library +// Copyright (C) ULP-IPB Strasbourg + +// 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 2 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, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +#ifndef _permutation_h +#define _permutation_h + +#include<gsl/gsl_permutation.h> + +namespace gsl +{ +class permutation +{ + friend class matrix; + friend class matrix_float; + friend class matrix_int; + + gsl_permutation *gsldata; +public: + permutation(size_t n,bool clear=true) + { + gsldata=(clear ? gsl_permutation_calloc(n) : gsl_permutation_alloc(n)); + } + permutation():gsldata(NULL){;} + void resize(size_t n){gsldata= gsl_permutation_calloc(n);} +}; +} +#endif// _permutation_h diff --git a/dtm_release/gslwrap/include/gslwrap/random_generator.h b/dtm_release/gslwrap/include/gslwrap/random_generator.h new file mode 100644 index 0000000000000000000000000000000000000000..ef371c7abc544f7555aea43a3ccb26667c323997 --- /dev/null +++ b/dtm_release/gslwrap/include/gslwrap/random_generator.h @@ -0,0 +1,76 @@ +// This random generator is a C++ wrapper for the GNU Scientific Library +// Copyright (C) 2001 Torbjorn Vik + +// 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 2 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, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#ifndef __random_generator_h +#define __random_generator_h + +#include "gsl/gsl_rng.h" +#include <string> + +namespace gsl +{ +#ifndef __HP_aCC +using std::string; +#endif + +//class RandomNumberGenerator +class random_generator +{ +private: + gsl_rng* generator; +public: +// Construction and Initializing: + //! Default args reads environment variable GSL_RNG_TYPE and GSL_RNG_SEED to initialize. If these are not set the generator gsl_rng_mt19937 will be used with seed 0. + random_generator (const random_generator& other) : generator(NULL) {generator = gsl_rng_clone(other.generator);} + random_generator (const gsl_rng_type* type=NULL, unsigned long int seed=0) : generator(NULL) + { + gsl_rng_env_setup(); + if (!type) + { + generator = gsl_rng_alloc (gsl_rng_default); + } + else + { + generator = gsl_rng_alloc (type) ; + if (seed) + gsl_rng_set(generator, seed); + } + } + ~random_generator () {gsl_rng_free(generator);} + random_generator& operator=(const random_generator& other){if (generator) gsl_rng_free(generator); generator = gsl_rng_clone(other.generator);return *this;} + void set(unsigned long int seed){gsl_rng_set(generator, seed);} + +// Sampling: + unsigned long int get(unsigned long int n=0) {if (n) return gsl_rng_uniform_int(generator, n); else return gsl_rng_get(generator);} // returns value in range [min, max] + double uniform() { return gsl_rng_uniform(generator);} // returns value in range [0, 1) + double uniform_positive() { return gsl_rng_uniform_pos(generator);}// returns value in range (0, 1) + unsigned long int uniform_int(unsigned long int n) + { return gsl_rng_uniform_int(generator, n);}// returns value in range [0, n-1] + +// Information: + string name(){return gsl_rng_name(generator);} + unsigned long int max(){return gsl_rng_max(generator);} + unsigned long int min(){return gsl_rng_min(generator);} + +// For calling gsl functions directly + gsl_rng* gslobj() { return generator;} + const gsl_rng* gslobj() const { return generator;} +// static void Test(); +}; + +} + +#endif //__random_generator_h diff --git a/dtm_release/gslwrap/include/gslwrap/random_number_distribution.h b/dtm_release/gslwrap/include/gslwrap/random_number_distribution.h new file mode 100644 index 0000000000000000000000000000000000000000..bc03a65e067843e8374a5a98212d2eb873889997 --- /dev/null +++ b/dtm_release/gslwrap/include/gslwrap/random_number_distribution.h @@ -0,0 +1,60 @@ +// This matrix class is a C++ wrapper for the GNU Scientific Library +// Copyright (C) ULP-IPB Strasbourg + +// 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 2 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, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +#ifndef __random_number_distribution_h +#define __random_number_distribution_h + +#include "gslwrap/random_generator.h" +#include "gsl/gsl_randist.h" + +namespace gsl +{ + +class random_number_distribution +{ + public: + random_number_distribution(const random_generator& _generator) : generator(_generator){;} + + //Methods: + virtual double get()=0; + virtual double pdf(const double& x)=0; + virtual ~random_number_distribution() + { + ; + } + protected: + random_generator generator; +}; + +class gaussian_random : public random_number_distribution +{ + public: + gaussian_random(const random_generator& _generator, const double& _sigma=1.0) : random_number_distribution(_generator), sigma(_sigma){;} + + //methods: + double get(){return gsl_ran_gaussian(generator.gslobj(), sigma);} + double get(double _sigma){return gsl_ran_gaussian(generator.gslobj(), _sigma);} + double pdf(const double& x){return gsl_ran_gaussian_pdf(x, sigma);} + + double ratio_method(){return gsl_ran_gaussian_ratio_method(generator.gslobj(), sigma);} + protected: + double sigma; +}; + +} + +#endif //__random_number_distribution_h diff --git a/dtm_release/gslwrap/include/gslwrap/vector_double.h b/dtm_release/gslwrap/include/gslwrap/vector_double.h new file mode 100644 index 0000000000000000000000000000000000000000..6858c596f0b71945fad8b23b07a5b328e29a5041 --- /dev/null +++ b/dtm_release/gslwrap/include/gslwrap/vector_double.h @@ -0,0 +1,401 @@ +// This matrix class is a C++ wrapper for the GNU Scientific Library +// Copyright (C) ULP-IPB Strasbourg + +// 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 2 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, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +#ifndef _vector_double_h +#define _vector_double_h + +#ifdef __HP_aCC +#include <iostream.h> +#else +#include <iostream> +#endif + +#include <gsl/gsl_math.h> +#include <gsl/gsl_vector.h> +#include <gsl/gsl_blas.h> +#include <gslwrap/vector_double.h> + +//#define NDEBUG 0 + +#include <assert.h> +namespace gsl +{ + +#ifndef __HP_aCC + using std::ostream; +//using std::string; +//using std::runtime_error; +#endif + +class vector_view; + +class vector +{ +protected: + gsl_vector *gsldata; + void free(){if(gsldata) gsl_vector_free(gsldata);gsldata=NULL;} + void alloc(size_t n) {gsldata=gsl_vector_alloc(n);} + void calloc(size_t n){gsldata=gsl_vector_calloc(n);} +public: + typedef double value_type; + vector() : gsldata(NULL) {;} + vector( const vector &other ):gsldata(NULL) {copy(other);} + template<class oclass> + vector( const oclass &other ):gsldata(NULL) {copy(other);} + ~vector(){free();} + vector(const size_t& n,bool clear=true) + { + if(clear){this->calloc(n);} + else {this->alloc(n);} + } + vector(const int& n,bool clear=true) + { + if(clear){this->calloc(n);} + else {this->alloc(n);} + } + + void resize(size_t n); + + template <class oclass> + void copy(const oclass &other) + { + if ( static_cast<const void *>( this ) == static_cast<const void *>( &other ) ) + return; + + if (!other.is_set()) + { + gsldata=NULL; + return; + } + resize(other.size()); + for (size_t i=0;i<size();i++) + { + gsl_vector_set(gsldata, i, (double)other[i]); + } + } + void copy(const vector& other); + bool is_set() const{if (gsldata) return true; else return false;} +// void clone(vector& other); + +// size_t size() const {if (!gsldata) {cout << "vector::size vector not initialized" << endl; exit(-1);}return gsldata->size;} + size_t size() const {assert (gsldata); return gsldata->size;} + + /** for interfacing with gsl c */ +/* gsl_vector *gslobj() {if (!gsldata){cout << "vector::gslobj ERROR, data not initialized!! " << endl; exit(-1);}return gsldata;} */ +/* const gsl_vector *gslobj() const {if (!gsldata){cout << "vector::gslobj ERROR, data not initialized!! " << endl; exit(-1);}return gsldata;} */ + gsl_vector *gslobj() {assert(gsldata);return gsldata;} + const gsl_vector *gslobj() const {assert(gsldata);return gsldata;} + + + static vector_view create_vector_view( const gsl_vector_view &other ); + +// ********Accessing vector elements + +// Unlike FORTRAN compilers, C compilers do not usually provide support for range checking of vectors and matrices (2). However, the functions gsl_vector_get and gsl_vector_set can perform range checking for you and report an error if you attempt to access elements outside the allowed range. + +// The functions for accessing the elements of a vector or matrix are defined in `gsl_vector.h' and declared extern inline to eliminate function-call overhead. If necessary you can turn off range checking completely without modifying any source files by recompiling your program with the preprocessor definition GSL_RANGE_CHECK_OFF. Provided your compiler supports inline functions the effect of turning off range checking is to replace calls to gsl_vector_get(v,i) by v->data[i*v->stride] and and calls to gsl_vector_set(v,i,x) by v->data[i*v->stride]=x. Thus there should be no performance penalty for using the range checking functions when range checking is turned off. + +// This function returns the i-th element of a vector v. If i lies outside the allowed range of 0 to n-1 then the error handler is invoked and 0 is returned. + double get(size_t i) const {return gsl_vector_get(gsldata,i);} + +// This function sets the value of the i-th element of a vector v to x. If i lies outside the allowed range of 0 to n-1 then the error handler is invoked. + void set(size_t i,double x){gsl_vector_set(gsldata,i,x);} + +// These functions return a pointer to the i-th element of a vector v. If i lies outside the allowed range of 0 to n-1 then the error handler is invoked + double &operator[](size_t i) { return *gsl_vector_ptr(gsldata,i);} + const double &operator[](size_t i) const { return *gsl_vector_ptr(gsldata,i);} + + double &operator()(size_t i) { return *gsl_vector_ptr(gsldata,i);} + const double &operator()(size_t i) const { return *gsl_vector_ptr(gsldata,i);} + + +// ***** Initializing vector elements + +// This function sets all the elements of the vector v to the value x. + void set_all(double x){gsl_vector_set_all (gsldata,x);} +// This function sets all the elements of the vector v to zero. + void set_zero(){gsl_vector_set_zero (gsldata);} + +// This function makes a basis vector by setting all the elements of the vector v to zero except for the i-th element which is set to one. + int set_basis (size_t i) {return gsl_vector_set_basis (gsldata,i);} + +// **** Reading and writing vectors + +// The library provides functions for reading and writing vectors to a file as binary data or formatted text. + + +// This function writes the elements of the vector v to the stream stream in binary format. The return value is 0 for success and GSL_EFAILED if there was a problem writing to the file. Since the data is written in the native binary format it may not be portable between different architectures. + int fwrite (FILE * stream) const {return gsl_vector_fwrite (stream, gsldata);} + +// This function reads into the vector v from the open stream stream in binary format. The vector v must be preallocated with the correct length since the function uses the size of v to determine how many bytes to read. The return value is 0 for success and GSL_EFAILED if there was a problem reading from the file. The data is assumed to have been written in the native binary format on the same architecture. + int fread (FILE * stream) {return gsl_vector_fread (stream, gsldata);} + + void load( const char *filename ); + /// + void save( const char *filename ) const; + +// This function writes the elements of the vector v line-by-line to the stream stream using the format specifier format, which should be one of the %g, %e or %f formats for floating point numbers and %d for integers. The function returns 0 for success and GSL_EFAILED if there was a problem writing to the file. + int fprintf (FILE * stream, const char * format) const {return gsl_vector_fprintf (stream, gsldata,format) ;} + +// This function reads formatted data from the stream stream into the vector v. The vector v must be preallocated with the correct length since the function uses the size of v to determine how many numbers to read. The function returns 0 for success and GSL_EFAILED if there was a problem reading from the file. + int fscanf (FILE * stream) {return gsl_vector_fscanf (stream, gsldata); } + + + + +// ******* Vector views + +// In addition to creating vectors from slices of blocks it is also possible to slice vectors and create vector views. For example, a subvector of another vector can be described with a view, or two views can be made which provide access to the even and odd elements of a vector. + +// A vector view is a temporary object, stored on the stack, which can be used to operate on a subset of vector elements. Vector views can be defined for both constant and non-constant vectors, using separate types that preserve constness. A vector view has the type gsl_vector_view and a constant vector view has the type gsl_vector_const_view. In both cases the elements of the view can be accessed as a gsl_vector using the vector component of the view object. A pointer to a vector of type gsl_vector * or const gsl_vector * can be obtained by taking the address of this component with the & operator. + +// These functions return a vector view of a subvector of another vector v. The start of the new vector is offset by offset elements from the start of the original +// vector. The new vector has n elements. Mathematically, the i-th element of the new vector v' is given by, + +// v'(i) = v->data[(offset + i)*v->stride] + +// where the index i runs from 0 to n-1. + +// The data pointer of the returned vector struct is set to null if the combined parameters (offset,n) overrun the end of the original vector. + +// The new vector is only a view of the block underlying the original vector, v. The block containing the elements of v is not owned by the new vector. When the +// new vector goes out of scope the original vector v and its block will continue to exist. The original memory can only be deallocated by freeing the original vector. +// Of course, the original vector should not be deallocated while the new vector is still in use. + +// The function gsl_vector_const_subvector is equivalent to gsl_vector_subvector but can be used for vectors which are declared const. + vector_view subvector (size_t offset, size_t n); + const vector_view subvector (size_t offset, size_t n) const; +// vector_const_view subvector (size_t offset, size_t n) const; + +// class view +// { +// gsl_vector_view *gsldata; +// public: +// view(); +// }; +// view subvector(size_t offset, size_t n) +// { +// return view(gsl_vector_subvector(gsldata,offset,n); +// } +// const view subvector(size_t offset, size_t n) const +// { +// return view(gsl_vector_const_subvector(gsldata,offset,n); +// } + + + +// Function: gsl_vector gsl_vector_subvector_with_stride (gsl_vector *v, size_t offset, size_t stride, size_t n) +// Function: gsl_vector_const_view gsl_vector_const_subvector_with_stride (const gsl_vector * v, size_t offset, size_t stride, size_t n) +// These functions return a vector view of a subvector of another vector v with an additional stride argument. The subvector is formed in the same way as for +// gsl_vector_subvector but the new vector has n elements with a step-size of stride from one element to the next in the original vector. Mathematically, +// the i-th element of the new vector v' is given by, + +// v'(i) = v->data[(offset + i*stride)*v->stride] + +// where the index i runs from 0 to n-1. + +// Note that subvector views give direct access to the underlying elements of the original vector. For example, the following code will zero the even elements of the +// vector v of length n, while leaving the odd elements untouched, + +// gsl_vector_view v_even = gsl_vector_subvector_with_stride (v, 0, 2, n/2); +// gsl_vector_set_zero (&v_even.vector); + +// A vector view can be passed to any subroutine which takes a vector argument just as a directly allocated vector would be, using &view.vector. For example, the +// following code computes the norm of odd elements of v using the BLAS routine DNRM2, + +// gsl_vector_view v_odd = gsl_vector_subvector_with_stride (v, 1, 2, n/2); +// double r = gsl_blas_dnrm2 (&v_odd.vector); + +// The function gsl_vector_const_subvector_with_stride is equivalent to gsl_vector_subvector_with_stride but can be used for +// vectors which are declared const. + +// Function: gsl_vector_view gsl_vector_complex_real (gsl_vector_complex *v) +// Function: gsl_vector_const_view gsl_vector_complex_const_real (const gsl_vector_complex *v) +// These functions return a vector view of the real parts of the complex vector v. + +// The function gsl_vector_complex_const_real is equivalent to gsl_vector_complex_real but can be used for vectors which are declared +// const. + +// Function: gsl_vector_view gsl_vector_complex_imag (gsl_vector_complex *v) +// Function: gsl_vector_const_view gsl_vector_complex_const_imag (const gsl_vector_complex *v) +// These functions return a vector view of the imaginary parts of the complex vector v. + +// The function gsl_vector_complex_const_imag is equivalent to gsl_vector_complex_imag but can be used for vectors which are declared +// const. + +// Function: gsl_vector_view gsl_vector_view_array (double *base, size_t n) +// Function: gsl_vector_const_view gsl_vector_const_view_array (const double *base, size_t n) +// These functions return a vector view of an array. The start of the new vector is given by base and has n elements. Mathematically, the i-th element of the new +// vector v' is given by, + +// v'(i) = base[i] + +// where the index i runs from 0 to n-1. + +// The array containing the elements of v is not owned by the new vector view. When the view goes out of scope the original array will continue to exist. The +// original memory can only be deallocated by freeing the original pointer base. Of course, the original array should not be deallocated while the view is still in use. + +// The function gsl_vector_const_view_array is equivalent to gsl_vector_view_array but can be used for vectors which are declared const. + +// Function: gsl_vector_view gsl_vector_view_array_with_stride (double * base, size_t stride, size_t n) +// Function: gsl_vector_const_view gsl_vector_const_view_array_with_stride (const double * base, size_t stride, size_t n) +// These functions return a vector view of an array base with an additional stride argument. The subvector is formed in the same way as for +// gsl_vector_view_array but the new vector has n elements with a step-size of stride from one element to the next in the original array. Mathematically, +// the i-th element of the new vector v' is given by, + +// v'(i) = base[i*stride] + +// where the index i runs from 0 to n-1. + +// Note that the view gives direct access to the underlying elements of the original array. A vector view can be passed to any subroutine which takes a vector +// argument just as a directly allocated vector would be, using &view.vector. + +// The function gsl_vector_const_view_array_with_stride is equivalent to gsl_vector_view_array_with_stride but can be used for +// arrays which are declared const. + + +// ************* Copying vectors + +// Common operations on vectors such as addition and multiplication are available in the BLAS part of the library (see section BLAS Support). However, it is useful to have a small number of utility functions which do not require the full BLAS code. The following functions fall into this category. + +// This function copies the elements of the vector src into the vector dest. + vector& operator=(const vector& other){copy(other);return (*this);} + +// Function: int gsl_vector_swap (gsl_vector * v, gsl_vector * w) +// This function exchanges the elements of the vectors v and w by copying. The two vectors must have the same length. + +// ***** Exchanging elements + +// The following function can be used to exchange, or permute, the elements of a vector. + +// Function: int gsl_vector_swap_elements (gsl_vector * v, size_t i, size_t j) +// This function exchanges the i-th and j-th elements of the vector v in-place. + int swap_elements (size_t i, size_t j) {return gsl_vector_swap_elements (gsldata, i,j);} + +// Function: int gsl_vector_reverse (gsl_vector * v) +// This function reverses the order of the elements of the vector v. + int reverse () {return gsl_vector_reverse (gsldata) ;} + +// ******* Vector operations + +// The following operations are only defined for real vectors. + +// This function adds the elements of vector b to the elements of vector a, a'_i = a_i + b_i. The two vectors must have the same length. + int operator+=(const vector &other) {return gsl_vector_add (gsldata, other.gsldata);} + +// This function subtracts the elements of vector b from the elements of vector a, a'_i = a_i - b_i. The two vectors must have the same length. + int operator-=(const vector &other) {return gsl_vector_sub (gsldata, other.gsldata);} + +// Function: int gsl_vector_mul (gsl_vector * a, const gsl_vector * b) +// This function multiplies the elements of vector a by the elements of vector b, a'_i = a_i * b_i. The two vectors must have the same length. + int operator*=(const vector &other) {return gsl_vector_mul (gsldata, other.gsldata);} + +// This function divides the elements of vector a by the elements of vector b, a'_i = a_i / b_i. The two vectors must have the same length. + int operator/=(const vector &other) {return gsl_vector_div (gsldata, other.gsldata);} + +// This function multiplies the elements of vector a by the constant factor x, a'_i = x a_i. + int operator*=(double x) {return gsl_vector_scale (gsldata, x);} + +// Function: int gsl_vector_add_constant (gsl_vector * a, const double x) +// This function adds the constant value x to the elements of the vector a, a'_i = a_i + x. + int operator+=(double x) {return gsl_vector_add_constant (gsldata,x);} + +// This function multiplies the elements of vector a by the constant factor x, a'_i = x a_i. + int operator/=(double x) {return gsl_vector_scale (gsldata, 1/x);} + +// bool operators: + bool operator==(const vector& other) const; + bool operator!=(const vector& other) const { return (!((*this)==other));} + +// stream output: +// friend ostream& operator<< ( ostream& os, const vector& vect ); + /** returns sum of all the vector elements. */ + double sum() const; + // returns sqrt(v.t*v); + double norm2() const; + + +// **** Finding maximum and minimum elements of vectors + +// This function returns the maximum value in the vector v. + double max() const{return gsl_vector_max (gsldata) ;} + +// Function: double gsl_vector_min (const gsl_vector * v) +// This function returns the minimum value in the vector v. + double min() const{return gsl_vector_min (gsldata) ;} + +// Function: void gsl_vector_minmax (const gsl_vector * v, double * min_out, double * max_out) +// This function returns the minimum and maximum values in the vector v, storing them in min_out and max_out. + +// This function returns the index of the maximum value in the vector v. When there are several equal maximum elements then the lowest index is returned. + size_t max_index(){return gsl_vector_max_index (gsldata);} + +// Function: size_t gsl_vector_min_index (const gsl_vector * v) +// This function returns the index of the minimum value in the vector v. When there are several equal minimum elements then the lowest index is returned. + size_t min_index(){return gsl_vector_min_index (gsldata);} + +// Function: void gsl_vector_minmax_index (const gsl_vector * v, size_t * imin, size_t * imax) +// This function returns the indices of the minimum and maximum values in the vector v, storing them in imin and imax. When there are several equal minimum +// or maximum elements then the lowest indices are returned. + +// Vector properties + +// Function: int gsl_vector_isnull (const gsl_vector * v) +// This function returns 1 if all the elements of the vector v are zero, and 0 otherwise. }; + bool isnull(){return gsl_vector_isnull (gsldata);} +}; + +// When you add create a view it will stick to its with the view until you call change_view +// ex: +// matrix_float m(5,5); +// vector_float v(5); +// // ... +// m.column(3) = v; //the 3rd column of the matrix m will equal v. +class vector_view : public vector +{ + public: + vector_view(const vector& other) :vector(){init(other);} + vector_view(const vector_view& other):vector(){init(other);} + vector_view(const gsl_vector& gsl_other) : vector() {init_with_gsl_vector(gsl_other);} + + void init(const vector& other); + void init_with_gsl_vector(const gsl_vector& gsl_other); + void change_view(const vector& other){init(other);} + private: +}; + +ostream& operator<< ( ostream& os, const vector & vect ); + + +// vector_type<>::type is a template interface to vector_? +// it is usefull for in templated situations for getting the correct vector type +#define tmp_type_is +#ifdef tmp_type_is +typedef vector vector_double; +template<class T> +struct vector_type {typedef vector_double type;}; + +template<class T> +struct value_type {typedef double type;}; + +#else +template<> struct vector_type<double> {typedef vector type;}; +#endif +#undef tmp_type_is + +} +#endif// _vector_double_h diff --git a/dtm_release/gslwrap/include/gslwrap/vector_float.h b/dtm_release/gslwrap/include/gslwrap/vector_float.h new file mode 100644 index 0000000000000000000000000000000000000000..6e2471745ad920b50f35530e2accbf1c795d4d1b --- /dev/null +++ b/dtm_release/gslwrap/include/gslwrap/vector_float.h @@ -0,0 +1,401 @@ +// This matrix class is a C++ wrapper for the GNU Scientific Library +// Copyright (C) ULP-IPB Strasbourg + +// 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 2 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, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +#ifndef _vector_float_h +#define _vector_float_h + +#ifdef __HP_aCC +#include <iostream.h> +#else +#include <iostream> +#endif + +#include <gsl/gsl_math.h> +#include <gsl/gsl_vector_float.h> +#include <gsl/gsl_blas.h> +#include <gslwrap/vector_double.h> + +//#define NDEBUG 0 + +#include <assert.h> +namespace gsl +{ + +#ifndef __HP_aCC + using std::ostream; +//using std::string; +//using std::runtime_error; +#endif + +class vector_float_view; + +class vector_float +{ +protected: + gsl_vector_float *gsldata; + void free(){if(gsldata) gsl_vector_float_free(gsldata);gsldata=NULL;} + void alloc(size_t n) {gsldata=gsl_vector_float_alloc(n);} + void calloc(size_t n){gsldata=gsl_vector_float_calloc(n);} +public: + typedef float value_type; + vector_float() : gsldata(NULL) {;} + vector_float( const vector_float &other ):gsldata(NULL) {copy(other);} + template<class oclass> + vector_float( const oclass &other ):gsldata(NULL) {copy(other);} + ~vector_float(){free();} + vector_float(const size_t& n,bool clear=true) + { + if(clear){this->calloc(n);} + else {this->alloc(n);} + } + vector_float(const int& n,bool clear=true) + { + if(clear){this->calloc(n);} + else {this->alloc(n);} + } + + void resize(size_t n); + + template <class oclass> + void copy(const oclass &other) + { + if ( static_cast<const void *>( this ) == static_cast<const void *>( &other ) ) + return; + + if (!other.is_set()) + { + gsldata=NULL; + return; + } + resize(other.size()); + for (size_t i=0;i<size();i++) + { + gsl_vector_float_set(gsldata, i, (float)other[i]); + } + } + void copy(const vector_float& other); + bool is_set() const{if (gsldata) return true; else return false;} +// void clone(vector_float& other); + +// size_t size() const {if (!gsldata) {cout << "vector_float::size vector not initialized" << endl; exit(-1);}return gsldata->size;} + size_t size() const {assert (gsldata); return gsldata->size;} + + /** for interfacing with gsl c */ +/* gsl_vector_float *gslobj() {if (!gsldata){cout << "vector_float::gslobj ERROR, data not initialized!! " << endl; exit(-1);}return gsldata;} */ +/* const gsl_vector_float *gslobj() const {if (!gsldata){cout << "vector_float::gslobj ERROR, data not initialized!! " << endl; exit(-1);}return gsldata;} */ + gsl_vector_float *gslobj() {assert(gsldata);return gsldata;} + const gsl_vector_float *gslobj() const {assert(gsldata);return gsldata;} + + + static vector_float_view create_vector_view( const gsl_vector_float_view &other ); + +// ********Accessing vector elements + +// Unlike FORTRAN compilers, C compilers do not usually provide support for range checking of vectors and matrices (2). However, the functions gsl_vector_float_get and gsl_vector_float_set can perform range checking for you and report an error if you attempt to access elements outside the allowed range. + +// The functions for accessing the elements of a vector or matrix are defined in `gsl_vector_float.h' and declared extern inline to eliminate function-call overhead. If necessary you can turn off range checking completely without modifying any source files by recompiling your program with the preprocessor definition GSL_RANGE_CHECK_OFF. Provided your compiler supports inline functions the effect of turning off range checking is to replace calls to gsl_vector_float_get(v,i) by v->data[i*v->stride] and and calls to gsl_vector_float_set(v,i,x) by v->data[i*v->stride]=x. Thus there should be no performance penalty for using the range checking functions when range checking is turned off. + +// This function returns the i-th element of a vector v. If i lies outside the allowed range of 0 to n-1 then the error handler is invoked and 0 is returned. + float get(size_t i) const {return gsl_vector_float_get(gsldata,i);} + +// This function sets the value of the i-th element of a vector v to x. If i lies outside the allowed range of 0 to n-1 then the error handler is invoked. + void set(size_t i,float x){gsl_vector_float_set(gsldata,i,x);} + +// These functions return a pointer to the i-th element of a vector v. If i lies outside the allowed range of 0 to n-1 then the error handler is invoked + float &operator[](size_t i) { return *gsl_vector_float_ptr(gsldata,i);} + const float &operator[](size_t i) const { return *gsl_vector_float_ptr(gsldata,i);} + + float &operator()(size_t i) { return *gsl_vector_float_ptr(gsldata,i);} + const float &operator()(size_t i) const { return *gsl_vector_float_ptr(gsldata,i);} + + +// ***** Initializing vector elements + +// This function sets all the elements of the vector v to the value x. + void set_all(float x){gsl_vector_float_set_all (gsldata,x);} +// This function sets all the elements of the vector v to zero. + void set_zero(){gsl_vector_float_set_zero (gsldata);} + +// This function makes a basis vector by setting all the elements of the vector v to zero except for the i-th element which is set to one. + int set_basis (size_t i) {return gsl_vector_float_set_basis (gsldata,i);} + +// **** Reading and writing vectors + +// The library provides functions for reading and writing vectors to a file as binary data or formatted text. + + +// This function writes the elements of the vector v to the stream stream in binary format. The return value is 0 for success and GSL_EFAILED if there was a problem writing to the file. Since the data is written in the native binary format it may not be portable between different architectures. + int fwrite (FILE * stream) const {return gsl_vector_float_fwrite (stream, gsldata);} + +// This function reads into the vector v from the open stream stream in binary format. The vector v must be preallocated with the correct length since the function uses the size of v to determine how many bytes to read. The return value is 0 for success and GSL_EFAILED if there was a problem reading from the file. The data is assumed to have been written in the native binary format on the same architecture. + int fread (FILE * stream) {return gsl_vector_float_fread (stream, gsldata);} + + void load( const char *filename ); + /// + void save( const char *filename ) const; + +// This function writes the elements of the vector v line-by-line to the stream stream using the format specifier format, which should be one of the %g, %e or %f formats for floating point numbers and %d for integers. The function returns 0 for success and GSL_EFAILED if there was a problem writing to the file. + int fprintf (FILE * stream, const char * format) const {return gsl_vector_float_fprintf (stream, gsldata,format) ;} + +// This function reads formatted data from the stream stream into the vector v. The vector v must be preallocated with the correct length since the function uses the size of v to determine how many numbers to read. The function returns 0 for success and GSL_EFAILED if there was a problem reading from the file. + int fscanf (FILE * stream) {return gsl_vector_float_fscanf (stream, gsldata); } + + + + +// ******* Vector views + +// In addition to creating vectors from slices of blocks it is also possible to slice vectors and create vector views. For example, a subvector of another vector can be described with a view, or two views can be made which provide access to the even and odd elements of a vector. + +// A vector view is a temporary object, stored on the stack, which can be used to operate on a subset of vector elements. Vector views can be defined for both constant and non-constant vectors, using separate types that preserve constness. A vector view has the type gsl_vector_float_view and a constant vector view has the type gsl_vector_float_const_view. In both cases the elements of the view can be accessed as a gsl_vector_float using the vector component of the view object. A pointer to a vector of type gsl_vector_float * or const gsl_vector_float * can be obtained by taking the address of this component with the & operator. + +// These functions return a vector view of a subvector of another vector v. The start of the new vector is offset by offset elements from the start of the original +// vector. The new vector has n elements. Mathematically, the i-th element of the new vector v' is given by, + +// v'(i) = v->data[(offset + i)*v->stride] + +// where the index i runs from 0 to n-1. + +// The data pointer of the returned vector struct is set to null if the combined parameters (offset,n) overrun the end of the original vector. + +// The new vector is only a view of the block underlying the original vector, v. The block containing the elements of v is not owned by the new vector. When the +// new vector goes out of scope the original vector v and its block will continue to exist. The original memory can only be deallocated by freeing the original vector. +// Of course, the original vector should not be deallocated while the new vector is still in use. + +// The function gsl_vector_float_const_subvector is equivalent to gsl_vector_float_subvector but can be used for vectors which are declared const. + vector_float_view subvector (size_t offset, size_t n); + const vector_float_view subvector (size_t offset, size_t n) const; +// vector_float_const_view subvector (size_t offset, size_t n) const; + +// class view +// { +// gsl_vector_float_view *gsldata; +// public: +// view(); +// }; +// view subvector(size_t offset, size_t n) +// { +// return view(gsl_vector_float_subvector(gsldata,offset,n); +// } +// const view subvector(size_t offset, size_t n) const +// { +// return view(gsl_vector_float_const_subvector(gsldata,offset,n); +// } + + + +// Function: gsl_vector_float gsl_vector_float_subvector_with_stride (gsl_vector_float *v, size_t offset, size_t stride, size_t n) +// Function: gsl_vector_float_const_view gsl_vector_float_const_subvector_with_stride (const gsl_vector_float * v, size_t offset, size_t stride, size_t n) +// These functions return a vector view of a subvector of another vector v with an additional stride argument. The subvector is formed in the same way as for +// gsl_vector_float_subvector but the new vector has n elements with a step-size of stride from one element to the next in the original vector. Mathematically, +// the i-th element of the new vector v' is given by, + +// v'(i) = v->data[(offset + i*stride)*v->stride] + +// where the index i runs from 0 to n-1. + +// Note that subvector views give direct access to the underlying elements of the original vector. For example, the following code will zero the even elements of the +// vector v of length n, while leaving the odd elements untouched, + +// gsl_vector_float_view v_even = gsl_vector_float_subvector_with_stride (v, 0, 2, n/2); +// gsl_vector_float_set_zero (&v_even.vector); + +// A vector view can be passed to any subroutine which takes a vector argument just as a directly allocated vector would be, using &view.vector. For example, the +// following code computes the norm of odd elements of v using the BLAS routine DNRM2, + +// gsl_vector_float_view v_odd = gsl_vector_float_subvector_with_stride (v, 1, 2, n/2); +// double r = gsl_blas_dnrm2 (&v_odd.vector); + +// The function gsl_vector_float_const_subvector_with_stride is equivalent to gsl_vector_float_subvector_with_stride but can be used for +// vectors which are declared const. + +// Function: gsl_vector_float_view gsl_vector_float_complex_real (gsl_vector_float_complex *v) +// Function: gsl_vector_float_const_view gsl_vector_float_complex_const_real (const gsl_vector_float_complex *v) +// These functions return a vector view of the real parts of the complex vector v. + +// The function gsl_vector_float_complex_const_real is equivalent to gsl_vector_float_complex_real but can be used for vectors which are declared +// const. + +// Function: gsl_vector_float_view gsl_vector_float_complex_imag (gsl_vector_float_complex *v) +// Function: gsl_vector_float_const_view gsl_vector_float_complex_const_imag (const gsl_vector_float_complex *v) +// These functions return a vector view of the imaginary parts of the complex vector v. + +// The function gsl_vector_float_complex_const_imag is equivalent to gsl_vector_float_complex_imag but can be used for vectors which are declared +// const. + +// Function: gsl_vector_float_view gsl_vector_float_view_array (double *base, size_t n) +// Function: gsl_vector_float_const_view gsl_vector_float_const_view_array (const double *base, size_t n) +// These functions return a vector view of an array. The start of the new vector is given by base and has n elements. Mathematically, the i-th element of the new +// vector v' is given by, + +// v'(i) = base[i] + +// where the index i runs from 0 to n-1. + +// The array containing the elements of v is not owned by the new vector view. When the view goes out of scope the original array will continue to exist. The +// original memory can only be deallocated by freeing the original pointer base. Of course, the original array should not be deallocated while the view is still in use. + +// The function gsl_vector_float_const_view_array is equivalent to gsl_vector_float_view_array but can be used for vectors which are declared const. + +// Function: gsl_vector_float_view gsl_vector_float_view_array_with_stride (double * base, size_t stride, size_t n) +// Function: gsl_vector_float_const_view gsl_vector_float_const_view_array_with_stride (const double * base, size_t stride, size_t n) +// These functions return a vector view of an array base with an additional stride argument. The subvector is formed in the same way as for +// gsl_vector_float_view_array but the new vector has n elements with a step-size of stride from one element to the next in the original array. Mathematically, +// the i-th element of the new vector v' is given by, + +// v'(i) = base[i*stride] + +// where the index i runs from 0 to n-1. + +// Note that the view gives direct access to the underlying elements of the original array. A vector view can be passed to any subroutine which takes a vector +// argument just as a directly allocated vector would be, using &view.vector. + +// The function gsl_vector_float_const_view_array_with_stride is equivalent to gsl_vector_float_view_array_with_stride but can be used for +// arrays which are declared const. + + +// ************* Copying vectors + +// Common operations on vectors such as addition and multiplication are available in the BLAS part of the library (see section BLAS Support). However, it is useful to have a small number of utility functions which do not require the full BLAS code. The following functions fall into this category. + +// This function copies the elements of the vector src into the vector dest. + vector_float& operator=(const vector_float& other){copy(other);return (*this);} + +// Function: int gsl_vector_float_swap (gsl_vector_float * v, gsl_vector_float * w) +// This function exchanges the elements of the vectors v and w by copying. The two vectors must have the same length. + +// ***** Exchanging elements + +// The following function can be used to exchange, or permute, the elements of a vector. + +// Function: int gsl_vector_float_swap_elements (gsl_vector_float * v, size_t i, size_t j) +// This function exchanges the i-th and j-th elements of the vector v in-place. + int swap_elements (size_t i, size_t j) {return gsl_vector_float_swap_elements (gsldata, i,j);} + +// Function: int gsl_vector_float_reverse (gsl_vector_float * v) +// This function reverses the order of the elements of the vector v. + int reverse () {return gsl_vector_float_reverse (gsldata) ;} + +// ******* Vector operations + +// The following operations are only defined for real vectors. + +// This function adds the elements of vector b to the elements of vector a, a'_i = a_i + b_i. The two vectors must have the same length. + int operator+=(const vector_float &other) {return gsl_vector_float_add (gsldata, other.gsldata);} + +// This function subtracts the elements of vector b from the elements of vector a, a'_i = a_i - b_i. The two vectors must have the same length. + int operator-=(const vector_float &other) {return gsl_vector_float_sub (gsldata, other.gsldata);} + +// Function: int gsl_vector_float_mul (gsl_vector_float * a, const gsl_vector_float * b) +// This function multiplies the elements of vector a by the elements of vector b, a'_i = a_i * b_i. The two vectors must have the same length. + int operator*=(const vector_float &other) {return gsl_vector_float_mul (gsldata, other.gsldata);} + +// This function divides the elements of vector a by the elements of vector b, a'_i = a_i / b_i. The two vectors must have the same length. + int operator/=(const vector_float &other) {return gsl_vector_float_div (gsldata, other.gsldata);} + +// This function multiplies the elements of vector a by the constant factor x, a'_i = x a_i. + int operator*=(float x) {return gsl_vector_float_scale (gsldata, x);} + +// Function: int gsl_vector_float_add_constant (gsl_vector_float * a, const double x) +// This function adds the constant value x to the elements of the vector a, a'_i = a_i + x. + int operator+=(float x) {return gsl_vector_float_add_constant (gsldata,x);} + +// This function multiplies the elements of vector a by the constant factor x, a'_i = x a_i. + int operator/=(float x) {return gsl_vector_float_scale (gsldata, 1/x);} + +// bool operators: + bool operator==(const vector_float& other) const; + bool operator!=(const vector_float& other) const { return (!((*this)==other));} + +// stream output: +// friend ostream& operator<< ( ostream& os, const vector_float& vect ); + /** returns sum of all the vector elements. */ + float sum() const; + // returns sqrt(v.t*v); + double norm2() const; + + +// **** Finding maximum and minimum elements of vectors + +// This function returns the maximum value in the vector v. + double max() const{return gsl_vector_float_max (gsldata) ;} + +// Function: double gsl_vector_float_min (const gsl_vector_float * v) +// This function returns the minimum value in the vector v. + double min() const{return gsl_vector_float_min (gsldata) ;} + +// Function: void gsl_vector_float_minmax (const gsl_vector_float * v, double * min_out, double * max_out) +// This function returns the minimum and maximum values in the vector v, storing them in min_out and max_out. + +// This function returns the index of the maximum value in the vector v. When there are several equal maximum elements then the lowest index is returned. + size_t max_index(){return gsl_vector_float_max_index (gsldata);} + +// Function: size_t gsl_vector_float_min_index (const gsl_vector_float * v) +// This function returns the index of the minimum value in the vector v. When there are several equal minimum elements then the lowest index is returned. + size_t min_index(){return gsl_vector_float_min_index (gsldata);} + +// Function: void gsl_vector_float_minmax_index (const gsl_vector_float * v, size_t * imin, size_t * imax) +// This function returns the indices of the minimum and maximum values in the vector v, storing them in imin and imax. When there are several equal minimum +// or maximum elements then the lowest indices are returned. + +// Vector properties + +// Function: int gsl_vector_float_isnull (const gsl_vector_float * v) +// This function returns 1 if all the elements of the vector v are zero, and 0 otherwise. }; + bool isnull(){return gsl_vector_float_isnull (gsldata);} +}; + +// When you add create a view it will stick to its with the view until you call change_view +// ex: +// matrix_float m(5,5); +// vector_float v(5); +// // ... +// m.column(3) = v; //the 3rd column of the matrix m will equal v. +class vector_float_view : public vector_float +{ + public: + vector_float_view(const vector_float& other) :vector_float(){init(other);} + vector_float_view(const vector_float_view& other):vector_float(){init(other);} + vector_float_view(const gsl_vector_float& gsl_other) : vector_float() {init_with_gsl_vector(gsl_other);} + + void init(const vector_float& other); + void init_with_gsl_vector(const gsl_vector_float& gsl_other); + void change_view(const vector_float& other){init(other);} + private: +}; + +ostream& operator<< ( ostream& os, const vector_float & vect ); + + +// vector_type<>::type is a template interface to vector_? +// it is usefull for in templated situations for getting the correct vector type +#define tmp_type_is_float +#ifdef tmp_type_is +typedef vector vector_double; +template<class T> +struct vector_type {typedef vector_double type;}; + +template<class T> +struct value_type {typedef double type;}; + +#else +template<> struct vector_type<float> {typedef vector_float type;}; +#endif +#undef tmp_type_is_float + +} +#endif// _vector_float_h diff --git a/dtm_release/gslwrap/include/gslwrap/vector_int.h b/dtm_release/gslwrap/include/gslwrap/vector_int.h new file mode 100644 index 0000000000000000000000000000000000000000..044fcfd46ae4b1830fc3fb1d4560f813e8af6bde --- /dev/null +++ b/dtm_release/gslwrap/include/gslwrap/vector_int.h @@ -0,0 +1,401 @@ +// This matrix class is a C++ wrapper for the GNU Scientific Library +// Copyright (C) ULP-IPB Strasbourg + +// 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 2 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, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +#ifndef _vector_int_h +#define _vector_int_h + +#ifdef __HP_aCC +#include <iostream.h> +#else +#include <iostream> +#endif + +#include <gsl/gsl_math.h> +#include <gsl/gsl_vector_int.h> +#include <gsl/gsl_blas.h> +#include <gslwrap/vector_double.h> + +//#define NDEBUG 0 + +#include <assert.h> +namespace gsl +{ + +#ifndef __HP_aCC + using std::ostream; +//using std::string; +//using std::runtime_error; +#endif + +class vector_int_view; + +class vector_int +{ +protected: + gsl_vector_int *gsldata; + void free(){if(gsldata) gsl_vector_int_free(gsldata);gsldata=NULL;} + void alloc(size_t n) {gsldata=gsl_vector_int_alloc(n);} + void calloc(size_t n){gsldata=gsl_vector_int_calloc(n);} +public: + typedef int value_type; + vector_int() : gsldata(NULL) {;} + vector_int( const vector_int &other ):gsldata(NULL) {copy(other);} + template<class oclass> + vector_int( const oclass &other ):gsldata(NULL) {copy(other);} + ~vector_int(){free();} + vector_int(const size_t& n,bool clear=true) + { + if(clear){this->calloc(n);} + else {this->alloc(n);} + } + vector_int(const int& n,bool clear=true) + { + if(clear){this->calloc(n);} + else {this->alloc(n);} + } + + void resize(size_t n); + + template <class oclass> + void copy(const oclass &other) + { + if ( static_cast<const void *>( this ) == static_cast<const void *>( &other ) ) + return; + + if (!other.is_set()) + { + gsldata=NULL; + return; + } + resize(other.size()); + for (size_t i=0;i<size();i++) + { + gsl_vector_int_set(gsldata, i, (int)other[i]); + } + } + void copy(const vector_int& other); + bool is_set() const{if (gsldata) return true; else return false;} +// void clone(vector_int& other); + +// size_t size() const {if (!gsldata) {cout << "vector_int::size vector not initialized" << endl; exit(-1);}return gsldata->size;} + size_t size() const {assert (gsldata); return gsldata->size;} + + /** for interfacing with gsl c */ +/* gsl_vector_int *gslobj() {if (!gsldata){cout << "vector_int::gslobj ERROR, data not initialized!! " << endl; exit(-1);}return gsldata;} */ +/* const gsl_vector_int *gslobj() const {if (!gsldata){cout << "vector_int::gslobj ERROR, data not initialized!! " << endl; exit(-1);}return gsldata;} */ + gsl_vector_int *gslobj() {assert(gsldata);return gsldata;} + const gsl_vector_int *gslobj() const {assert(gsldata);return gsldata;} + + + static vector_int_view create_vector_view( const gsl_vector_int_view &other ); + +// ********Accessing vector elements + +// Unlike FORTRAN compilers, C compilers do not usually provide support for range checking of vectors and matrices (2). However, the functions gsl_vector_int_get and gsl_vector_int_set can perform range checking for you and report an error if you attempt to access elements outside the allowed range. + +// The functions for accessing the elements of a vector or matrix are defined in `gsl_vector_int.h' and declared extern inline to eliminate function-call overhead. If necessary you can turn off range checking completely without modifying any source files by recompiling your program with the preprocessor definition GSL_RANGE_CHECK_OFF. Provided your compiler supports inline functions the effect of turning off range checking is to replace calls to gsl_vector_int_get(v,i) by v->data[i*v->stride] and and calls to gsl_vector_int_set(v,i,x) by v->data[i*v->stride]=x. Thus there should be no performance penalty for using the range checking functions when range checking is turned off. + +// This function returns the i-th element of a vector v. If i lies outside the allowed range of 0 to n-1 then the error handler is invoked and 0 is returned. + int get(size_t i) const {return gsl_vector_int_get(gsldata,i);} + +// This function sets the value of the i-th element of a vector v to x. If i lies outside the allowed range of 0 to n-1 then the error handler is invoked. + void set(size_t i,int x){gsl_vector_int_set(gsldata,i,x);} + +// These functions return a pointer to the i-th element of a vector v. If i lies outside the allowed range of 0 to n-1 then the error handler is invoked + int &operator[](size_t i) { return *gsl_vector_int_ptr(gsldata,i);} + const int &operator[](size_t i) const { return *gsl_vector_int_ptr(gsldata,i);} + + int &operator()(size_t i) { return *gsl_vector_int_ptr(gsldata,i);} + const int &operator()(size_t i) const { return *gsl_vector_int_ptr(gsldata,i);} + + +// ***** Initializing vector elements + +// This function sets all the elements of the vector v to the value x. + void set_all(int x){gsl_vector_int_set_all (gsldata,x);} +// This function sets all the elements of the vector v to zero. + void set_zero(){gsl_vector_int_set_zero (gsldata);} + +// This function makes a basis vector by setting all the elements of the vector v to zero except for the i-th element which is set to one. + int set_basis (size_t i) {return gsl_vector_int_set_basis (gsldata,i);} + +// **** Reading and writing vectors + +// The library provides functions for reading and writing vectors to a file as binary data or formatted text. + + +// This function writes the elements of the vector v to the stream stream in binary format. The return value is 0 for success and GSL_EFAILED if there was a problem writing to the file. Since the data is written in the native binary format it may not be portable between different architectures. + int fwrite (FILE * stream) const {return gsl_vector_int_fwrite (stream, gsldata);} + +// This function reads into the vector v from the open stream stream in binary format. The vector v must be preallocated with the correct length since the function uses the size of v to determine how many bytes to read. The return value is 0 for success and GSL_EFAILED if there was a problem reading from the file. The data is assumed to have been written in the native binary format on the same architecture. + int fread (FILE * stream) {return gsl_vector_int_fread (stream, gsldata);} + + void load( const char *filename ); + /// + void save( const char *filename ) const; + +// This function writes the elements of the vector v line-by-line to the stream stream using the format specifier format, which should be one of the %g, %e or %f formats for floating point numbers and %d for integers. The function returns 0 for success and GSL_EFAILED if there was a problem writing to the file. + int fprintf (FILE * stream, const char * format) const {return gsl_vector_int_fprintf (stream, gsldata,format) ;} + +// This function reads formatted data from the stream stream into the vector v. The vector v must be preallocated with the correct length since the function uses the size of v to determine how many numbers to read. The function returns 0 for success and GSL_EFAILED if there was a problem reading from the file. + int fscanf (FILE * stream) {return gsl_vector_int_fscanf (stream, gsldata); } + + + + +// ******* Vector views + +// In addition to creating vectors from slices of blocks it is also possible to slice vectors and create vector views. For example, a subvector of another vector can be described with a view, or two views can be made which provide access to the even and odd elements of a vector. + +// A vector view is a temporary object, stored on the stack, which can be used to operate on a subset of vector elements. Vector views can be defined for both constant and non-constant vectors, using separate types that preserve constness. A vector view has the type gsl_vector_int_view and a constant vector view has the type gsl_vector_int_const_view. In both cases the elements of the view can be accessed as a gsl_vector_int using the vector component of the view object. A pointer to a vector of type gsl_vector_int * or const gsl_vector_int * can be obtained by taking the address of this component with the & operator. + +// These functions return a vector view of a subvector of another vector v. The start of the new vector is offset by offset elements from the start of the original +// vector. The new vector has n elements. Mathematically, the i-th element of the new vector v' is given by, + +// v'(i) = v->data[(offset + i)*v->stride] + +// where the index i runs from 0 to n-1. + +// The data pointer of the returned vector struct is set to null if the combined parameters (offset,n) overrun the end of the original vector. + +// The new vector is only a view of the block underlying the original vector, v. The block containing the elements of v is not owned by the new vector. When the +// new vector goes out of scope the original vector v and its block will continue to exist. The original memory can only be deallocated by freeing the original vector. +// Of course, the original vector should not be deallocated while the new vector is still in use. + +// The function gsl_vector_int_const_subvector is equivalent to gsl_vector_int_subvector but can be used for vectors which are declared const. + vector_int_view subvector (size_t offset, size_t n); + const vector_int_view subvector (size_t offset, size_t n) const; +// vector_int_const_view subvector (size_t offset, size_t n) const; + +// class view +// { +// gsl_vector_int_view *gsldata; +// public: +// view(); +// }; +// view subvector(size_t offset, size_t n) +// { +// return view(gsl_vector_int_subvector(gsldata,offset,n); +// } +// const view subvector(size_t offset, size_t n) const +// { +// return view(gsl_vector_int_const_subvector(gsldata,offset,n); +// } + + + +// Function: gsl_vector_int gsl_vector_int_subvector_with_stride (gsl_vector_int *v, size_t offset, size_t stride, size_t n) +// Function: gsl_vector_int_const_view gsl_vector_int_const_subvector_with_stride (const gsl_vector_int * v, size_t offset, size_t stride, size_t n) +// These functions return a vector view of a subvector of another vector v with an additional stride argument. The subvector is formed in the same way as for +// gsl_vector_int_subvector but the new vector has n elements with a step-size of stride from one element to the next in the original vector. Mathematically, +// the i-th element of the new vector v' is given by, + +// v'(i) = v->data[(offset + i*stride)*v->stride] + +// where the index i runs from 0 to n-1. + +// Note that subvector views give direct access to the underlying elements of the original vector. For example, the following code will zero the even elements of the +// vector v of length n, while leaving the odd elements untouched, + +// gsl_vector_int_view v_even = gsl_vector_int_subvector_with_stride (v, 0, 2, n/2); +// gsl_vector_int_set_zero (&v_even.vector); + +// A vector view can be passed to any subroutine which takes a vector argument just as a directly allocated vector would be, using &view.vector. For example, the +// following code computes the norm of odd elements of v using the BLAS routine DNRM2, + +// gsl_vector_int_view v_odd = gsl_vector_int_subvector_with_stride (v, 1, 2, n/2); +// double r = gsl_blas_dnrm2 (&v_odd.vector); + +// The function gsl_vector_int_const_subvector_with_stride is equivalent to gsl_vector_int_subvector_with_stride but can be used for +// vectors which are declared const. + +// Function: gsl_vector_int_view gsl_vector_int_complex_real (gsl_vector_int_complex *v) +// Function: gsl_vector_int_const_view gsl_vector_int_complex_const_real (const gsl_vector_int_complex *v) +// These functions return a vector view of the real parts of the complex vector v. + +// The function gsl_vector_int_complex_const_real is equivalent to gsl_vector_int_complex_real but can be used for vectors which are declared +// const. + +// Function: gsl_vector_int_view gsl_vector_int_complex_imag (gsl_vector_int_complex *v) +// Function: gsl_vector_int_const_view gsl_vector_int_complex_const_imag (const gsl_vector_int_complex *v) +// These functions return a vector view of the imaginary parts of the complex vector v. + +// The function gsl_vector_int_complex_const_imag is equivalent to gsl_vector_int_complex_imag but can be used for vectors which are declared +// const. + +// Function: gsl_vector_int_view gsl_vector_int_view_array (double *base, size_t n) +// Function: gsl_vector_int_const_view gsl_vector_int_const_view_array (const double *base, size_t n) +// These functions return a vector view of an array. The start of the new vector is given by base and has n elements. Mathematically, the i-th element of the new +// vector v' is given by, + +// v'(i) = base[i] + +// where the index i runs from 0 to n-1. + +// The array containing the elements of v is not owned by the new vector view. When the view goes out of scope the original array will continue to exist. The +// original memory can only be deallocated by freeing the original pointer base. Of course, the original array should not be deallocated while the view is still in use. + +// The function gsl_vector_int_const_view_array is equivalent to gsl_vector_int_view_array but can be used for vectors which are declared const. + +// Function: gsl_vector_int_view gsl_vector_int_view_array_with_stride (double * base, size_t stride, size_t n) +// Function: gsl_vector_int_const_view gsl_vector_int_const_view_array_with_stride (const double * base, size_t stride, size_t n) +// These functions return a vector view of an array base with an additional stride argument. The subvector is formed in the same way as for +// gsl_vector_int_view_array but the new vector has n elements with a step-size of stride from one element to the next in the original array. Mathematically, +// the i-th element of the new vector v' is given by, + +// v'(i) = base[i*stride] + +// where the index i runs from 0 to n-1. + +// Note that the view gives direct access to the underlying elements of the original array. A vector view can be passed to any subroutine which takes a vector +// argument just as a directly allocated vector would be, using &view.vector. + +// The function gsl_vector_int_const_view_array_with_stride is equivalent to gsl_vector_int_view_array_with_stride but can be used for +// arrays which are declared const. + + +// ************* Copying vectors + +// Common operations on vectors such as addition and multiplication are available in the BLAS part of the library (see section BLAS Support). However, it is useful to have a small number of utility functions which do not require the full BLAS code. The following functions fall into this category. + +// This function copies the elements of the vector src into the vector dest. + vector_int& operator=(const vector_int& other){copy(other);return (*this);} + +// Function: int gsl_vector_int_swap (gsl_vector_int * v, gsl_vector_int * w) +// This function exchanges the elements of the vectors v and w by copying. The two vectors must have the same length. + +// ***** Exchanging elements + +// The following function can be used to exchange, or permute, the elements of a vector. + +// Function: int gsl_vector_int_swap_elements (gsl_vector_int * v, size_t i, size_t j) +// This function exchanges the i-th and j-th elements of the vector v in-place. + int swap_elements (size_t i, size_t j) {return gsl_vector_int_swap_elements (gsldata, i,j);} + +// Function: int gsl_vector_int_reverse (gsl_vector_int * v) +// This function reverses the order of the elements of the vector v. + int reverse () {return gsl_vector_int_reverse (gsldata) ;} + +// ******* Vector operations + +// The following operations are only defined for real vectors. + +// This function adds the elements of vector b to the elements of vector a, a'_i = a_i + b_i. The two vectors must have the same length. + int operator+=(const vector_int &other) {return gsl_vector_int_add (gsldata, other.gsldata);} + +// This function subtracts the elements of vector b from the elements of vector a, a'_i = a_i - b_i. The two vectors must have the same length. + int operator-=(const vector_int &other) {return gsl_vector_int_sub (gsldata, other.gsldata);} + +// Function: int gsl_vector_int_mul (gsl_vector_int * a, const gsl_vector_int * b) +// This function multiplies the elements of vector a by the elements of vector b, a'_i = a_i * b_i. The two vectors must have the same length. + int operator*=(const vector_int &other) {return gsl_vector_int_mul (gsldata, other.gsldata);} + +// This function divides the elements of vector a by the elements of vector b, a'_i = a_i / b_i. The two vectors must have the same length. + int operator/=(const vector_int &other) {return gsl_vector_int_div (gsldata, other.gsldata);} + +// This function multiplies the elements of vector a by the constant factor x, a'_i = x a_i. + int operator*=(int x) {return gsl_vector_int_scale (gsldata, x);} + +// Function: int gsl_vector_int_add_constant (gsl_vector_int * a, const double x) +// This function adds the constant value x to the elements of the vector a, a'_i = a_i + x. + int operator+=(int x) {return gsl_vector_int_add_constant (gsldata,x);} + +// This function multiplies the elements of vector a by the constant factor x, a'_i = x a_i. + int operator/=(int x) {return gsl_vector_int_scale (gsldata, 1/x);} + +// bool operators: + bool operator==(const vector_int& other) const; + bool operator!=(const vector_int& other) const { return (!((*this)==other));} + +// stream output: +// friend ostream& operator<< ( ostream& os, const vector_int& vect ); + /** returns sum of all the vector elements. */ + int sum() const; + // returns sqrt(v.t*v); + double norm2() const; + + +// **** Finding maximum and minimum elements of vectors + +// This function returns the maximum value in the vector v. + double max() const{return gsl_vector_int_max (gsldata) ;} + +// Function: double gsl_vector_int_min (const gsl_vector_int * v) +// This function returns the minimum value in the vector v. + double min() const{return gsl_vector_int_min (gsldata) ;} + +// Function: void gsl_vector_int_minmax (const gsl_vector_int * v, double * min_out, double * max_out) +// This function returns the minimum and maximum values in the vector v, storing them in min_out and max_out. + +// This function returns the index of the maximum value in the vector v. When there are several equal maximum elements then the lowest index is returned. + size_t max_index(){return gsl_vector_int_max_index (gsldata);} + +// Function: size_t gsl_vector_int_min_index (const gsl_vector_int * v) +// This function returns the index of the minimum value in the vector v. When there are several equal minimum elements then the lowest index is returned. + size_t min_index(){return gsl_vector_int_min_index (gsldata);} + +// Function: void gsl_vector_int_minmax_index (const gsl_vector_int * v, size_t * imin, size_t * imax) +// This function returns the indices of the minimum and maximum values in the vector v, storing them in imin and imax. When there are several equal minimum +// or maximum elements then the lowest indices are returned. + +// Vector properties + +// Function: int gsl_vector_int_isnull (const gsl_vector_int * v) +// This function returns 1 if all the elements of the vector v are zero, and 0 otherwise. }; + bool isnull(){return gsl_vector_int_isnull (gsldata);} +}; + +// When you add create a view it will stick to its with the view until you call change_view +// ex: +// matrix_float m(5,5); +// vector_float v(5); +// // ... +// m.column(3) = v; //the 3rd column of the matrix m will equal v. +class vector_int_view : public vector_int +{ + public: + vector_int_view(const vector_int& other) :vector_int(){init(other);} + vector_int_view(const vector_int_view& other):vector_int(){init(other);} + vector_int_view(const gsl_vector_int& gsl_other) : vector_int() {init_with_gsl_vector(gsl_other);} + + void init(const vector_int& other); + void init_with_gsl_vector(const gsl_vector_int& gsl_other); + void change_view(const vector_int& other){init(other);} + private: +}; + +ostream& operator<< ( ostream& os, const vector_int & vect ); + + +// vector_type<>::type is a template interface to vector_? +// it is usefull for in templated situations for getting the correct vector type +#define tmp_type_is_int +#ifdef tmp_type_is +typedef vector vector_double; +template<class T> +struct vector_type {typedef vector_double type;}; + +template<class T> +struct value_type {typedef double type;}; + +#else +template<> struct vector_type<int> {typedef vector_int type;}; +#endif +#undef tmp_type_is_int + +} +#endif// _vector_int_h diff --git a/dtm_release/lib/math/gradient_projection.cpp b/dtm_release/lib/math/gradient_projection.cpp new file mode 100644 index 0000000000000000000000000000000000000000..762bdb117cd2119b9513e246f42c004ac2474be1 --- /dev/null +++ b/dtm_release/lib/math/gradient_projection.cpp @@ -0,0 +1,193 @@ + +#include "gradient_projection.h" + +namespace GradientProjection { + +void display(const gsl_vector* v, const char* name) { + std::cout << name << " = <"; + for(unsigned int i=0; i<v->size; i++) { + std::cout << gsl_vector_get(v, i); + if (i < v->size - 1) { + std::cout << ", "; + } + } + std::cout << "> (" << v->size << ")" << std::endl; +} + +void display(const gsl_matrix* m, const char* name) { + std::cout << name << "\t = |"; + for(unsigned int i=0; i<m->size1; i++) { + if(i!=0) { + std::cout << "\t |"; + } + for(unsigned int j=0; j<m->size2; j++) { + std::cout << gsl_matrix_get(m, i, j) << "\t"; + } + std::cout << "|" << std::endl; + } + std::cout << " SIZE: " << m->size1 << " x " << m->size2 << std::endl; +} + +void createProjection(const gsl::matrix& activeConstraints, + const gsl::vector& g, + const gsl::vector& grad, + gsl::matrix& projection, + gsl::vector& direction, + gsl::vector& correction) { + int n = activeConstraints.size1(); + int r = activeConstraints.size2(); + + correction.resize(n); + direction.resize(n); + + // This could be done with cholesky or QR decomposition, but I + // couldn't get it to work. Given that this happens infrequently + // and the matrices are not *that* big, it's not that bad + gsl::matrix S(r,r); + // S = N^T N + gsl_blas_dgemm(CblasTrans, CblasNoTrans, 1.0, + activeConstraints.gslobj(), activeConstraints.gslobj(), + 0.0, S.gslobj()); + // T = (N^{T} N) ^{-1} + gsl::matrix T = S.LU_invert(); + S.set_dimensions(n, r); + // S = -N(N^{T} N)^{-1} + gsl_blas_dgemm(CblasNoTrans, CblasNoTrans, -1.0, + activeConstraints.gslobj(), T.gslobj(), 0.0, S.gslobj()); + + // Set the correction + gsl_blas_dgemv(CblasNoTrans, 1.0, S.gslobj(), g.gslobj(), 0.0, + correction.gslobj()); + + // Set the direction + // P = -N(N^{T} N)^{-1}N + I + projection.identity(n); + gsl_blas_dgemm(CblasNoTrans, CblasTrans, 1.0, + S.gslobj(), activeConstraints.gslobj(), + 1.0, projection.gslobj()); + gsl_blas_dgemv(CblasNoTrans, -1.0, projection.gslobj(), grad.gslobj(), 0.0, + direction.gslobj()); +} + +bool createActiveConstraints(const gsl::vector& x, + gsl::matrix& n, + gsl::vector& g) { + bool sumConstraintViolated = false; + int dimension = x.size(); + double margin = SAFETY_BOX; + + if(x.sum() >= 1.0 - margin) { + sumConstraintViolated = true; + } + + int nonNegativeConstraintsViolated = 0; + for(int ii = 0; ii < dimension; ++ii) { + if (x[ii] <= margin) { + ++nonNegativeConstraintsViolated; + } + } + + int newSize = nonNegativeConstraintsViolated; + if(sumConstraintViolated) { + newSize += 1; + } + + if(newSize > 0) { + n.set_dimensions(dimension, newSize); + g.resize(newSize); + g.set_all(SAFETY_BOX); + int col = 0; + if(sumConstraintViolated) { + g[0] = -(1.0 - SAFETY_BOX); + for(int ii = 0; ii < dimension; ++ii) { + n(ii, 0) = -1.0; + } + ++col; + } + + for(int ii = 0; ii < dimension; ++ii) { + if(x[ii] <= margin) { + n(ii, col) = 1.0; + ++col; + } + } + assert(col == newSize); + + gsl_blas_dgemv(CblasTrans, 1.0, n.gslobj(), x.gslobj(), -1.0, g.gslobj()); + + //display(n.gslobj(), "N"); + //display(g.gslobj(), "g"); + + return true; + } else { + return false; + } +} + +double descend(gsl::vector& x, + gsl::vector& s, + const double gamma, + const double obj_value, + const gsl::vector& correction, + const gsl::vector& grad) { + double alpha = 0.0; + + gsl_blas_ddot(s.gslobj(), grad.gslobj(), &alpha); + //std::cout << "dot prod= " << alpha << " "; + if(alpha == 0) { + return alpha; + } + alpha = -(gamma * obj_value) / alpha; + //std::cout << " alpha= " << alpha << " "; + + s *= alpha; + s += correction; + x += s; + + //display(s.gslobj(), "final move"); + + if(alpha < 0) { + alpha = -alpha; + } + return alpha; +} + +double updateState(gsl::vector& x, + const double gamma, + const gsl::vector grad, + const double f) { + /* + * First we see if we're up against constraints + */ + int dim = x.size(); + gsl::matrix n; + gsl::vector g; + gsl::vector s; + gsl::vector correction(dim); + + if(createActiveConstraints(x, n, g)) { + s.resize(dim); + gsl::matrix p; + + createProjection(n, g, grad, p, s, correction); + //std::cout << "Constraints violated." << std::endl; + + //display(p.gslobj(), "p"); + //display(s.gslobj(), "s"); + //display(correction.gslobj(), "correction"); + return descend(x, s, gamma, f, correction, grad); + } else { + //std::cout << "No constraints violated." << std::endl; + s.copy(grad); + s *= -gamma * GRADIENT_DESCENT_SLOWDOWN; + x += s; + double diff; + gsl_blas_ddot(s.gslobj(), s.gslobj(), &diff); + return diff * gamma; + } + + +} + + +} diff --git a/dtm_release/lib/math/gradient_projection.h b/dtm_release/lib/math/gradient_projection.h new file mode 100644 index 0000000000000000000000000000000000000000..d61ce491d9d4f4564aadb5ecb9e2447de52f1972 --- /dev/null +++ b/dtm_release/lib/math/gradient_projection.h @@ -0,0 +1,47 @@ +#ifndef MATH_GRADIENTPROJECTION_INCLUDED +#define MATH_GRADIENTPROJECTION_INCLUDED + +#define SAFETY_BOX 0.001 +#define GRADIENT_DESCENT_SLOWDOWN 1.0 + +#include <iostream> + +#include "gslwrap/vector_double.h" +#include "gslwrap/matrix_double.h" + +namespace GradientProjection { +/* + * Returns true if the sum to less than one constraint is violated, + * fills in with the active constraint matrix. Caller is responsible + * for memory management of newly created matrix. + */ +bool createActiveConstraints(const gsl::vector& x, + gsl::matrix& n, + gsl::vector& g); + +void display(const gsl_vector* v, const char* name); + +void display(const gsl_matrix* m, const char* name); + +void createProjection(const gsl::matrix& activeConstraints, + const gsl::vector& g, + const gsl::vector& grad, + gsl::matrix& projection, + gsl::vector& direction, + gsl::vector& correction); + +double updateState(gsl::vector& x, + const double gamma, + const gsl::vector grad, + const double f); + +double descend(gsl::vector& x, + gsl::vector& s, + const double gamma, + const double obj_value, + const gsl::vector& correction, + const gsl::vector& grad); + +} + +#endif diff --git a/dtm_release/lib/math/gradient_projection_test.cpp b/dtm_release/lib/math/gradient_projection_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9e45a0f03ee8d9821d00ad455faebf93c6226036 --- /dev/null +++ b/dtm_release/lib/math/gradient_projection_test.cpp @@ -0,0 +1,107 @@ +#include <boost/test/included/unit_test_framework.hpp> +#include <boost/test/unit_test.hpp> +#include <boost/test/floating_point_comparison.hpp> +#include "gradient_projection.h" + +#define CLOSE_TOL 0.1 +#define LOOSE_TOL 10 + +using boost::unit_test_framework::test_suite; +using namespace GradientProjection; + +void test_projection() { + gsl::matrix n(4, 3); + gsl::matrix p(1, 1); + n(0, 0) = 2; n(0, 1) = 1; n(0, 2) = 0; + n(1, 0) = 1; n(1, 1) = 1; n(1, 2) = 0; + n(2, 0) = 1; n(2, 1) = 2; n(2, 2) = 0; + n(3, 0) = 4; n(3, 1) = 1; n(3, 2) = 1; + gsl::vector g(3); + g[0] = 0.0; g[1] = -0.1; g[2] = 0.0; + gsl::vector grad(4); + grad[0] = 2.0; grad[1] = 4.0; grad[2] = 2.0; grad[3] = -3.0; + gsl::vector direction; + gsl::vector correction; + + createProjection(n, g, grad, p, direction, correction); + BOOST_CHECK_CLOSE(p(0, 0), 1.0/11.0, LOOSE_TOL); + BOOST_CHECK_CLOSE(p(0, 1), -3.0/11.0, LOOSE_TOL); + BOOST_CHECK_CLOSE(p(0, 2), 1.0/11.0, LOOSE_TOL); + BOOST_CHECK(abs(p(0, 3)) < 1e-10); + BOOST_CHECK_CLOSE(p(1, 0), -3.0/11.0, LOOSE_TOL); + BOOST_CHECK_CLOSE(p(1, 1), 9.0/11.0, LOOSE_TOL); + BOOST_CHECK_CLOSE(p(1, 2), -3.0/11.0, LOOSE_TOL); + BOOST_CHECK(abs(p(1, 3)) < 1e-10); + BOOST_CHECK_CLOSE(p(2, 0), 1.0/11.0, LOOSE_TOL); + BOOST_CHECK_CLOSE(p(2, 1), -3.0/11.0, LOOSE_TOL); + BOOST_CHECK_CLOSE(p(2, 2), 1.0/11.0, LOOSE_TOL); + BOOST_CHECK(abs(p(2, 3)) < 1e-10); + BOOST_CHECK(abs(p(3, 0)) < 1e-10); + BOOST_CHECK(abs(p(3, 1)) < 1e-10); + BOOST_CHECK(abs(p(3, 2)) < 1e-10); + BOOST_CHECK(abs(p(3, 3)) < 1e-10); + + BOOST_CHECK_CLOSE(correction[0], -4.0/110.0, CLOSE_TOL); + BOOST_CHECK_CLOSE(correction[1], 1.0/110.0, CLOSE_TOL); + BOOST_CHECK_CLOSE(correction[2], 7.0/110.0, CLOSE_TOL); + BOOST_CHECK(abs(correction[3]) < 1e-10); + + BOOST_CHECK_CLOSE(direction[0], 8.0/11.0, CLOSE_TOL); + BOOST_CHECK_CLOSE(direction[1], -24.0/11.0, CLOSE_TOL); + BOOST_CHECK_CLOSE(direction[2], 8.0/11.0, CLOSE_TOL); + BOOST_CHECK(abs(direction[3]) < 1e-10); + + gsl::vector x(4); + x[0] = 2; x[1] = 2; x[2] = 1; x[3] = 0; + + descend(x, direction, 0.1, 5, correction, grad); + BOOST_CHECK_CLOSE(x[0], 2.026, CLOSE_TOL); + BOOST_CHECK_CLOSE(x[1], 1.822, CLOSE_TOL); + BOOST_CHECK_CLOSE(x[2], 1.126, CLOSE_TOL); + BOOST_CHECK(abs(x[3]) < 1e-10); +} + +void test_constraint_matrix() { + gsl::matrix n; + gsl::vector g; + gsl::vector x(3); + + + x[0] = 0.15; x[1] = 0.5; x[2] = 0.2; + + BOOST_CHECK_EQUAL(createActiveConstraints(x, n, g), false); + + x[0] = 0.0; + BOOST_CHECK_EQUAL(createActiveConstraints(x, n, g), true); + BOOST_CHECK_EQUAL(n.size1(), x.size()); + // Only one constraint is broken. + BOOST_CHECK_EQUAL(n.size2(), 1); + BOOST_CHECK_EQUAL(n(0, 0), 1); + BOOST_CHECK_EQUAL(n(1, 0), 0); + BOOST_CHECK_EQUAL(n(2, 0), 0); + BOOST_CHECK_EQUAL(g.size(), 1); + BOOST_CHECK_EQUAL(g[0], -SAFETY_BOX); + + x[2] = 0.6; + BOOST_CHECK_EQUAL(createActiveConstraints(x, n, g), true); + BOOST_CHECK_EQUAL(n.size1(), x.size()); + // Two constraints are broken. + BOOST_CHECK_EQUAL(n.size2(), 2); + BOOST_CHECK_EQUAL(n(0, 0), -1); + BOOST_CHECK_EQUAL(n(1, 0), -1); + BOOST_CHECK_EQUAL(n(2, 0), -1); + BOOST_CHECK_EQUAL(n(0, 1), 1); + BOOST_CHECK_EQUAL(n(1, 1), 0); + BOOST_CHECK_EQUAL(n(2, 1), 0); + BOOST_CHECK_EQUAL(g.size(), 2); + BOOST_CHECK_CLOSE(g[0], -0.2, CLOSE_TOL); + BOOST_CHECK_EQUAL(g[1], -SAFETY_BOX); + +} + +test_suite* init_unit_test_suite(int, char* []) { + test_suite* test= BOOST_TEST_SUITE( "Testing Gradient Projection" ); + test->add( BOOST_TEST_CASE( &test_constraint_matrix ), 0); + test->add( BOOST_TEST_CASE( &test_projection ), 0); + return test; +} diff --git a/dtm_release/lib/math/gsl_matrix.h b/dtm_release/lib/math/gsl_matrix.h new file mode 100644 index 0000000000000000000000000000000000000000..2563f949559df5dadaf678b171a9dd38ef0f485d --- /dev/null +++ b/dtm_release/lib/math/gsl_matrix.h @@ -0,0 +1,195 @@ +#ifndef __MATH_GSL_MATRIX__ +#define __MATH_GSL_MATRIX__ + +#include <gsl/gsl_vector.h> +#include <gsl/gsl_matrix.h> +#include <gsl/gsl_cblas.h> + +class GslMatrixItem { + public: + GslMatrixItem(gsl_matrix* ptr, size_t index1, size_t index2) : + ptr_(ptr), + index1_(index1), + index2_(index2) { } + + operator const double() { + return gsl_matrix_get(ptr_, index1_, index2_); + } + + double operator =(const double v) { + gsl_matrix_set(ptr_, index1_, index2_, v); + return v; + } + + double operator +=(const double v) { + double old_v = gsl_matrix_get(ptr_, index1_, index2_); + gsl_matrix_set(ptr_, index1_, index2_, v + old_v); + return v + old_v; + } + private: + gsl_matrix* ptr_; + size_t index1_; + size_t index2_; +}; + +class GslMatrixBase { + public: + GslMatrixBase& operator=(const double v) { + if (v == 0.0) { + SetZero(); + } else { + SetAll(v); + } + return *this; + } + + GslMatrixItem operator()(const size_t index1, const size_t index2) const { + assert(ptr_ != NULL); + return GslMatrixItem(ptr_, index1, index2); + } + + void SetZero() { + assert(ptr_ != NULL); + gsl_matrix_set_zero(ptr_); + } + + void SetAll(const double v) { + assert(ptr_ != NULL); + gsl_matrix_set_all(ptr_, v); + } + + void Reset(gsl_matrix* val) { + if(ptr_ != NULL) { + gsl_matrix_free(ptr_); + } + ptr_ = val; + } + + int Fprintf(FILE* stream, const char* format) const { + assert(ptr_ != NULL); + return gsl_matrix_fprintf(stream, ptr_, format); + } + + int Fscanf(FILE* stream) { + assert(ptr_ != NULL); + return gsl_matrix_fscanf(stream, ptr_); + } + + void Set(const int i, const int j, double val) { + gsl_matrix_set(ptr_, i, j, val); + } + + /* + double operator()(const int nCol, const int nRow) { + return gsl_matrix_get(ptr_, nCol, nRow); + } + */ + + int size1() const { + return ptr_->size1; + } + + int size2() const { + return ptr_->size2; + } + + double Trace() const { + double val = 0; + assert(ptr_ != NULL); + assert(ptr_->size1 == ptr_->size2); + for (size_t ii = 0; ii < ptr_->size1; ++ii) { + val += gsl_matrix_get(ptr_, ii, ii); + } + return val; + } + + double Sum() const { + double val = 0; + assert(ptr_ != NULL); + for (size_t ii = 0; ii < ptr_->size1; ++ii) { + for (size_t jj = 0; jj < ptr_->size2; ++jj) { + val += gsl_matrix_get(ptr_, ii, jj); + } + } + return val; + } + + /* + * Apply the transpose of this matrix to a vector x and store the result. + + int TransMul(const GslVector& x, GslVector& res, double scale = 0.0) { + return gsl_blas_dgemv(CblasTrans, 1.0, ptr_, x.ptr(), scale, res.ptr()); + } + + int Mul(const GslVector& x, GslVector& res, double scale = 0.0) { + return gsl_blas_dgemv(CblasNoTrans, 1.0, ptr_, x.ptr(), scale, res.ptr()); + } + */ + + const gsl_matrix* ptr() const { return ptr_; } + gsl_matrix* mutable_ptr() { return ptr_; } + + protected: + GslMatrixBase() : ptr_(NULL) { + } + gsl_matrix* ptr_; + + private: + GslMatrixBase(const GslMatrixBase&) { } +}; + +class GslMatrix : public GslMatrixBase { + public: + GslMatrix(const size_t size1, const size_t size2) : GslMatrixBase() { + Allocate(size1, size2); + } + + void Allocate(const size_t size1, const size_t size2) { + assert(ptr_ == NULL); + ptr_ = gsl_matrix_alloc(size1, size2); + } + + GslMatrix() : GslMatrixBase() { + } + + GslMatrix(gsl_matrix* val) : GslMatrixBase() { + ptr_ = val; + } + + ~GslMatrix() { + if(ptr_ != NULL) { + gsl_matrix_free(ptr_); + } + } + + GslMatrixBase& operator=(const double v) { + GslMatrixBase::operator=(v); + return *this; + } + private: + GslMatrix(const GslMatrix&) { } +}; + + +class GslSubmatrix : public GslMatrixBase { + public: + GslSubmatrix(GslMatrixBase& matrix, size_t k1, size_t k2, size_t n1, size_t n2) : + view_(gsl_matrix_submatrix(matrix.mutable_ptr(), k1, k2, n1, n2)) { + ptr_ = &view_.matrix; + } + + GslSubmatrix(gsl_matrix* matrix, size_t k1, size_t k2, size_t n1, size_t n2) : + view_(gsl_matrix_submatrix(matrix, k1, k2, n1, n2)) { + ptr_ = &view_.matrix; + } + + GslMatrixBase& operator=(const double v) { + GslMatrixBase::operator=(v); + return *this; + } + private: + gsl_matrix_view view_; + GslSubmatrix(const GslSubmatrix&) { } +}; + +#endif // __MATH_GSL_MATRIX__ diff --git a/dtm_release/lib/math/gsl_vector.h b/dtm_release/lib/math/gsl_vector.h new file mode 100644 index 0000000000000000000000000000000000000000..402343cde49f770c6e440778eea1b317bca4a4d7 --- /dev/null +++ b/dtm_release/lib/math/gsl_vector.h @@ -0,0 +1,375 @@ +#ifndef __MATH_GSL_VECTOR__ +#define __MATH_GSL_VECTOR__ + +#include <assert.h> + +#include <gsl/gsl_vector.h> +#include <gsl/gsl_cblas.h> + +#include <gsl/gsl_matrix.h> +#include "math/vectorops.h" + +class GslVectorItem { + public: + GslVectorItem(gsl_vector* ptr, size_t index) : + ptr_(ptr), + index_(index) { } + + operator const double() { + return gsl_vector_get(ptr_, index_); + } + + double operator =(const double v) { + gsl_vector_set(ptr_, index_, v); + return v; + } + + double operator +=(const double v) { + double oldv = gsl_vector_get(ptr_, index_); + gsl_vector_set(ptr_, index_, oldv + v); + return oldv + v; + } + + double operator -=(const double v) { + double oldv = gsl_vector_get(ptr_, index_); + gsl_vector_set(ptr_, index_, oldv - v); + return oldv - v; + } + private: + gsl_vector* ptr_; + size_t index_; +}; + +class GslVectorBase { + public: + /* + double operator[](const size_t index) const { + assert(ptr_ != NULL); + return gsl_vector_get(ptr_, index); + } + */ + + GslVectorItem operator[](const size_t index) const { + assert(ptr_ != NULL); + return GslVectorItem(ptr_, index); + } + + GslVectorBase& operator+=(const gsl_vector* x) { + assert(ptr_ != NULL); + gsl_vector_add(ptr_, x); + return *this; + } + + GslVectorBase& operator-=(const gsl_vector* x) { + assert(ptr_ != NULL); + gsl_vector_sub(ptr_, x); + return *this; + } + + GslVectorBase& operator+=(const GslVectorBase& x) { + assert(ptr_ != NULL); + gsl_vector_add(ptr_, x.ptr()); + return *this; + } + + GslVectorBase& operator-=(const GslVectorBase& x) { + assert(ptr_ != NULL); + gsl_vector_sub(ptr_, x.ptr()); + return *this; + } + + GslVectorBase& operator*=(const gsl_vector* x) { + assert(ptr_ != NULL); + gsl_vector_mul(ptr_, x); + return *this; + } + + GslVectorBase& operator*=(const GslVectorBase& x) { + assert(ptr_ != NULL); + gsl_vector_mul(ptr_, x.ptr()); + return *this; + } + + GslVectorBase& operator/=(const GslVectorBase& x) { + assert(ptr_ != NULL); + gsl_vector_div(ptr_, x.ptr()); + return *this; + } + + double Sum() const { + return gsl_blas_dsum(ptr_); + } + + double L2Norm() const { + return gsl_blas_dnrm2(ptr_); + } + + void Normalize() const { + assert(ptr_ != NULL); + double s = Sum(); + gsl_vector_scale(ptr_, 1. / s); + } + + size_t size() const { + return ptr_->size; + } + + GslVectorBase& operator*=(double v) { + assert(ptr_ != NULL); + gsl_vector_scale(ptr_, v); + return *this; + } + + GslVectorBase& operator/=(double v) { + assert(ptr_ != NULL); + gsl_vector_scale(ptr_, 1. / v); + return *this; + } + + // Note that the standalone product is a dot product! + const double operator*(const gsl_vector* x) const { + double result; + assert(ptr_ != NULL); + gsl_blas_ddot(ptr_, x, &result); + return result; + } + + const double operator*(const GslVectorBase& x) const { + double result; + assert(ptr_ != NULL); + gsl_blas_ddot(ptr_, x.ptr(), &result); + return result; + } + + GslVectorBase& operator+=(const double x) { + for (size_t ii = 0; ii < ptr_->size; ++ii) { + gsl_vector_set(ptr_, ii, gsl_vector_get(ptr_, ii) + x); + } + return *this; + } + + GslVectorBase& operator-=(const double x) { + for (size_t ii = 0; ii < ptr_->size; ++ii) { + gsl_vector_set(ptr_, ii, gsl_vector_get(ptr_, ii) - x); + } + return *this; + } + + GslVectorBase& operator=(const gsl_vector* x) { + assert(ptr_ != NULL); + gsl_vector_memcpy(ptr_, x); + + return *this; + } + + GslVectorBase& operator=(const GslVectorBase& x) { + assert(ptr_ != NULL); + return *this = x.ptr(); + } + + GslVectorBase& operator=(const double v) { + if (v == 0.0) { + SetZero(); + } else { + SetAll(v); + } + return *this; + } + + void SetZero() { + assert(ptr_ != NULL); + gsl_vector_set_zero(ptr_); + } + + void SetAll(const double v) { + assert(ptr_ != NULL); + gsl_vector_set_all(ptr_, v); + } + + int Fprintf(FILE* stream, const char* format) const { + assert(ptr_ != NULL); + return gsl_vector_fprintf(stream, ptr_, format); + } + + int Fscanf(FILE* stream) { + assert(ptr_ != NULL); + return gsl_vector_fscanf(stream, ptr_); + } + + const gsl_vector* ptr() const { return ptr_; } + gsl_vector* mutable_ptr() { return ptr_; } + + protected: + GslVectorBase() : ptr_(NULL) { } + gsl_vector* ptr_; + + private: + GslVectorBase(const GslVectorBase&) { } +}; + +class GslVector : public GslVectorBase { + public: + GslVector(const size_t size) : GslVectorBase() { + Allocate(size); + } + + GslVector() : GslVectorBase() { + } + + ~GslVector() { + if (ptr_ != NULL) { + gsl_vector_free(ptr_); + } + } + + void Reset(gsl_vector* val) { + if (ptr_ != NULL) { + gsl_vector_free(ptr_); + } + ptr_ = val; + } + + void Allocate(const size_t size) { + assert(ptr_ == NULL); + ptr_ = gsl_vector_alloc(size); + } + + GslVectorBase& operator=(const gsl_vector* x) { + GslVectorBase::operator=(x); + return *this; + } + + GslVectorBase& operator=(const GslVectorBase& x) { + GslVectorBase::operator=(x); + return *this; + } + + GslVectorBase& operator=(const double v) { + GslVectorBase::operator=(v); + return *this; + } + private: + GslVector(const GslVector&) { } +}; + +class GslMatrixRow : public GslVectorBase { + public: + GslMatrixRow(GslMatrix& matrix, const size_t row) : + view_(gsl_matrix_row(matrix.mutable_ptr(), row)) { + ptr_ = &view_.vector; + } + + GslMatrixRow(gsl_matrix* matrix, const size_t row) : + view_(gsl_matrix_row(matrix, row)) { + ptr_ = &view_.vector; + } + + GslVectorBase& operator=(const gsl_vector* x) { + GslVectorBase::operator=(x); + return *this; + } + + GslVectorBase& operator=(const GslVectorBase& x) { + GslVectorBase::operator=(x); + return *this; + } + + GslVectorBase& operator=(const double v) { + GslVectorBase::operator=(v); + return *this; + } + private: + gsl_vector_view view_; + GslMatrixRow(const GslMatrixRow&) { } +}; + +class GslMatrixColumn : public GslVectorBase { + public: + GslMatrixColumn(GslMatrix& matrix, const size_t col) : + view_(gsl_matrix_column(matrix.mutable_ptr(), col)) { + ptr_ = &view_.vector; + } + + GslMatrixColumn(gsl_matrix* matrix, const size_t col) : + view_(gsl_matrix_column(matrix, col)) { + ptr_ = &view_.vector; + } + + GslVectorBase& operator=(const gsl_vector* x) { + GslVectorBase::operator=(x); + return *this; + } + + GslVectorBase& operator=(const GslVectorBase& x) { + GslVectorBase::operator=(x); + return *this; + } + + GslVectorBase& operator=(const double v) { + GslVectorBase::operator=(v); + return *this; + } + private: + gsl_vector_view view_; + GslMatrixColumn(const GslMatrixColumn&) { } +}; + +class GslMatrixDiagonal : public GslVectorBase { + public: + GslMatrixDiagonal(GslMatrix& matrix) : + view_(gsl_matrix_diagonal(matrix.mutable_ptr())) { + ptr_ = &view_.vector; + } + + GslMatrixDiagonal(gsl_matrix* matrix) : + view_(gsl_matrix_diagonal(matrix)) { + ptr_ = &view_.vector; + } + + GslVectorBase& operator=(const gsl_vector* x) { + GslVectorBase::operator=(x); + return *this; + } + + GslVectorBase& operator=(const GslVectorBase& x) { + GslVectorBase::operator=(x); + return *this; + } + + GslVectorBase& operator=(const double v) { + GslVectorBase::operator=(v); + return *this; + } + private: + gsl_vector_view view_; + GslMatrixDiagonal(const GslMatrixDiagonal&) { } +}; + +class GslSubvector : public GslVectorBase { + public: + GslSubvector(GslVectorBase& vector, size_t i, size_t n) : + view_(gsl_vector_subvector(vector.mutable_ptr(), i, n)) { + ptr_ = &view_.vector; + } + + GslVectorBase& operator=(const gsl_vector* x) { + GslVectorBase::operator=(x); + return *this; + } + + GslVectorBase& operator=(const GslVectorBase& x) { + GslVectorBase::operator=(x); + return *this; + } + + GslVectorBase& operator=(const double v) { + GslVectorBase::operator=(v); + return *this; + } + private: + gsl_vector_view view_; + GslSubvector(const GslSubvector&) { } +}; + +#endif // __MATH_GSL_VECTOR__ + diff --git a/dtm_release/lib/math/logspace.cpp b/dtm_release/lib/math/logspace.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0724da36de11fc9bb63cb3e4129787f6a2d61d59 --- /dev/null +++ b/dtm_release/lib/math/logspace.cpp @@ -0,0 +1,105 @@ +#include "logspace.h" + +double log_dirichlet_likelihood(const double sum, + const double prior_sum, + const std::vector<int>& counts, + bool debug) { + double val = 0.0; + int length = counts.size(); + + double prior_value = prior_sum / (double)length; + val += gsl_sf_lngamma(prior_sum); + val -= (double)length * gsl_sf_lngamma(prior_value); + + if(debug) cout << "Likelihood (" << sum << "," << prior_sum << "," << + prior_value << "," << length << ") = " << val << endl; + + for(int ii = 0; ii < length; ++ii) { + + if(debug) cout << "\tGAMMA(" << prior_value << " + " << + (double)counts[ii] << " = " << prior_value + + (double)counts[ii] << ") -> " << val << endl; + val += gsl_sf_lngamma(prior_value + (double)counts[ii]); + } + val -= gsl_sf_lngamma(prior_sum + sum); + + if(debug) cout << endl; + + return val; +} + +double log_dirichlet_likelihood(const double sum, + const double prior_scale, + const gsl_vector* prior, + const std::vector<int>& counts) { + double val = 0.0; + int length = counts.size(); + + val += gsl_sf_lngamma(prior_scale); + for(int ii=0; ii < length; ++ii) { + double prior_value = gsl_vector_get(prior, ii); + val -= gsl_sf_lngamma(prior_value); + val += gsl_sf_lngamma(prior_value + (double)counts[ii]); + } + val -= gsl_sf_lngamma(prior_scale + sum); + + return val; + +} + +double log_dot_product(const gsl_vector* log_a, const gsl_vector* log_b) { + double sum = gsl_vector_get(log_a, 0) + gsl_vector_get(log_b, 0); + assert(log_a->size == log_b->size); + for (unsigned int ii = 1; ii < log_a->size; ++ii) { + sum = log_sum(sum, gsl_vector_get(log_a, ii) + + gsl_vector_get(log_b, ii)); + } + return sum; +} + +double log_sum(const gsl_vector* x) { + double sum = gsl_vector_get(x, 0); + + for (unsigned int ii = 1; ii < x->size; ii++) { + sum = log_sum(sum, gsl_vector_get(x, ii)); + } + return sum; +} + +// Given a log vector, log a_i, compute log sum a_i. Returns the sum. +double log_normalize(gsl_vector* x) { + double sum = gsl_vector_get(x, 0); + unsigned int i; + + for (i = 1; i < x->size; i++) { + sum = log_sum(sum, gsl_vector_get(x, i)); + } + + for (i = 0; i < x->size; i++) { + double val = gsl_vector_get(x, i); + gsl_vector_set(x, i, val - sum); + } + return sum; +} + +// Given a log matrix, log a_i, compute log sum a_i. Returns the sum. +double log_normalize_matrix(gsl_matrix* x) { + double sum = gsl_matrix_get(x, 0, 0); + + for (size_t ii = 0; ii < x->size1; ++ii) { + for (size_t jj = 0; jj < x->size2; ++jj) { + if (ii == 0 && jj == 0) { + continue; + } + sum = log_sum(sum, gsl_matrix_get(x, ii, jj)); + } + } + + for (size_t ii = 0; ii < x->size1; ++ii) { + for (size_t jj = 0; jj < x->size2; ++jj) { + double val = gsl_matrix_get(x, ii, jj); + gsl_matrix_set(x, ii, jj, val - sum); + } + } + return sum; +} diff --git a/dtm_release/lib/math/logspace.h b/dtm_release/lib/math/logspace.h new file mode 100644 index 0000000000000000000000000000000000000000..4d6589b54d39d7403a6c094b31d7953624c993f4 --- /dev/null +++ b/dtm_release/lib/math/logspace.h @@ -0,0 +1,34 @@ +#ifndef __MATH_LOGSPACE_H__ +#define __MATH_LOGSPACE_H__ +#include <cmath> +#include <vector> +#include <gsl/gsl_vector.h> +#include <gsl/gsl_matrix.h> +#include <gsl/gsl_sf_gamma.h> +#include "logspace_base.h" +#include "specialfunc.h" + +// Given two log vectors, log a_i and log b_i, compute +// log sum (a_i * b_i). +double log_dot_product(const gsl_vector* log_a, const gsl_vector* log_b); + +// Given a log vector, log a_i, compute log sum a_i. Returns the sum. +double log_normalize(gsl_vector* x); + +// Compute the log sum over all elements in the vector +double log_sum(const gsl_vector* x); + +// Given a log matrix, log a_i, compute log sum a_i. Returns the sum. +double log_normalize_matrix(gsl_matrix* x); + +double log_dirichlet_likelihood(const double sum, + const double prior_sum, + const std::vector<int>& counts, + bool debug = false); + +double log_dirichlet_likelihood(const double sum, + const double prior_scale, + const gsl_vector* prior, + const std::vector<int>& counts); + +#endif // __MATH_LOGSPACE_H__ diff --git a/dtm_release/lib/math/logspace_base.cpp b/dtm_release/lib/math/logspace_base.cpp new file mode 100644 index 0000000000000000000000000000000000000000..55de6cf4fbfdbaacb04a9259caf39a761f0ef11d --- /dev/null +++ b/dtm_release/lib/math/logspace_base.cpp @@ -0,0 +1,70 @@ +#include "logspace_base.h" + +using namespace std; + +double safe_log(double x) { + if (x <= 0) { + return(-1e4); + } else { + return(log(x)); + } +} + +// Given log(a) and log(b), return log(a + b). +double log_sum(double log_a, double log_b) { + double v; + + if (log_a == -std::numeric_limits<double>::infinity() && + log_b == log_a) { + return -std::numeric_limits<double>::infinity(); + } else if (log_a < log_b) { + v = log_b + log(1 + exp(log_a - log_b)); + } else { + v = log_a + log(1 + exp(log_b - log_a)); + } + return(v); +} + +// Given log(a) and log(b), return log(a - b). +double log_diff(double log_a, double log_b) { + double val; + double dangerous_part = exp(log_b - log_a); + assert(dangerous_part < 1.0); + val = log_a + log(1.0 - dangerous_part); + return val; +} + +/* + * returns the element randomly sampled from the log + * probabilities in array (number is the number of elements) + */ +int log_sample(double* vals, int length) { + double normalizer = safe_log(0.0); + int ii; + for(ii=0; ii<length; ++ii) { + normalizer = log_sum(normalizer, vals[ii]); + } + + double val = 0, sum = 0, cutoff = (double)rand() / ((double)RAND_MAX + 1.0); + for(ii=0; ii<length; ++ii) { + val = exp(vals[ii] - normalizer); + sum += val; + if(sum >= cutoff) + break; + } + assert(ii < length); + return ii; +} + +/* + * A stupid "sampling" function for deterministic testing + */ +int sample_first_nonzero(double* vals, int length) { + int ii; + for(ii=0; ii < length - 1 && exp(vals[ii]) < 0.01; ++ii) { } + return ii; +} + +bool is_nan(double val) { + return val != val; +} diff --git a/dtm_release/lib/math/logspace_base.h b/dtm_release/lib/math/logspace_base.h new file mode 100644 index 0000000000000000000000000000000000000000..127b1518edb4eb3dc44ba34429109d269134f7a6 --- /dev/null +++ b/dtm_release/lib/math/logspace_base.h @@ -0,0 +1,60 @@ +/* + * Author: Jordan Boyd-Graber + * Date: March 2008 + * + * This file was spun off from logspace.h in order to create a + * logspace file that wouldn't depend on gsl. + */ +#ifndef __MATH_LOGSPACE_BASE_H__ +#define __MATH_LOGSPACE_BASE_H__ + +#include <iostream> +#include <limits> +#include <assert.h> +#include <math.h> + +using namespace std; + +#ifndef isnan +# define isnan(x) \ + (sizeof (x) == sizeof (long double) ? isnan_ld (x) \ + : sizeof (x) == sizeof (double) ? isnan_d (x) \ + : isnan_f (x)) +static inline int isnan_f (float x) { return x != x; } +static inline int isnan_d (double x) { return x != x; } +static inline int isnan_ld (long double x) { return x != x; } +#endif + +#ifndef isinf +# define isinf(x) \ + (sizeof (x) == sizeof (long double) ? isinf_ld (x) \ + : sizeof (x) == sizeof (double) ? isinf_d (x) \ + : isinf_f (x)) +static inline int isinf_f (float x) { return isnan (x - x); } +static inline int isinf_d (double x) { return isnan (x - x); } +static inline int isinf_ld (long double x) { return isnan (x - x); } +#endif + +double safe_log(double x); + +// Given log(a) and log(b), return log(a + b). +double log_sum(double log_a, double log_b); + +// Given log(a) and log(b), return log(a - b). +double log_diff(double log_a, double log_b); + +/* + * returns the element randomly sampled from the log + * probabilities in array (number is the number of elements) + */ +int log_sample(double* vals, int length); + +/* + * Stupid "sampling" function for deterministic testing (i.e. in unit tests) + */ +int sample_first_nonzero(double* vals, int length); +int sample_max(double* vals); + +bool is_nan(double val); + +#endif // __MATH_LOGSPACE_BASE_H__ diff --git a/dtm_release/lib/math/optimizer.h b/dtm_release/lib/math/optimizer.h new file mode 100644 index 0000000000000000000000000000000000000000..3a948fb84c15b239fbc2d0a36badc065ff86a421 --- /dev/null +++ b/dtm_release/lib/math/optimizer.h @@ -0,0 +1,100 @@ +#ifndef __LIB_MATH_OPTIMIZER__ +#define __LIB_MATH_OPTIMIZER__ + +#include <iostream> +#include <limits> +#include <gsl/gsl_multimin.h> +#include "math/gsl_vector.h" +#include "util/flags.h" + +using std::cout; +using std::endl; + +DEFINE_double(multimin_convergence_threshold, + 1e-5, + "Convergence threshold for conjugate gradient."); +DEFINE_size(max_multimin_iterations, + 40, + "Maximum number of conjugate gradient iterations to perform."); + +class Optimizer { + public: + Optimizer(size_t size) : size_(size) { + } + + void Optimize() { + gsl_multimin_function_fdf my_func; + my_func.n = size_; + my_func.f = &MultiminObjectiveWrapper; + my_func.df = &MultiminGradientWrapper; + my_func.fdf = &MultiminObjectiveGradientWrapper; + my_func.params = this; + + gsl_multimin_fdfminimizer* s = + gsl_multimin_fdfminimizer_alloc(gsl_multimin_fdfminimizer_conjugate_fr, size_); + GslVector initial_guess(size_); + MultiminInitialGuess(initial_guess.mutable_ptr()); + + // step_size, tol + // gsl_multimin_fdfminimizer_set(s, &my_func, initial_guess.ptr(), 0.1, 1.0); + gsl_multimin_fdfminimizer_set(s, &my_func, initial_guess.ptr(), 0.01, 0.01); + + size_t iter = 0; + int status; + + double value = std::numeric_limits<double>::infinity(); + double prev_value; + do { + prev_value = value; + iter++; + status = gsl_multimin_fdfminimizer_iterate(s); + if (status) { + cout << "Error: " << gsl_strerror(status) << endl; + break; + } + status = gsl_multimin_test_gradient(s->gradient, 1e-3); + if (status == GSL_SUCCESS) { + cout << "Minimum found." << endl; + } + value = s->f; + cout << "Iteration: " << iter << " Value: " << + value << " dValue:" << (prev_value - value)/fabs(value) << " " << + gsl_strerror(status) << endl; + } while (status == GSL_CONTINUE && + iter < FLAGS_max_multimin_iterations && + (prev_value - value) / fabs(value) > FLAGS_multimin_convergence_threshold); + MultiminResult(s->x); + gsl_multimin_fdfminimizer_free(s); + } + + virtual void MultiminObjectiveGradient(const gsl_vector* x, + double* objective, + gsl_vector* gradient) = 0; + + virtual void MultiminInitialGuess(gsl_vector* v) = 0; + + virtual void MultiminResult(gsl_vector* x) = 0; + + virtual ~Optimizer() { } + protected: + static double MultiminObjectiveWrapper(const gsl_vector* x, void* params) { + double objective; + reinterpret_cast<Optimizer*>(params)->MultiminObjectiveGradient(x, &objective, NULL); + return objective; + } + + static void MultiminGradientWrapper(const gsl_vector* x, void* params, gsl_vector* g) { + reinterpret_cast<Optimizer*>(params)->MultiminObjectiveGradient(x, NULL, g); + } + + static void MultiminObjectiveGradientWrapper(const gsl_vector* x, + void* params, + double* f, + gsl_vector* g) { + reinterpret_cast<Optimizer*>(params)->MultiminObjectiveGradient(x, f, g); + } + + private: + size_t size_; +}; +#endif // __LIB_MATH_OPTIMIZER__ diff --git a/dtm_release/lib/math/specialfunc.cpp b/dtm_release/lib/math/specialfunc.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fdcd9c5a23aefd98e7116d621a65abc9cec774da --- /dev/null +++ b/dtm_release/lib/math/specialfunc.cpp @@ -0,0 +1,144 @@ +#include "specialfunc.h" +#include <limits> +#include <gsl/gsl_sf_erf.h> + +double trigamma(double x) +{ + double p; + int i; + + x=x+6; + p=1/(x*x); + p=(((((0.075757575757576*p-0.033333333333333)*p+0.0238095238095238) + *p-0.033333333333333)*p+0.166666666666667)*p+1)/x+0.5*p; + for (i=0; i<6 ;i++) + { + x=x-1; + p=1/(x*x)+p; + } + return(p); +} + + +double digamma(double x) { + if (x == 0.0) { + return -std::numeric_limits<double>::infinity(); + } + + double p; + x=x+6; + p=1/(x*x); + p=(((0.004166666666667*p-0.003968253986254)*p+ + 0.008333333333333)*p-0.083333333333333)*p; + p=p+log(x)-0.5/x-1/(x-1)-1/(x-2)-1/(x-3)-1/(x-4)-1/(x-5)-1/(x-6); + return p; +} + +/* + We invert the gamma by making a reasonable initial guess (typically + this is correct to within a few percent). An iteration of Newton's + method is then used; this yields errors whose worst case are around + .3% and typically around .01%. + + For small x, digamma is approximately -1/x and for large x it is + approximately log(x). Thus we make the initial guesses -1/x and + exp(x) (with some fudge factors) depending on where x lies. + */ +double InverseDigamma(double x) { + double guess = 0.0; + if (x < -2) { + guess = -1/x; + } else { + guess = exp(x) - 1 / (x + 7) + 0.5772157; // Euler-Mascheroni constant. + } + guess -= (digamma(guess) - x) / trigamma(guess); + return(guess); +} + + +double log_gamma(double x) +{ + double x0,x2,xp,gl,gl0; + int n=0,k=0; + static double a[] = { + 8.333333333333333e-02, + -2.777777777777778e-03, + 7.936507936507937e-04, + -5.952380952380952e-04, + 8.417508417508418e-04, + -1.917526917526918e-03, + 6.410256410256410e-03, + -2.955065359477124e-02, + 1.796443723688307e-01, + -1.39243221690590}; + + x0 = x; + if (x <= 0.0) return 1e308; + else if ((x == 1.0) || (x == 2.0)) return 0.0; + else if (x <= 7.0) { + n = (int)(7-x); + x0 = x+n; + } + x2 = 1.0/(x0*x0); + xp = 2.0*M_PI; + gl0 = a[9]; + for (k=8;k>=0;k--) { + gl0 = gl0*x2 + a[k]; + } + gl = gl0/x0+0.5*log(xp)+(x0-0.5)*log(x0)-x0; + if (x <= 7.0) { + for (k=1;k<=n;k++) { + gl -= log(x0-1.0); + x0 -= 1.0; + } + } + return gl; +} + +double sigmoid(double x) { + return 1./(1 + exp(-x)); +} + +// First derivative of sigmoid function. +double dsigmoid(double x) { + double s = sigmoid(x); + return s * s * exp(-x); +} + +// Second derivative of sigmoid function. +double d2sigmoid(double x) { + double s = sigmoid(x); + double ds = dsigmoid(x); + return ds * (2 * s * exp(-x) - 1); +} + +double LogPGaussian(double x) { + // Phi(x) = 0.5 * erfc( - x / sqrt(2)) + // log Phi(x) = log(0.5) + log erfc( -x / sqrt(2)) + return log(0.5) + gsl_sf_log_erfc(-x / sqrt(2)); +} + +// d Phi(x) = 0.5 erfc'( - x / sqrt(2)) * (- 1 / sqrt(2)) +// Note that d erfc = d (1 - erf) = - d erf = - 2 / sqrt(pi) exp(-x^2) +// => d Phi(x) = 0.5 * (-2 / sqrt(pi)) * exp(-x^2/2) * (-1 / sqrt(2)) +// = 1 / sqrt(2 pi) exp(-x^2 / 2) +double LogDGaussian(double x) { + return -x * x / 2 - 0.5 * log(2 * M_PI); +} + +// Computes the inverse of PGaussian. We use Newton iteration on the +// *log*. This makes the iteration converge much better for small x. +// I dunno how well it will work for large values of x. +// 5 iterations seems to be enough. It's still pretty slow so don't use +// this in time-critical code. +double InversePGaussian(double x) { + double y = 0; + x = log(x); + for (int ii = 0; ii < 5; ++ii) { + double pgy = LogPGaussian(y); + y -= (pgy - x) * exp(pgy) / exp(LogDGaussian(y)); + } + return y; +} + + diff --git a/dtm_release/lib/math/specialfunc.h b/dtm_release/lib/math/specialfunc.h new file mode 100644 index 0000000000000000000000000000000000000000..315b84e0132dccf4abb582e3ea947621f611cfd4 --- /dev/null +++ b/dtm_release/lib/math/specialfunc.h @@ -0,0 +1,57 @@ +#ifndef __MATH_SPECIALFUNC_H__ +#define __MATH_SPECIALFUNC_H__ +#include <cmath> + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + + /** + * Proc to calculate the value of the trigamma, the second + * derivative of the loggamma function. Accepts positive matrices. + * From Abromowitz and Stegun. Uses formulas 6.4.11 and 6.4.12 with + * recurrence formula 6.4.6. Each requires workspace at least 5 + * times the size of X. + * + **/ + +double trigamma(double x); + + +/* + * taylor approximation of first derivative of the log gamma function + * + */ +double digamma(double x); +double InverseDigamma(double x); + + +// lgamma.cpp -- log gamma function of real argument. +// Algorithms and coefficient values from "Computation of Special +// Functions", Zhang and Jin, John Wiley and Sons, 1996. +// +// (C) 2003, C. Bond. All rights reserved. +// +// Returns log(gamma) of real argument. +// NOTE: Returns 1e308 if argument is 0 or negative. +// +double log_gamma(double x); + +double sigmoid(double x); + +// First derivative of sigmoid function. +double dsigmoid(double x); + +// Second derivative of sigmoid function. +double d2sigmoid(double x); + +// Log of the CDF of a Gaussian. +double LogPGaussian(double x); + +// Log of the PDF of a Gaussian. +double LogDGaussian(double x); + +// Computes the inverse of PGaussian. +double InversePGaussian(double x); + +#endif diff --git a/dtm_release/lib/math/vectorops.h b/dtm_release/lib/math/vectorops.h new file mode 100644 index 0000000000000000000000000000000000000000..e31484893d4d9004c4e2ffc6063869de6fabdae0 --- /dev/null +++ b/dtm_release/lib/math/vectorops.h @@ -0,0 +1,342 @@ +#ifndef __MATH_VECTOROPS_INCLUDED +#define __MATH_VECTOROPS_INCLUDED + +#include <cmath> +#include <limits> +#include <gsl/gsl_matrix.h> +#include <gsl/gsl_vector.h> +<<<<<<< vectorops.h +#include <gsl/gsl_cblas.h> +#include "math/specialfunc.h" +======= +#include <gsl/gsl_blas.h> +#include "specialfunc.h" +>>>>>>> 1.27 + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +#ifndef isnan +# define isnan(x) ((x) != (x)) +#endif + +/* + * take the exponent of a vector + * + * If the exponent is infinite, then we replace the value with a + * suitably large max_val + */ +void vexp(const gsl_vector* v, + gsl_vector* exp_v, + double max_val = std::numeric_limits<double>::infinity()) { + assert(exp_v->size >= v->size); + for (unsigned int ii = 0; ii < v->size; ++ii) { + double val = exp(gsl_vector_get(v, ii)); + if (val == std::numeric_limits<double>::infinity() || val > max_val) { + val = max_val; + } + gsl_vector_set(exp_v, ii, val); + } +} + +/* take the exponent of a matrix */ +void mexp(const gsl_matrix* m, gsl_matrix* exp_m) { + for (unsigned int ii = 0; ii < m->size1; ++ii) { + for (unsigned int jj = 0; jj < m->size2; ++jj) { + double val = exp(gsl_matrix_get(m, ii, jj)); + assert(!isnan(val)); + gsl_matrix_set(exp_m, ii, jj, val); + } + } +} + +/* like vexp except that it also computes sum x log x */ +double vexp_entropy(const gsl_vector* v, gsl_vector* exp_v) { + double entropy = 0.0; + for (unsigned int ii = 0; ii < v->size; ++ii) { + double logval = gsl_vector_get(v, ii); + double val = exp(logval); + assert(!isnan(val)); + gsl_vector_set(exp_v, ii, val); + if (val != 0) { + entropy -= val * logval; + } + } + return entropy; +} + +double ventropy(const gsl_vector* v) { + double entropy = 0.0; + for (unsigned int ii = 0; ii < v->size; ++ii) { + double val = gsl_vector_get(v, ii); + if (val != 0) { + entropy -= val * log(val); + } + } + return entropy; +} + +double lgamma(double x) { + double x0,x2,xp,gl,gl0; + int n=0,k=0; + static double a[] = { + 8.333333333333333e-02, + -2.777777777777778e-03, + 7.936507936507937e-04, + -5.952380952380952e-04, + 8.417508417508418e-04, + -1.917526917526918e-03, + 6.410256410256410e-03, + -2.955065359477124e-02, + 1.796443723688307e-01, + -1.39243221690590}; + + x0 = x; + if (x <= 0.0) return 1e308; + else if ((x == 1.0) || (x == 2.0)) return 0.0; + else if (x <= 7.0) { + n = (int)(7-x); + x0 = x+n; + } + x2 = 1.0/(x0*x0); + xp = 2.0*M_PI; + gl0 = a[9]; + for (k=8;k>=0;k--) { + gl0 = gl0*x2 + a[k]; + } + gl = gl0/x0+0.5*log(xp)+(x0-0.5)*log(x0)-x0; + if (x <= 7.0) { + for (k=1;k<=n;k++) { + gl -= log(x0-1.0); + x0 -= 1.0; + } + } + return gl; +} + +void mlog(const gsl_matrix* m, gsl_matrix* log_m) { + for (unsigned int ii = 0; ii < m->size1; ++ii) { + for (unsigned int jj = 0; jj < m->size2; ++jj) { + gsl_matrix_set(log_m, ii, jj, log(gsl_matrix_get(m, ii, jj))); + } + } +} + +void vlog(const gsl_vector* v, gsl_vector* log_v) { + for (unsigned int ii = 0; ii < v->size; ++ii) + gsl_vector_set(log_v, ii, log(gsl_vector_get(v, ii))); +} + +void vlogit(const gsl_vector* v, gsl_vector* log_v) { + for (unsigned int ii = 0; ii < v->size; ++ii) { + double p = gsl_vector_get(v, ii); + assert(p >= 0.0); + assert(p <= 1.0); + gsl_vector_set(log_v, ii, log(p / (1 - p))); + } +} + + +void vsigmoid(const gsl_vector* v, gsl_vector* sig_v) { + for (unsigned int ii = 0; ii < v->size; ++ii) { + double p = gsl_vector_get(v, ii); + gsl_vector_set(sig_v, ii, 1. / (1. + exp(-p))); + } +} + + +double vlog_entropy(const gsl_vector* v, gsl_vector* log_v) { + double entropy = 0; + for (unsigned int ii = 0; ii < v->size; ++ii) { + double val = gsl_vector_get(v, ii); + entropy -= val * log(val); + gsl_vector_set(log_v, ii, log(val)); + } + return entropy; +} + +double entropy(const gsl_vector* v) { + double entropy = 0; + for (unsigned int ii = 0; ii < v->size; ++ii) { + double val = gsl_vector_get(v, ii); + entropy -= val * log(val); + } + return entropy; +} + +void vdigamma(const gsl_vector* v, gsl_vector* digamma_v) { + for (unsigned int ii = 0; ii < v->size; ++ii) + // gsl_sf_psi throws an error when its argument is 0, whereas digamma returns inf. + // gsl_vector_set(digamma_v, ii, gsl_sf_psi(gsl_vector_get(v, ii))); + gsl_vector_set(digamma_v, ii, digamma(gsl_vector_get(v, ii))); +} + +void vlgamma(const gsl_vector* v, gsl_vector* lgamma_v) { + for (unsigned int ii = 0; ii < v->size; ++ii) + gsl_vector_set(lgamma_v, ii, lgamma(gsl_vector_get(v, ii))); +} + +double gsl_blas_dsum(const gsl_vector* v) { + double sum = 0; + for (unsigned int ii = 0; ii < v->size; ++ii) { + sum += gsl_vector_get(v, ii); + } + return sum; +} + +double gsl_blas_dsum(const gsl_matrix* v) { + double sum = 0; + for (unsigned int ii = 0; ii < v->size1; ++ii) { + for (unsigned int jj = 0; jj < v->size2; ++jj) { + sum += gsl_matrix_get(v, ii, jj); + } + } + return sum; +} + +double gsl_matrix_rowsum(const gsl_matrix* m, const int row) { + double sum = 0; + for(unsigned int i=0; i < m->size2; i++) { + sum += gsl_matrix_get(m, row, i); + } + return sum; +} + +double dot_product(const gsl_vector* a, const gsl_vector* b) { + assert(a->size == b->size); + double val = 0; + for(unsigned i=0; i<a->size; i++) { + val += gsl_vector_get(a, i) * gsl_vector_get(b, i); + } + return val; +} + +void uniform(gsl_vector* v) { + gsl_vector_set_all(v, 1.0 / (double)v->size); +} + +double normalize(gsl_vector* v) { + double sum = gsl_blas_dsum(v); + gsl_blas_dscal(1 / sum, v); + return sum; +} + +/* + This function takes as input a multinomial parameter vector and + computes the "total" variance, i.e., the sum of the diagonal of the + covariance matrix. + + If the multinomial parameter is unnormalized, then the variance of + the normalized multinomial vector will be computed and then + multiplied by the scale of the vector. + */ +double MultinomialTotalVariance(const gsl_vector* v) { + double scale = gsl_blas_dsum(v); + double variance = 0.0; + for (size_t ii = 0; ii < v->size; ++ii) { + double val = gsl_vector_get(v, ii) / scale; + variance += val * (1. - val); + } + return variance * scale; +} + +/* + Computes covariance using the renormalization above and adds it to + an existing matrix. +*/ +void MultinomialCovariance(double alpha, + const gsl_vector* v, + gsl_matrix* m) { + double scale = gsl_blas_dsum(v); + gsl_blas_dger(-alpha / scale, v, v, m); + gsl_vector_view diag = gsl_matrix_diagonal(m); + gsl_blas_daxpy(alpha, v, &diag.vector); +} + +double MatrixProductSum(const gsl_matrix* m1, + const gsl_matrix* m2) { + double val = 0; + assert(m1->size1 == m2->size1); + assert(m1->size2 == m2->size2); + for (size_t ii = 0; ii < m1->size1; ++ii) { + for (size_t jj = 0; jj < m2->size2; ++jj) { + val += gsl_matrix_get(m1, ii, jj) * + gsl_matrix_get(m2, ii, jj); + } + } + return val; +} + +double MatrixProductProductSum(const gsl_matrix* m1, + const gsl_matrix* m2, + const gsl_matrix* m3) { + double val = 0; + assert(m1->size1 == m2->size1); + assert(m1->size2 == m2->size2); + assert(m1->size1 == m3->size1); + assert(m1->size2 == m3->size2); + for (size_t ii = 0; ii < m1->size1; ++ii) { + for (size_t jj = 0; jj < m2->size2; ++jj) { + for (size_t kk = 0; kk < m3->size2; ++kk) { + val += gsl_matrix_get(m1, ii, jj) * + gsl_matrix_get(m2, ii, jj) * + gsl_matrix_get(m3, ii, jj); + } + } + } + return val; +} + +double SumLGamma(const gsl_vector* v) { + double s = 0.0; + for (size_t ii = 0; ii < v->size; ++ii) { + s += lgamma(gsl_vector_get(v, ii)); + } + return s; +} + +void mtx_fprintf(const char* filename, const gsl_matrix * m) +{ + FILE* fileptr; + fileptr = fopen(filename, "w"); + gsl_matrix_fprintf(fileptr, m, "%20.17e"); + fclose(fileptr); +} + + +void mtx_fscanf(const char* filename, gsl_matrix * m) +{ + FILE* fileptr; + fileptr = fopen(filename, "r"); + gsl_matrix_fscanf(fileptr, m); + fclose(fileptr); +} + +double mtx_accum(const int i, + const int j, + const double contribution, + gsl_matrix* m) { + + double new_val = gsl_matrix_get(m, i, j) + contribution; + gsl_matrix_set(m, i, j, new_val); + return new_val; +} + +void vct_fscanf(const char* filename, gsl_vector* v) +{ + FILE* fileptr; + fileptr = fopen(filename, "r"); + gsl_vector_fscanf(fileptr, v); + fclose(fileptr); +} + +void vct_fprintf(const char* filename, gsl_vector* v) +{ + FILE* fileptr; + fileptr = fopen(filename, "w"); + gsl_vector_fprintf(fileptr, v, "%20.17e"); + fclose(fileptr); +} + +#endif diff --git a/dtm_release/lib/util/gflags-1.1/.deps/gflags_unittest-gflags_unittest.Po b/dtm_release/lib/util/gflags-1.1/.deps/gflags_unittest-gflags_unittest.Po new file mode 100644 index 0000000000000000000000000000000000000000..bc9f0cea95b97d837fa7f0be23d3d625f27270b5 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/.deps/gflags_unittest-gflags_unittest.Po @@ -0,0 +1,354 @@ +gflags_unittest-gflags_unittest.o gflags_unittest-gflags_unittest.o: \ + src/gflags_unittest.cc src/config.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/bits/stdio.h /usr/include/stdlib.h \ + /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ + /usr/include/endian.h /usr/include/bits/endian.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/string.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/sys/stat.h /usr/include/bits/stat.h /usr/include/math.h \ + /usr/include/bits/huge_val.h /usr/include/bits/huge_valf.h \ + /usr/include/bits/huge_vall.h /usr/include/bits/inf.h \ + /usr/include/bits/nan.h /usr/include/bits/mathdef.h \ + /usr/include/bits/mathcalls.h /usr/include/bits/mathinline.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/vector \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++config.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/os_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/cpu_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstddef \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdlib \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++locale.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale \ + /usr/include/locale.h /usr/include/bits/locale.h \ + /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ + /usr/include/libintl.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/signal.h /usr/include/bits/setjmp.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cctype \ + /usr/include/ctype.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwchar \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ctime \ + /usr/include/stdint.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/debug/debug.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/limits \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/atomic_word.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc \ + src/gflags/gflags.h /usr/include/inttypes.h \ + src/google/gflags_completions.h src/gflags/gflags_completions.h + +src/config.h: + +/usr/include/stdio.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/include/bits/wchar.h: + +/usr/include/gconv.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/bits/sys_errlist.h: + +/usr/include/bits/stdio.h: + +/usr/include/stdlib.h: + +/usr/include/bits/waitflags.h: + +/usr/include/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/xlocale.h: + +/usr/include/sys/types.h: + +/usr/include/time.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/string.h: + +/usr/include/unistd.h: + +/usr/include/bits/posix_opt.h: + +/usr/include/bits/environments.h: + +/usr/include/bits/confname.h: + +/usr/include/getopt.h: + +/usr/include/sys/stat.h: + +/usr/include/bits/stat.h: + +/usr/include/math.h: + +/usr/include/bits/huge_val.h: + +/usr/include/bits/huge_valf.h: + +/usr/include/bits/huge_vall.h: + +/usr/include/bits/inf.h: + +/usr/include/bits/nan.h: + +/usr/include/bits/mathdef.h: + +/usr/include/bits/mathcalls.h: + +/usr/include/bits/mathinline.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/vector: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++config.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/os_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/cpu_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstddef: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/xopen_lim.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdlib: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++locale.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale: + +/usr/include/locale.h: + +/usr/include/bits/locale.h: + +/usr/include/langinfo.h: + +/usr/include/nl_types.h: + +/usr/include/iconv.h: + +/usr/include/libintl.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/bits/sched.h: + +/usr/include/signal.h: + +/usr/include/bits/setjmp.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cctype: + +/usr/include/ctype.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwchar: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ctime: + +/usr/include/stdint.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/debug/debug.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/limits: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/atomic_word.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc: + +src/gflags/gflags.h: + +/usr/include/inttypes.h: + +src/google/gflags_completions.h: + +src/gflags/gflags_completions.h: diff --git a/dtm_release/lib/util/gflags-1.1/.deps/gflags_unittest-main.Po b/dtm_release/lib/util/gflags-1.1/.deps/gflags_unittest-main.Po new file mode 100644 index 0000000000000000000000000000000000000000..6290d20a0d95fb21bd89e920babb82a354fd200a --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/.deps/gflags_unittest-main.Po @@ -0,0 +1,354 @@ +gflags_unittest-main.o gflags_unittest-main.o: \ + src/gflags_unittest-main.cc src/config.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/bits/stdio.h /usr/include/stdlib.h \ + /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ + /usr/include/endian.h /usr/include/bits/endian.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/string.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/sys/stat.h /usr/include/bits/stat.h /usr/include/math.h \ + /usr/include/bits/huge_val.h /usr/include/bits/huge_valf.h \ + /usr/include/bits/huge_vall.h /usr/include/bits/inf.h \ + /usr/include/bits/nan.h /usr/include/bits/mathdef.h \ + /usr/include/bits/mathcalls.h /usr/include/bits/mathinline.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/vector \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++config.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/os_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/cpu_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstddef \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdlib \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++locale.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale \ + /usr/include/locale.h /usr/include/bits/locale.h \ + /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ + /usr/include/libintl.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/signal.h /usr/include/bits/setjmp.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cctype \ + /usr/include/ctype.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwchar \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ctime \ + /usr/include/stdint.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/debug/debug.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/limits \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/atomic_word.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc \ + src/gflags/gflags.h /usr/include/inttypes.h \ + src/google/gflags_completions.h src/gflags/gflags_completions.h + +src/config.h: + +/usr/include/stdio.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/include/bits/wchar.h: + +/usr/include/gconv.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/bits/sys_errlist.h: + +/usr/include/bits/stdio.h: + +/usr/include/stdlib.h: + +/usr/include/bits/waitflags.h: + +/usr/include/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/xlocale.h: + +/usr/include/sys/types.h: + +/usr/include/time.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/string.h: + +/usr/include/unistd.h: + +/usr/include/bits/posix_opt.h: + +/usr/include/bits/environments.h: + +/usr/include/bits/confname.h: + +/usr/include/getopt.h: + +/usr/include/sys/stat.h: + +/usr/include/bits/stat.h: + +/usr/include/math.h: + +/usr/include/bits/huge_val.h: + +/usr/include/bits/huge_valf.h: + +/usr/include/bits/huge_vall.h: + +/usr/include/bits/inf.h: + +/usr/include/bits/nan.h: + +/usr/include/bits/mathdef.h: + +/usr/include/bits/mathcalls.h: + +/usr/include/bits/mathinline.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/vector: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++config.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/os_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/cpu_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstddef: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/xopen_lim.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdlib: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++locale.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale: + +/usr/include/locale.h: + +/usr/include/bits/locale.h: + +/usr/include/langinfo.h: + +/usr/include/nl_types.h: + +/usr/include/iconv.h: + +/usr/include/libintl.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/bits/sched.h: + +/usr/include/signal.h: + +/usr/include/bits/setjmp.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cctype: + +/usr/include/ctype.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwchar: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ctime: + +/usr/include/stdint.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/debug/debug.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/limits: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/atomic_word.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc: + +src/gflags/gflags.h: + +/usr/include/inttypes.h: + +src/google/gflags_completions.h: + +src/gflags/gflags_completions.h: diff --git a/dtm_release/lib/util/gflags-1.1/.deps/gflags_unittest.Po b/dtm_release/lib/util/gflags-1.1/.deps/gflags_unittest.Po new file mode 100644 index 0000000000000000000000000000000000000000..8bba8be5dfdbcdbbfbde675136650013cdda9df0 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/.deps/gflags_unittest.Po @@ -0,0 +1,353 @@ +gflags_unittest.o gflags_unittest.o: src/gflags_unittest.cc src/config.h \ + /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/bits/stdio.h /usr/include/stdlib.h \ + /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ + /usr/include/endian.h /usr/include/bits/endian.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/string.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/sys/stat.h /usr/include/bits/stat.h /usr/include/math.h \ + /usr/include/bits/huge_val.h /usr/include/bits/huge_valf.h \ + /usr/include/bits/huge_vall.h /usr/include/bits/inf.h \ + /usr/include/bits/nan.h /usr/include/bits/mathdef.h \ + /usr/include/bits/mathcalls.h /usr/include/bits/mathinline.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/vector \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++config.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/os_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/cpu_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstddef \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdlib \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++locale.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale \ + /usr/include/locale.h /usr/include/bits/locale.h \ + /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ + /usr/include/libintl.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/signal.h /usr/include/bits/setjmp.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cctype \ + /usr/include/ctype.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwchar \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ctime \ + /usr/include/stdint.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/debug/debug.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/limits \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/atomic_word.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc \ + src/gflags/gflags.h /usr/include/inttypes.h \ + src/google/gflags_completions.h src/gflags/gflags_completions.h + +src/config.h: + +/usr/include/stdio.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/include/bits/wchar.h: + +/usr/include/gconv.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/bits/sys_errlist.h: + +/usr/include/bits/stdio.h: + +/usr/include/stdlib.h: + +/usr/include/bits/waitflags.h: + +/usr/include/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/xlocale.h: + +/usr/include/sys/types.h: + +/usr/include/time.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/string.h: + +/usr/include/unistd.h: + +/usr/include/bits/posix_opt.h: + +/usr/include/bits/environments.h: + +/usr/include/bits/confname.h: + +/usr/include/getopt.h: + +/usr/include/sys/stat.h: + +/usr/include/bits/stat.h: + +/usr/include/math.h: + +/usr/include/bits/huge_val.h: + +/usr/include/bits/huge_valf.h: + +/usr/include/bits/huge_vall.h: + +/usr/include/bits/inf.h: + +/usr/include/bits/nan.h: + +/usr/include/bits/mathdef.h: + +/usr/include/bits/mathcalls.h: + +/usr/include/bits/mathinline.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/vector: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++config.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/os_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/cpu_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstddef: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/xopen_lim.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdlib: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++locale.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale: + +/usr/include/locale.h: + +/usr/include/bits/locale.h: + +/usr/include/langinfo.h: + +/usr/include/nl_types.h: + +/usr/include/iconv.h: + +/usr/include/libintl.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/bits/sched.h: + +/usr/include/signal.h: + +/usr/include/bits/setjmp.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cctype: + +/usr/include/ctype.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwchar: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ctime: + +/usr/include/stdint.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/debug/debug.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/limits: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/atomic_word.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc: + +src/gflags/gflags.h: + +/usr/include/inttypes.h: + +src/google/gflags_completions.h: + +src/gflags/gflags_completions.h: diff --git a/dtm_release/lib/util/gflags-1.1/.deps/gflags_unittest_main.Po b/dtm_release/lib/util/gflags-1.1/.deps/gflags_unittest_main.Po new file mode 100644 index 0000000000000000000000000000000000000000..30785bba44840af1f1f85693b7c76e6b8006b771 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/.deps/gflags_unittest_main.Po @@ -0,0 +1,354 @@ +gflags_unittest_main.o gflags_unittest_main.o: \ + src/gflags_unittest_main.cc src/config.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/bits/stdio.h /usr/include/stdlib.h \ + /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ + /usr/include/endian.h /usr/include/bits/endian.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/string.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/include/sys/stat.h /usr/include/bits/stat.h /usr/include/math.h \ + /usr/include/bits/huge_val.h /usr/include/bits/huge_valf.h \ + /usr/include/bits/huge_vall.h /usr/include/bits/inf.h \ + /usr/include/bits/nan.h /usr/include/bits/mathdef.h \ + /usr/include/bits/mathcalls.h /usr/include/bits/mathinline.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/vector \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++config.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/os_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/cpu_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstddef \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdlib \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++locale.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale \ + /usr/include/locale.h /usr/include/bits/locale.h \ + /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ + /usr/include/libintl.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/signal.h /usr/include/bits/setjmp.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cctype \ + /usr/include/ctype.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwchar \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ctime \ + /usr/include/stdint.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/debug/debug.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/limits \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/atomic_word.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc \ + src/gflags/gflags.h /usr/include/inttypes.h \ + src/google/gflags_completions.h src/gflags/gflags_completions.h + +src/config.h: + +/usr/include/stdio.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/include/bits/wchar.h: + +/usr/include/gconv.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/bits/sys_errlist.h: + +/usr/include/bits/stdio.h: + +/usr/include/stdlib.h: + +/usr/include/bits/waitflags.h: + +/usr/include/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/xlocale.h: + +/usr/include/sys/types.h: + +/usr/include/time.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/string.h: + +/usr/include/unistd.h: + +/usr/include/bits/posix_opt.h: + +/usr/include/bits/environments.h: + +/usr/include/bits/confname.h: + +/usr/include/getopt.h: + +/usr/include/sys/stat.h: + +/usr/include/bits/stat.h: + +/usr/include/math.h: + +/usr/include/bits/huge_val.h: + +/usr/include/bits/huge_valf.h: + +/usr/include/bits/huge_vall.h: + +/usr/include/bits/inf.h: + +/usr/include/bits/nan.h: + +/usr/include/bits/mathdef.h: + +/usr/include/bits/mathcalls.h: + +/usr/include/bits/mathinline.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/vector: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++config.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/os_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/cpu_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstddef: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/xopen_lim.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdlib: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++locale.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale: + +/usr/include/locale.h: + +/usr/include/bits/locale.h: + +/usr/include/langinfo.h: + +/usr/include/nl_types.h: + +/usr/include/iconv.h: + +/usr/include/libintl.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/bits/sched.h: + +/usr/include/signal.h: + +/usr/include/bits/setjmp.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cctype: + +/usr/include/ctype.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwchar: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ctime: + +/usr/include/stdint.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/debug/debug.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/limits: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/atomic_word.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc: + +src/gflags/gflags.h: + +/usr/include/inttypes.h: + +src/google/gflags_completions.h: + +src/gflags/gflags_completions.h: diff --git a/dtm_release/lib/util/gflags-1.1/.deps/libgflags_la-gflags.Plo b/dtm_release/lib/util/gflags-1.1/.deps/libgflags_la-gflags.Plo new file mode 100644 index 0000000000000000000000000000000000000000..6a1c09435788793e20e3335c1fb990f5e38d112d --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/.deps/libgflags_la-gflags.Plo @@ -0,0 +1,438 @@ +libgflags_la-gflags.lo libgflags_la-gflags.o: src/gflags.cc src/config.h \ + /usr/include/inttypes.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h \ + /usr/include/stdint.h /usr/include/bits/wchar.h /usr/include/stdio.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/bits/stdio.h /usr/include/ctype.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/xlocale.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-x86_64/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h /usr/include/assert.h /usr/include/fnmatch.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iostream \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++config.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/os_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/cpu_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ostream \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ios \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++locale.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstddef \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale \ + /usr/include/locale.h /usr/include/bits/locale.h \ + /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ + /usr/include/libintl.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/time.h \ + /usr/include/bits/sched.h /usr/include/bits/time.h \ + /usr/include/signal.h /usr/include/bits/sigset.h \ + /usr/include/bits/pthreadtypes.h /usr/include/bits/setjmp.h \ + /usr/include/unistd.h /usr/include/bits/posix_opt.h \ + /usr/include/bits/environments.h /usr/include/bits/confname.h \ + /usr/include/getopt.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cctype \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwchar \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ctime \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdlib \ + /usr/include/stdlib.h /usr/include/bits/waitflags.h \ + /usr/include/bits/waitstatus.h /usr/include/sys/types.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/sys/sysmacros.h /usr/include/alloca.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/debug/debug.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/localefwd.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/ios_base.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/atomic_word.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/locale_classes.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/limits \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/streambuf \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/streambuf.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_ios.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/streambuf_iterator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/locale_facets.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwctype \ + /usr/include/wctype.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/ctype_base.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/ctype_inline.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/codecvt.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/time_members.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/messages_members.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_ios.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/ostream.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/locale \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/locale_facets.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/typeinfo \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/istream \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/istream.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/map \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_map.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_multimap.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/vector \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/utility \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_relops.h \ + src/gflags/gflags.h src/mutex.h + +src/config.h: + +/usr/include/inttypes.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-64.h: + +/usr/include/stdint.h: + +/usr/include/bits/wchar.h: + +/usr/include/stdio.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/include/gconv.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/bits/sys_errlist.h: + +/usr/include/bits/stdio.h: + +/usr/include/ctype.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/xlocale.h: + +/usr/include/errno.h: + +/usr/include/bits/errno.h: + +/usr/include/linux/errno.h: + +/usr/include/asm/errno.h: + +/usr/include/asm-x86_64/errno.h: + +/usr/include/asm-generic/errno.h: + +/usr/include/asm-generic/errno-base.h: + +/usr/include/string.h: + +/usr/include/assert.h: + +/usr/include/fnmatch.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iostream: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++config.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/os_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/cpu_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ostream: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ios: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++locale.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstddef: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale: + +/usr/include/locale.h: + +/usr/include/bits/locale.h: + +/usr/include/langinfo.h: + +/usr/include/nl_types.h: + +/usr/include/iconv.h: + +/usr/include/libintl.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/time.h: + +/usr/include/bits/sched.h: + +/usr/include/bits/time.h: + +/usr/include/signal.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/bits/setjmp.h: + +/usr/include/unistd.h: + +/usr/include/bits/posix_opt.h: + +/usr/include/bits/environments.h: + +/usr/include/bits/confname.h: + +/usr/include/getopt.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cctype: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwchar: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ctime: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/xopen_lim.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdlib: + +/usr/include/stdlib.h: + +/usr/include/bits/waitflags.h: + +/usr/include/bits/waitstatus.h: + +/usr/include/sys/types.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/alloca.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/debug/debug.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/localefwd.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/ios_base.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/atomic_word.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/locale_classes.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/limits: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/streambuf: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/streambuf.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_ios.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/streambuf_iterator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/locale_facets.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwctype: + +/usr/include/wctype.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/ctype_base.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/ctype_inline.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/codecvt.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/time_members.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/messages_members.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_ios.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/ostream.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/locale: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/locale_facets.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/typeinfo: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/istream: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/istream.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/map: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_map.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_multimap.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/vector: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/utility: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_relops.h: + +src/gflags/gflags.h: + +src/mutex.h: diff --git a/dtm_release/lib/util/gflags-1.1/.deps/libgflags_la-gflags_completions.Plo b/dtm_release/lib/util/gflags-1.1/.deps/libgflags_la-gflags_completions.Plo new file mode 100644 index 0000000000000000000000000000000000000000..3ac96ad774b2978f9e55c1f63e9db69062741f6a --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/.deps/libgflags_la-gflags_completions.Plo @@ -0,0 +1,340 @@ +libgflags_la-gflags_completions.lo libgflags_la-gflags_completions.o: \ + src/gflags_completions.cc src/config.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/bits/stdio.h /usr/include/stdlib.h \ + /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ + /usr/include/endian.h /usr/include/bits/endian.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/string.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/set \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++config.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/os_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/cpu_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstddef \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdlib \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++locale.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale \ + /usr/include/locale.h /usr/include/bits/locale.h \ + /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ + /usr/include/libintl.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/signal.h /usr/include/bits/setjmp.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cctype \ + /usr/include/ctype.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwchar \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ctime \ + /usr/include/stdint.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/debug/debug.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_set.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_multiset.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/limits \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/atomic_word.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/utility \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_relops.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/vector \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc \ + src/gflags/gflags.h /usr/include/inttypes.h + +src/config.h: + +/usr/include/stdio.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/include/bits/wchar.h: + +/usr/include/gconv.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/bits/sys_errlist.h: + +/usr/include/bits/stdio.h: + +/usr/include/stdlib.h: + +/usr/include/bits/waitflags.h: + +/usr/include/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/xlocale.h: + +/usr/include/sys/types.h: + +/usr/include/time.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/string.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/set: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++config.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/os_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/cpu_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstddef: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/xopen_lim.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdlib: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++locale.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale: + +/usr/include/locale.h: + +/usr/include/bits/locale.h: + +/usr/include/langinfo.h: + +/usr/include/nl_types.h: + +/usr/include/iconv.h: + +/usr/include/libintl.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/bits/sched.h: + +/usr/include/signal.h: + +/usr/include/bits/setjmp.h: + +/usr/include/unistd.h: + +/usr/include/bits/posix_opt.h: + +/usr/include/bits/environments.h: + +/usr/include/bits/confname.h: + +/usr/include/getopt.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cctype: + +/usr/include/ctype.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwchar: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ctime: + +/usr/include/stdint.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/debug/debug.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_set.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_multiset.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/limits: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/atomic_word.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/utility: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_relops.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/vector: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc: + +src/gflags/gflags.h: + +/usr/include/inttypes.h: diff --git a/dtm_release/lib/util/gflags-1.1/.deps/libgflags_la-gflags_reporting.Plo b/dtm_release/lib/util/gflags-1.1/.deps/libgflags_la-gflags_reporting.Plo new file mode 100644 index 0000000000000000000000000000000000000000..a774850cf9ab401d2d376e14fb339f566b2a7e5f --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/.deps/libgflags_la-gflags_reporting.Plo @@ -0,0 +1,327 @@ +libgflags_la-gflags_reporting.lo libgflags_la-gflags_reporting.o: \ + src/gflags_reporting.cc src/config.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/bits/stdio.h /usr/include/string.h /usr/include/xlocale.h \ + /usr/include/ctype.h /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/assert.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++config.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/os_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/cpu_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstddef \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdlib \ + /usr/include/stdlib.h /usr/include/bits/waitflags.h \ + /usr/include/bits/waitstatus.h /usr/include/sys/types.h \ + /usr/include/time.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++locale.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale \ + /usr/include/locale.h /usr/include/bits/locale.h \ + /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ + /usr/include/libintl.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/signal.h /usr/include/bits/setjmp.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cctype \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwchar \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ctime \ + /usr/include/stdint.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/debug/debug.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/limits \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/atomic_word.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/vector \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc \ + src/gflags/gflags.h /usr/include/inttypes.h \ + src/gflags/gflags_completions.h + +src/config.h: + +/usr/include/stdio.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/include/bits/wchar.h: + +/usr/include/gconv.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/bits/sys_errlist.h: + +/usr/include/bits/stdio.h: + +/usr/include/string.h: + +/usr/include/xlocale.h: + +/usr/include/ctype.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/assert.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++config.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/os_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/cpu_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstddef: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/xopen_lim.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdlib: + +/usr/include/stdlib.h: + +/usr/include/bits/waitflags.h: + +/usr/include/bits/waitstatus.h: + +/usr/include/sys/types.h: + +/usr/include/time.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++locale.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale: + +/usr/include/locale.h: + +/usr/include/bits/locale.h: + +/usr/include/langinfo.h: + +/usr/include/nl_types.h: + +/usr/include/iconv.h: + +/usr/include/libintl.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/bits/sched.h: + +/usr/include/signal.h: + +/usr/include/bits/setjmp.h: + +/usr/include/unistd.h: + +/usr/include/bits/posix_opt.h: + +/usr/include/bits/environments.h: + +/usr/include/bits/confname.h: + +/usr/include/getopt.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cctype: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwchar: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ctime: + +/usr/include/stdint.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/debug/debug.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/limits: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/atomic_word.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/vector: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc: + +src/gflags/gflags.h: + +/usr/include/inttypes.h: + +src/gflags/gflags_completions.h: diff --git a/dtm_release/lib/util/gflags-1.1/.deps/libgflags_nothreads_la-gflags.Plo b/dtm_release/lib/util/gflags-1.1/.deps/libgflags_nothreads_la-gflags.Plo new file mode 100644 index 0000000000000000000000000000000000000000..c3ebcaba5b4285c1d904f0fcf8c62e4b1ddb117d --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/.deps/libgflags_nothreads_la-gflags.Plo @@ -0,0 +1,439 @@ +libgflags_nothreads_la-gflags.lo libgflags_nothreads_la-gflags.o: \ + src/gflags.cc src/config.h /usr/include/inttypes.h \ + /usr/include/features.h /usr/include/sys/cdefs.h \ + /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ + /usr/include/gnu/stubs-64.h /usr/include/stdint.h \ + /usr/include/bits/wchar.h /usr/include/stdio.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/gconv.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/bits/stdio.h /usr/include/ctype.h /usr/include/endian.h \ + /usr/include/bits/endian.h /usr/include/xlocale.h /usr/include/errno.h \ + /usr/include/bits/errno.h /usr/include/linux/errno.h \ + /usr/include/asm/errno.h /usr/include/asm-x86_64/errno.h \ + /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \ + /usr/include/string.h /usr/include/assert.h /usr/include/fnmatch.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iostream \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++config.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/os_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/cpu_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ostream \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ios \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++locale.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstddef \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale \ + /usr/include/locale.h /usr/include/bits/locale.h \ + /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ + /usr/include/libintl.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/time.h \ + /usr/include/bits/sched.h /usr/include/bits/time.h \ + /usr/include/signal.h /usr/include/bits/sigset.h \ + /usr/include/bits/pthreadtypes.h /usr/include/bits/setjmp.h \ + /usr/include/unistd.h /usr/include/bits/posix_opt.h \ + /usr/include/bits/environments.h /usr/include/bits/confname.h \ + /usr/include/getopt.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cctype \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwchar \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ctime \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdlib \ + /usr/include/stdlib.h /usr/include/bits/waitflags.h \ + /usr/include/bits/waitstatus.h /usr/include/sys/types.h \ + /usr/include/sys/select.h /usr/include/bits/select.h \ + /usr/include/sys/sysmacros.h /usr/include/alloca.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/debug/debug.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/localefwd.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/ios_base.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/atomic_word.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/locale_classes.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/limits \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/streambuf \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/streambuf.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_ios.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/streambuf_iterator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/locale_facets.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwctype \ + /usr/include/wctype.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/ctype_base.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/ctype_inline.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/codecvt.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/time_members.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/messages_members.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_ios.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/ostream.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/locale \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/locale_facets.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/typeinfo \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/istream \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/istream.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/map \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_map.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_multimap.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/vector \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/utility \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_relops.h \ + src/gflags/gflags.h src/mutex.h + +src/config.h: + +/usr/include/inttypes.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-64.h: + +/usr/include/stdint.h: + +/usr/include/bits/wchar.h: + +/usr/include/stdio.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/include/gconv.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/bits/sys_errlist.h: + +/usr/include/bits/stdio.h: + +/usr/include/ctype.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/xlocale.h: + +/usr/include/errno.h: + +/usr/include/bits/errno.h: + +/usr/include/linux/errno.h: + +/usr/include/asm/errno.h: + +/usr/include/asm-x86_64/errno.h: + +/usr/include/asm-generic/errno.h: + +/usr/include/asm-generic/errno-base.h: + +/usr/include/string.h: + +/usr/include/assert.h: + +/usr/include/fnmatch.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iostream: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++config.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/os_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/cpu_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ostream: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ios: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++locale.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstddef: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale: + +/usr/include/locale.h: + +/usr/include/bits/locale.h: + +/usr/include/langinfo.h: + +/usr/include/nl_types.h: + +/usr/include/iconv.h: + +/usr/include/libintl.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/time.h: + +/usr/include/bits/sched.h: + +/usr/include/bits/time.h: + +/usr/include/signal.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/bits/setjmp.h: + +/usr/include/unistd.h: + +/usr/include/bits/posix_opt.h: + +/usr/include/bits/environments.h: + +/usr/include/bits/confname.h: + +/usr/include/getopt.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cctype: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwchar: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ctime: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/xopen_lim.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdlib: + +/usr/include/stdlib.h: + +/usr/include/bits/waitflags.h: + +/usr/include/bits/waitstatus.h: + +/usr/include/sys/types.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/alloca.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/debug/debug.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/localefwd.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/ios_base.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/atomic_word.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/locale_classes.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/limits: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/streambuf: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/streambuf.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_ios.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/streambuf_iterator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/locale_facets.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwctype: + +/usr/include/wctype.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/ctype_base.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/ctype_inline.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/codecvt.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/time_members.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/messages_members.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_ios.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/ostream.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/locale: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/locale_facets.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/typeinfo: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/istream: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/istream.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/map: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_map.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_multimap.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/vector: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/utility: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_relops.h: + +src/gflags/gflags.h: + +src/mutex.h: diff --git a/dtm_release/lib/util/gflags-1.1/.deps/libgflags_nothreads_la-gflags_completions.Plo b/dtm_release/lib/util/gflags-1.1/.deps/libgflags_nothreads_la-gflags_completions.Plo new file mode 100644 index 0000000000000000000000000000000000000000..66e63b2a0000969e56345d0d4ba9c9a2aa36b7c8 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/.deps/libgflags_nothreads_la-gflags_completions.Plo @@ -0,0 +1,340 @@ +libgflags_nothreads_la-gflags_completions.lo \ + libgflags_nothreads_la-gflags_completions.o: src/gflags_completions.cc \ + src/config.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/bits/stdio.h /usr/include/stdlib.h \ + /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ + /usr/include/endian.h /usr/include/bits/endian.h /usr/include/xlocale.h \ + /usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/string.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/set \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++config.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/os_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/cpu_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstddef \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdlib \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++locale.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale \ + /usr/include/locale.h /usr/include/bits/locale.h \ + /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ + /usr/include/libintl.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/signal.h /usr/include/bits/setjmp.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cctype \ + /usr/include/ctype.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwchar \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ctime \ + /usr/include/stdint.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/debug/debug.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_set.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_multiset.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/limits \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/atomic_word.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/utility \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_relops.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/vector \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc \ + src/gflags/gflags.h /usr/include/inttypes.h + +src/config.h: + +/usr/include/stdio.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/include/bits/wchar.h: + +/usr/include/gconv.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/bits/sys_errlist.h: + +/usr/include/bits/stdio.h: + +/usr/include/stdlib.h: + +/usr/include/bits/waitflags.h: + +/usr/include/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/xlocale.h: + +/usr/include/sys/types.h: + +/usr/include/time.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/string.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/set: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++config.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/os_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/cpu_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstddef: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/xopen_lim.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdlib: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++locale.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale: + +/usr/include/locale.h: + +/usr/include/bits/locale.h: + +/usr/include/langinfo.h: + +/usr/include/nl_types.h: + +/usr/include/iconv.h: + +/usr/include/libintl.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/bits/sched.h: + +/usr/include/signal.h: + +/usr/include/bits/setjmp.h: + +/usr/include/unistd.h: + +/usr/include/bits/posix_opt.h: + +/usr/include/bits/environments.h: + +/usr/include/bits/confname.h: + +/usr/include/getopt.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cctype: + +/usr/include/ctype.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwchar: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ctime: + +/usr/include/stdint.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/debug/debug.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_set.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_multiset.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/limits: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/atomic_word.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/utility: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_relops.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/vector: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc: + +src/gflags/gflags.h: + +/usr/include/inttypes.h: diff --git a/dtm_release/lib/util/gflags-1.1/.deps/libgflags_nothreads_la-gflags_reporting.Plo b/dtm_release/lib/util/gflags-1.1/.deps/libgflags_nothreads_la-gflags_reporting.Plo new file mode 100644 index 0000000000000000000000000000000000000000..a51fd509e43a305e1751374335c2dd637097aea4 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/.deps/libgflags_nothreads_la-gflags_reporting.Plo @@ -0,0 +1,327 @@ +libgflags_nothreads_la-gflags_reporting.lo \ + libgflags_nothreads_la-gflags_reporting.o: src/gflags_reporting.cc \ + src/config.h /usr/include/stdio.h /usr/include/features.h \ + /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ + /usr/include/gnu/stubs.h /usr/include/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h \ + /usr/include/bits/types.h /usr/include/bits/typesizes.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/include/bits/wchar.h /usr/include/gconv.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h \ + /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ + /usr/include/bits/stdio.h /usr/include/string.h /usr/include/xlocale.h \ + /usr/include/ctype.h /usr/include/endian.h /usr/include/bits/endian.h \ + /usr/include/assert.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++config.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/os_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/cpu_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstddef \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h \ + /usr/include/limits.h /usr/include/bits/posix1_lim.h \ + /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ + /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdlib \ + /usr/include/stdlib.h /usr/include/bits/waitflags.h \ + /usr/include/bits/waitstatus.h /usr/include/sys/types.h \ + /usr/include/time.h /usr/include/sys/select.h \ + /usr/include/bits/select.h /usr/include/bits/sigset.h \ + /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ + /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++locale.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale \ + /usr/include/locale.h /usr/include/bits/locale.h \ + /usr/include/langinfo.h /usr/include/nl_types.h /usr/include/iconv.h \ + /usr/include/libintl.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \ + /usr/include/signal.h /usr/include/bits/setjmp.h /usr/include/unistd.h \ + /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ + /usr/include/bits/confname.h /usr/include/getopt.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cctype \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwchar \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ctime \ + /usr/include/stdint.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception_defines.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/debug/debug.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/limits \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/atomic_word.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/vector \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h \ + /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc \ + src/gflags/gflags.h /usr/include/inttypes.h \ + src/gflags/gflags_completions.h + +src/config.h: + +/usr/include/stdio.h: + +/usr/include/features.h: + +/usr/include/sys/cdefs.h: + +/usr/include/bits/wordsize.h: + +/usr/include/gnu/stubs.h: + +/usr/include/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stddef.h: + +/usr/include/bits/types.h: + +/usr/include/bits/typesizes.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/include/bits/wchar.h: + +/usr/include/gconv.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/stdarg.h: + +/usr/include/bits/stdio_lim.h: + +/usr/include/bits/sys_errlist.h: + +/usr/include/bits/stdio.h: + +/usr/include/string.h: + +/usr/include/xlocale.h: + +/usr/include/ctype.h: + +/usr/include/endian.h: + +/usr/include/bits/endian.h: + +/usr/include/assert.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++config.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/os_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/cpu_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stringfwd.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstring: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstddef: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/climits: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h: + +/usr/include/limits.h: + +/usr/include/bits/posix1_lim.h: + +/usr/include/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/bits/posix2_lim.h: + +/usr/include/bits/xopen_lim.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdlib: + +/usr/include/stdlib.h: + +/usr/include/bits/waitflags.h: + +/usr/include/bits/waitstatus.h: + +/usr/include/sys/types.h: + +/usr/include/time.h: + +/usr/include/sys/select.h: + +/usr/include/bits/select.h: + +/usr/include/bits/sigset.h: + +/usr/include/bits/time.h: + +/usr/include/sys/sysmacros.h: + +/usr/include/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++locale.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cstdio: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/clocale: + +/usr/include/locale.h: + +/usr/include/bits/locale.h: + +/usr/include/langinfo.h: + +/usr/include/nl_types.h: + +/usr/include/iconv.h: + +/usr/include/libintl.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/bits/sched.h: + +/usr/include/signal.h: + +/usr/include/bits/setjmp.h: + +/usr/include/unistd.h: + +/usr/include/bits/posix_opt.h: + +/usr/include/bits/environments.h: + +/usr/include/bits/confname.h: + +/usr/include/getopt.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cctype: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/postypes.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/cwchar: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ctime: + +/usr/include/stdint.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/functexcept.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception_defines.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/cpp_type_traits.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_funcs.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/concept_check.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/debug/debug.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/memory: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/new: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/exception: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_construct.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_uninitialized.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_raw_storage_iter.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/limits: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/atomicity.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/atomic_word.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_heap.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tempbuf.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/vector: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_vector.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_bvector.h: + +/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/vector.tcc: + +src/gflags/gflags.h: + +/usr/include/inttypes.h: + +src/gflags/gflags_completions.h: diff --git a/dtm_release/lib/util/gflags-1.1/AUTHORS b/dtm_release/lib/util/gflags-1.1/AUTHORS new file mode 100644 index 0000000000000000000000000000000000000000..ee92be88dcf11ca104c765ee339b69f8c5b90d8d --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/AUTHORS @@ -0,0 +1,2 @@ +opensource@google.com + diff --git a/dtm_release/lib/util/gflags-1.1/COPYING b/dtm_release/lib/util/gflags-1.1/COPYING new file mode 100644 index 0000000000000000000000000000000000000000..d15b0c24134de8ce0185ac22cb2dd96e23911fab --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/COPYING @@ -0,0 +1,28 @@ +Copyright (c) 2006, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/dtm_release/lib/util/gflags-1.1/ChangeLog b/dtm_release/lib/util/gflags-1.1/ChangeLog new file mode 100644 index 0000000000000000000000000000000000000000..222ec31e996283b956059291df4146994ac4a8b8 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/ChangeLog @@ -0,0 +1,127 @@ +Tue Apr 14 12:35:25 2009 Google Inc. <opensource@google.com> + + * google-gflags: version 1.1 + * Add both foo and nofoo for boolean flags, with --undefok (andychu) + * Better document how validators work (wojtekm) + * Improve binary-detection for bash-completion (mtamsky) + * Python: Add a concept of "key flags", used with --help (salcianu) + * Python: Robustify flag_values (salcianu) + * Python: Add a new DEFINE_bool alias (keir, andrewliu) + * Python: Do module introspection based on module name (dsturtevant) + * Fix autoconf a bit better, especially on windows and solaris (ajenjo) + * BUG FIX: gflags_nothreads was linking against the wrong lib (ajenjo) + * BUG FIX: threads-detection failed on FreeBSD; replace it (ajenjo) + * PORTABILITY: Quiet an internal compiler error with SUSE 10 (csilvers) + * PORTABILITY: Update deb.sh for more recenty debuilds (csilvers) + * PORTABILITY: #include more headers to satify new gcc's (csilvers) + * INSTALL: Updated to autoconf 2.61 and libtool 1.5.26 (csilvers) + +Fri Oct 3 15:16:46 2008 Google Inc. <opensource@google.com> + + * google-gflags: version 1.0 + * Add a missing newline to an error string (bcmills) + * (otherwise exactly the same as gflags 1.0rc2) + +Thu Sep 18 12:58:05 2008 Google Inc. <opensource@google.com> + + * google-gflags: version 1.0rc2 + * Report current flag values in --helpxml (hdn) + * Fix compilation troubles with gcc 4.3.3 (simonb) + * BUG FIX: I was missing a std:: in DECLARE_string (csilvers) + * BUG FIX: Clarify in docs how to specify --bool flags (csilvers) + * BUG FIX: Fix --helpshort for source files not in a subdir (csilvers) + * BUG FIX: Fix python unittest for 64-bit builds (bcmills) + +Tue Aug 19 16:15:48 2008 + + * google-gflags: version 1.0rc1 + * Move #include files from google/ to gflags/ (csilvers) + * Small optimizations to reduce binary (library) size (jyrki) + * BUGFIX: forgot a std:: in one of the .h files (csilvers) + * Speed up locking by making sure calls are inlined (ajenjo) + * 64-BIT COMPATIBILITY: Use %PRId64 instead of %lld (csilvers) + * PORTABILITY: fix Makefile to work with Cygwin (ajenjo) + * PORTABILITY: fix code to compile under Visual Studio (ajenjo) + * PORTABILITY: fix code to compile under Solaris 10 with CC (csilvers) + +Mon Jul 21 23:01:38 2008 Google Inc. <opensource@google.com> + + * google-gflags: version 0.9 + * Add the ability to validate a command-line flag (csilvers) + * Add completion support for commandline flags in bash (daven) + * Add -W compile flags to Makefile, when using gcc (csilvers) + * Allow helpstring to be NULL (cristianoc) + * Improved documentation of classes in the .cc file (csilvers) + * Fix python bug with AppendFlagValues + shortnames (jjtswan) + * Use bool instead of int for boolean flags in gflags.py (bcmills) + * Simplify the way we declare flags, now more foolproof (csilvers) + * Better error messages when bool flags collide (colohan) + * Only evaluate DEFINE_foo macro args once (csilvers) + +Wed Mar 26 15:20:18 2008 Google Inc. <opensource@google.com> + + * google-gflags: version 0.8 + * Export DescribeOneFlag() in the API + * Add support for automatic line wrapping at 80 cols for gflags.py + * Bugfix: do not treat an isolated "-" the same as an isolated "--" + * Update rpm spec to point to Google Code rather than sourceforge (!) + * Improve documentation (including documenting thread-safety) + * Improve #include hygiene + * Improve testing + +Thu Oct 18 11:33:20 2007 Google Inc. <opensource@google.com> + + * google-gflags: version 0.7 + * Deal even more correctly with libpthread not linked in (csilvers) + * Add STRIP_LOG, an improved DO_NOT_SHOW_COMMANDLINE_HELP (sioffe) + * Be more accurate printing default flag values in --help (dsturtevant) + * Reduce .o file size a bit by using shorter namespace names (jeff) + * Use relative install path, so 'setup.py --home' works (csilvers) + * Notice when a boolean flag has a non-boolean default (bnmouli) + * Broaden --helpshort to match foo-main.cc and foo_main.cc (hendrie) + * Fix "no modules match" message for --helpshort, etc (hendrie) + +Wed Aug 15 07:35:51 2007 Google Inc. <opensource@google.com> + + * google-gflags: version 0.6 + * Deal correctly with case that libpthread is not linked in (csilvers) + * Update Makefile/tests so we pass "make distcheck" (csilvers) + * Document and test that last assignment to a flag wins (wan) + +Tue Jun 12 15:23:42 2007 Google Inc. <opensource@google.com> + + * google-gflags: version 0.5 + * Include all m4 macros in the distribution (csilvers) + * Python: Fix broken data_files field in setup.py (sidlon) + * Python: better string serliaizing and unparsing (abo, csimmons) + * Fix checks for NaN and inf to work with Mac OS X (csilvers) + +Thu Apr 19 15:15:07 2007 Google Inc. <opensource@google.com> + + * google-gflags: version 0.4 + * Remove is_default from GetCommandLineFlagInfo (csilvers) + * Portability fixes: includes, strtoll, gcc4.3 errors (csilvers) + * A few doc typo cleanups (csilvers) + +Wed Mar 28 12:15:56 2007 Google Inc. <opensource@google.com> + + * google-gflags: version 0.3 + * python portability fix: use popen instead of subprocess (csilvers) + * Add is_default to CommandLineFlagInfo (pchien) + * Make docs a bit prettier (csilvers) + * Actually include the python files in the distribution! :-/ (csilvers) + +Mon Jan 22 15:33:06 2007 Google Inc. <opensource@google.com> + + * google-gflags: version 0.2 + * added support for python commandlineflags, as well as c++ + * gflags2man, a script to turn flags into a man page (dchristian) + +Wed Dec 13 12:37:19 2006 Google Inc. <opensource@google.com> + + * google-gflags: initial release: + The gflags package contains a library that implements commandline + flags processing. As such it's a replacement for getopt(). It + has increased flexibility, including built-in support for C++ + types like string, and the ability to define flags in the source + file in which they're used. diff --git a/dtm_release/lib/util/gflags-1.1/INSTALL b/dtm_release/lib/util/gflags-1.1/INSTALL new file mode 100644 index 0000000000000000000000000000000000000000..23e5f25d0e5f85798dcfb368ecb2f04f59777f61 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/INSTALL @@ -0,0 +1,236 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free +Software Foundation, Inc. + +This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + +These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. + +Installation Names +================== + +By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + +Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + +Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). Here is a another example: + + /bin/bash ./configure CONFIG_SHELL=/bin/bash + +Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent +configuration-related scripts to be executed by `/bin/bash'. + +`configure' Invocation +====================== + +`configure' recognizes the following options to control how it operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/dtm_release/lib/util/gflags-1.1/Makefile b/dtm_release/lib/util/gflags-1.1/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..38013b4f2259d5fdf1e22500eaae5025b8cc3738 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/Makefile @@ -0,0 +1,1077 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + + + + + +srcdir = . +top_srcdir = . + +pkgdatadir = $(datadir)/gflags +pkglibdir = $(libdir)/gflags +pkgincludedir = $(includedir)/gflags +top_builddir = . +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = /usr/bin/install -c +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-unknown-linux-gnu +host_triplet = x86_64-unknown-linux-gnu + +# These are good warnings to turn on by default, +am__append_1 = -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare +noinst_PROGRAMS = $(am__EXEEXT_1) +DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \ + $(dist_noinst_DATA) $(gflagsinclude_HEADERS) \ + $(googleinclude_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(top_srcdir)/configure \ + $(top_srcdir)/src/config.h.in \ + $(top_srcdir)/src/gflags/gflags.h.in \ + $(top_srcdir)/src/gflags/gflags_completions.h.in AUTHORS \ + COPYING ChangeLog INSTALL NEWS compile config.guess config.sub \ + depcomp install-sh ltmain.sh missing mkinstalldirs +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_have_attribute.m4 \ + $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/m4/google_namespace.m4 \ + $(top_srcdir)/m4/namespaces.m4 \ + $(top_srcdir)/m4/stl_namespace.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno configure.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = src/gflags/gflags.h \ + src/gflags/gflags_completions.h +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ + "$(DESTDIR)$(docdir)" "$(DESTDIR)$(gflagsincludedir)" \ + "$(DESTDIR)$(googleincludedir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libgflags_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am__objects_1 = +am__objects_2 = $(am__objects_1) libgflags_la-gflags.lo \ + libgflags_la-gflags_reporting.lo \ + libgflags_la-gflags_completions.lo +am_libgflags_la_OBJECTS = $(am__objects_2) +libgflags_la_OBJECTS = $(am_libgflags_la_OBJECTS) +libgflags_nothreads_la_LIBADD = +am__objects_3 = $(am__objects_1) libgflags_nothreads_la-gflags.lo \ + libgflags_nothreads_la-gflags_reporting.lo \ + libgflags_nothreads_la-gflags_completions.lo +am_libgflags_nothreads_la_OBJECTS = $(am__objects_3) +libgflags_nothreads_la_OBJECTS = $(am_libgflags_nothreads_la_OBJECTS) +am__EXEEXT_1 = gflags_unittest$(EXEEXT) \ + gflags_nothreads_unittest$(EXEEXT) gflags_unittest2$(EXEEXT) \ + gflags_unittest3$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) +am__objects_4 = $(am__objects_1) gflags_unittest.$(OBJEXT) +am_gflags_nothreads_unittest_OBJECTS = $(am__objects_4) +gflags_nothreads_unittest_OBJECTS = \ + $(am_gflags_nothreads_unittest_OBJECTS) +gflags_nothreads_unittest_DEPENDENCIES = libgflags_nothreads.la +am_gflags_unittest_OBJECTS = $(am__objects_1) \ + gflags_unittest-gflags_unittest.$(OBJEXT) +gflags_unittest_OBJECTS = $(am_gflags_unittest_OBJECTS) +gflags_unittest_DEPENDENCIES = libgflags.la +am_gflags_unittest2_OBJECTS = $(am__objects_1) \ + gflags_unittest-main.$(OBJEXT) +gflags_unittest2_OBJECTS = $(am_gflags_unittest2_OBJECTS) +gflags_unittest2_DEPENDENCIES = libgflags_nothreads.la +am_gflags_unittest3_OBJECTS = $(am__objects_1) \ + gflags_unittest_main.$(OBJEXT) +gflags_unittest3_OBJECTS = $(am_gflags_unittest3_OBJECTS) +gflags_unittest3_DEPENDENCIES = libgflags_nothreads.la +binSCRIPT_INSTALL = $(INSTALL_SCRIPT) +SCRIPTS = $(bin_SCRIPTS) $(noinst_SCRIPTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libgflags_la_SOURCES) $(libgflags_nothreads_la_SOURCES) \ + $(gflags_nothreads_unittest_SOURCES) \ + $(gflags_unittest_SOURCES) $(gflags_unittest2_SOURCES) \ + $(gflags_unittest3_SOURCES) +DIST_SOURCES = $(libgflags_la_SOURCES) \ + $(libgflags_nothreads_la_SOURCES) \ + $(gflags_nothreads_unittest_SOURCES) \ + $(gflags_unittest_SOURCES) $(gflags_unittest2_SOURCES) \ + $(gflags_unittest3_SOURCES) +dist_docDATA_INSTALL = $(INSTALL_DATA) +DATA = $(dist_doc_DATA) $(dist_noinst_DATA) +gflagsincludeHEADERS_INSTALL = $(INSTALL_HEADER) +googleincludeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(gflagsinclude_HEADERS) $(googleinclude_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = ${SHELL} /u/sgerrish/src1/topics/lib/util/gflags-1.1/missing --run aclocal-1.9 +AMDEP_FALSE = # +AMDEP_TRUE = +AMTAR = ${SHELL} /u/sgerrish/src1/topics/lib/util/gflags-1.1/missing --run tar +AR = ar +AUTOCONF = ${SHELL} /u/sgerrish/src1/topics/lib/util/gflags-1.1/missing --run autoconf +AUTOHEADER = ${SHELL} /u/sgerrish/src1/topics/lib/util/gflags-1.1/missing --run autoheader +AUTOMAKE = ${SHELL} /u/sgerrish/src1/topics/lib/util/gflags-1.1/missing --run automake-1.9 +AWK = gawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -g -O2 +CPP = gcc -E +CPPFLAGS = +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DSYMUTIL = +ECHO = echo +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /bin/grep -E +EXEEXT = +F77 = g77 +FFLAGS = -g -O2 +GCC_FALSE = # +GCC_TRUE = +GREP = /bin/grep +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s +LDFLAGS = +LIBOBJS = +LIBS = +LIBSTDCXX_LA_LINKER_FLAG = +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIBTOOL_DEPS = ./ltmain.sh +LN_S = ln -s +LTLIBOBJS = +MAKEINFO = ${SHELL} /u/sgerrish/src1/topics/lib/util/gflags-1.1/missing --run makeinfo +NMEDIT = +OBJEXT = o +PACKAGE = gflags +PACKAGE_BUGREPORT = opensource@google.com +PACKAGE_NAME = gflags +PACKAGE_STRING = gflags 1.1 +PACKAGE_TARNAME = gflags +PACKAGE_VERSION = 1.1 +PATH_SEPARATOR = : +PTHREAD_CC = gcc +PTHREAD_CFLAGS = -pthread +PTHREAD_LIBS = +RANLIB = ranlib +SED = /bin/sed +SET_MAKE = +SHELL = /bin/sh +STRIP = strip +VERSION = 1.1 +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_F77 = g77 +ac_cv___attribute__unused = __attribute__ ((unused)) +ac_cv_have___int16 = 0 +ac_cv_have_inttypes_h = 1 +ac_cv_have_stdint_h = 1 +ac_cv_have_systypes_h = 1 +ac_cv_have_u_int16_t = 1 +ac_cv_have_uint16_t = 1 +ac_google_end_namespace = } +ac_google_namespace = ::google +ac_google_start_namespace = namespace google { +acx_pthread_config = +am__fastdepCC_FALSE = # +am__fastdepCC_TRUE = +am__fastdepCXX_FALSE = # +am__fastdepCXX_TRUE = +am__include = include +am__leading_dot = . +am__quote = +am__tar = ${AMTAR} chof - "$$tardir" +am__untar = ${AMTAR} xf - +bindir = ${exec_prefix}/bin +build = x86_64-unknown-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = unknown +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION) +dvidir = ${docdir} +exec_prefix = ${prefix} +host = x86_64-unknown-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = unknown +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = /u/sgerrish/src1/topics/lib/util/gflags-1.1/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = mkdir -p -- +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /usr/local +program_transform_name = s,x,x, +psdir = ${docdir} +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +sysconfdir = ${prefix}/etc +target_alias = + +# Make sure that when we re-make ./configure, we get the macros we need +ACLOCAL_AMFLAGS = -I m4 + +# This is so we can #include <gflags/foo> +AM_CPPFLAGS = -I$(top_srcdir)/src + +# This is mostly based on configure options +AM_CXXFLAGS = $(am__append_1) + +# The -no-undefined flag allows libtool to generate shared libraries for +# Cygwin and MinGW. LIBSTDCXX_LA_LINKER_FLAG is used to fix a Solaris bug. +AM_LDFLAGS = -no-undefined $(LIBSTDCXX_LA_LINKER_FLAG) +gflagsincludedir = $(includedir)/gflags +gflagsinclude_HEADERS = src/gflags/gflags.h src/gflags/gflags_completions.h + +# This is for backwards compatibility only. +googleincludedir = $(includedir)/google +googleinclude_HEADERS = src/google/gflags.h src/google/gflags_completions.h +bin_SCRIPTS = src/gflags_completions.sh +dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README \ + doc/designstyle.css doc/gflags.html + +lib_LTLIBRARIES = libgflags.la libgflags_nothreads.la + +# Also make sure this works when we don't link in pthreads + +# We also want to test that things work properly when the file that +# holds main() has a name ending with -main or _main. To keep the +# Makefile small :-), we test the no-threads version of these. +TESTS = gflags_unittest$(EXEEXT) gflags_nothreads_unittest$(EXEEXT) \ + gflags_unittest2$(EXEEXT) gflags_unittest3$(EXEEXT) +TESTS_ENVIRONMENT = SRCDIR="$(top_srcdir)" + +# Some buggy sh's ignore "" instead of treating it as a positional +# parameter. Since we use "" in this script, we prefer bash if we +# can. If there's no bash, we fall back to sh. +check_SCRIPTS = gflags_unittest_sh +# Every time you add a unittest to check_SCRIPTS, add it here too +noinst_SCRIPTS = src/gflags_unittest.sh +# Used for auto-generated source files +CLEANFILES = src/gflags_unittest-main.cc src/gflags_unittest_main.cc +GFLAGS_SOURCES = $(gflagsinclude_HEADERS) src/config.h src/mutex.h \ + src/gflags.cc src/gflags_reporting.cc \ + src/gflags_completions.cc + +libgflags_la_SOURCES = $(GFLAGS_SOURCES) +libgflags_la_CXXFLAGS = $(PTHREAD_CFLAGS) -DNDEBUG +libgflags_la_LDFLAGS = $(PTHREAD_CFLAGS) +libgflags_la_LIBADD = $(PTHREAD_LIBS) +libgflags_nothreads_la_SOURCES = $(GFLAGS_SOURCES) +libgflags_nothreads_la_CXXFLAGS = -DNDEBUG -DNO_THREADS +gflags_unittest_SOURCES = $(gflagsinclude_HEADERS) src/config.h \ + src/gflags_unittest.cc + +gflags_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) +gflags_unittest_LDFLAGS = $(PTHREAD_CFLAGS) +gflags_unittest_LDADD = libgflags.la +gflags_nothreads_unittest_SOURCES = $(gflags_unittest_SOURCES) +gflags_nothreads_unittest_LDADD = libgflags_nothreads.la +gflags_unittest2_SOURCES = $(gflagsinclude_HEADERS) src/config.h \ + src/gflags_unittest-main.cc + +gflags_unittest2_LDADD = libgflags_nothreads.la +gflags_unittest3_SOURCES = $(gflagsinclude_HEADERS) src/config.h \ + src/gflags_unittest_main.cc + +gflags_unittest3_LDADD = libgflags_nothreads.la +dist_noinst_DATA = src/gflags_unittest_flagfile + +# These aren't part of the c++ source, but we want them to be distributed +PYTHON = python/setup.py \ + python/gflags.py \ + python/gflags2man.py \ + python/gflags_unittest.py \ + python/test_module_foo.py \ + python/test_module_bar.py + +EXTRA_DIST = packages/rpm.sh packages/rpm/rpm.spec packages/deb.sh packages/deb \ + libtool $(SCRIPTS) $(PYTHON) \ + src/solaris/libstdc++.la + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +src/config.h: src/stamp-h1 + @if test ! -f $@; then \ + rm -f src/stamp-h1; \ + $(MAKE) src/stamp-h1; \ + else :; fi + +src/stamp-h1: $(top_srcdir)/src/config.h.in $(top_builddir)/config.status + @rm -f src/stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status src/config.h +$(top_srcdir)/src/config.h.in: $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f src/stamp-h1 + touch $@ + +distclean-hdr: + -rm -f src/config.h src/stamp-h1 +src/gflags/gflags.h: $(top_builddir)/config.status $(top_srcdir)/src/gflags/gflags.h.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +src/gflags/gflags_completions.h: $(top_builddir)/config.status $(top_srcdir)/src/gflags/gflags_completions.h.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libgflags.la: $(libgflags_la_OBJECTS) $(libgflags_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libgflags_la_LDFLAGS) $(libgflags_la_OBJECTS) $(libgflags_la_LIBADD) $(LIBS) +libgflags_nothreads.la: $(libgflags_nothreads_la_OBJECTS) $(libgflags_nothreads_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libgflags_nothreads_la_LDFLAGS) $(libgflags_nothreads_la_OBJECTS) $(libgflags_nothreads_la_LIBADD) $(LIBS) + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +gflags_nothreads_unittest$(EXEEXT): $(gflags_nothreads_unittest_OBJECTS) $(gflags_nothreads_unittest_DEPENDENCIES) + @rm -f gflags_nothreads_unittest$(EXEEXT) + $(CXXLINK) $(gflags_nothreads_unittest_LDFLAGS) $(gflags_nothreads_unittest_OBJECTS) $(gflags_nothreads_unittest_LDADD) $(LIBS) +gflags_unittest$(EXEEXT): $(gflags_unittest_OBJECTS) $(gflags_unittest_DEPENDENCIES) + @rm -f gflags_unittest$(EXEEXT) + $(CXXLINK) $(gflags_unittest_LDFLAGS) $(gflags_unittest_OBJECTS) $(gflags_unittest_LDADD) $(LIBS) +gflags_unittest2$(EXEEXT): $(gflags_unittest2_OBJECTS) $(gflags_unittest2_DEPENDENCIES) + @rm -f gflags_unittest2$(EXEEXT) + $(CXXLINK) $(gflags_unittest2_LDFLAGS) $(gflags_unittest2_OBJECTS) $(gflags_unittest2_LDADD) $(LIBS) +gflags_unittest3$(EXEEXT): $(gflags_unittest3_OBJECTS) $(gflags_unittest3_DEPENDENCIES) + @rm -f gflags_unittest3$(EXEEXT) + $(CXXLINK) $(gflags_unittest3_LDFLAGS) $(gflags_unittest3_OBJECTS) $(gflags_unittest3_LDADD) $(LIBS) +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f $$d$$p; then \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " $(binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \ + else :; fi; \ + done + +uninstall-binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/gflags_unittest-gflags_unittest.Po +include ./$(DEPDIR)/gflags_unittest-main.Po +include ./$(DEPDIR)/gflags_unittest.Po +include ./$(DEPDIR)/gflags_unittest_main.Po +include ./$(DEPDIR)/libgflags_la-gflags.Plo +include ./$(DEPDIR)/libgflags_la-gflags_completions.Plo +include ./$(DEPDIR)/libgflags_la-gflags_reporting.Plo +include ./$(DEPDIR)/libgflags_nothreads_la-gflags.Plo +include ./$(DEPDIR)/libgflags_nothreads_la-gflags_completions.Plo +include ./$(DEPDIR)/libgflags_nothreads_la-gflags_reporting.Plo + +.cc.o: + if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(CXXCOMPILE) -c -o $@ $< + +.cc.obj: + if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: + if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +# source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(LTCXXCOMPILE) -c -o $@ $< + +libgflags_la-gflags.lo: src/gflags.cc + if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_la_CXXFLAGS) $(CXXFLAGS) -MT libgflags_la-gflags.lo -MD -MP -MF "$(DEPDIR)/libgflags_la-gflags.Tpo" -c -o libgflags_la-gflags.lo `test -f 'src/gflags.cc' || echo '$(srcdir)/'`src/gflags.cc; \ + then mv -f "$(DEPDIR)/libgflags_la-gflags.Tpo" "$(DEPDIR)/libgflags_la-gflags.Plo"; else rm -f "$(DEPDIR)/libgflags_la-gflags.Tpo"; exit 1; fi +# source='src/gflags.cc' object='libgflags_la-gflags.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_la_CXXFLAGS) $(CXXFLAGS) -c -o libgflags_la-gflags.lo `test -f 'src/gflags.cc' || echo '$(srcdir)/'`src/gflags.cc + +libgflags_la-gflags_reporting.lo: src/gflags_reporting.cc + if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_la_CXXFLAGS) $(CXXFLAGS) -MT libgflags_la-gflags_reporting.lo -MD -MP -MF "$(DEPDIR)/libgflags_la-gflags_reporting.Tpo" -c -o libgflags_la-gflags_reporting.lo `test -f 'src/gflags_reporting.cc' || echo '$(srcdir)/'`src/gflags_reporting.cc; \ + then mv -f "$(DEPDIR)/libgflags_la-gflags_reporting.Tpo" "$(DEPDIR)/libgflags_la-gflags_reporting.Plo"; else rm -f "$(DEPDIR)/libgflags_la-gflags_reporting.Tpo"; exit 1; fi +# source='src/gflags_reporting.cc' object='libgflags_la-gflags_reporting.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_la_CXXFLAGS) $(CXXFLAGS) -c -o libgflags_la-gflags_reporting.lo `test -f 'src/gflags_reporting.cc' || echo '$(srcdir)/'`src/gflags_reporting.cc + +libgflags_la-gflags_completions.lo: src/gflags_completions.cc + if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_la_CXXFLAGS) $(CXXFLAGS) -MT libgflags_la-gflags_completions.lo -MD -MP -MF "$(DEPDIR)/libgflags_la-gflags_completions.Tpo" -c -o libgflags_la-gflags_completions.lo `test -f 'src/gflags_completions.cc' || echo '$(srcdir)/'`src/gflags_completions.cc; \ + then mv -f "$(DEPDIR)/libgflags_la-gflags_completions.Tpo" "$(DEPDIR)/libgflags_la-gflags_completions.Plo"; else rm -f "$(DEPDIR)/libgflags_la-gflags_completions.Tpo"; exit 1; fi +# source='src/gflags_completions.cc' object='libgflags_la-gflags_completions.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_la_CXXFLAGS) $(CXXFLAGS) -c -o libgflags_la-gflags_completions.lo `test -f 'src/gflags_completions.cc' || echo '$(srcdir)/'`src/gflags_completions.cc + +libgflags_nothreads_la-gflags.lo: src/gflags.cc + if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_nothreads_la_CXXFLAGS) $(CXXFLAGS) -MT libgflags_nothreads_la-gflags.lo -MD -MP -MF "$(DEPDIR)/libgflags_nothreads_la-gflags.Tpo" -c -o libgflags_nothreads_la-gflags.lo `test -f 'src/gflags.cc' || echo '$(srcdir)/'`src/gflags.cc; \ + then mv -f "$(DEPDIR)/libgflags_nothreads_la-gflags.Tpo" "$(DEPDIR)/libgflags_nothreads_la-gflags.Plo"; else rm -f "$(DEPDIR)/libgflags_nothreads_la-gflags.Tpo"; exit 1; fi +# source='src/gflags.cc' object='libgflags_nothreads_la-gflags.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_nothreads_la_CXXFLAGS) $(CXXFLAGS) -c -o libgflags_nothreads_la-gflags.lo `test -f 'src/gflags.cc' || echo '$(srcdir)/'`src/gflags.cc + +libgflags_nothreads_la-gflags_reporting.lo: src/gflags_reporting.cc + if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_nothreads_la_CXXFLAGS) $(CXXFLAGS) -MT libgflags_nothreads_la-gflags_reporting.lo -MD -MP -MF "$(DEPDIR)/libgflags_nothreads_la-gflags_reporting.Tpo" -c -o libgflags_nothreads_la-gflags_reporting.lo `test -f 'src/gflags_reporting.cc' || echo '$(srcdir)/'`src/gflags_reporting.cc; \ + then mv -f "$(DEPDIR)/libgflags_nothreads_la-gflags_reporting.Tpo" "$(DEPDIR)/libgflags_nothreads_la-gflags_reporting.Plo"; else rm -f "$(DEPDIR)/libgflags_nothreads_la-gflags_reporting.Tpo"; exit 1; fi +# source='src/gflags_reporting.cc' object='libgflags_nothreads_la-gflags_reporting.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_nothreads_la_CXXFLAGS) $(CXXFLAGS) -c -o libgflags_nothreads_la-gflags_reporting.lo `test -f 'src/gflags_reporting.cc' || echo '$(srcdir)/'`src/gflags_reporting.cc + +libgflags_nothreads_la-gflags_completions.lo: src/gflags_completions.cc + if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_nothreads_la_CXXFLAGS) $(CXXFLAGS) -MT libgflags_nothreads_la-gflags_completions.lo -MD -MP -MF "$(DEPDIR)/libgflags_nothreads_la-gflags_completions.Tpo" -c -o libgflags_nothreads_la-gflags_completions.lo `test -f 'src/gflags_completions.cc' || echo '$(srcdir)/'`src/gflags_completions.cc; \ + then mv -f "$(DEPDIR)/libgflags_nothreads_la-gflags_completions.Tpo" "$(DEPDIR)/libgflags_nothreads_la-gflags_completions.Plo"; else rm -f "$(DEPDIR)/libgflags_nothreads_la-gflags_completions.Tpo"; exit 1; fi +# source='src/gflags_completions.cc' object='libgflags_nothreads_la-gflags_completions.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_nothreads_la_CXXFLAGS) $(CXXFLAGS) -c -o libgflags_nothreads_la-gflags_completions.lo `test -f 'src/gflags_completions.cc' || echo '$(srcdir)/'`src/gflags_completions.cc + +gflags_unittest.o: src/gflags_unittest.cc + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gflags_unittest.o -MD -MP -MF "$(DEPDIR)/gflags_unittest.Tpo" -c -o gflags_unittest.o `test -f 'src/gflags_unittest.cc' || echo '$(srcdir)/'`src/gflags_unittest.cc; \ + then mv -f "$(DEPDIR)/gflags_unittest.Tpo" "$(DEPDIR)/gflags_unittest.Po"; else rm -f "$(DEPDIR)/gflags_unittest.Tpo"; exit 1; fi +# source='src/gflags_unittest.cc' object='gflags_unittest.o' libtool=no \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gflags_unittest.o `test -f 'src/gflags_unittest.cc' || echo '$(srcdir)/'`src/gflags_unittest.cc + +gflags_unittest.obj: src/gflags_unittest.cc + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gflags_unittest.obj -MD -MP -MF "$(DEPDIR)/gflags_unittest.Tpo" -c -o gflags_unittest.obj `if test -f 'src/gflags_unittest.cc'; then $(CYGPATH_W) 'src/gflags_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/src/gflags_unittest.cc'; fi`; \ + then mv -f "$(DEPDIR)/gflags_unittest.Tpo" "$(DEPDIR)/gflags_unittest.Po"; else rm -f "$(DEPDIR)/gflags_unittest.Tpo"; exit 1; fi +# source='src/gflags_unittest.cc' object='gflags_unittest.obj' libtool=no \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gflags_unittest.obj `if test -f 'src/gflags_unittest.cc'; then $(CYGPATH_W) 'src/gflags_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/src/gflags_unittest.cc'; fi` + +gflags_unittest-gflags_unittest.o: src/gflags_unittest.cc + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gflags_unittest_CXXFLAGS) $(CXXFLAGS) -MT gflags_unittest-gflags_unittest.o -MD -MP -MF "$(DEPDIR)/gflags_unittest-gflags_unittest.Tpo" -c -o gflags_unittest-gflags_unittest.o `test -f 'src/gflags_unittest.cc' || echo '$(srcdir)/'`src/gflags_unittest.cc; \ + then mv -f "$(DEPDIR)/gflags_unittest-gflags_unittest.Tpo" "$(DEPDIR)/gflags_unittest-gflags_unittest.Po"; else rm -f "$(DEPDIR)/gflags_unittest-gflags_unittest.Tpo"; exit 1; fi +# source='src/gflags_unittest.cc' object='gflags_unittest-gflags_unittest.o' libtool=no \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gflags_unittest_CXXFLAGS) $(CXXFLAGS) -c -o gflags_unittest-gflags_unittest.o `test -f 'src/gflags_unittest.cc' || echo '$(srcdir)/'`src/gflags_unittest.cc + +gflags_unittest-gflags_unittest.obj: src/gflags_unittest.cc + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gflags_unittest_CXXFLAGS) $(CXXFLAGS) -MT gflags_unittest-gflags_unittest.obj -MD -MP -MF "$(DEPDIR)/gflags_unittest-gflags_unittest.Tpo" -c -o gflags_unittest-gflags_unittest.obj `if test -f 'src/gflags_unittest.cc'; then $(CYGPATH_W) 'src/gflags_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/src/gflags_unittest.cc'; fi`; \ + then mv -f "$(DEPDIR)/gflags_unittest-gflags_unittest.Tpo" "$(DEPDIR)/gflags_unittest-gflags_unittest.Po"; else rm -f "$(DEPDIR)/gflags_unittest-gflags_unittest.Tpo"; exit 1; fi +# source='src/gflags_unittest.cc' object='gflags_unittest-gflags_unittest.obj' libtool=no \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gflags_unittest_CXXFLAGS) $(CXXFLAGS) -c -o gflags_unittest-gflags_unittest.obj `if test -f 'src/gflags_unittest.cc'; then $(CYGPATH_W) 'src/gflags_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/src/gflags_unittest.cc'; fi` + +gflags_unittest-main.o: src/gflags_unittest-main.cc + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gflags_unittest-main.o -MD -MP -MF "$(DEPDIR)/gflags_unittest-main.Tpo" -c -o gflags_unittest-main.o `test -f 'src/gflags_unittest-main.cc' || echo '$(srcdir)/'`src/gflags_unittest-main.cc; \ + then mv -f "$(DEPDIR)/gflags_unittest-main.Tpo" "$(DEPDIR)/gflags_unittest-main.Po"; else rm -f "$(DEPDIR)/gflags_unittest-main.Tpo"; exit 1; fi +# source='src/gflags_unittest-main.cc' object='gflags_unittest-main.o' libtool=no \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gflags_unittest-main.o `test -f 'src/gflags_unittest-main.cc' || echo '$(srcdir)/'`src/gflags_unittest-main.cc + +gflags_unittest-main.obj: src/gflags_unittest-main.cc + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gflags_unittest-main.obj -MD -MP -MF "$(DEPDIR)/gflags_unittest-main.Tpo" -c -o gflags_unittest-main.obj `if test -f 'src/gflags_unittest-main.cc'; then $(CYGPATH_W) 'src/gflags_unittest-main.cc'; else $(CYGPATH_W) '$(srcdir)/src/gflags_unittest-main.cc'; fi`; \ + then mv -f "$(DEPDIR)/gflags_unittest-main.Tpo" "$(DEPDIR)/gflags_unittest-main.Po"; else rm -f "$(DEPDIR)/gflags_unittest-main.Tpo"; exit 1; fi +# source='src/gflags_unittest-main.cc' object='gflags_unittest-main.obj' libtool=no \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gflags_unittest-main.obj `if test -f 'src/gflags_unittest-main.cc'; then $(CYGPATH_W) 'src/gflags_unittest-main.cc'; else $(CYGPATH_W) '$(srcdir)/src/gflags_unittest-main.cc'; fi` + +gflags_unittest_main.o: src/gflags_unittest_main.cc + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gflags_unittest_main.o -MD -MP -MF "$(DEPDIR)/gflags_unittest_main.Tpo" -c -o gflags_unittest_main.o `test -f 'src/gflags_unittest_main.cc' || echo '$(srcdir)/'`src/gflags_unittest_main.cc; \ + then mv -f "$(DEPDIR)/gflags_unittest_main.Tpo" "$(DEPDIR)/gflags_unittest_main.Po"; else rm -f "$(DEPDIR)/gflags_unittest_main.Tpo"; exit 1; fi +# source='src/gflags_unittest_main.cc' object='gflags_unittest_main.o' libtool=no \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gflags_unittest_main.o `test -f 'src/gflags_unittest_main.cc' || echo '$(srcdir)/'`src/gflags_unittest_main.cc + +gflags_unittest_main.obj: src/gflags_unittest_main.cc + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gflags_unittest_main.obj -MD -MP -MF "$(DEPDIR)/gflags_unittest_main.Tpo" -c -o gflags_unittest_main.obj `if test -f 'src/gflags_unittest_main.cc'; then $(CYGPATH_W) 'src/gflags_unittest_main.cc'; else $(CYGPATH_W) '$(srcdir)/src/gflags_unittest_main.cc'; fi`; \ + then mv -f "$(DEPDIR)/gflags_unittest_main.Tpo" "$(DEPDIR)/gflags_unittest_main.Po"; else rm -f "$(DEPDIR)/gflags_unittest_main.Tpo"; exit 1; fi +# source='src/gflags_unittest_main.cc' object='gflags_unittest_main.obj' libtool=no \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gflags_unittest_main.obj `if test -f 'src/gflags_unittest_main.cc'; then $(CYGPATH_W) 'src/gflags_unittest_main.cc'; else $(CYGPATH_W) '$(srcdir)/src/gflags_unittest_main.cc'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-dist_docDATA: $(dist_doc_DATA) + @$(NORMAL_INSTALL) + test -z "$(docdir)" || $(mkdir_p) "$(DESTDIR)$(docdir)" + @list='$(dist_doc_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(dist_docDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docdir)/$$f'"; \ + $(dist_docDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docdir)/$$f"; \ + done + +uninstall-dist_docDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_doc_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(docdir)/$$f'"; \ + rm -f "$(DESTDIR)$(docdir)/$$f"; \ + done +install-gflagsincludeHEADERS: $(gflagsinclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(gflagsincludedir)" || $(mkdir_p) "$(DESTDIR)$(gflagsincludedir)" + @list='$(gflagsinclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(gflagsincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(gflagsincludedir)/$$f'"; \ + $(gflagsincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(gflagsincludedir)/$$f"; \ + done + +uninstall-gflagsincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(gflagsinclude_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(gflagsincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(gflagsincludedir)/$$f"; \ + done +install-googleincludeHEADERS: $(googleinclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(googleincludedir)" || $(mkdir_p) "$(DESTDIR)$(googleincludedir)" + @list='$(googleinclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(googleincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(googleincludedir)/$$f'"; \ + $(googleincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(googleincludedir)/$$f"; \ + done + +uninstall-googleincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(googleinclude_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(googleincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(googleincludedir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list='$(TESTS)'; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + echo "SKIP: $$tst"; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + skipped="($$skip tests were not run)"; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + $(mkdir_p) $(distdir)/doc $(distdir)/m4 $(distdir)/packages $(distdir)/packages/rpm $(distdir)/python $(distdir)/src $(distdir)/src/gflags $(distdir)/src/google $(distdir)/src/solaris + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(DATA) \ + $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(gflagsincludedir)" "$(DESTDIR)$(googleincludedir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-dist_docDATA install-gflagsincludeHEADERS \ + install-googleincludeHEADERS + +install-exec-am: install-binSCRIPTS install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binSCRIPTS uninstall-dist_docDATA \ + uninstall-gflagsincludeHEADERS uninstall-googleincludeHEADERS \ + uninstall-info-am uninstall-libLTLIBRARIES + +.PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \ + clean clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-noinstPROGRAMS ctags dist dist-all dist-bzip2 dist-gzip \ + dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-compile distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-binSCRIPTS install-data \ + install-data-am install-dist_docDATA install-exec \ + install-exec-am install-gflagsincludeHEADERS \ + install-googleincludeHEADERS install-info install-info-am \ + install-libLTLIBRARIES install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binSCRIPTS \ + uninstall-dist_docDATA uninstall-gflagsincludeHEADERS \ + uninstall-googleincludeHEADERS uninstall-info-am \ + uninstall-libLTLIBRARIES + +src/gflags_unittest-main.cc: src/gflags_unittest.cc + rm -f src/gflags_unittest-main.cc + cp -p src/gflags_unittest.cc src/gflags_unittest-main.cc +src/gflags_unittest_main.cc: src/gflags_unittest.cc + rm -f src/gflags_unittest_main.cc + cp -p src/gflags_unittest.cc src/gflags_unittest_main.cc +gflags_unittest_sh: gflags_unittest$(EXEEXT) \ + gflags_unittest2$(EXEEXT) \ + gflags_unittest3$(EXEEXT) + bash --version >/dev/null && export SH=bash || export SH=sh; \ + $$SH "$(top_srcdir)/src/gflags_unittest.sh" "$(PWD)/gflags_unittest" \ + "$(top_srcdir)" + +rpm: dist-gzip packages/rpm.sh packages/rpm/rpm.spec + @cd packages && ./rpm.sh ${PACKAGE} ${VERSION} + +deb: dist-gzip packages/deb.sh packages/deb/* + @cd packages && ./deb.sh ${PACKAGE} ${VERSION} + +libtool: $(LIBTOOL_DEPS) + $(SHELL) ./config.status --recheck +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/dtm_release/lib/util/gflags-1.1/Makefile.am b/dtm_release/lib/util/gflags-1.1/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..d0db111daebceaf564a00e0a1746942d9079373d --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/Makefile.am @@ -0,0 +1,142 @@ +## Process this file with automake to produce Makefile.in + +# Make sure that when we re-make ./configure, we get the macros we need +ACLOCAL_AMFLAGS = -I m4 + +# This is so we can #include <gflags/foo> +AM_CPPFLAGS = -I$(top_srcdir)/src + +# This is mostly based on configure options +AM_CXXFLAGS = + +# These are good warnings to turn on by default, +if GCC +AM_CXXFLAGS += -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare +endif + +# The -no-undefined flag allows libtool to generate shared libraries for +# Cygwin and MinGW. LIBSTDCXX_LA_LINKER_FLAG is used to fix a Solaris bug. +AM_LDFLAGS = -no-undefined $(LIBSTDCXX_LA_LINKER_FLAG) + +gflagsincludedir = $(includedir)/gflags +## The .h files you want to install (that is, .h files that people +## who install this package can include in their own applications.) +gflagsinclude_HEADERS = src/gflags/gflags.h src/gflags/gflags_completions.h + +# This is for backwards compatibility only. +googleincludedir = $(includedir)/google +googleinclude_HEADERS = src/google/gflags.h src/google/gflags_completions.h + +bin_SCRIPTS = src/gflags_completions.sh + +docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION) +## This is for HTML and other documentation you want to install. +## Add your documentation files (in doc/) in addition to these +## top-level boilerplate files. Also add a TODO file if you have one. +dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README \ + doc/designstyle.css doc/gflags.html + +## The libraries (.so's) you want to install +lib_LTLIBRARIES = + +## unittests you want to run when people type 'make check'. +## TESTS is for binary unittests, check_SCRIPTS for script-based unittests. +## TESTS_ENVIRONMENT sets environment variables for when you run unittest, +## but it only seems to take effect for *binary* unittests (argh!) +TESTS = +TESTS_ENVIRONMENT = SRCDIR="$(top_srcdir)" +check_SCRIPTS = +# Every time you add a unittest to check_SCRIPTS, add it here too +noinst_SCRIPTS = +# Used for auto-generated source files +CLEANFILES = + +## vvvv RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS + +GFLAGS_SOURCES = $(gflagsinclude_HEADERS) src/config.h src/mutex.h \ + src/gflags.cc src/gflags_reporting.cc \ + src/gflags_completions.cc + +lib_LTLIBRARIES += libgflags.la +libgflags_la_SOURCES = $(GFLAGS_SOURCES) +libgflags_la_CXXFLAGS = $(PTHREAD_CFLAGS) -DNDEBUG +libgflags_la_LDFLAGS = $(PTHREAD_CFLAGS) +libgflags_la_LIBADD = $(PTHREAD_LIBS) + +lib_LTLIBRARIES += libgflags_nothreads.la +libgflags_nothreads_la_SOURCES = $(GFLAGS_SOURCES) +libgflags_nothreads_la_CXXFLAGS = -DNDEBUG -DNO_THREADS + +TESTS += gflags_unittest$(EXEEXT) +gflags_unittest_SOURCES = $(gflagsinclude_HEADERS) src/config.h \ + src/gflags_unittest.cc +gflags_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) +gflags_unittest_LDFLAGS = $(PTHREAD_CFLAGS) +gflags_unittest_LDADD = libgflags.la + +# Also make sure this works when we don't link in pthreads +TESTS += gflags_nothreads_unittest$(EXEEXT) +gflags_nothreads_unittest_SOURCES = $(gflags_unittest_SOURCES) +gflags_nothreads_unittest_LDADD = libgflags_nothreads.la + +# We also want to test that things work properly when the file that +# holds main() has a name ending with -main or _main. To keep the +# Makefile small :-), we test the no-threads version of these. +TESTS += gflags_unittest2$(EXEEXT) +gflags_unittest2_SOURCES = $(gflagsinclude_HEADERS) src/config.h \ + src/gflags_unittest-main.cc +gflags_unittest2_LDADD = libgflags_nothreads.la +src/gflags_unittest-main.cc: src/gflags_unittest.cc + rm -f src/gflags_unittest-main.cc + cp -p src/gflags_unittest.cc src/gflags_unittest-main.cc +CLEANFILES += src/gflags_unittest-main.cc + +TESTS += gflags_unittest3$(EXEEXT) +gflags_unittest3_SOURCES = $(gflagsinclude_HEADERS) src/config.h \ + src/gflags_unittest_main.cc +gflags_unittest3_LDADD = libgflags_nothreads.la +src/gflags_unittest_main.cc: src/gflags_unittest.cc + rm -f src/gflags_unittest_main.cc + cp -p src/gflags_unittest.cc src/gflags_unittest_main.cc +CLEANFILES += src/gflags_unittest_main.cc + +# Some buggy sh's ignore "" instead of treating it as a positional +# parameter. Since we use "" in this script, we prefer bash if we +# can. If there's no bash, we fall back to sh. +check_SCRIPTS += gflags_unittest_sh +noinst_SCRIPTS += src/gflags_unittest.sh +dist_noinst_DATA = src/gflags_unittest_flagfile +gflags_unittest_sh: gflags_unittest$(EXEEXT) \ + gflags_unittest2$(EXEEXT) \ + gflags_unittest3$(EXEEXT) + bash --version >/dev/null && export SH=bash || export SH=sh; \ + $$SH "$(top_srcdir)/src/gflags_unittest.sh" "$(PWD)/gflags_unittest" \ + "$(top_srcdir)" + +# These aren't part of the c++ source, but we want them to be distributed +PYTHON = python/setup.py \ + python/gflags.py \ + python/gflags2man.py \ + python/gflags_unittest.py \ + python/test_module_foo.py \ + python/test_module_bar.py + + +## ^^^^ END OF RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS + + +## This should always include $(TESTS), but may also include other +## binaries that you compile but don't want automatically installed. +noinst_PROGRAMS = $(TESTS) + +rpm: dist-gzip packages/rpm.sh packages/rpm/rpm.spec + @cd packages && ./rpm.sh ${PACKAGE} ${VERSION} + +deb: dist-gzip packages/deb.sh packages/deb/* + @cd packages && ./deb.sh ${PACKAGE} ${VERSION} + +libtool: $(LIBTOOL_DEPS) + $(SHELL) ./config.status --recheck +EXTRA_DIST = packages/rpm.sh packages/rpm/rpm.spec packages/deb.sh packages/deb \ + libtool $(SCRIPTS) $(PYTHON) \ + src/solaris/libstdc++.la diff --git a/dtm_release/lib/util/gflags-1.1/Makefile.in b/dtm_release/lib/util/gflags-1.1/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..39bc78fc2574bbfd864247026c3533ca6eb88f30 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/Makefile.in @@ -0,0 +1,1077 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + + + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = . +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ + +# These are good warnings to turn on by default, +@GCC_TRUE@am__append_1 = -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare +noinst_PROGRAMS = $(am__EXEEXT_1) +DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \ + $(dist_noinst_DATA) $(gflagsinclude_HEADERS) \ + $(googleinclude_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(top_srcdir)/configure \ + $(top_srcdir)/src/config.h.in \ + $(top_srcdir)/src/gflags/gflags.h.in \ + $(top_srcdir)/src/gflags/gflags_completions.h.in AUTHORS \ + COPYING ChangeLog INSTALL NEWS compile config.guess config.sub \ + depcomp install-sh ltmain.sh missing mkinstalldirs +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_have_attribute.m4 \ + $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/m4/google_namespace.m4 \ + $(top_srcdir)/m4/namespaces.m4 \ + $(top_srcdir)/m4/stl_namespace.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno configure.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = src/gflags/gflags.h \ + src/gflags/gflags_completions.h +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ + "$(DESTDIR)$(docdir)" "$(DESTDIR)$(gflagsincludedir)" \ + "$(DESTDIR)$(googleincludedir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libgflags_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am__objects_1 = +am__objects_2 = $(am__objects_1) libgflags_la-gflags.lo \ + libgflags_la-gflags_reporting.lo \ + libgflags_la-gflags_completions.lo +am_libgflags_la_OBJECTS = $(am__objects_2) +libgflags_la_OBJECTS = $(am_libgflags_la_OBJECTS) +libgflags_nothreads_la_LIBADD = +am__objects_3 = $(am__objects_1) libgflags_nothreads_la-gflags.lo \ + libgflags_nothreads_la-gflags_reporting.lo \ + libgflags_nothreads_la-gflags_completions.lo +am_libgflags_nothreads_la_OBJECTS = $(am__objects_3) +libgflags_nothreads_la_OBJECTS = $(am_libgflags_nothreads_la_OBJECTS) +am__EXEEXT_1 = gflags_unittest$(EXEEXT) \ + gflags_nothreads_unittest$(EXEEXT) gflags_unittest2$(EXEEXT) \ + gflags_unittest3$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) +am__objects_4 = $(am__objects_1) gflags_unittest.$(OBJEXT) +am_gflags_nothreads_unittest_OBJECTS = $(am__objects_4) +gflags_nothreads_unittest_OBJECTS = \ + $(am_gflags_nothreads_unittest_OBJECTS) +gflags_nothreads_unittest_DEPENDENCIES = libgflags_nothreads.la +am_gflags_unittest_OBJECTS = $(am__objects_1) \ + gflags_unittest-gflags_unittest.$(OBJEXT) +gflags_unittest_OBJECTS = $(am_gflags_unittest_OBJECTS) +gflags_unittest_DEPENDENCIES = libgflags.la +am_gflags_unittest2_OBJECTS = $(am__objects_1) \ + gflags_unittest-main.$(OBJEXT) +gflags_unittest2_OBJECTS = $(am_gflags_unittest2_OBJECTS) +gflags_unittest2_DEPENDENCIES = libgflags_nothreads.la +am_gflags_unittest3_OBJECTS = $(am__objects_1) \ + gflags_unittest_main.$(OBJEXT) +gflags_unittest3_OBJECTS = $(am_gflags_unittest3_OBJECTS) +gflags_unittest3_DEPENDENCIES = libgflags_nothreads.la +binSCRIPT_INSTALL = $(INSTALL_SCRIPT) +SCRIPTS = $(bin_SCRIPTS) $(noinst_SCRIPTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libgflags_la_SOURCES) $(libgflags_nothreads_la_SOURCES) \ + $(gflags_nothreads_unittest_SOURCES) \ + $(gflags_unittest_SOURCES) $(gflags_unittest2_SOURCES) \ + $(gflags_unittest3_SOURCES) +DIST_SOURCES = $(libgflags_la_SOURCES) \ + $(libgflags_nothreads_la_SOURCES) \ + $(gflags_nothreads_unittest_SOURCES) \ + $(gflags_unittest_SOURCES) $(gflags_unittest2_SOURCES) \ + $(gflags_unittest3_SOURCES) +dist_docDATA_INSTALL = $(INSTALL_DATA) +DATA = $(dist_doc_DATA) $(dist_noinst_DATA) +gflagsincludeHEADERS_INSTALL = $(INSTALL_HEADER) +googleincludeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(gflagsinclude_HEADERS) $(googleinclude_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GCC_FALSE = @GCC_FALSE@ +GCC_TRUE = @GCC_TRUE@ +GREP = @GREP@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSTDCXX_LA_LINKER_FLAG = @LIBSTDCXX_LA_LINKER_FLAG@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_cv___attribute__unused = @ac_cv___attribute__unused@ +ac_cv_have___int16 = @ac_cv_have___int16@ +ac_cv_have_inttypes_h = @ac_cv_have_inttypes_h@ +ac_cv_have_stdint_h = @ac_cv_have_stdint_h@ +ac_cv_have_systypes_h = @ac_cv_have_systypes_h@ +ac_cv_have_u_int16_t = @ac_cv_have_u_int16_t@ +ac_cv_have_uint16_t = @ac_cv_have_uint16_t@ +ac_google_end_namespace = @ac_google_end_namespace@ +ac_google_namespace = @ac_google_namespace@ +ac_google_start_namespace = @ac_google_start_namespace@ +acx_pthread_config = @acx_pthread_config@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION) +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ + +# Make sure that when we re-make ./configure, we get the macros we need +ACLOCAL_AMFLAGS = -I m4 + +# This is so we can #include <gflags/foo> +AM_CPPFLAGS = -I$(top_srcdir)/src + +# This is mostly based on configure options +AM_CXXFLAGS = $(am__append_1) + +# The -no-undefined flag allows libtool to generate shared libraries for +# Cygwin and MinGW. LIBSTDCXX_LA_LINKER_FLAG is used to fix a Solaris bug. +AM_LDFLAGS = -no-undefined $(LIBSTDCXX_LA_LINKER_FLAG) +gflagsincludedir = $(includedir)/gflags +gflagsinclude_HEADERS = src/gflags/gflags.h src/gflags/gflags_completions.h + +# This is for backwards compatibility only. +googleincludedir = $(includedir)/google +googleinclude_HEADERS = src/google/gflags.h src/google/gflags_completions.h +bin_SCRIPTS = src/gflags_completions.sh +dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README \ + doc/designstyle.css doc/gflags.html + +lib_LTLIBRARIES = libgflags.la libgflags_nothreads.la + +# Also make sure this works when we don't link in pthreads + +# We also want to test that things work properly when the file that +# holds main() has a name ending with -main or _main. To keep the +# Makefile small :-), we test the no-threads version of these. +TESTS = gflags_unittest$(EXEEXT) gflags_nothreads_unittest$(EXEEXT) \ + gflags_unittest2$(EXEEXT) gflags_unittest3$(EXEEXT) +TESTS_ENVIRONMENT = SRCDIR="$(top_srcdir)" + +# Some buggy sh's ignore "" instead of treating it as a positional +# parameter. Since we use "" in this script, we prefer bash if we +# can. If there's no bash, we fall back to sh. +check_SCRIPTS = gflags_unittest_sh +# Every time you add a unittest to check_SCRIPTS, add it here too +noinst_SCRIPTS = src/gflags_unittest.sh +# Used for auto-generated source files +CLEANFILES = src/gflags_unittest-main.cc src/gflags_unittest_main.cc +GFLAGS_SOURCES = $(gflagsinclude_HEADERS) src/config.h src/mutex.h \ + src/gflags.cc src/gflags_reporting.cc \ + src/gflags_completions.cc + +libgflags_la_SOURCES = $(GFLAGS_SOURCES) +libgflags_la_CXXFLAGS = $(PTHREAD_CFLAGS) -DNDEBUG +libgflags_la_LDFLAGS = $(PTHREAD_CFLAGS) +libgflags_la_LIBADD = $(PTHREAD_LIBS) +libgflags_nothreads_la_SOURCES = $(GFLAGS_SOURCES) +libgflags_nothreads_la_CXXFLAGS = -DNDEBUG -DNO_THREADS +gflags_unittest_SOURCES = $(gflagsinclude_HEADERS) src/config.h \ + src/gflags_unittest.cc + +gflags_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) +gflags_unittest_LDFLAGS = $(PTHREAD_CFLAGS) +gflags_unittest_LDADD = libgflags.la +gflags_nothreads_unittest_SOURCES = $(gflags_unittest_SOURCES) +gflags_nothreads_unittest_LDADD = libgflags_nothreads.la +gflags_unittest2_SOURCES = $(gflagsinclude_HEADERS) src/config.h \ + src/gflags_unittest-main.cc + +gflags_unittest2_LDADD = libgflags_nothreads.la +gflags_unittest3_SOURCES = $(gflagsinclude_HEADERS) src/config.h \ + src/gflags_unittest_main.cc + +gflags_unittest3_LDADD = libgflags_nothreads.la +dist_noinst_DATA = src/gflags_unittest_flagfile + +# These aren't part of the c++ source, but we want them to be distributed +PYTHON = python/setup.py \ + python/gflags.py \ + python/gflags2man.py \ + python/gflags_unittest.py \ + python/test_module_foo.py \ + python/test_module_bar.py + +EXTRA_DIST = packages/rpm.sh packages/rpm/rpm.spec packages/deb.sh packages/deb \ + libtool $(SCRIPTS) $(PYTHON) \ + src/solaris/libstdc++.la + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +src/config.h: src/stamp-h1 + @if test ! -f $@; then \ + rm -f src/stamp-h1; \ + $(MAKE) src/stamp-h1; \ + else :; fi + +src/stamp-h1: $(top_srcdir)/src/config.h.in $(top_builddir)/config.status + @rm -f src/stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status src/config.h +$(top_srcdir)/src/config.h.in: $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f src/stamp-h1 + touch $@ + +distclean-hdr: + -rm -f src/config.h src/stamp-h1 +src/gflags/gflags.h: $(top_builddir)/config.status $(top_srcdir)/src/gflags/gflags.h.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +src/gflags/gflags_completions.h: $(top_builddir)/config.status $(top_srcdir)/src/gflags/gflags_completions.h.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libgflags.la: $(libgflags_la_OBJECTS) $(libgflags_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libgflags_la_LDFLAGS) $(libgflags_la_OBJECTS) $(libgflags_la_LIBADD) $(LIBS) +libgflags_nothreads.la: $(libgflags_nothreads_la_OBJECTS) $(libgflags_nothreads_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libgflags_nothreads_la_LDFLAGS) $(libgflags_nothreads_la_OBJECTS) $(libgflags_nothreads_la_LIBADD) $(LIBS) + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +gflags_nothreads_unittest$(EXEEXT): $(gflags_nothreads_unittest_OBJECTS) $(gflags_nothreads_unittest_DEPENDENCIES) + @rm -f gflags_nothreads_unittest$(EXEEXT) + $(CXXLINK) $(gflags_nothreads_unittest_LDFLAGS) $(gflags_nothreads_unittest_OBJECTS) $(gflags_nothreads_unittest_LDADD) $(LIBS) +gflags_unittest$(EXEEXT): $(gflags_unittest_OBJECTS) $(gflags_unittest_DEPENDENCIES) + @rm -f gflags_unittest$(EXEEXT) + $(CXXLINK) $(gflags_unittest_LDFLAGS) $(gflags_unittest_OBJECTS) $(gflags_unittest_LDADD) $(LIBS) +gflags_unittest2$(EXEEXT): $(gflags_unittest2_OBJECTS) $(gflags_unittest2_DEPENDENCIES) + @rm -f gflags_unittest2$(EXEEXT) + $(CXXLINK) $(gflags_unittest2_LDFLAGS) $(gflags_unittest2_OBJECTS) $(gflags_unittest2_LDADD) $(LIBS) +gflags_unittest3$(EXEEXT): $(gflags_unittest3_OBJECTS) $(gflags_unittest3_DEPENDENCIES) + @rm -f gflags_unittest3$(EXEEXT) + $(CXXLINK) $(gflags_unittest3_LDFLAGS) $(gflags_unittest3_OBJECTS) $(gflags_unittest3_LDADD) $(LIBS) +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f $$d$$p; then \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " $(binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \ + else :; fi; \ + done + +uninstall-binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gflags_unittest-gflags_unittest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gflags_unittest-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gflags_unittest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gflags_unittest_main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgflags_la-gflags.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgflags_la-gflags_completions.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgflags_la-gflags_reporting.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgflags_nothreads_la-gflags.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgflags_nothreads_la-gflags_completions.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgflags_nothreads_la-gflags_reporting.Plo@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +libgflags_la-gflags.lo: src/gflags.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_la_CXXFLAGS) $(CXXFLAGS) -MT libgflags_la-gflags.lo -MD -MP -MF "$(DEPDIR)/libgflags_la-gflags.Tpo" -c -o libgflags_la-gflags.lo `test -f 'src/gflags.cc' || echo '$(srcdir)/'`src/gflags.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgflags_la-gflags.Tpo" "$(DEPDIR)/libgflags_la-gflags.Plo"; else rm -f "$(DEPDIR)/libgflags_la-gflags.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/gflags.cc' object='libgflags_la-gflags.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_la_CXXFLAGS) $(CXXFLAGS) -c -o libgflags_la-gflags.lo `test -f 'src/gflags.cc' || echo '$(srcdir)/'`src/gflags.cc + +libgflags_la-gflags_reporting.lo: src/gflags_reporting.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_la_CXXFLAGS) $(CXXFLAGS) -MT libgflags_la-gflags_reporting.lo -MD -MP -MF "$(DEPDIR)/libgflags_la-gflags_reporting.Tpo" -c -o libgflags_la-gflags_reporting.lo `test -f 'src/gflags_reporting.cc' || echo '$(srcdir)/'`src/gflags_reporting.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgflags_la-gflags_reporting.Tpo" "$(DEPDIR)/libgflags_la-gflags_reporting.Plo"; else rm -f "$(DEPDIR)/libgflags_la-gflags_reporting.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/gflags_reporting.cc' object='libgflags_la-gflags_reporting.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_la_CXXFLAGS) $(CXXFLAGS) -c -o libgflags_la-gflags_reporting.lo `test -f 'src/gflags_reporting.cc' || echo '$(srcdir)/'`src/gflags_reporting.cc + +libgflags_la-gflags_completions.lo: src/gflags_completions.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_la_CXXFLAGS) $(CXXFLAGS) -MT libgflags_la-gflags_completions.lo -MD -MP -MF "$(DEPDIR)/libgflags_la-gflags_completions.Tpo" -c -o libgflags_la-gflags_completions.lo `test -f 'src/gflags_completions.cc' || echo '$(srcdir)/'`src/gflags_completions.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgflags_la-gflags_completions.Tpo" "$(DEPDIR)/libgflags_la-gflags_completions.Plo"; else rm -f "$(DEPDIR)/libgflags_la-gflags_completions.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/gflags_completions.cc' object='libgflags_la-gflags_completions.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_la_CXXFLAGS) $(CXXFLAGS) -c -o libgflags_la-gflags_completions.lo `test -f 'src/gflags_completions.cc' || echo '$(srcdir)/'`src/gflags_completions.cc + +libgflags_nothreads_la-gflags.lo: src/gflags.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_nothreads_la_CXXFLAGS) $(CXXFLAGS) -MT libgflags_nothreads_la-gflags.lo -MD -MP -MF "$(DEPDIR)/libgflags_nothreads_la-gflags.Tpo" -c -o libgflags_nothreads_la-gflags.lo `test -f 'src/gflags.cc' || echo '$(srcdir)/'`src/gflags.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgflags_nothreads_la-gflags.Tpo" "$(DEPDIR)/libgflags_nothreads_la-gflags.Plo"; else rm -f "$(DEPDIR)/libgflags_nothreads_la-gflags.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/gflags.cc' object='libgflags_nothreads_la-gflags.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_nothreads_la_CXXFLAGS) $(CXXFLAGS) -c -o libgflags_nothreads_la-gflags.lo `test -f 'src/gflags.cc' || echo '$(srcdir)/'`src/gflags.cc + +libgflags_nothreads_la-gflags_reporting.lo: src/gflags_reporting.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_nothreads_la_CXXFLAGS) $(CXXFLAGS) -MT libgflags_nothreads_la-gflags_reporting.lo -MD -MP -MF "$(DEPDIR)/libgflags_nothreads_la-gflags_reporting.Tpo" -c -o libgflags_nothreads_la-gflags_reporting.lo `test -f 'src/gflags_reporting.cc' || echo '$(srcdir)/'`src/gflags_reporting.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgflags_nothreads_la-gflags_reporting.Tpo" "$(DEPDIR)/libgflags_nothreads_la-gflags_reporting.Plo"; else rm -f "$(DEPDIR)/libgflags_nothreads_la-gflags_reporting.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/gflags_reporting.cc' object='libgflags_nothreads_la-gflags_reporting.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_nothreads_la_CXXFLAGS) $(CXXFLAGS) -c -o libgflags_nothreads_la-gflags_reporting.lo `test -f 'src/gflags_reporting.cc' || echo '$(srcdir)/'`src/gflags_reporting.cc + +libgflags_nothreads_la-gflags_completions.lo: src/gflags_completions.cc +@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_nothreads_la_CXXFLAGS) $(CXXFLAGS) -MT libgflags_nothreads_la-gflags_completions.lo -MD -MP -MF "$(DEPDIR)/libgflags_nothreads_la-gflags_completions.Tpo" -c -o libgflags_nothreads_la-gflags_completions.lo `test -f 'src/gflags_completions.cc' || echo '$(srcdir)/'`src/gflags_completions.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libgflags_nothreads_la-gflags_completions.Tpo" "$(DEPDIR)/libgflags_nothreads_la-gflags_completions.Plo"; else rm -f "$(DEPDIR)/libgflags_nothreads_la-gflags_completions.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/gflags_completions.cc' object='libgflags_nothreads_la-gflags_completions.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_nothreads_la_CXXFLAGS) $(CXXFLAGS) -c -o libgflags_nothreads_la-gflags_completions.lo `test -f 'src/gflags_completions.cc' || echo '$(srcdir)/'`src/gflags_completions.cc + +gflags_unittest.o: src/gflags_unittest.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gflags_unittest.o -MD -MP -MF "$(DEPDIR)/gflags_unittest.Tpo" -c -o gflags_unittest.o `test -f 'src/gflags_unittest.cc' || echo '$(srcdir)/'`src/gflags_unittest.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gflags_unittest.Tpo" "$(DEPDIR)/gflags_unittest.Po"; else rm -f "$(DEPDIR)/gflags_unittest.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/gflags_unittest.cc' object='gflags_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gflags_unittest.o `test -f 'src/gflags_unittest.cc' || echo '$(srcdir)/'`src/gflags_unittest.cc + +gflags_unittest.obj: src/gflags_unittest.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gflags_unittest.obj -MD -MP -MF "$(DEPDIR)/gflags_unittest.Tpo" -c -o gflags_unittest.obj `if test -f 'src/gflags_unittest.cc'; then $(CYGPATH_W) 'src/gflags_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/src/gflags_unittest.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gflags_unittest.Tpo" "$(DEPDIR)/gflags_unittest.Po"; else rm -f "$(DEPDIR)/gflags_unittest.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/gflags_unittest.cc' object='gflags_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gflags_unittest.obj `if test -f 'src/gflags_unittest.cc'; then $(CYGPATH_W) 'src/gflags_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/src/gflags_unittest.cc'; fi` + +gflags_unittest-gflags_unittest.o: src/gflags_unittest.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gflags_unittest_CXXFLAGS) $(CXXFLAGS) -MT gflags_unittest-gflags_unittest.o -MD -MP -MF "$(DEPDIR)/gflags_unittest-gflags_unittest.Tpo" -c -o gflags_unittest-gflags_unittest.o `test -f 'src/gflags_unittest.cc' || echo '$(srcdir)/'`src/gflags_unittest.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gflags_unittest-gflags_unittest.Tpo" "$(DEPDIR)/gflags_unittest-gflags_unittest.Po"; else rm -f "$(DEPDIR)/gflags_unittest-gflags_unittest.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/gflags_unittest.cc' object='gflags_unittest-gflags_unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gflags_unittest_CXXFLAGS) $(CXXFLAGS) -c -o gflags_unittest-gflags_unittest.o `test -f 'src/gflags_unittest.cc' || echo '$(srcdir)/'`src/gflags_unittest.cc + +gflags_unittest-gflags_unittest.obj: src/gflags_unittest.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gflags_unittest_CXXFLAGS) $(CXXFLAGS) -MT gflags_unittest-gflags_unittest.obj -MD -MP -MF "$(DEPDIR)/gflags_unittest-gflags_unittest.Tpo" -c -o gflags_unittest-gflags_unittest.obj `if test -f 'src/gflags_unittest.cc'; then $(CYGPATH_W) 'src/gflags_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/src/gflags_unittest.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gflags_unittest-gflags_unittest.Tpo" "$(DEPDIR)/gflags_unittest-gflags_unittest.Po"; else rm -f "$(DEPDIR)/gflags_unittest-gflags_unittest.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/gflags_unittest.cc' object='gflags_unittest-gflags_unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gflags_unittest_CXXFLAGS) $(CXXFLAGS) -c -o gflags_unittest-gflags_unittest.obj `if test -f 'src/gflags_unittest.cc'; then $(CYGPATH_W) 'src/gflags_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/src/gflags_unittest.cc'; fi` + +gflags_unittest-main.o: src/gflags_unittest-main.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gflags_unittest-main.o -MD -MP -MF "$(DEPDIR)/gflags_unittest-main.Tpo" -c -o gflags_unittest-main.o `test -f 'src/gflags_unittest-main.cc' || echo '$(srcdir)/'`src/gflags_unittest-main.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gflags_unittest-main.Tpo" "$(DEPDIR)/gflags_unittest-main.Po"; else rm -f "$(DEPDIR)/gflags_unittest-main.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/gflags_unittest-main.cc' object='gflags_unittest-main.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gflags_unittest-main.o `test -f 'src/gflags_unittest-main.cc' || echo '$(srcdir)/'`src/gflags_unittest-main.cc + +gflags_unittest-main.obj: src/gflags_unittest-main.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gflags_unittest-main.obj -MD -MP -MF "$(DEPDIR)/gflags_unittest-main.Tpo" -c -o gflags_unittest-main.obj `if test -f 'src/gflags_unittest-main.cc'; then $(CYGPATH_W) 'src/gflags_unittest-main.cc'; else $(CYGPATH_W) '$(srcdir)/src/gflags_unittest-main.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gflags_unittest-main.Tpo" "$(DEPDIR)/gflags_unittest-main.Po"; else rm -f "$(DEPDIR)/gflags_unittest-main.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/gflags_unittest-main.cc' object='gflags_unittest-main.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gflags_unittest-main.obj `if test -f 'src/gflags_unittest-main.cc'; then $(CYGPATH_W) 'src/gflags_unittest-main.cc'; else $(CYGPATH_W) '$(srcdir)/src/gflags_unittest-main.cc'; fi` + +gflags_unittest_main.o: src/gflags_unittest_main.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gflags_unittest_main.o -MD -MP -MF "$(DEPDIR)/gflags_unittest_main.Tpo" -c -o gflags_unittest_main.o `test -f 'src/gflags_unittest_main.cc' || echo '$(srcdir)/'`src/gflags_unittest_main.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gflags_unittest_main.Tpo" "$(DEPDIR)/gflags_unittest_main.Po"; else rm -f "$(DEPDIR)/gflags_unittest_main.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/gflags_unittest_main.cc' object='gflags_unittest_main.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gflags_unittest_main.o `test -f 'src/gflags_unittest_main.cc' || echo '$(srcdir)/'`src/gflags_unittest_main.cc + +gflags_unittest_main.obj: src/gflags_unittest_main.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gflags_unittest_main.obj -MD -MP -MF "$(DEPDIR)/gflags_unittest_main.Tpo" -c -o gflags_unittest_main.obj `if test -f 'src/gflags_unittest_main.cc'; then $(CYGPATH_W) 'src/gflags_unittest_main.cc'; else $(CYGPATH_W) '$(srcdir)/src/gflags_unittest_main.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gflags_unittest_main.Tpo" "$(DEPDIR)/gflags_unittest_main.Po"; else rm -f "$(DEPDIR)/gflags_unittest_main.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/gflags_unittest_main.cc' object='gflags_unittest_main.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gflags_unittest_main.obj `if test -f 'src/gflags_unittest_main.cc'; then $(CYGPATH_W) 'src/gflags_unittest_main.cc'; else $(CYGPATH_W) '$(srcdir)/src/gflags_unittest_main.cc'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-dist_docDATA: $(dist_doc_DATA) + @$(NORMAL_INSTALL) + test -z "$(docdir)" || $(mkdir_p) "$(DESTDIR)$(docdir)" + @list='$(dist_doc_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(dist_docDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docdir)/$$f'"; \ + $(dist_docDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docdir)/$$f"; \ + done + +uninstall-dist_docDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_doc_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(docdir)/$$f'"; \ + rm -f "$(DESTDIR)$(docdir)/$$f"; \ + done +install-gflagsincludeHEADERS: $(gflagsinclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(gflagsincludedir)" || $(mkdir_p) "$(DESTDIR)$(gflagsincludedir)" + @list='$(gflagsinclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(gflagsincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(gflagsincludedir)/$$f'"; \ + $(gflagsincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(gflagsincludedir)/$$f"; \ + done + +uninstall-gflagsincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(gflagsinclude_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(gflagsincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(gflagsincludedir)/$$f"; \ + done +install-googleincludeHEADERS: $(googleinclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(googleincludedir)" || $(mkdir_p) "$(DESTDIR)$(googleincludedir)" + @list='$(googleinclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(googleincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(googleincludedir)/$$f'"; \ + $(googleincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(googleincludedir)/$$f"; \ + done + +uninstall-googleincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(googleinclude_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(googleincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(googleincludedir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list='$(TESTS)'; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + echo "SKIP: $$tst"; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + skipped="($$skip tests were not run)"; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + $(mkdir_p) $(distdir)/doc $(distdir)/m4 $(distdir)/packages $(distdir)/packages/rpm $(distdir)/python $(distdir)/src $(distdir)/src/gflags $(distdir)/src/google $(distdir)/src/solaris + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(DATA) \ + $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(gflagsincludedir)" "$(DESTDIR)$(googleincludedir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-dist_docDATA install-gflagsincludeHEADERS \ + install-googleincludeHEADERS + +install-exec-am: install-binSCRIPTS install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binSCRIPTS uninstall-dist_docDATA \ + uninstall-gflagsincludeHEADERS uninstall-googleincludeHEADERS \ + uninstall-info-am uninstall-libLTLIBRARIES + +.PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \ + clean clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-noinstPROGRAMS ctags dist dist-all dist-bzip2 dist-gzip \ + dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-compile distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-binSCRIPTS install-data \ + install-data-am install-dist_docDATA install-exec \ + install-exec-am install-gflagsincludeHEADERS \ + install-googleincludeHEADERS install-info install-info-am \ + install-libLTLIBRARIES install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binSCRIPTS \ + uninstall-dist_docDATA uninstall-gflagsincludeHEADERS \ + uninstall-googleincludeHEADERS uninstall-info-am \ + uninstall-libLTLIBRARIES + +src/gflags_unittest-main.cc: src/gflags_unittest.cc + rm -f src/gflags_unittest-main.cc + cp -p src/gflags_unittest.cc src/gflags_unittest-main.cc +src/gflags_unittest_main.cc: src/gflags_unittest.cc + rm -f src/gflags_unittest_main.cc + cp -p src/gflags_unittest.cc src/gflags_unittest_main.cc +gflags_unittest_sh: gflags_unittest$(EXEEXT) \ + gflags_unittest2$(EXEEXT) \ + gflags_unittest3$(EXEEXT) + bash --version >/dev/null && export SH=bash || export SH=sh; \ + $$SH "$(top_srcdir)/src/gflags_unittest.sh" "$(PWD)/gflags_unittest" \ + "$(top_srcdir)" + +rpm: dist-gzip packages/rpm.sh packages/rpm/rpm.spec + @cd packages && ./rpm.sh ${PACKAGE} ${VERSION} + +deb: dist-gzip packages/deb.sh packages/deb/* + @cd packages && ./deb.sh ${PACKAGE} ${VERSION} + +libtool: $(LIBTOOL_DEPS) + $(SHELL) ./config.status --recheck +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/dtm_release/lib/util/gflags-1.1/NEWS b/dtm_release/lib/util/gflags-1.1/NEWS new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/dtm_release/lib/util/gflags-1.1/README b/dtm_release/lib/util/gflags-1.1/README new file mode 100644 index 0000000000000000000000000000000000000000..d6dd30a5e7768312a241f4b8e96214defad6f86a --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/README @@ -0,0 +1,16 @@ +This repository contains both a C++ and a python implementation of the +Google commandline flags module. Documentation for the C++ +implementation is in doc/. Documentation for the python +implementation is at the top of gflags/flags.py. + +See INSTALL for (generic) installation instructions for C++: basically + ./configure && make && make install + +To install the python module, run + cd python; python ./setup.py install + +When you install the python library, you also get a helper +application, gflags2man.py, installed into /usr/local/bin. You can +run gflags2man.py to create an instant man page, with all the +commandline flags and their docs, for any C++ or python program you've +written using the gflags library. diff --git a/dtm_release/lib/util/gflags-1.1/aclocal.m4 b/dtm_release/lib/util/gflags-1.1/aclocal.m4 new file mode 100644 index 0000000000000000000000000000000000000000..7e1432dadd393df6525f8d1654cc511da8ca0177 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/aclocal.m4 @@ -0,0 +1,7519 @@ +# generated automatically by aclocal 1.9.6 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- + +# serial 52 Debian 1.5.26-1ubuntu1 AC_PROG_LIBTOOL + + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If this macro is not defined by Autoconf, define it here. +m4_ifdef([AC_PROVIDE_IFELSE], + [], + [m4_define([AC_PROVIDE_IFELSE], + [m4_ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# AC_PROG_LIBTOOL +# --------------- +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX + ])]) +dnl And a similar setup for Fortran 77 support + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AC_LIBTOOL_F77], + [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 +])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], + defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) +])])# AC_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +])# _AC_PROG_LIBTOOL + + +# AC_LIBTOOL_SETUP +# ---------------- +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.50)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl + +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +_LT_AC_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] + +# Same as above, but do not quote variable references. +[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +AC_CHECK_TOOL(AR, ar, false) +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +_LT_REQUIRED_DARWIN_CHECKS + +AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +AC_ARG_WITH([pic], + [AC_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +])# AC_LIBTOOL_SETUP + + +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_AC_SYS_COMPILER + + +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +AC_DEFUN([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +]) + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +AC_DEFUN([_LT_COMPILER_BOILERPLATE], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +AC_DEFUN([_LT_LINKER_BOILERPLATE], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm -r conftest* +])# _LT_LINKER_BOILERPLATE + +# _LT_REQUIRED_DARWIN_CHECKS +# -------------------------- +# Check for some things on darwin +AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + echo "int foo(void){return 1;}" > conftest.c + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib ${wl}-single_module conftest.c + if test -f libconftest.dylib; then + lt_cv_apple_cc_single_mod=yes + rm -rf libconftest.dylib* + fi + rm conftest.c + fi]) + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS="$save_LDFLAGS" + ]) + case $host_os in + rhapsody* | darwin1.[[0123]]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[[012]]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}" + fi + if test "$DSYMUTIL" != ":"; then + _lt_dsymutil="~$DSYMUTIL \$lib || :" + else + _lt_dsymutil= + fi + ;; + esac +]) + +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_AC_SYS_LIBPATH_AIX + + +# _LT_AC_SHELL_INIT(ARG) +# ---------------------- +AC_DEFUN([_LT_AC_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_AC_SHELL_INIT + + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[_LT_AC_SHELL_INIT([ +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<EOF +[$]* +EOF + exit 0 +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test -z "$ECHO"; then +if test "X${echo_test_string+set}" != Xset; then +# find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string=`eval $cmd`) 2>/dev/null && + echo_test_string=`eval $cmd` && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +])])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_REQUIRE([LT_AC_PROG_SED]) +AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $rm conftest* +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $rm -r conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ + = "XX$teststring") >/dev/null 2>&1 && + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# ------------------ +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# --------------------------------------------------------------------- +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<EOF +[#line __oline__ "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include <dlfcn.h> +#endif + +#include <stdio.h> + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + + +# AC_LIBTOOL_DLOPEN_SELF +# ---------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + + +# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) +# --------------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler +AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* +]) +])# AC_LIBTOOL_PROG_CC_C_O + + +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- +# Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + +hard_links="nottested" +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS + + +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- +# Check hardcoding attributes. +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_AC_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_AC_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) +fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +])# AC_LIBTOOL_SYS_LIB_STRIP + + +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- +# PORTME Fill in your ld.so characteristics +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +m4_if($1,[],[ +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'` + else + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + sys_lib_search_path_spec=`echo $lt_search_path_spec` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[[4-9]]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[123]]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[[3-9]]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +AC_CACHE_VAL([lt_cv_sys_lib_search_path_spec], +[lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"]) +sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +AC_CACHE_VAL([lt_cv_sys_lib_dlsearch_path_spec], +[lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"]) +sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER + + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], + [include additional configurations @<:@automatic@:>@])], + [tagnames="$withval"]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + if test -z "$LTCFLAGS"; then + eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name \"$tagname\" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_LIBTOOL_LANG_CXX_CONFIG + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + AC_LIBTOOL_LANG_F77_CONFIG + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + AC_LIBTOOL_LANG_GCJ_CONFIG + else + tagname="" + fi + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# AC_LIBTOOL_WIN32_DLL +# -------------------- +# declare package support for building win32 DLLs +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([shared], + [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]AC_ENABLE_SHARED_DEFAULT) +])# AC_ENABLE_SHARED + + +# AC_DISABLE_SHARED +# ----------------- +# set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no) +])# AC_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([static], + [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]AC_ENABLE_STATIC_DEFAULT) +])# AC_ENABLE_STATIC + + +# AC_DISABLE_STATIC +# ----------------- +# set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no) +])# AC_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([fast-install], + [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) +])# AC_ENABLE_FAST_INSTALL + + +# AC_DISABLE_FAST_INSTALL +# ----------------------- +# set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no) +])# AC_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default) +])# AC_LIBTOOL_PICMODE + + +# AC_PROG_EGREP +# ------------- +# This is predefined starting with Autoconf 2.54, so this conditional +# definition can be removed once we require Autoconf 2.54 or later. +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], +[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], + [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi]) + EGREP=$ac_cv_prog_egrep + AC_SUBST([EGREP]) +])]) + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognize shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +])# AC_PATH_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognize a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no]) +AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break + ;; + *) + test "$with_gnu_ld" != yes && break + ;; + esac + fi + done + IFS="$lt_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$lt_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +])# AC_PROG_LD + + +# AC_PROG_LD_GNU +# -------------- +AC_DEFUN([AC_PROG_LD_GNU], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 </dev/null` in +*GNU* | *'with BFD'*) + lt_cv_prog_gnu_ld=yes + ;; +*) + lt_cv_prog_gnu_ld=no + ;; +esac]) +with_gnu_ld=$lt_cv_prog_gnu_ld +])# AC_PROG_LD_GNU + + +# AC_PROG_LD_RELOAD_FLAG +# ---------------------- +# find reload flag for linker +# -- PORTME Some linkers may need a different reload flag. +AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], +[AC_CACHE_CHECK([for $LD option to reload object files], + lt_cv_ld_reload_flag, + [lt_cv_ld_reload_flag='-r']) +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac +])# AC_PROG_LD_RELOAD_FLAG + + +# AC_DEPLIBS_CHECK_METHOD +# ----------------------- +# how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], +[AC_CACHE_CHECK([how to recognize dependent libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[[4-9]]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[[45]]*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the pathname to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_NM + + +# AC_CHECK_LIBM +# ------------- +# check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, +# it is assumed to be `libltdl'. LIBLTDL will be prefixed with +# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/' +# (note the single quotes!). If your package is not flat and you're not +# using automake, define top_builddir and top_srcdir appropriately in +# the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl installable library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, +# and an installed libltdl is not found, it is assumed to be `libltdl'. +# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and top_srcdir +# appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, lt_dlinit, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_INSTALLABLE + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) +])# _LT_AC_LANG_CXX + +# _LT_AC_PROG_CXXCPP +# ------------------ +AC_DEFUN([_LT_AC_PROG_CXXCPP], +[ +AC_REQUIRE([AC_PROG_CXX]) +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +fi +])# _LT_AC_PROG_CXXCPP + +# AC_LIBTOOL_F77 +# -------------- +# enable support for Fortran 77 libraries +AC_DEFUN([AC_LIBTOOL_F77], +[AC_REQUIRE([_LT_AC_LANG_F77]) +])# AC_LIBTOOL_F77 + + +# _LT_AC_LANG_F77 +# --------------- +AC_DEFUN([_LT_AC_LANG_F77], +[AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) +])# _LT_AC_LANG_F77 + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# ------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([LT_AC_PROG_RC]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF + +# Report which library types will actually be built +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case $host_os in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= +_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)= + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + $as_unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + $as_unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + AC_PROG_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + darwin* | rhapsody*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" + if test "$GXX" = yes ; then + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "$lt_cv_apple_cc_single_mod" != "yes"; then + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" + fi + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[[12]]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux9*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) ;; + *) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + interix[[3-9]]*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux* | k*bsd*-gnu) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc*) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + openbsd2*) + # C++ shared libraries are fairly broken + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + osf3*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + # So that behaviour is only enabled if SCOABSPATH is set to a + # non-empty value in the environment. Most likely only useful for + # creating official distributions of packages. + # This is a hack until libtool officially supports absolute path + # names for shared libraries. + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +AC_LIBTOOL_POSTDEP_PREDEP($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +])# AC_LIBTOOL_LANG_CXX_CONFIG + +# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) +# ------------------------------------ +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +ifelse([$1],[],[cat > conftest.$ac_ext <<EOF +int a; +void foo (void) { a = 0; } +EOF +],[$1],[CXX],[cat > conftest.$ac_ext <<EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +EOF +],[$1],[F77],[cat > conftest.$ac_ext <<EOF + subroutine foo + implicit none + integer*4 a + a=0 + return + end +EOF +],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF +public class foo { + private int a; + public void bar (void) { + a = 0; + } +}; +EOF +]) +dnl Parse the compiler output and extract the necessary +dnl objects, libraries and library flags. +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + # The `*' in the case matches for architectures that use `case' in + # $output_verbose_cmd can trigger glob expansion during the loop + # eval without this substitution. + output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` + + for p in `eval $output_verbose_link_cmd`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" \ + || test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" + else + _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then + _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}" + else + _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}" + fi + fi + ;; + + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then + _LT_AC_TAGVAR(predep_objects, $1)="$p" + else + _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then + _LT_AC_TAGVAR(postdep_objects, $1)="$p" + else + _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling $1 test program" +fi + +$rm -f confest.$objext + +_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_AC_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` +fi + +# PORTME: override above test on systems where it is broken +ifelse([$1],[CXX], +[case $host_os in +interix[[3-9]]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_AC_TAGVAR(predep_objects,$1)= + _LT_AC_TAGVAR(postdep_objects,$1)= + _LT_AC_TAGVAR(postdeps,$1)= + ;; + +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + # + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + if test "$solaris_use_stlport4" != yes; then + _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; +esac +]) +case " $_LT_AC_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac +])# AC_LIBTOOL_POSTDEP_PREDEP + +# AC_LIBTOOL_LANG_F77_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)]) +AC_DEFUN([_LT_AC_LANG_F77_CONFIG], +[AC_REQUIRE([AC_PROG_F77]) +AC_LANG_PUSH(Fortran 77) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="\ + subroutine t + return + end +" + +# Code to be used in simple link tests +lt_simple_link_test_code="\ + program t + end +" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${F77-"f77"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) + +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case $host_os in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; +aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +_LT_AC_TAGVAR(GCC, $1)="$G77" +_LT_AC_TAGVAR(LD, $1)="$LD" + +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_F77_CONFIG + + +# AC_LIBTOOL_LANG_GCJ_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)]) +AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG], +[AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds + +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_RESTORE +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_GCJ_CONFIG + + +# AC_LIBTOOL_LANG_RC_CONFIG +# ------------------------- +# Ensure that the configuration vars for the Windows resource compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)]) +AC_DEFUN([_LT_AC_LANG_RC_CONFIG], +[AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_RESTORE +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_RC_CONFIG + + +# AC_LIBTOOL_CONFIG([TAGNAME]) +# ---------------------------- +# If TAGNAME is not passed, then create an initial libtool script +# with a default configuration from the untagged config vars. Otherwise +# add code to config.status for appending the configuration named by +# TAGNAME from the matching tagged config vars. +AC_DEFUN([AC_LIBTOOL_CONFIG], +[# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + _LT_AC_TAGVAR(compiler, $1) \ + _LT_AC_TAGVAR(CC, $1) \ + _LT_AC_TAGVAR(LD, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \ + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \ + _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \ + _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \ + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \ + _LT_AC_TAGVAR(old_archive_cmds, $1) \ + _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \ + _LT_AC_TAGVAR(predep_objects, $1) \ + _LT_AC_TAGVAR(postdep_objects, $1) \ + _LT_AC_TAGVAR(predeps, $1) \ + _LT_AC_TAGVAR(postdeps, $1) \ + _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ + _LT_AC_TAGVAR(compiler_lib_search_dirs, $1) \ + _LT_AC_TAGVAR(archive_cmds, $1) \ + _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ + _LT_AC_TAGVAR(postinstall_cmds, $1) \ + _LT_AC_TAGVAR(postuninstall_cmds, $1) \ + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \ + _LT_AC_TAGVAR(allow_undefined_flag, $1) \ + _LT_AC_TAGVAR(no_undefined_flag, $1) \ + _LT_AC_TAGVAR(export_symbols_cmds, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \ + _LT_AC_TAGVAR(hardcode_automatic, $1) \ + _LT_AC_TAGVAR(module_cmds, $1) \ + _LT_AC_TAGVAR(module_expsym_cmds, $1) \ + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ + _LT_AC_TAGVAR(fix_srcfile_path, $1) \ + _LT_AC_TAGVAR(exclude_expsyms, $1) \ + _LT_AC_TAGVAR(include_expsyms, $1); do + + case $var in + _LT_AC_TAGVAR(old_archive_cmds, $1) | \ + _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \ + _LT_AC_TAGVAR(archive_cmds, $1) | \ + _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ + _LT_AC_TAGVAR(module_cmds, $1) | \ + _LT_AC_TAGVAR(module_expsym_cmds, $1) | \ + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ + _LT_AC_TAGVAR(export_symbols_cmds, $1) | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\[$]0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` + ;; + esac + +ifelse([$1], [], + [cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + AC_MSG_NOTICE([creating $ofile])], + [cfgfile="$ofile"]) + + cat <<__EOF__ >> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 +# +# 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 2 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="$SED -e 1s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) + +# Is the compiler the GNU C compiler? +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) + +# Commands used to build and install a shared archive. +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) +module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The directories searched by this compiler when creating a shared +# library +compiler_lib_search_dirs=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_dirs, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to yes if exported symbols are required. +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) + +# The commands to list exported symbols. +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) + +# Symbols that must always be exported. +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) + +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) + +__EOF__ + +ifelse([$1],[], [ + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([LT_AC_PROG_SED]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +linux* | k*bsd*-gnu) + if test "$host_cpu" = ia64; then + symcode='[[ABCDGIRSTW]]' + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat <<EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <<EOF >> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix[[4-9]]*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + icpc* | ecpc*) + # Intel C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler. + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd* | netbsdelf*-gnu) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + linux* | k*bsd*-gnu) + case $cc_basename in + icc* | ecc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + esac + ;; + esac + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_cv_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\" +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_AC_TAGVAR(lt_cv_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix[[4-9]]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + ;; + linux* | k*bsd*-gnu) + _LT_AC_TAGVAR(link_all_deplibs, $1)=no + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(hardcode_automatic, $1)=no + _LT_AC_TAGVAR(module_cmds, $1)= + _LT_AC_TAGVAR(module_expsym_cmds, $1)= + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + _LT_CC_BASENAME([$compiler]) + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[[3-9]]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <<EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + interix[[3-9]]*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | k*bsd*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=no + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <<EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi[[45]]*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $rm conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include <windows.h> +# #undef WIN32_LEAN_AND_MEAN +# #include <stdio.h> +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include <cygwin/cygwin_dll.h> +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ +])# _LT_AC_FILE_LTDLL_C + + +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) + + +# old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + + +# Cheap backport of AS_EXECUTABLE_P and required macros +# from Autoconf 2.59; we should not use $as_executable_p directly. + +# _AS_TEST_PREPARE +# ---------------- +m4_ifndef([_AS_TEST_PREPARE], +[m4_defun([_AS_TEST_PREPARE], +[if test -x / >/dev/null 2>&1; then + as_executable_p='test -x' +else + as_executable_p='test -f' +fi +])])# _AS_TEST_PREPARE + +# AS_EXECUTABLE_P +# --------------- +# Check whether a file is executable. +m4_ifndef([AS_EXECUTABLE_P], +[m4_defun([AS_EXECUTABLE_P], +[AS_REQUIRE([_AS_TEST_PREPARE])dnl +$as_executable_p $1[]dnl +])])# AS_EXECUTABLE_P + +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +# LT_AC_PROG_SED +# -------------- +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +AC_DEFUN([LT_AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if AS_EXECUTABLE_P(["$as_dir/$lt_ac_prog$ac_exec_ext"]); then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +]) + +# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.9.6])]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 7 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 3 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 12 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.58])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $1 | $1:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. +# +# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories +# created by `make install' are always world readable, even if the +# installer happens to have an overly restrictive umask (e.g. 077). +# This was a mistake. There are at least two reasons why we must not +# use `-m 0755': +# - it causes special bits like SGID to be ignored, +# - it may be too restrictive (some setups expect 775 directories). +# +# Do not use -m 0755 and let people choose whatever they expect by +# setting umask. +# +# We cannot accept any implementation of `mkdir' that recognizes `-p'. +# Some implementations (such as Solaris 8's) are not thread-safe: if a +# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' +# concurrently, both version can detect that a/ is missing, but only +# one can create it and the other will error out. Consequently we +# restrict ourselves to GNU make (using the --version option ensures +# this.) +AC_DEFUN([AM_PROG_MKDIR_P], +[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi +AC_SUBST([mkdir_p])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar <conftest.tar]) + grep GrepMe conftest.dir/file >/dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([m4/ac_have_attribute.m4]) +m4_include([m4/acx_pthread.m4]) +m4_include([m4/google_namespace.m4]) +m4_include([m4/namespaces.m4]) +m4_include([m4/stl_namespace.m4]) diff --git a/dtm_release/lib/util/gflags-1.1/compile b/dtm_release/lib/util/gflags-1.1/compile new file mode 100755 index 0000000000000000000000000000000000000000..9bb997a6a9b4549a733ed71f7e449e70c89f7a69 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/compile @@ -0,0 +1,99 @@ +#! /bin/sh + +# Wrapper for compilers which do not understand `-c -o'. + +# Copyright 1999, 2000 Free Software Foundation, Inc. +# Written by Tom Tromey <tromey@cygnus.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 2, 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, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Usage: +# compile PROGRAM [ARGS]... +# `-o FOO.o' is removed from the args passed to the actual compile. + +prog=$1 +shift + +ofile= +cfile= +args= +while test $# -gt 0; do + case "$1" in + -o) + # configure might choose to run compile as `compile cc -o foo foo.c'. + # So we do something ugly here. + ofile=$2 + shift + case "$ofile" in + *.o | *.obj) + ;; + *) + args="$args -o $ofile" + ofile= + ;; + esac + ;; + *.c) + cfile=$1 + args="$args $1" + ;; + *) + args="$args $1" + ;; + esac + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no `-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # `.c' file was seen then we are probably linking. That is also + # ok. + exec "$prog" $args +fi + +# Name of file we expect compiler to create. +cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'` + +# Create the lock directory. +# Note: use `[/.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d +while true; do + if mkdir $lockdir > /dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir $lockdir; exit 1" 1 2 15 + +# Run the compile. +"$prog" $args +status=$? + +if test -f "$cofile"; then + mv "$cofile" "$ofile" +fi + +rmdir $lockdir +exit $status diff --git a/dtm_release/lib/util/gflags-1.1/config.guess b/dtm_release/lib/util/gflags-1.1/config.guess new file mode 100755 index 0000000000000000000000000000000000000000..ad5281e66e9def96e03533881ed570a8a495ccd5 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/config.guess @@ -0,0 +1,1466 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + +timestamp='2005-08-03' + +# This file 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 2 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner <per@bothner.com>. +# Please send patches to <config-patches@gnu.org>. Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerppc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <sys/systemcfg.h> + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include <stdlib.h> + #include <unistd.h> + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <unistd.h> + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + x86:Interix*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' + exit ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <features.h> + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + echo ${UNAME_MACHINE}-pc-isc$UNAME_REL + elif /bin/uname -X 2>/dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <hewes@openmarket.com>. + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + *86) UNAME_PROCESSOR=i686 ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c <<EOF +#ifdef _SEQUENT_ +# include <sys/types.h> +# include <sys/utsname.h> +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include <sys/param.h> + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include <sys/param.h> +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 <<EOF +$0: unable to guess system type + +This script, last modified $timestamp, has failed to recognize +the operating system you are using. It is advised that you +download the most up to date version of the config scripts from + + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess +and + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub + +If the version you run ($0) is already up to date, please +send the following data and any information you think might be +pertinent to <config-patches@gnu.org> in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +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` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/dtm_release/lib/util/gflags-1.1/config.status b/dtm_release/lib/util/gflags-1.1/config.status new file mode 100755 index 0000000000000000000000000000000000000000..ece8c67953336f0920665b4a874184f40184b063 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/config.status @@ -0,0 +1,1095 @@ +#! /bin/sh +# Generated by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=${CONFIG_SHELL-/bin/sh} +## --------------------- ## +## 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=: + # Zsh 3.x and 4.x performs 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 + + + + +# PATH needs CR +# 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 + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +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.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +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 + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +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 + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. 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" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # 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 +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +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 +fi +echo >conf$$.file +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 -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +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=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# 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'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by gflags $as_me 1.1, which was +generated by GNU Autoconf 2.61. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +# Files that config.status was made for. +config_files=" Makefile src/gflags/gflags.h src/gflags/gflags_completions.h" +config_headers=" src/config.h" +config_commands=" depfiles" + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to <bug-autoconf@gnu.org>." + +ac_cs_version="\ +gflags config.status 1.1 +configured by ./configure, generated by GNU Autoconf 2.61, + with options \"\" + +Copyright (C) 2006 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='/u/sgerrish/src1/topics/lib/util/gflags-1.1' +srcdir='.' +INSTALL='/usr/bin/install -c' +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + { echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +if $ac_cs_recheck; then + echo "running CONFIG_SHELL=/bin/sh /bin/sh ./configure " $ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=/bin/sh + export CONFIG_SHELL + exec /bin/sh "./configure" $ac_configure_extra_args --no-create --no-recursion +fi + +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + echo "$ac_log" +} >&5 + +# +# INIT-COMMANDS +# +AMDEP_TRUE="" ac_aux_dir="." + + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/gflags/gflags.h") CONFIG_FILES="$CONFIG_FILES src/gflags/gflags.h" ;; + "src/gflags/gflags_completions.h") CONFIG_FILES="$CONFIG_FILES src/gflags/gflags_completions.h" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# +# Set up the sed scripts for CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + +cat >"$tmp/subs-1.sed" <<\CEOF +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@SHELL@,|#_!!_#|/bin/sh,g +s,@PATH_SEPARATOR@,|#_!!_#|:,g +s,@PACKAGE_NAME@,|#_!!_#|gflags,g +s,@PACKAGE_TARNAME@,|#_!!_#|gflags,g +s,@PACKAGE_VERSION@,|#_!!_#|1.1,g +s,@PACKAGE_STRING@,|#_!!_#|gflags 1.1,g +s,@PACKAGE_BUGREPORT@,|#_!!_#|opensource@|#_!!_#|google.com,g +s,@exec_prefix@,|#_!!_#|${prefix},g +s,@prefix@,|#_!!_#|/usr/local,g +s,@program_transform_name@,|#_!!_#|s\,x\,x\,,g +s,@bindir@,|#_!!_#|${exec_prefix}/bin,g +s,@sbindir@,|#_!!_#|${exec_prefix}/sbin,g +s,@libexecdir@,|#_!!_#|${exec_prefix}/libexec,g +s,@datarootdir@,|#_!!_#|${prefix}/share,g +s,@datadir@,|#_!!_#|${datarootdir},g +s,@sysconfdir@,|#_!!_#|${prefix}/etc,g +s,@sharedstatedir@,|#_!!_#|${prefix}/com,g +s,@localstatedir@,|#_!!_#|${prefix}/var,g +s,@includedir@,|#_!!_#|${prefix}/include,g +s,@oldincludedir@,|#_!!_#|/usr/include,g +s,@docdir@,|#_!!_#|${datarootdir}/doc/${PACKAGE_TARNAME},g +s,@infodir@,|#_!!_#|${datarootdir}/info,g +s,@htmldir@,|#_!!_#|${docdir},g +s,@dvidir@,|#_!!_#|${docdir},g +s,@pdfdir@,|#_!!_#|${docdir},g +s,@psdir@,|#_!!_#|${docdir},g +s,@libdir@,|#_!!_#|${exec_prefix}/lib,g +s,@localedir@,|#_!!_#|${datarootdir}/locale,g +s,@mandir@,|#_!!_#|${datarootdir}/man,g +s,@DEFS@,|#_!!_#|-DHAVE_CONFIG_H,g +s,@ECHO_C@,|#_!!_#|,g +s,@ECHO_N@,|#_!!_#|-n,g +s,@ECHO_T@,|#_!!_#|,g +s,@LIBS@,|#_!!_#|,g +s,@build_alias@,|#_!!_#|,g +s,@host_alias@,|#_!!_#|,g +s,@target_alias@,|#_!!_#|,g +s,@INSTALL_PROGRAM@,|#_!!_#|${INSTALL},g +s,@INSTALL_SCRIPT@,|#_!!_#|${INSTALL},g +s,@INSTALL_DATA@,|#_!!_#|${INSTALL} -m 644,g +s,@CYGPATH_W@,|#_!!_#|echo,g +s,@PACKAGE@,|#_!!_#|gflags,g +s,@VERSION@,|#_!!_#|1.1,g +s,@ACLOCAL@,|#_!!_#|${SHELL} /u/sgerrish/src1/topics/lib/util/gflags-1.1/missing --run aclocal-1.9,g +s,@AUTOCONF@,|#_!!_#|${SHELL} /u/sgerrish/src1/topics/lib/util/gflags-1.1/missing --run autoconf,g +s,@AUTOMAKE@,|#_!!_#|${SHELL} /u/sgerrish/src1/topics/lib/util/gflags-1.1/missing --run automake-1.9,g +s,@AUTOHEADER@,|#_!!_#|${SHELL} /u/sgerrish/src1/topics/lib/util/gflags-1.1/missing --run autoheader,g +s,@MAKEINFO@,|#_!!_#|${SHELL} /u/sgerrish/src1/topics/lib/util/gflags-1.1/missing --run makeinfo,g +s,@install_sh@,|#_!!_#|/u/sgerrish/src1/topics/lib/util/gflags-1.1/install-sh,g +s,@STRIP@,|#_!!_#|strip,g +s,@INSTALL_STRIP_PROGRAM@,|#_!!_#|${SHELL} $(install_sh) -c -s,g +s,@mkdir_p@,|#_!!_#|mkdir -p --,g +s,@AWK@,|#_!!_#|gawk,g +s,@SET_MAKE@,|#_!!_#|,g +s,@am__leading_dot@,|#_!!_#|.,g +s,@AMTAR@,|#_!!_#|${SHELL} /u/sgerrish/src1/topics/lib/util/gflags-1.1/missing --run tar,g +s,@am__tar@,|#_!!_#|${AMTAR} chof - "$$tardir",g +s,@am__untar@,|#_!!_#|${AMTAR} xf -,g +s,@CC@,|#_!!_#|gcc,g +s,@CFLAGS@,|#_!!_#|-g -O2,g +s,@LDFLAGS@,|#_!!_#|,g +s,@CPPFLAGS@,|#_!!_#|,g +s,@ac_ct_CC@,|#_!!_#|gcc,g +s,@EXEEXT@,|#_!!_#|,g +s,@OBJEXT@,|#_!!_#|o,g +s,@DEPDIR@,|#_!!_#|.deps,g +s,@am__include@,|#_!!_#|include,g +s,@am__quote@,|#_!!_#|,g +s,@AMDEP_TRUE@,|#_!!_#|,g +s,@AMDEP_FALSE@,|#_!!_#|#,g +s,@AMDEPBACKSLASH@,|#_!!_#|\\,g +s,@CCDEPMODE@,|#_!!_#|depmode=gcc3,g +s,@am__fastdepCC_TRUE@,|#_!!_#|,g +s,@am__fastdepCC_FALSE@,|#_!!_#|#,g +s,@CPP@,|#_!!_#|gcc -E,g +s,@CXX@,|#_!!_#|g++,g +s,@CXXFLAGS@,|#_!!_#|-g -O2,g +s,@ac_ct_CXX@,|#_!!_#|g++,g +s,@CXXDEPMODE@,|#_!!_#|depmode=gcc3,g +s,@am__fastdepCXX_TRUE@,|#_!!_#|,g +s,@am__fastdepCXX_FALSE@,|#_!!_#|#,g +s,@GCC_TRUE@,|#_!!_#|,g +s,@GCC_FALSE@,|#_!!_#|#,g +s,@build@,|#_!!_#|x86_64-unknown-linux-gnu,g +s,@build_cpu@,|#_!!_#|x86_64,g +s,@build_vendor@,|#_!!_#|unknown,g +s,@build_os@,|#_!!_#|linux-gnu,g +s,@host@,|#_!!_#|x86_64-unknown-linux-gnu,g +s,@host_cpu@,|#_!!_#|x86_64,g +s,@host_vendor@,|#_!!_#|unknown,g +s,@host_os@,|#_!!_#|linux-gnu,g +s,@SED@,|#_!!_#|/bin/sed,g +s,@GREP@,|#_!!_#|/bin/grep,g +s,@EGREP@,|#_!!_#|/bin/grep -E,g +s,@LN_S@,|#_!!_#|ln -s,g +s,@ECHO@,|#_!!_#|echo,g +s,@AR@,|#_!!_#|ar,g +CEOF +cat >"$tmp/subs-2.sed" <<\CEOF +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +s,@RANLIB@,|#_!!_#|ranlib,g +s,@DSYMUTIL@,|#_!!_#|,g +s,@NMEDIT@,|#_!!_#|,g +s,@CXXCPP@,|#_!!_#|g++ -E,g +s,@F77@,|#_!!_#|g77,g +s,@FFLAGS@,|#_!!_#|-g -O2,g +s,@ac_ct_F77@,|#_!!_#|g77,g +s,@LIBTOOL@,|#_!!_#|$(SHELL) $(top_builddir)/libtool,g +s,@LIBTOOL_DEPS@,|#_!!_#|./ltmain.sh,g +s,@acx_pthread_config@,|#_!!_#|,g +s,@PTHREAD_CC@,|#_!!_#|gcc,g +s,@PTHREAD_LIBS@,|#_!!_#|,g +s,@PTHREAD_CFLAGS@,|#_!!_#|-pthread,g +s,@LIBSTDCXX_LA_LINKER_FLAG@,|#_!!_#|,g +s,@ac_google_start_namespace@,|#_!!_#|namespace google {,g +s,@ac_google_end_namespace@,|#_!!_#|},g +s,@ac_google_namespace@,|#_!!_#|::google,g +s,@ac_cv___attribute__unused@,|#_!!_#|__attribute__ ((unused)),g +s,@ac_cv_have_stdint_h@,|#_!!_#|1,g +s,@ac_cv_have_systypes_h@,|#_!!_#|1,g +s,@ac_cv_have_inttypes_h@,|#_!!_#|1,g +s,@ac_cv_have_uint16_t@,|#_!!_#|1,g +s,@ac_cv_have_u_int16_t@,|#_!!_#|1,g +s,@ac_cv_have___int16@,|#_!!_#|0,g +s,@LIBOBJS@,|#_!!_#|,g +s,@LTLIBOBJS@,|#_!!_#|,g +:end +s/|#_!!_#|//g +CEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`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 || +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" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`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 + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + ac_datarootdir_hack=' + s&@datadir@&${datarootdir}&g + s&@docdir@&${datarootdir}/doc/${PACKAGE_TARNAME}&g + s&@infodir@&${datarootdir}/info&g + s&@localedir@&${datarootdir}/locale&g + s&@mandir@&${datarootdir}/man&g + s&\${datarootdir}&${prefix}/share&g' ;; +esac + sed "/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +} + +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + :H) + # + # CONFIG_HEADER + # + # First, check the format of the line: + cat >"$tmp/defines.sed" <<\CEOF +/^[ ]*#[ ]*undef[ ][ ]*[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*[ ]*$/b def +/^[ ]*#[ ]*define[ ][ ]*[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*[( ]/b def +b +:def +s/$/ / +s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_NAME\)[ (].*,\1define\2 "gflags" , +s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_TARNAME\)[ (].*,\1define\2 "gflags" , +s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_VERSION\)[ (].*,\1define\2 "1.1" , +s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_STRING\)[ (].*,\1define\2 "gflags 1.1" , +s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_BUGREPORT\)[ (].*,\1define\2 "opensource@google.com" , +s,^\([ #]*\)[^ ]*\([ ]*PACKAGE\)[ (].*,\1define\2 "gflags" , +s,^\([ #]*\)[^ ]*\([ ]*VERSION\)[ (].*,\1define\2 "1.1" , +s,^\([ #]*\)[^ ]*\([ ]*STDC_HEADERS\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_SYS_TYPES_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_SYS_STAT_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_STDLIB_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRING_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_MEMORY_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRINGS_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_INTTYPES_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_STDINT_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_UNISTD_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_DLFCN_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*STDC_HEADERS\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_FNMATCH_H\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRTOLL\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRTOQ\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE___ATTRIBUTE__\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_PTHREAD\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*HAVE_NAMESPACES\)[ (].*,\1define\2 1 , +s,^\([ #]*\)[^ ]*\([ ]*STL_NAMESPACE\)[ (].*,\1define\2 std , +s,^\([ #]*\)[^ ]*\([ ]*GOOGLE_NAMESPACE\)[ (].*,\1define\2 ::google , +s,^\([ #]*\)[^ ]*\([ ]*_START_GOOGLE_NAMESPACE_\)[ (].*,\1define\2 namespace google { , +s,^\([ #]*\)[^ ]*\([ ]*_END_GOOGLE_NAMESPACE_\)[ (].*,\1define\2 } , +s/ $// +s,^[ #]*u.*,/* & */, +CEOF + sed -f "$tmp/defines.sed" $ac_file_inputs >"$tmp/out1" +ac_result="$tmp/out1" + if test x"$ac_file" != x-; then + echo "/* $configure_input */" >"$tmp/config.h" + cat "$ac_result" >>"$tmp/config.h" + if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f $ac_file + mv "$tmp/config.h" $ac_file + fi + else + echo "/* $configure_input */" + cat "$ac_result" + fi + rm -f "$tmp/out12" +# Compute $ac_file's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $ac_file | $ac_file:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $ac_file" >`$as_dirname -- $ac_file || +$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X$ac_file : 'X\(//\)[^/]' \| \ + X$ac_file : 'X\(//\)$' \| \ + X$ac_file : 'X\(/\)' \| . 2>/dev/null || +echo X$ac_file | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 +echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir=$dirpart/$fdir + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`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 || +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" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + + esac +done # for ac_tag + + +{ (exit 0); exit 0; } diff --git a/dtm_release/lib/util/gflags-1.1/config.sub b/dtm_release/lib/util/gflags-1.1/config.sub new file mode 100755 index 0000000000000000000000000000000000000000..1c366dfde9ab35fe6474af49933455433951457f --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/config.sub @@ -0,0 +1,1579 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + +timestamp='2005-07-08' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file 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 2 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to <config-patches@gnu.org>. Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ + kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | ms1 \ + | msp430 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m32c) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | ms1-* \ + | msp430-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + m32c-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/dtm_release/lib/util/gflags-1.1/configure b/dtm_release/lib/util/gflags-1.1/configure new file mode 100755 index 0000000000000000000000000000000000000000..bfab10cd4b24ae5ee0d7636b81242fc669377eb4 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/configure @@ -0,0 +1,23315 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.61 for gflags 1.1. +# +# Report bugs to <opensource@google.com>. +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006 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=: + # Zsh 3.x and 4.x performs 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 + + + + +# PATH needs CR +# 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 + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +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.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +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 + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +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 + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs 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 + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs 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_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell autoconf@gnu.org about your system, + echo including any error possibly output before this + echo message +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. 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" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # 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 +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +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 +fi +echo >conf$$.file +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 -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +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=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# 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'" + + + + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +echo=${ECHO-echo} +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<EOF +$* +EOF + exit 0 +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test -z "$ECHO"; then +if test "X${echo_test_string+set}" != Xset; then +# find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string=`eval $cmd`) 2>/dev/null && + echo_test_string=`eval $cmd` && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + + + +tagnames=${tagnames+${tagnames},}CXX + +tagnames=${tagnames+${tagnames},}F77 + +exec 7<&0 </dev/null 6>&1 + +# Name of the host. +# hostname on some systems (SVR3.2, 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= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME='gflags' +PACKAGE_TARNAME='gflags' +PACKAGE_VERSION='1.1' +PACKAGE_STRING='gflags 1.1' +PACKAGE_BUGREPORT='opensource@google.com' + +ac_unique_file="README" +# 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='SHELL +PATH_SEPARATOR +PACKAGE_NAME +PACKAGE_TARNAME +PACKAGE_VERSION +PACKAGE_STRING +PACKAGE_BUGREPORT +exec_prefix +prefix +program_transform_name +bindir +sbindir +libexecdir +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +CYGPATH_W +PACKAGE +VERSION +ACLOCAL +AUTOCONF +AUTOMAKE +AUTOHEADER +MAKEINFO +install_sh +STRIP +INSTALL_STRIP_PROGRAM +mkdir_p +AWK +SET_MAKE +am__leading_dot +AMTAR +am__tar +am__untar +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +DEPDIR +am__include +am__quote +AMDEP_TRUE +AMDEP_FALSE +AMDEPBACKSLASH +CCDEPMODE +am__fastdepCC_TRUE +am__fastdepCC_FALSE +CPP +CXX +CXXFLAGS +ac_ct_CXX +CXXDEPMODE +am__fastdepCXX_TRUE +am__fastdepCXX_FALSE +GCC_TRUE +GCC_FALSE +build +build_cpu +build_vendor +build_os +host +host_cpu +host_vendor +host_os +SED +GREP +EGREP +LN_S +ECHO +AR +RANLIB +DSYMUTIL +NMEDIT +CXXCPP +F77 +FFLAGS +ac_ct_F77 +LIBTOOL +LIBTOOL_DEPS +acx_pthread_config +PTHREAD_CC +PTHREAD_LIBS +PTHREAD_CFLAGS +LIBSTDCXX_LA_LINKER_FLAG +ac_google_start_namespace +ac_google_end_namespace +ac_google_namespace +ac_cv___attribute__unused +ac_cv_have_stdint_h +ac_cv_have_systypes_h +ac_cv_have_inttypes_h +ac_cv_have_uint16_t +ac_cv_have_u_int16_t +ac_cv_have___int16 +LIBOBJS +LTLIBOBJS' +ac_subst_files='' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +CXX +CXXFLAGS +CCC +CXXCPP +F77 +FFLAGS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# 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=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_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=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_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=\$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_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=\$ac_optarg ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=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 ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + 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'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute directory names. +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 + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } +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 + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + 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 .` || + { echo "$as_me: error: Working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + +# 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 -- "$0" || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X"$0" | + 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 .." + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + 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 gflags 1.1 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/gflags] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of gflags 1.1:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-fast-install[=PKGS] + optimize for fast installation [default=no] + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-static[=PKGS] build static libraries [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-namespace=FOO to define these Google + classes in the FOO namespace. --disable-namespace + to define them in the global namespace. Default + is to define them in namespace google. + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-pic try to use only PIC/non-PIC objects [default=use + both] + --with-tags[=TAGS] include additional configurations [automatic] + +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 C/C++/Objective 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 + CXXCPP C++ preprocessor + F77 Fortran 77 compiler command + FFLAGS Fortran 77 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 <opensource@google.com>. +_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" || continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`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 + 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 +gflags configure 1.1 +generated by GNU Autoconf 2.61 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006 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 +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 gflags $as_me 1.1, which was +generated by GNU Autoconf 2.61. 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=. + 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=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$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 + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export 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 + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + 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_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_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 + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------------- ## +## File substitutions. ## +## ------------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + 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'; { (exit 1); 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 + +# 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 + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + set x "$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + set x "$prefix/share/config.site" "$prefix/etc/config.site" +else + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" +fi +shift +for ac_site_file +do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + 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. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +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,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +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 + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`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. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +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 + + +# The argument here is just something that should be in the current directory +# (for sanity checking) + +am__api_version="1.9" +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} + { (exit 1); exit 1; }; } +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done +IFS=$as_save_IFS + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm -f conftest.sed + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } +set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + SET_MAKE= +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='gflags' + VERSION='1.1' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + +ac_config_headers="$ac_config_headers src/config.h" + + +# Checks for programs. +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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out 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. +{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; 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 | *.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 + +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } +if test -z "$ac_file"; then + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext + +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6; } + +{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; 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 | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; 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 ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + 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 +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +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 +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$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 +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* 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" + 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +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) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +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 +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +{ echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + + +depcc="$CC" am_compiler_list= + +{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +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 +{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f 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 +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +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 +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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C++ compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } +if test "${ac_cv_cxx_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + 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 +{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; } +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cxx_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CXXFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +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 +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$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 + +depcc="$CXX" am_compiler_list= + +{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } +if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +{ echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + + + +if test "$GCC" = yes; then + GCC_TRUE= + GCC_FALSE='#' +else + GCC_TRUE='#' + GCC_FALSE= +fi + # let the Makefile know if we're gcc +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 +echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} + { (exit 1); exit 1; }; } + +{ echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6; } +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 +echo "$as_me: error: invalid value of canonical build" >&2;} + { (exit 1); exit 1; }; };; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6; } +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} + { (exit 1); exit 1; }; } +fi + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + + +# Populate $host_cpu, $host_os, etc. +{ echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6; } +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} + { (exit 1); exit 1; }; } +fi + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +case $host_os in + *mingw*) + # Disabling fast install keeps libtool from creating wrapper scripts + # around the executables it builds. Such scripts have caused failures on + # MinGW. Using this option means an extra link step is executed during + # "make install". + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=no +fi + + + + ;; + *) + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi + + + ;; +esac + +# Uncomment this if you'll be exporting libraries (.so's) +# Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi + + +# Check whether --enable-static was given. +if test "${enable_static+set}" = set; then + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi + + +{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; } +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$lt_ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$lt_ac_prog$ac_exec_ext"; }; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done + +fi + +SED=$lt_cv_path_SED + +{ echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6; } + +{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + 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" + { test -f "$ac_path_GREP" && $as_test_x "$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 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + 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 + ac_count=`expr $ac_count + 1` + 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 + + +fi + +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_GREP=$GREP +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + 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" + { test -f "$ac_path_EGREP" && $as_test_x "$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 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + 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 + ac_count=`expr $ac_count + 1` + 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 + + +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_EGREP=$EGREP +fi + + + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { echo "$as_me:$LINENO: checking for ld used by $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; } +else + { echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; } +fi +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break + ;; + *) + test "$with_gnu_ld" != yes && break + ;; + esac + fi + done + IFS="$lt_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$lt_cv_path_LD" +if test -n "$LD"; then + { echo "$as_me:$LINENO: result: $LD" >&5 +echo "${ECHO_T}$LD" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; } +if test "${lt_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 </dev/null` in +*GNU* | *'with BFD'*) + lt_cv_prog_gnu_ld=yes + ;; +*) + lt_cv_prog_gnu_ld=no + ;; +esac +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + +{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 +echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; } +if test "${lt_cv_ld_reload_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 +echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + +{ echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 +echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; } +if test "${lt_cv_path_NM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi +fi +{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 +echo "${ECHO_T}$lt_cv_path_NM" >&6; } +NM="$lt_cv_path_NM" + +{ echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else + { echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6; } +fi + +{ echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5 +echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6; } +if test "${lt_cv_deplibs_check_method+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 +echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; } +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 5116 "configure"' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 +echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; } +if test "${lt_cv_cc_needs_belf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + 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 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + lt_cv_cc_needs_belf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + lt_cv_cc_needs_belf=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + 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 + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 +echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; } + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + + +esac + +need_locks="$enable_libtool_lock" + + + +{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +int +main () +{ + + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + 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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +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=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +for ac_header in dlfcn.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ------------------------------------ ## +## Report this to opensource@google.com ## +## ------------------------------------ ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + 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 +{ echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 +echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6; } +if test -z "$CXXCPP"; then + if test "${ac_cv_prog_CXXCPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +{ echo "$as_me:$LINENO: result: $CXXCPP" >&5 +echo "${ECHO_T}$CXXCPP" >&6; } +ac_preproc_ok=false +for ac_cxx_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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +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 + +fi + + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn + 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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$F77"; then + ac_cv_prog_F77="$F77" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_F77="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +F77=$ac_cv_prog_F77 +if test -n "$F77"; then + { echo "$as_me:$LINENO: result: $F77" >&5 +echo "${ECHO_T}$F77" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$F77" && break + done +fi +if test -z "$F77"; then + ac_ct_F77=$F77 + for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_F77"; then + ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_F77="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_F77=$ac_cv_prog_ac_ct_F77 +if test -n "$ac_ct_F77"; then + { echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 +echo "${ECHO_T}$ac_ct_F77" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_F77" && break +done + + if test "x$ac_ct_F77" = x; then + F77="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + F77=$ac_ct_F77 + fi +fi + + +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +rm -f a.out + +# If we don't use `.F' as extension, the preprocessor is not run on the +# input file. (Note that this only needs to work for GNU compilers.) +ac_save_ext=$ac_ext +ac_ext=F +{ echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6; } +if test "${ac_cv_f77_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF + program main +#ifndef __GNUC__ + choke me +#endif + + end +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_f77_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_f77_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6; } +ac_ext=$ac_save_ext +ac_test_FFLAGS=${FFLAGS+set} +ac_save_FFLAGS=$FFLAGS +FFLAGS= +{ echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 +echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_f77_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + FFLAGS=-g +cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_f77_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_f77_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_prog_f77_g=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 +echo "${ECHO_T}$ac_cv_prog_f77_g" >&6; } +if test "$ac_test_FFLAGS" = set; then + FFLAGS=$ac_save_FFLAGS +elif test $ac_cv_prog_f77_g = yes; then + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-g -O2" + else + FFLAGS="-g" + fi +else + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-O2" + else + FFLAGS= + fi +fi + +G77=`test $ac_compiler_gnu = yes && echo yes` +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 + + + +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +# find the maximum length of command line arguments +{ echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 +echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; } +if test "${lt_cv_sys_max_cmd_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ + = "XX$teststring") >/dev/null 2>&1 && + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 +echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; } +else + { echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6; } +fi + + + + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 +echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; } +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +linux* | k*bsd*-gnu) + if test "$host_cpu" = ia64; then + symcode='[ABCDGIRSTW]' + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +EOF + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat <<EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <<EOF >> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6; } +else + { echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6; } +fi + +{ echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6; } +if test "${lt_cv_objdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 +echo "${ECHO_T}$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AR="ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 +echo "${ECHO_T}$ac_ct_AR" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +else + AR="$ac_cv_prog_AR" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 +echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; } +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { echo "$as_me:$LINENO: checking for file" >&5 +echo $ECHO_N "checking for file... $ECHO_C" >&6; } +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_DSYMUTIL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { echo "$as_me:$LINENO: result: $DSYMUTIL" >&5 +echo "${ECHO_T}$DSYMUTIL" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { echo "$as_me:$LINENO: result: $ac_ct_DSYMUTIL" >&5 +echo "${ECHO_T}$ac_ct_DSYMUTIL" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_NMEDIT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { echo "$as_me:$LINENO: result: $NMEDIT" >&5 +echo "${ECHO_T}$NMEDIT" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { echo "$as_me:$LINENO: result: $ac_ct_NMEDIT" >&5 +echo "${ECHO_T}$ac_ct_NMEDIT" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + + { echo "$as_me:$LINENO: checking for -single_module linker flag" >&5 +echo $ECHO_N "checking for -single_module linker flag... $ECHO_C" >&6; } +if test "${lt_cv_apple_cc_single_mod+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + echo "int foo(void){return 1;}" > conftest.c + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib ${wl}-single_module conftest.c + if test -f libconftest.dylib; then + lt_cv_apple_cc_single_mod=yes + rm -rf libconftest.dylib* + fi + rm conftest.c + fi +fi +{ echo "$as_me:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5 +echo "${ECHO_T}$lt_cv_apple_cc_single_mod" >&6; } + { echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5 +echo $ECHO_N "checking for -exported_symbols_list linker flag... $ECHO_C" >&6; } +if test "${lt_cv_ld_exported_symbols_list+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + lt_cv_ld_exported_symbols_list=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + lt_cv_ld_exported_symbols_list=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5 +echo "${ECHO_T}$lt_cv_ld_exported_symbols_list" >&6; } + case $host_os in + rhapsody* | darwin1.[0123]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[012]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}" + fi + if test "$DSYMUTIL" != ":"; then + _lt_dsymutil="~$DSYMUTIL \$lib || :" + else + _lt_dsymutil= + fi + ;; + esac + + +enable_dlopen=no +enable_win32_dll=no + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then + withval=$with_pic; pic_mode="$withval" +else + pic_mode=default +fi + +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +lt_save_CC="$CC" +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 + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm -r conftest* + + + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag=' -fno-builtin' + + +{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7471: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:7475: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + +{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic='-qnocommon' + lt_prog_compiler_wl='-Wl,' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + linux* | k*bsd*-gnu) + case $cc_basename in + icc* | ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + esac + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic" >&6; } + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + +{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_pic_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7761: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:7765: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_pic_works" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $rm -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_static_works" >&6; } + +if test x"$lt_cv_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + +{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_c_o+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7865: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:7869: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; } + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6; } + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } + + runpath_var= + allow_undefined_flag= + enable_shared_with_static_runtimes=no + archive_cmds= + archive_expsym_cmds= + old_archive_From_new_cmds= + old_archive_from_expsyms_cmds= + export_dynamic_flag_spec= + whole_archive_flag_spec= + thread_safe_flag_spec= + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld= + hardcode_libdir_separator= + hardcode_direct=no + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + link_all_deplibs=unknown + hardcode_automatic=no + module_cmds= + module_expsym_cmds= + always_export_symbols=no + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <<EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | k*bsd*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + link_all_deplibs=no + else + ld_shlibs=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes=yes + ;; + + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[012]) + allow_undefined_flag='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='' + link_all_deplibs=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs=no + ;; + esac + fi + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + hardcode_direct=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld='-rpath $libdir' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5 +echo "${ECHO_T}$ld_shlibs" >&6; } +test "$ld_shlibs" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } + $rm conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc=no + else + archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 +echo "${ECHO_T}$archive_cmds_need_lc" >&6; } + ;; + esac + fi + ;; +esac + +{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" + +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'` + else + lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + sys_lib_search_path_spec=`echo $lt_search_path_spec` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec" +fi + +sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec" +fi + +sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var" || \ + test "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6; } + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + ;; + *) + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + ;; + esac +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dl_dlopen=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + { echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; } +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef shl_load + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_shl_load || defined __stub___shl_load +choke me +#endif + +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_shl_load=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6; } +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; } +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dld_shl_load=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; } +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + { echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; } +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef dlopen + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_dlopen || defined __stub___dlopen +choke me +#endif + +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_dlopen=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6; } +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dl_dlopen=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; } +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_svld_dlopen=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; } +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; } +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dld_link (); +int +main () +{ +return dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dld_dld_link=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; } +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; } +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<EOF +#line 10242 "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include <dlfcn.h> +#endif + +#include <stdio.h> + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + exit (status); +} +EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6; } + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; } +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<EOF +#line 10342 "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include <dlfcn.h> +#endif + +#include <stdio.h> + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + exit (status); +} +EOF + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# Report which library types will actually be built +{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6; } + +{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; } +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case $host_os in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix[4-9]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +{ echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6; } + +{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; } +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +{ echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6; } + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler \ + CC \ + LD \ + lt_prog_compiler_wl \ + lt_prog_compiler_pic \ + lt_prog_compiler_static \ + lt_prog_compiler_no_builtin_flag \ + export_dynamic_flag_spec \ + thread_safe_flag_spec \ + whole_archive_flag_spec \ + enable_shared_with_static_runtimes \ + old_archive_cmds \ + old_archive_from_new_cmds \ + predep_objects \ + postdep_objects \ + predeps \ + postdeps \ + compiler_lib_search_path \ + compiler_lib_search_dirs \ + archive_cmds \ + archive_expsym_cmds \ + postinstall_cmds \ + postuninstall_cmds \ + old_archive_from_expsyms_cmds \ + allow_undefined_flag \ + no_undefined_flag \ + export_symbols_cmds \ + hardcode_libdir_flag_spec \ + hardcode_libdir_flag_spec_ld \ + hardcode_libdir_separator \ + hardcode_automatic \ + module_cmds \ + module_expsym_cmds \ + lt_cv_prog_compiler_c_o \ + fix_srcfile_path \ + exclude_expsyms \ + include_expsyms; do + + case $var in + old_archive_cmds | \ + old_archive_from_new_cmds | \ + archive_cmds | \ + archive_expsym_cmds | \ + module_cmds | \ + module_expsym_cmds | \ + old_archive_from_expsyms_cmds | \ + export_symbols_cmds | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + { echo "$as_me:$LINENO: creating $ofile" >&5 +echo "$as_me: creating $ofile" >&6;} + + cat <<__EOF__ >> "$cfgfile" +#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 +# +# 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 2 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="$SED -e 1s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU C compiler? +with_gcc=$GCC + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps + +# The directories searched by this compiler when creating a shared +# library +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + 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 + +CC="$lt_save_CC" + + +# Check whether --with-tags was given. +if test "${with_tags+set}" = set; then + withval=$with_tags; tagnames="$withval" +fi + + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} + else + { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 +echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} + fi + fi + if test -z "$LTCFLAGS"; then + eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in + "") ;; + *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 +echo "$as_me: error: invalid tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 +echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} + { (exit 1); exit 1; }; } + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + 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 + + + + +archive_cmds_need_lc_CXX=no +allow_undefined_flag_CXX= +always_export_symbols_CXX=no +archive_expsym_cmds_CXX= +export_dynamic_flag_spec_CXX= +hardcode_direct_CXX=no +hardcode_libdir_flag_spec_CXX= +hardcode_libdir_flag_spec_ld_CXX= +hardcode_libdir_separator_CXX= +hardcode_minus_L_CXX=no +hardcode_shlibpath_var_CXX=unsupported +hardcode_automatic_CXX=no +module_cmds_CXX= +module_expsym_cmds_CXX= +link_all_deplibs_CXX=unknown +old_archive_cmds_CXX=$old_archive_cmds +no_undefined_flag_CXX= +whole_archive_flag_spec_CXX= +enable_shared_with_static_runtimes_CXX=no + +# Dependencies to place before and after the object being linked: +predep_objects_CXX= +postdep_objects_CXX= +predeps_CXX= +postdeps_CXX= +compiler_lib_search_path_CXX= +compiler_lib_search_dirs_CXX= + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +objext_CXX=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[]) { return(0); }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm -r conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + $as_unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + $as_unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +compiler_CXX=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' +else + lt_prog_compiler_no_builtin_flag_CXX= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { echo "$as_me:$LINENO: checking for ld used by $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; } +else + { echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; } +fi +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break + ;; + *) + test "$with_gnu_ld" != yes && break + ;; + esac + fi + done + IFS="$lt_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$lt_cv_path_LD" +if test -n "$LD"; then + { echo "$as_me:$LINENO: result: $LD" >&5 +echo "${ECHO_T}$LD" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; } +if test "${lt_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 </dev/null` in +*GNU* | *'with BFD'*) + lt_cv_prog_gnu_ld=yes + ;; +*) + lt_cv_prog_gnu_ld=no + ;; +esac +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_CXX= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } +ld_shlibs_CXX=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_CXX='' + hardcode_direct_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct_CXX=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_CXX=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_CXX='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_CXX="-z nodefs" + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_CXX=' ${wl}-bernotok' + allow_undefined_flag_CXX=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX='$convenience' + archive_cmds_need_lc_CXX=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_CXX=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_CXX=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs_CXX=no + fi + ;; + darwin* | rhapsody*) + archive_cmds_need_lc_CXX=no + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + whole_archive_flag_spec_CXX='' + link_all_deplibs_CXX=yes + allow_undefined_flag_CXX="$_lt_dar_allow_undefined" + if test "$GXX" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "$lt_cv_apple_cc_single_mod" != "yes"; then + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" + fi + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' + module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_CXX=no + ;; + esac + fi + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + freebsd[12]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + ld_shlibs_CXX=no + ;; + freebsd-elf*) + archive_cmds_need_lc_CXX=no + ;; + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + ld_shlibs_CXX=yes + ;; + gnu*) + ;; + hpux9*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + case $host_cpu in + hppa*64*|ia64*) ;; + *) + export_dynamic_flag_spec_CXX='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + ;; + *) + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + interix[3-9]*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + link_all_deplibs_CXX=yes + ;; + esac + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + ;; + linux* | k*bsd*-gnu) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc*) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + archive_cmds_need_lc_CXX=no + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + hardcode_libdir_flag_spec_CXX='-R$libdir' + whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + openbsd2*) + # C++ shared libraries are fairly broken + ld_shlibs_CXX=no + ;; + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + export_dynamic_flag_spec_CXX='${wl}-E' + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + else + ld_shlibs_CXX=no + fi + ;; + osf3*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx*) + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx*) + allow_undefined_flag_CXX=' -expect_unresolved \*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + archive_cmds_need_lc_CXX=yes + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_shlibpath_var_CXX=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' + ;; + esac + link_all_deplibs_CXX=yes + + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + no_undefined_flag_CXX=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag_CXX='${wl}-z,text' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + # So that behaviour is only enabled if SCOABSPATH is set to a + # non-empty value in the environment. Most likely only useful for + # creating official distributions of packages. + # This is a hack until libtool officially supports absolute path + # names for shared libraries. + no_undefined_flag_CXX='${wl}-z,text' + allow_undefined_flag_CXX='${wl}-z,nodefs' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + export_dynamic_flag_spec_CXX='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; +esac +{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6; } +test "$ld_shlibs_CXX" = no && can_build_shared=no + +GCC_CXX="$GXX" +LD_CXX="$LD" + +cat > conftest.$ac_ext <<EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +EOF + +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + # The `*' in the case matches for architectures that use `case' in + # $output_verbose_cmd can trigger glob expansion during the loop + # eval without this substitution. + output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` + + for p in `eval $output_verbose_link_cmd`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" \ + || test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX="${prev}${p}" + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$postdeps_CXX"; then + postdeps_CXX="${prev}${p}" + else + postdeps_CXX="${postdeps_CXX} ${prev}${p}" + fi + fi + ;; + + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX="$p" + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX="$p" + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$rm -f confest.$objext + +compiler_lib_search_dirs_CXX= +if test -n "$compiler_lib_search_path_CXX"; then + compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` +fi + +# PORTME: override above test on systems where it is broken +case $host_os in +interix[3-9]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + predep_objects_CXX= + postdep_objects_CXX= + postdeps_CXX= + ;; + +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + # + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + if test "$solaris_use_stlport4" != yes; then + postdeps_CXX='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + postdeps_CXX='-library=Cstd -library=Crun' + fi + ;; + esac + ;; +esac + +case " $postdeps_CXX " in +*" -lc "*) archive_cmds_need_lc_CXX=no ;; +esac + +lt_prog_compiler_wl_CXX= +lt_prog_compiler_pic_CXX= +lt_prog_compiler_static_CXX= + +{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } + + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_CXX=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + else + case $host_os in + aix[4-9]*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic_CXX='-qnocommon' + lt_prog_compiler_wl_CXX='-Wl,' + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++*) + lt_prog_compiler_pic_CXX='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + lt_prog_compiler_pic_CXX='+Z' + fi + ;; + aCC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_CXX='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu) + case $cc_basename in + KCC*) + # KAI C++ Compiler + lt_prog_compiler_wl_CXX='--backend -Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + ;; + icpc* | ecpc*) + # Intel C++ + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fpic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd* | netbsdelf*-gnu) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx*) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + lt_prog_compiler_pic_CXX='-pic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + lcc*) + # Lucid + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + lt_prog_compiler_pic_CXX='-KPIC' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + esac + ;; + vxworks*) + ;; + *) + lt_prog_compiler_can_build_shared_CXX=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6; } + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_CXX"; then + +{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_pic_works_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:12743: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:12747: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works_CXX=yes + fi + fi + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_CXX" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" +{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_static_works_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_static_works_CXX=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works_CXX=yes + fi + else + lt_cv_prog_compiler_static_works_CXX=yes + fi + fi + $rm -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_CXX" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_static_works_CXX" >&6; } + +if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then + : +else + lt_prog_compiler_static_CXX= +fi + + +{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_CXX=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:12847: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:12851: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . 2>&5 + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6; } + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6; } + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } + + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix[4-9]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX="$ltdll_cmds" + ;; + cygwin* | mingw*) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + ;; + linux* | k*bsd*-gnu) + link_all_deplibs_CXX=no + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + +{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6; } +test "$ld_shlibs_CXX" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_CXX in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } + $rm conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + pic_flag=$lt_prog_compiler_pic_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_CXX=no + else + archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6; } + ;; + esac + fi + ;; +esac + +{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" + +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec" +fi + +sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec" +fi + +sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } +hardcode_action_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || \ + test -n "$runpath_var_CXX" || \ + test "X$hardcode_automatic_CXX" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_CXX" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && + test "$hardcode_minus_L_CXX" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +{ echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 +echo "${ECHO_T}$hardcode_action_CXX" >&6; } + +if test "$hardcode_action_CXX" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_CXX \ + CC_CXX \ + LD_CXX \ + lt_prog_compiler_wl_CXX \ + lt_prog_compiler_pic_CXX \ + lt_prog_compiler_static_CXX \ + lt_prog_compiler_no_builtin_flag_CXX \ + export_dynamic_flag_spec_CXX \ + thread_safe_flag_spec_CXX \ + whole_archive_flag_spec_CXX \ + enable_shared_with_static_runtimes_CXX \ + old_archive_cmds_CXX \ + old_archive_from_new_cmds_CXX \ + predep_objects_CXX \ + postdep_objects_CXX \ + predeps_CXX \ + postdeps_CXX \ + compiler_lib_search_path_CXX \ + compiler_lib_search_dirs_CXX \ + archive_cmds_CXX \ + archive_expsym_cmds_CXX \ + postinstall_cmds_CXX \ + postuninstall_cmds_CXX \ + old_archive_from_expsyms_cmds_CXX \ + allow_undefined_flag_CXX \ + no_undefined_flag_CXX \ + export_symbols_cmds_CXX \ + hardcode_libdir_flag_spec_CXX \ + hardcode_libdir_flag_spec_ld_CXX \ + hardcode_libdir_separator_CXX \ + hardcode_automatic_CXX \ + module_cmds_CXX \ + module_expsym_cmds_CXX \ + lt_cv_prog_compiler_c_o_CXX \ + fix_srcfile_path_CXX \ + exclude_expsyms_CXX \ + include_expsyms_CXX; do + + case $var in + old_archive_cmds_CXX | \ + old_archive_from_new_cmds_CXX | \ + archive_cmds_CXX | \ + archive_expsym_cmds_CXX | \ + module_cmds_CXX | \ + module_expsym_cmds_CXX | \ + old_archive_from_expsyms_cmds_CXX | \ + export_symbols_cmds_CXX | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_CXX + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_CXX +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_CXX + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_CXX + +# The directories searched by this compiler when creating a shared +# library +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + 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 + +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld + + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu + + +archive_cmds_need_lc_F77=no +allow_undefined_flag_F77= +always_export_symbols_F77=no +archive_expsym_cmds_F77= +export_dynamic_flag_spec_F77= +hardcode_direct_F77=no +hardcode_libdir_flag_spec_F77= +hardcode_libdir_flag_spec_ld_F77= +hardcode_libdir_separator_F77= +hardcode_minus_L_F77=no +hardcode_automatic_F77=no +module_cmds_F77= +module_expsym_cmds_F77= +link_all_deplibs_F77=unknown +old_archive_cmds_F77=$old_archive_cmds +no_undefined_flag_F77= +whole_archive_flag_spec_F77= +enable_shared_with_static_runtimes_F77=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +objext_F77=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="\ + subroutine t + return + end +" + +# Code to be used in simple link tests +lt_simple_link_test_code="\ + program t + end +" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm -r conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${F77-"f77"} +compiler=$CC +compiler_F77=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6; } + +{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; } +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case $host_os in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; +aix[4-9]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +{ echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6; } + +{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; } +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +{ echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6; } + +GCC_F77="$G77" +LD_F77="$LD" + +lt_prog_compiler_wl_F77= +lt_prog_compiler_pic_F77= +lt_prog_compiler_static_F77= + +{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } + + if test "$GCC" = yes; then + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_static_F77='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_F77='-fno-common' + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_F77=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_F77=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_F77='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + else + lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic_F77='-qnocommon' + lt_prog_compiler_wl_F77='-Wl,' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_F77='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_F77='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + linux* | k*bsd*-gnu) + case $cc_basename in + icc* | ecc*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-fpic' + lt_prog_compiler_static_F77='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl_F77='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + lt_prog_compiler_wl_F77='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + lt_prog_compiler_wl_F77='' + ;; + esac + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_F77='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static_F77='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_F77='-Qoption ld ';; + *) + lt_prog_compiler_wl_F77='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl_F77='-Qoption ld ' + lt_prog_compiler_pic_F77='-PIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_F77='-Kconform_pic' + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_can_build_shared_F77=no + ;; + + uts4*) + lt_prog_compiler_pic_F77='-pic' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_F77=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6; } + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_F77"; then + +{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_pic_works_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_pic_works_F77=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_F77" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:14445: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:14449: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works_F77=yes + fi + fi + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_F77" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_F77" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works_F77" = xyes; then + case $lt_prog_compiler_pic_F77 in + "" | " "*) ;; + *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; + esac +else + lt_prog_compiler_pic_F77= + lt_prog_compiler_can_build_shared_F77=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_F77= + ;; + *) + lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\" +{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_static_works_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_static_works_F77=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works_F77=yes + fi + else + lt_cv_prog_compiler_static_works_F77=yes + fi + fi + $rm -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_F77" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_static_works_F77" >&6; } + +if test x"$lt_cv_prog_compiler_static_works_F77" = xyes; then + : +else + lt_prog_compiler_static_F77= +fi + + +{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_F77=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:14549: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:14553: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_F77=yes + fi + fi + chmod u+w . 2>&5 + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6; } + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6; } + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } + + runpath_var= + allow_undefined_flag_F77= + enable_shared_with_static_runtimes_F77=no + archive_cmds_F77= + archive_expsym_cmds_F77= + old_archive_From_new_cmds_F77= + old_archive_from_expsyms_cmds_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= + thread_safe_flag_spec_F77= + hardcode_libdir_flag_spec_F77= + hardcode_libdir_flag_spec_ld_F77= + hardcode_libdir_separator_F77= + hardcode_direct_F77=no + hardcode_minus_L_F77=no + hardcode_shlibpath_var_F77=unsupported + link_all_deplibs_F77=unknown + hardcode_automatic_F77=no + module_cmds_F77= + module_expsym_cmds_F77= + always_export_symbols_F77=no + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_F77= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_F77='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_F77=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_F77=no + cat <<EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + + # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_F77=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_F77=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_F77='-L$libdir' + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=no + enable_shared_with_static_runtimes_F77=yes + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs_F77=no + fi + ;; + + interix[3-9]*) + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + export_dynamic_flag_spec_F77='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | k*bsd*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec_F77='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + archive_cmds_F77='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + link_all_deplibs_F77=no + else + ld_shlibs_F77=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_F77=no + cat <<EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs_F77=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + esac + + if test "$ld_shlibs_F77" = no; then + runpath_var= + hardcode_libdir_flag_spec_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=yes + archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_F77=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_F77=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_F77='' + hardcode_direct_F77=yes + hardcode_libdir_separator_F77=':' + link_all_deplibs_F77=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct_F77=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_F77=yes + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_libdir_separator_F77= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_F77=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_F77='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_f77_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_F77="-z nodefs" + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_f77_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_F77=' ${wl}-bernotok' + allow_undefined_flag_F77=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_F77='$convenience' + archive_cmds_need_lc_F77=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_F77=no + ;; + + bsdi[45]*) + export_dynamic_flag_spec_F77=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_F77=' ' + allow_undefined_flag_F77=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_F77='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_F77='lib -OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path_F77='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_F77=yes + ;; + + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[012]) + allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc_F77=no + hardcode_direct_F77=no + hardcode_automatic_F77=yes + hardcode_shlibpath_var_F77=unsupported + whole_archive_flag_spec_F77='' + link_all_deplibs_F77=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds_F77="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_F77="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_F77="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_F77="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' + module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_F77=no + ;; + esac + fi + ;; + + dgux*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + freebsd1*) + ld_shlibs_F77=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + + hardcode_direct_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_libdir_flag_spec_ld_F77='+b $libdir' + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + ;; + *) + hardcode_direct_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + link_all_deplibs_F77=yes + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + newsos6) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_shlibpath_var_F77=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + export_dynamic_flag_spec_F77='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + ;; + *) + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs_F77=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + allow_undefined_flag_F77=unsupported + archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_F77='-rpath $libdir' + fi + hardcode_libdir_separator_F77=: + ;; + + solaris*) + no_undefined_flag_F77=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_shlibpath_var_F77=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs_F77=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_F77='$CC -r -o $output$reload_objs' + hardcode_direct_F77=no + ;; + motorola) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_F77=no + ;; + + sysv4.3*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + export_dynamic_flag_spec_F77='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_F77=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag_F77='${wl}-z,text' + archive_cmds_need_lc_F77=no + hardcode_shlibpath_var_F77=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag_F77='${wl}-z,text' + allow_undefined_flag_F77='${wl}-z,nodefs' + archive_cmds_need_lc_F77=no + hardcode_shlibpath_var_F77=no + hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator_F77=':' + link_all_deplibs_F77=yes + export_dynamic_flag_spec_F77='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + *) + ld_shlibs_F77=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 +echo "${ECHO_T}$ld_shlibs_F77" >&6; } +test "$ld_shlibs_F77" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_F77" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_F77=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_F77 in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } + $rm conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_F77 + pic_flag=$lt_prog_compiler_pic_F77 + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_F77 + allow_undefined_flag_F77= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_F77=no + else + archive_cmds_need_lc_F77=yes + fi + allow_undefined_flag_F77=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6; } + ;; + esac + fi + ;; +esac + +{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" + +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec" +fi + +sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec" +fi + +sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } +hardcode_action_F77= +if test -n "$hardcode_libdir_flag_spec_F77" || \ + test -n "$runpath_var_F77" || \ + test "X$hardcode_automatic_F77" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_F77" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && + test "$hardcode_minus_L_F77" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_F77=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_F77=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_F77=unsupported +fi +{ echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 +echo "${ECHO_T}$hardcode_action_F77" >&6; } + +if test "$hardcode_action_F77" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_F77 \ + CC_F77 \ + LD_F77 \ + lt_prog_compiler_wl_F77 \ + lt_prog_compiler_pic_F77 \ + lt_prog_compiler_static_F77 \ + lt_prog_compiler_no_builtin_flag_F77 \ + export_dynamic_flag_spec_F77 \ + thread_safe_flag_spec_F77 \ + whole_archive_flag_spec_F77 \ + enable_shared_with_static_runtimes_F77 \ + old_archive_cmds_F77 \ + old_archive_from_new_cmds_F77 \ + predep_objects_F77 \ + postdep_objects_F77 \ + predeps_F77 \ + postdeps_F77 \ + compiler_lib_search_path_F77 \ + compiler_lib_search_dirs_F77 \ + archive_cmds_F77 \ + archive_expsym_cmds_F77 \ + postinstall_cmds_F77 \ + postuninstall_cmds_F77 \ + old_archive_from_expsyms_cmds_F77 \ + allow_undefined_flag_F77 \ + no_undefined_flag_F77 \ + export_symbols_cmds_F77 \ + hardcode_libdir_flag_spec_F77 \ + hardcode_libdir_flag_spec_ld_F77 \ + hardcode_libdir_separator_F77 \ + hardcode_automatic_F77 \ + module_cmds_F77 \ + module_expsym_cmds_F77 \ + lt_cv_prog_compiler_c_o_F77 \ + fix_srcfile_path_F77 \ + exclude_expsyms_F77 \ + include_expsyms_F77; do + + case $var in + old_archive_cmds_F77 | \ + old_archive_from_new_cmds_F77 | \ + archive_cmds_F77 | \ + archive_expsym_cmds_F77 | \ + module_cmds_F77 | \ + module_expsym_cmds_F77 | \ + old_archive_from_expsyms_cmds_F77 | \ + export_symbols_cmds_F77 | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_F77 + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_compiler_F77 + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_F77 + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_F77 + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_F77 + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_F77 +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_F77 + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_F77 +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_F77 +archive_expsym_cmds=$lt_archive_expsym_cmds_F77 +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_F77 +module_expsym_cmds=$lt_module_expsym_cmds_F77 + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_F77 + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_F77 + +# The directories searched by this compiler when creating a shared +# library +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_F77 + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_F77 + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_F77 + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_F77 + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_F77 + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_F77 + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_F77 + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_F77 + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_F77 + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_F77 + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_F77 + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_F77 + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_F77 + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + 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 + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +objext_GCJ=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm -r conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +compiler=$CC +compiler_GCJ=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +archive_cmds_need_lc_GCJ=no + +old_archive_cmds_GCJ=$old_archive_cmds + + +lt_prog_compiler_no_builtin_flag_GCJ= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' + + +{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:16769: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:16773: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl_GCJ= +lt_prog_compiler_pic_GCJ= +lt_prog_compiler_static_GCJ= + +{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; } + + if test "$GCC" = yes; then + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_static_GCJ='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_GCJ='-fno-common' + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_GCJ=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_GCJ=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_GCJ='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + else + lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic_GCJ='-qnocommon' + lt_prog_compiler_wl_GCJ='-Wl,' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + linux* | k*bsd*-gnu) + case $cc_basename in + icc* | ecc*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-fpic' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + lt_prog_compiler_wl_GCJ='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + lt_prog_compiler_wl_GCJ='' + ;; + esac + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_GCJ='-Qoption ld ';; + *) + lt_prog_compiler_wl_GCJ='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl_GCJ='-Qoption ld ' + lt_prog_compiler_pic_GCJ='-PIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_GCJ='-Kconform_pic' + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_can_build_shared_GCJ=no + ;; + + uts4*) + lt_prog_compiler_pic_GCJ='-pic' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_GCJ=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6; } + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_GCJ"; then + +{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_pic_works_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_pic_works_GCJ=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_GCJ" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:17059: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:17063: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works_GCJ=yes + fi + fi + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_GCJ" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_GCJ" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works_GCJ" = xyes; then + case $lt_prog_compiler_pic_GCJ in + "" | " "*) ;; + *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; + esac +else + lt_prog_compiler_pic_GCJ= + lt_prog_compiler_can_build_shared_GCJ=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_GCJ= + ;; + *) + lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\" +{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_static_works_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_static_works_GCJ=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works_GCJ=yes + fi + else + lt_cv_prog_compiler_static_works_GCJ=yes + fi + fi + $rm -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_GCJ" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_static_works_GCJ" >&6; } + +if test x"$lt_cv_prog_compiler_static_works_GCJ" = xyes; then + : +else + lt_prog_compiler_static_GCJ= +fi + + +{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; } +if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_GCJ=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:17163: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:17167: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_GCJ=yes + fi + fi + chmod u+w . 2>&5 + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6; } + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; } + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6; } + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; } + + runpath_var= + allow_undefined_flag_GCJ= + enable_shared_with_static_runtimes_GCJ=no + archive_cmds_GCJ= + archive_expsym_cmds_GCJ= + old_archive_From_new_cmds_GCJ= + old_archive_from_expsyms_cmds_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= + thread_safe_flag_spec_GCJ= + hardcode_libdir_flag_spec_GCJ= + hardcode_libdir_flag_spec_ld_GCJ= + hardcode_libdir_separator_GCJ= + hardcode_direct_GCJ=no + hardcode_minus_L_GCJ=no + hardcode_shlibpath_var_GCJ=unsupported + link_all_deplibs_GCJ=unknown + hardcode_automatic_GCJ=no + module_cmds_GCJ= + module_expsym_cmds_GCJ= + always_export_symbols_GCJ=no + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_GCJ= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_GCJ='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_GCJ=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_GCJ=no + cat <<EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + + # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_GCJ=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_GCJ=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_GCJ='-L$libdir' + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=no + enable_shared_with_static_runtimes_GCJ=yes + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + interix[3-9]*) + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + export_dynamic_flag_spec_GCJ='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | k*bsd*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec_GCJ='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + *) + tmp_sharedflag='-shared' ;; + esac + archive_cmds_GCJ='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + link_all_deplibs_GCJ=no + else + ld_shlibs_GCJ=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_GCJ=no + cat <<EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs_GCJ=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + esac + + if test "$ld_shlibs_GCJ" = no; then + runpath_var= + hardcode_libdir_flag_spec_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=yes + archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_GCJ=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_GCJ=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_GCJ='' + hardcode_direct_GCJ=yes + hardcode_libdir_separator_GCJ=':' + link_all_deplibs_GCJ=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct_GCJ=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_GCJ=yes + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_libdir_separator_GCJ= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_GCJ=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_GCJ='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_GCJ="-z nodefs" + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_GCJ=' ${wl}-bernotok' + allow_undefined_flag_GCJ=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_GCJ='$convenience' + archive_cmds_need_lc_GCJ=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_GCJ=no + ;; + + bsdi[45]*) + export_dynamic_flag_spec_GCJ=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_GCJ=' ' + allow_undefined_flag_GCJ=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_GCJ='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_GCJ='lib -OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_GCJ=yes + ;; + + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[012]) + allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc_GCJ=no + hardcode_direct_GCJ=no + hardcode_automatic_GCJ=yes + hardcode_shlibpath_var_GCJ=unsupported + whole_archive_flag_spec_GCJ='' + link_all_deplibs_GCJ=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds_GCJ="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_GCJ="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_GCJ="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_GCJ="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring' + module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_GCJ=no + ;; + esac + fi + ;; + + dgux*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + freebsd1*) + ld_shlibs_GCJ=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + + hardcode_direct_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + ;; + *) + hardcode_direct_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + link_all_deplibs_GCJ=yes + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + newsos6) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_shlibpath_var_GCJ=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + export_dynamic_flag_spec_GCJ='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + ;; + *) + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs_GCJ=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + allow_undefined_flag_GCJ=unsupported + archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_GCJ='-rpath $libdir' + fi + hardcode_libdir_separator_GCJ=: + ;; + + solaris*) + no_undefined_flag_GCJ=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_shlibpath_var_GCJ=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs_GCJ=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_GCJ='$CC -r -o $output$reload_objs' + hardcode_direct_GCJ=no + ;; + motorola) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4.3*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + export_dynamic_flag_spec_GCJ='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_GCJ=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag_GCJ='${wl}-z,text' + archive_cmds_need_lc_GCJ=no + hardcode_shlibpath_var_GCJ=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag_GCJ='${wl}-z,text' + allow_undefined_flag_GCJ='${wl}-z,nodefs' + archive_cmds_need_lc_GCJ=no + hardcode_shlibpath_var_GCJ=no + hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator_GCJ=':' + link_all_deplibs_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + *) + ld_shlibs_GCJ=no + ;; + esac + fi + +{ echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 +echo "${ECHO_T}$ld_shlibs_GCJ" >&6; } +test "$ld_shlibs_GCJ" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_GCJ" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_GCJ=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_GCJ in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; } + $rm conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_GCJ + pic_flag=$lt_prog_compiler_pic_GCJ + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ + allow_undefined_flag_GCJ= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_GCJ=no + else + archive_cmds_need_lc_GCJ=yes + fi + allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6; } + ;; + esac + fi + ;; +esac + +{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; } +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" + +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec" +fi + +sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec" +fi + +sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; } +hardcode_action_GCJ= +if test -n "$hardcode_libdir_flag_spec_GCJ" || \ + test -n "$runpath_var_GCJ" || \ + test "X$hardcode_automatic_GCJ" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_GCJ" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && + test "$hardcode_minus_L_GCJ" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_GCJ=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_GCJ=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_GCJ=unsupported +fi +{ echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 +echo "${ECHO_T}$hardcode_action_GCJ" >&6; } + +if test "$hardcode_action_GCJ" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_GCJ \ + CC_GCJ \ + LD_GCJ \ + lt_prog_compiler_wl_GCJ \ + lt_prog_compiler_pic_GCJ \ + lt_prog_compiler_static_GCJ \ + lt_prog_compiler_no_builtin_flag_GCJ \ + export_dynamic_flag_spec_GCJ \ + thread_safe_flag_spec_GCJ \ + whole_archive_flag_spec_GCJ \ + enable_shared_with_static_runtimes_GCJ \ + old_archive_cmds_GCJ \ + old_archive_from_new_cmds_GCJ \ + predep_objects_GCJ \ + postdep_objects_GCJ \ + predeps_GCJ \ + postdeps_GCJ \ + compiler_lib_search_path_GCJ \ + compiler_lib_search_dirs_GCJ \ + archive_cmds_GCJ \ + archive_expsym_cmds_GCJ \ + postinstall_cmds_GCJ \ + postuninstall_cmds_GCJ \ + old_archive_from_expsyms_cmds_GCJ \ + allow_undefined_flag_GCJ \ + no_undefined_flag_GCJ \ + export_symbols_cmds_GCJ \ + hardcode_libdir_flag_spec_GCJ \ + hardcode_libdir_flag_spec_ld_GCJ \ + hardcode_libdir_separator_GCJ \ + hardcode_automatic_GCJ \ + module_cmds_GCJ \ + module_expsym_cmds_GCJ \ + lt_cv_prog_compiler_c_o_GCJ \ + fix_srcfile_path_GCJ \ + exclude_expsyms_GCJ \ + include_expsyms_GCJ; do + + case $var in + old_archive_cmds_GCJ | \ + old_archive_from_new_cmds_GCJ | \ + archive_cmds_GCJ | \ + archive_expsym_cmds_GCJ | \ + module_cmds_GCJ | \ + module_expsym_cmds_GCJ | \ + old_archive_from_expsyms_cmds_GCJ | \ + export_symbols_cmds_GCJ | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_GCJ + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_compiler_GCJ + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_GCJ + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_GCJ + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_GCJ + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_GCJ +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_GCJ + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_GCJ +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_GCJ +archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_GCJ +module_expsym_cmds=$lt_module_expsym_cmds_GCJ + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_GCJ + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_GCJ + +# The directories searched by this compiler when creating a shared +# library +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_GCJ + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_GCJ + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_GCJ + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_GCJ + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_GCJ + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_GCJ + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_GCJ + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_GCJ + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_GCJ + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_GCJ + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_GCJ + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_GCJ + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + 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 + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + RC) + + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +objext_RC=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm -r conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +compiler=$CC +compiler_RC=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + +lt_cv_prog_compiler_c_o_RC=yes + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_RC \ + CC_RC \ + LD_RC \ + lt_prog_compiler_wl_RC \ + lt_prog_compiler_pic_RC \ + lt_prog_compiler_static_RC \ + lt_prog_compiler_no_builtin_flag_RC \ + export_dynamic_flag_spec_RC \ + thread_safe_flag_spec_RC \ + whole_archive_flag_spec_RC \ + enable_shared_with_static_runtimes_RC \ + old_archive_cmds_RC \ + old_archive_from_new_cmds_RC \ + predep_objects_RC \ + postdep_objects_RC \ + predeps_RC \ + postdeps_RC \ + compiler_lib_search_path_RC \ + compiler_lib_search_dirs_RC \ + archive_cmds_RC \ + archive_expsym_cmds_RC \ + postinstall_cmds_RC \ + postuninstall_cmds_RC \ + old_archive_from_expsyms_cmds_RC \ + allow_undefined_flag_RC \ + no_undefined_flag_RC \ + export_symbols_cmds_RC \ + hardcode_libdir_flag_spec_RC \ + hardcode_libdir_flag_spec_ld_RC \ + hardcode_libdir_separator_RC \ + hardcode_automatic_RC \ + module_cmds_RC \ + module_expsym_cmds_RC \ + lt_cv_prog_compiler_c_o_RC \ + fix_srcfile_path_RC \ + exclude_expsyms_RC \ + include_expsyms_RC; do + + case $var in + old_archive_cmds_RC | \ + old_archive_from_new_cmds_RC | \ + archive_cmds_RC | \ + archive_expsym_cmds_RC | \ + module_cmds_RC | \ + module_expsym_cmds_RC | \ + old_archive_from_expsyms_cmds_RC | \ + export_symbols_cmds_RC | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_RC + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_compiler_RC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_RC + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_RC + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_RC + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_RC +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_RC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_RC +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_RC +archive_expsym_cmds=$lt_archive_expsym_cmds_RC +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_RC +module_expsym_cmds=$lt_module_expsym_cmds_RC + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_RC + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_RC + +# The directories searched by this compiler when creating a shared +# library +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_RC + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_RC + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_RC + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_RC + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_RC + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_RC + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_RC + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_RC + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_RC + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_RC + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_RC + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_RC + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_RC + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_RC + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + 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 + +CC="$lt_save_CC" + + ;; + + *) + { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 +echo "$as_me: error: Unsupported tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 +echo "$as_me: error: unable to update list of available tagged configurations." >&2;} + { (exit 1); exit 1; }; } + fi +fi + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Prevent multiple expansion + + + + + + + + + + + + + + + + + + + + + + +# Check whether some low-level functions/files are available +{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +int +main () +{ + + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + 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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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 +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + + +# These are tested for by AC_HEADER_STDC, but I check again to set the var +if test "${ac_cv_header_stdint_h+set}" = set; then + { echo "$as_me:$LINENO: checking for stdint.h" >&5 +echo $ECHO_N "checking for stdint.h... $ECHO_C" >&6; } +if test "${ac_cv_header_stdint_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdint_h" >&5 +echo "${ECHO_T}$ac_cv_header_stdint_h" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking stdint.h usability" >&5 +echo $ECHO_N "checking stdint.h usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <stdint.h> +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking stdint.h presence" >&5 +echo $ECHO_N "checking stdint.h presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdint.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: stdint.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: stdint.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: stdint.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: stdint.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: stdint.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: stdint.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: stdint.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: stdint.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: stdint.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: stdint.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: stdint.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: stdint.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: stdint.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: stdint.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: stdint.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: stdint.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ------------------------------------ ## +## Report this to opensource@google.com ## +## ------------------------------------ ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for stdint.h" >&5 +echo $ECHO_N "checking for stdint.h... $ECHO_C" >&6; } +if test "${ac_cv_header_stdint_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_stdint_h=$ac_header_preproc +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdint_h" >&5 +echo "${ECHO_T}$ac_cv_header_stdint_h" >&6; } + +fi +if test $ac_cv_header_stdint_h = yes; then + ac_cv_have_stdint_h=1 +else + ac_cv_have_stdint_h=0 +fi + + +if test "${ac_cv_header_sys_types_h+set}" = set; then + { echo "$as_me:$LINENO: checking for sys/types.h" >&5 +echo $ECHO_N "checking for sys/types.h... $ECHO_C" >&6; } +if test "${ac_cv_header_sys_types_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_types_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_types_h" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking sys/types.h usability" >&5 +echo $ECHO_N "checking sys/types.h usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <sys/types.h> +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking sys/types.h presence" >&5 +echo $ECHO_N "checking sys/types.h presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: sys/types.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sys/types.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/types.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sys/types.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: sys/types.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sys/types.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/types.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sys/types.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/types.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sys/types.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/types.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sys/types.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/types.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/types.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/types.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sys/types.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ------------------------------------ ## +## Report this to opensource@google.com ## +## ------------------------------------ ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for sys/types.h" >&5 +echo $ECHO_N "checking for sys/types.h... $ECHO_C" >&6; } +if test "${ac_cv_header_sys_types_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_sys_types_h=$ac_header_preproc +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_types_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_types_h" >&6; } + +fi +if test $ac_cv_header_sys_types_h = yes; then + ac_cv_have_systypes_h=1 +else + ac_cv_have_systypes_h=0 +fi + + +if test "${ac_cv_header_inttypes_h+set}" = set; then + { echo "$as_me:$LINENO: checking for inttypes.h" >&5 +echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6; } +if test "${ac_cv_header_inttypes_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_inttypes_h" >&5 +echo "${ECHO_T}$ac_cv_header_inttypes_h" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking inttypes.h usability" >&5 +echo $ECHO_N "checking inttypes.h usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <inttypes.h> +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking inttypes.h presence" >&5 +echo $ECHO_N "checking inttypes.h presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <inttypes.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: inttypes.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: inttypes.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: inttypes.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: inttypes.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: inttypes.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: inttypes.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: inttypes.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: inttypes.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: inttypes.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: inttypes.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: inttypes.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: inttypes.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: inttypes.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: inttypes.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: inttypes.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: inttypes.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ------------------------------------ ## +## Report this to opensource@google.com ## +## ------------------------------------ ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for inttypes.h" >&5 +echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6; } +if test "${ac_cv_header_inttypes_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_inttypes_h=$ac_header_preproc +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_inttypes_h" >&5 +echo "${ECHO_T}$ac_cv_header_inttypes_h" >&6; } + +fi +if test $ac_cv_header_inttypes_h = yes; then + ac_cv_have_inttypes_h=1 +else + ac_cv_have_inttypes_h=0 +fi + + + +for ac_header in fnmatch.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ------------------------------------ ## +## Report this to opensource@google.com ## +## ------------------------------------ ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +# These are the types I need. We look for them in either stdint.h, +# sys/types.h, or inttypes.h, all of which are part of the default-includes. +{ echo "$as_me:$LINENO: checking for uint16_t" >&5 +echo $ECHO_N "checking for uint16_t... $ECHO_C" >&6; } +if test "${ac_cv_type_uint16_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef uint16_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_uint16_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_uint16_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_uint16_t" >&5 +echo "${ECHO_T}$ac_cv_type_uint16_t" >&6; } +if test $ac_cv_type_uint16_t = yes; then + ac_cv_have_uint16_t=1 +else + ac_cv_have_uint16_t=0 +fi + +{ echo "$as_me:$LINENO: checking for u_int16_t" >&5 +echo $ECHO_N "checking for u_int16_t... $ECHO_C" >&6; } +if test "${ac_cv_type_u_int16_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef u_int16_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_u_int16_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_u_int16_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_u_int16_t" >&5 +echo "${ECHO_T}$ac_cv_type_u_int16_t" >&6; } +if test $ac_cv_type_u_int16_t = yes; then + ac_cv_have_u_int16_t=1 +else + ac_cv_have_u_int16_t=0 +fi + +{ echo "$as_me:$LINENO: checking for __int16" >&5 +echo $ECHO_N "checking for __int16... $ECHO_C" >&6; } +if test "${ac_cv_type___int16+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef __int16 ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type___int16=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type___int16=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type___int16" >&5 +echo "${ECHO_T}$ac_cv_type___int16" >&6; } +if test $ac_cv_type___int16 = yes; then + ac_cv_have___int16=1 +else + ac_cv_have___int16=0 +fi + + + + +for ac_func in strtoll strtoq +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + + { echo "$as_me:$LINENO: checking for __attribute__" >&5 +echo $ECHO_N "checking for __attribute__... $ECHO_C" >&6; } + if test "${ac_cv___attribute__+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdlib.h> + static void foo(void) __attribute__ ((unused)); + void foo(void) { exit(1); } +int +main () +{ + + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv___attribute__=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv___attribute__=no + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + if test "$ac_cv___attribute__" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE___ATTRIBUTE__ 1 +_ACEOF + + fi + { echo "$as_me:$LINENO: result: $ac_cv___attribute__" >&5 +echo "${ECHO_T}$ac_cv___attribute__" >&6; } + +# We only care about __attribute__ ((unused)) +if test x"$ac_cv___attribute__" = x"yes"; then + ac_cv___attribute__unused="__attribute__ ((unused))" +else + ac_cv___attribute__unused= +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 + +acx_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on True64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + { echo "$as_me:$LINENO: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5 +echo $ECHO_N "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_join (); +int +main () +{ +return pthread_join (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + acx_pthread_ok=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + { echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5 +echo "${ECHO_T}$acx_pthread_ok" >&6; } + if test x"$acx_pthread_ok" = xno; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. + +acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) +# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) +# -pthreads: Solaris/gcc +# -mthreads: Mingw32/gcc, Lynx/gcc +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads too; +# also defines -D_REENTRANT) +# ... -mt is also the pthreads flag for HP/aCC +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case "${host_cpu}-${host_os}" in + *solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthreads/-mt/ + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + + acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" + ;; +esac + +if test x"$acx_pthread_ok" = xno; then +for flag in $acx_pthread_flags; do + + case $flag in + none) + { echo "$as_me:$LINENO: checking whether pthreads work without any flags" >&5 +echo $ECHO_N "checking whether pthreads work without any flags... $ECHO_C" >&6; } + ;; + + -*) + { echo "$as_me:$LINENO: checking whether pthreads work with $flag" >&5 +echo $ECHO_N "checking whether pthreads work with $flag... $ECHO_C" >&6; } + PTHREAD_CFLAGS="$flag" + ;; + + pthread-config) + # Extract the first word of "pthread-config", so it can be a program name with args. +set dummy pthread-config; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_acx_pthread_config+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$acx_pthread_config"; then + ac_cv_prog_acx_pthread_config="$acx_pthread_config" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_acx_pthread_config="yes" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_acx_pthread_config" && ac_cv_prog_acx_pthread_config="no" +fi +fi +acx_pthread_config=$ac_cv_prog_acx_pthread_config +if test -n "$acx_pthread_config"; then + { echo "$as_me:$LINENO: result: $acx_pthread_config" >&5 +echo "${ECHO_T}$acx_pthread_config" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + if test x"$acx_pthread_config" = xno; then continue; fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + { echo "$as_me:$LINENO: checking for the pthreads library -l$flag" >&5 +echo $ECHO_N "checking for the pthreads library -l$flag... $ECHO_C" >&6; } + PTHREAD_LIBS="-l$flag" + ;; + esac + + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <pthread.h> +int +main () +{ +pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + acx_pthread_ok=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + { echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5 +echo "${ECHO_T}$acx_pthread_ok" >&6; } + if test "x$acx_pthread_ok" = xyes; then + break; + fi + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$acx_pthread_ok" = xyes; then + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + { echo "$as_me:$LINENO: checking for joinable pthread attribute" >&5 +echo $ECHO_N "checking for joinable pthread attribute... $ECHO_C" >&6; } + attr_name=unknown + for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <pthread.h> +int +main () +{ +int attr=$attr; return attr; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + attr_name=$attr; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + done + { echo "$as_me:$LINENO: result: $attr_name" >&5 +echo "${ECHO_T}$attr_name" >&6; } + if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then + +cat >>confdefs.h <<_ACEOF +#define PTHREAD_CREATE_JOINABLE $attr_name +_ACEOF + + fi + + { echo "$as_me:$LINENO: checking if more special flags are required for pthreads" >&5 +echo $ECHO_N "checking if more special flags are required for pthreads... $ECHO_C" >&6; } + flag=no + case "${host_cpu}-${host_os}" in + *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; + *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; + esac + { echo "$as_me:$LINENO: result: ${flag}" >&5 +echo "${ECHO_T}${flag}" >&6; } + if test "x$flag" != xno; then + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + fi + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + # More AIX lossage: must compile with xlc_r or cc_r + if test x"$GCC" != xyes; then + for ac_prog in xlc_r cc_r +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_PTHREAD_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$PTHREAD_CC"; then + ac_cv_prog_PTHREAD_CC="$PTHREAD_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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_PTHREAD_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +PTHREAD_CC=$ac_cv_prog_PTHREAD_CC +if test -n "$PTHREAD_CC"; then + { echo "$as_me:$LINENO: result: $PTHREAD_CC" >&5 +echo "${ECHO_T}$PTHREAD_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$PTHREAD_CC" && break +done +test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}" + + else + PTHREAD_CC=$CC + fi + + # The next part tries to detect GCC inconsistency with -shared on some + # architectures and systems. The problem is that in certain + # configurations, when -shared is specified, GCC "forgets" to + # internally use various flags which are still necessary. + + # + # Prepare the flags + # + save_CFLAGS="$CFLAGS" + save_LIBS="$LIBS" + save_CC="$CC" + + # Try with the flags determined by the earlier checks. + # + # -Wl,-z,defs forces link-time symbol resolution, so that the + # linking checks with -shared actually have any value + # + # FIXME: -fPIC is required for -shared on many architectures, + # so we specify it here, but the right way would probably be to + # properly detect whether it is actually required. + CFLAGS="-shared -fPIC -Wl,-z,defs $CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CC="$PTHREAD_CC" + + # In order not to create several levels of indentation, we test + # the value of "$done" until we find the cure or run out of ideas. + done="no" + + # First, make sure the CFLAGS we added are actually accepted by our + # compiler. If not (and OS X's ld, for instance, does not accept -z), + # then we can't do this test. + if test x"$done" = xno; then + { echo "$as_me:$LINENO: checking whether to check for GCC pthread/shared inconsistencies" >&5 +echo $ECHO_N "checking whether to check for GCC pthread/shared inconsistencies... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + done=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + + if test "x$done" = xyes ; then + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + else + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + fi + fi + + if test x"$done" = xno; then + { echo "$as_me:$LINENO: checking whether -pthread is sufficient with -shared" >&5 +echo $ECHO_N "checking whether -pthread is sufficient with -shared... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <pthread.h> +int +main () +{ +pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + done=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + + if test "x$done" = xyes; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + fi + fi + + # + # Linux gcc on some architectures such as mips/mipsel forgets + # about -lpthread + # + if test x"$done" = xno; then + { echo "$as_me:$LINENO: checking whether -lpthread fixes that" >&5 +echo $ECHO_N "checking whether -lpthread fixes that... $ECHO_C" >&6; } + LIBS="-lpthread $PTHREAD_LIBS $save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <pthread.h> +int +main () +{ +pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + done=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + + if test "x$done" = xyes; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + PTHREAD_LIBS="-lpthread $PTHREAD_LIBS" + else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + fi + fi + # + # FreeBSD 4.10 gcc forgets to use -lc_r instead of -lc + # + if test x"$done" = xno; then + { echo "$as_me:$LINENO: checking whether -lc_r fixes that" >&5 +echo $ECHO_N "checking whether -lc_r fixes that... $ECHO_C" >&6; } + LIBS="-lc_r $PTHREAD_LIBS $save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <pthread.h> +int +main () +{ +pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + done=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + + if test "x$done" = xyes; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + PTHREAD_LIBS="-lc_r $PTHREAD_LIBS" + else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + fi + fi + if test x"$done" = xno; then + # OK, we have run out of ideas + { echo "$as_me:$LINENO: WARNING: Impossible to determine how to use pthreads with shared libraries" >&5 +echo "$as_me: WARNING: Impossible to determine how to use pthreads with shared libraries" >&2;} + + # so it's not safe to assume that we may use pthreads + acx_pthread_ok=no + fi + + CFLAGS="$save_CFLAGS" + LIBS="$save_LIBS" + CC="$save_CC" +else + PTHREAD_CC="$CC" +fi + + + + + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$acx_pthread_ok" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_PTHREAD 1 +_ACEOF + + : +else + acx_pthread_ok=no + +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 + + + +# Find out what namespace 'normal' STL code lives in, and also what namespace +# the user wants our classes to be defined in +{ echo "$as_me:$LINENO: checking whether the compiler implements namespaces" >&5 +echo $ECHO_N "checking whether the compiler implements namespaces... $ECHO_C" >&6; } +if test "${ac_cv_cxx_namespaces+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + 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 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +namespace Outer { + namespace Inner { int i = 0; }} +int +main () +{ +using namespace Outer::Inner; return i; + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_cxx_namespaces=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_cxx_namespaces=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + 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 + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_cxx_namespaces" >&5 +echo "${ECHO_T}$ac_cv_cxx_namespaces" >&6; } + if test "$ac_cv_cxx_namespaces" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_NAMESPACES 1 +_ACEOF + + fi +{ echo "$as_me:$LINENO: checking what namespace STL code is in" >&5 +echo $ECHO_N "checking what namespace STL code is in... $ECHO_C" >&6; } +if test "${ac_cv_cxx_stl_namespace+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + 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 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <vector> +int +main () +{ +vector<int> t; return 0; + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_cxx_stl_namespace=none +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <vector> +int +main () +{ +std::vector<int> t; return 0; + ; + return 0; +} +_ACEOF +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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_cxx_stl_namespace=std +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + 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 + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_cxx_stl_namespace" >&5 +echo "${ECHO_T}$ac_cv_cxx_stl_namespace" >&6; } + if test "$ac_cv_cxx_stl_namespace" = none; then + +cat >>confdefs.h <<\_ACEOF +#define STL_NAMESPACE +_ACEOF + + fi + if test "$ac_cv_cxx_stl_namespace" = std; then + +cat >>confdefs.h <<\_ACEOF +#define STL_NAMESPACE std +_ACEOF + + fi + +google_namespace_default=google + # Check whether --enable-namespace was given. +if test "${enable_namespace+set}" = set; then + enableval=$enable_namespace; case "$enableval" in + yes) google_namespace="$google_namespace_default" ;; + no) google_namespace="" ;; + *) google_namespace="$enableval" ;; + esac +else + google_namespace="$google_namespace_default" +fi + + if test -n "$google_namespace"; then + ac_google_namespace="::$google_namespace" + ac_google_start_namespace="namespace $google_namespace {" + ac_google_end_namespace="}" + else + ac_google_namespace="" + ac_google_start_namespace="" + ac_google_end_namespace="" + fi + +cat >>confdefs.h <<_ACEOF +#define GOOGLE_NAMESPACE $ac_google_namespace +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define _START_GOOGLE_NAMESPACE_ $ac_google_start_namespace +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define _END_GOOGLE_NAMESPACE_ $ac_google_end_namespace +_ACEOF + + + +# Solaris 10 6/06 has a bug where /usr/sfw/lib/libstdc++.la is empty. +# If so, we replace it with our own version. +LIBSTDCXX_LA_LINKER_FLAG= +if test -f /usr/sfw/lib/libstdc++.la && ! test -s /usr/sfw/lib/libstdc++.la +then + LIBSTDCXX_LA_LINKER_FLAG='-L$(top_srcdir)/src/solaris' +fi + + +# These are what's needed by gflags.h.in + + + + + + + + + + + +## Check out ../autoconf/ for other macros you can call to do useful stuff + +# Write generated configuration file, and also .h files +ac_config_files="$ac_config_files Makefile src/gflags/gflags.h src/gflags/gflags_completions.h" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + 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_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { echo "$as_me:$LINENO: updating cache $cache_file" >&5 +echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${GCC_TRUE}" && test -z "${GCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"GCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"GCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## 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=: + # Zsh 3.x and 4.x performs 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 + + + + +# PATH needs CR +# 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 + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +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.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +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 + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +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 + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. 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" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # 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 +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +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 +fi +echo >conf$$.file +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 -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +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=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# 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'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by gflags $as_me 1.1, which was +generated by GNU Autoconf 2.61. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to <bug-autoconf@gnu.org>." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +gflags config.status 1.1 +configured by $0, generated by GNU Autoconf 2.61, + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2006 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + { echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=$SHELL + export CONFIG_SHELL + exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/gflags/gflags.h") CONFIG_FILES="$CONFIG_FILES src/gflags/gflags.h" ;; + "src/gflags/gflags_completions.h") CONFIG_FILES="$CONFIG_FILES src/gflags/gflags_completions.h" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# +# Set up the sed scripts for CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + +_ACEOF + + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +SHELL!$SHELL$ac_delim +PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim +PACKAGE_NAME!$PACKAGE_NAME$ac_delim +PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim +PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim +PACKAGE_STRING!$PACKAGE_STRING$ac_delim +PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim +exec_prefix!$exec_prefix$ac_delim +prefix!$prefix$ac_delim +program_transform_name!$program_transform_name$ac_delim +bindir!$bindir$ac_delim +sbindir!$sbindir$ac_delim +libexecdir!$libexecdir$ac_delim +datarootdir!$datarootdir$ac_delim +datadir!$datadir$ac_delim +sysconfdir!$sysconfdir$ac_delim +sharedstatedir!$sharedstatedir$ac_delim +localstatedir!$localstatedir$ac_delim +includedir!$includedir$ac_delim +oldincludedir!$oldincludedir$ac_delim +docdir!$docdir$ac_delim +infodir!$infodir$ac_delim +htmldir!$htmldir$ac_delim +dvidir!$dvidir$ac_delim +pdfdir!$pdfdir$ac_delim +psdir!$psdir$ac_delim +libdir!$libdir$ac_delim +localedir!$localedir$ac_delim +mandir!$mandir$ac_delim +DEFS!$DEFS$ac_delim +ECHO_C!$ECHO_C$ac_delim +ECHO_N!$ECHO_N$ac_delim +ECHO_T!$ECHO_T$ac_delim +LIBS!$LIBS$ac_delim +build_alias!$build_alias$ac_delim +host_alias!$host_alias$ac_delim +target_alias!$target_alias$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +CYGPATH_W!$CYGPATH_W$ac_delim +PACKAGE!$PACKAGE$ac_delim +VERSION!$VERSION$ac_delim +ACLOCAL!$ACLOCAL$ac_delim +AUTOCONF!$AUTOCONF$ac_delim +AUTOMAKE!$AUTOMAKE$ac_delim +AUTOHEADER!$AUTOHEADER$ac_delim +MAKEINFO!$MAKEINFO$ac_delim +install_sh!$install_sh$ac_delim +STRIP!$STRIP$ac_delim +INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim +mkdir_p!$mkdir_p$ac_delim +AWK!$AWK$ac_delim +SET_MAKE!$SET_MAKE$ac_delim +am__leading_dot!$am__leading_dot$ac_delim +AMTAR!$AMTAR$ac_delim +am__tar!$am__tar$ac_delim +am__untar!$am__untar$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +DEPDIR!$DEPDIR$ac_delim +am__include!$am__include$ac_delim +am__quote!$am__quote$ac_delim +AMDEP_TRUE!$AMDEP_TRUE$ac_delim +AMDEP_FALSE!$AMDEP_FALSE$ac_delim +AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim +CCDEPMODE!$CCDEPMODE$ac_delim +am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim +am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim +CPP!$CPP$ac_delim +CXX!$CXX$ac_delim +CXXFLAGS!$CXXFLAGS$ac_delim +ac_ct_CXX!$ac_ct_CXX$ac_delim +CXXDEPMODE!$CXXDEPMODE$ac_delim +am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim +am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim +GCC_TRUE!$GCC_TRUE$ac_delim +GCC_FALSE!$GCC_FALSE$ac_delim +build!$build$ac_delim +build_cpu!$build_cpu$ac_delim +build_vendor!$build_vendor$ac_delim +build_os!$build_os$ac_delim +host!$host$ac_delim +host_cpu!$host_cpu$ac_delim +host_vendor!$host_vendor$ac_delim +host_os!$host_os$ac_delim +SED!$SED$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim +LN_S!$LN_S$ac_delim +ECHO!$ECHO$ac_delim +AR!$AR$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS <conf$$subs.sed +rm -f conf$$subs.sed +cat >>$CONFIG_STATUS <<_ACEOF +CEOF$ac_eof +_ACEOF + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +RANLIB!$RANLIB$ac_delim +DSYMUTIL!$DSYMUTIL$ac_delim +NMEDIT!$NMEDIT$ac_delim +CXXCPP!$CXXCPP$ac_delim +F77!$F77$ac_delim +FFLAGS!$FFLAGS$ac_delim +ac_ct_F77!$ac_ct_F77$ac_delim +LIBTOOL!$LIBTOOL$ac_delim +LIBTOOL_DEPS!$LIBTOOL_DEPS$ac_delim +acx_pthread_config!$acx_pthread_config$ac_delim +PTHREAD_CC!$PTHREAD_CC$ac_delim +PTHREAD_LIBS!$PTHREAD_LIBS$ac_delim +PTHREAD_CFLAGS!$PTHREAD_CFLAGS$ac_delim +LIBSTDCXX_LA_LINKER_FLAG!$LIBSTDCXX_LA_LINKER_FLAG$ac_delim +ac_google_start_namespace!$ac_google_start_namespace$ac_delim +ac_google_end_namespace!$ac_google_end_namespace$ac_delim +ac_google_namespace!$ac_google_namespace$ac_delim +ac_cv___attribute__unused!$ac_cv___attribute__unused$ac_delim +ac_cv_have_stdint_h!$ac_cv_have_stdint_h$ac_delim +ac_cv_have_systypes_h!$ac_cv_have_systypes_h$ac_delim +ac_cv_have_inttypes_h!$ac_cv_have_inttypes_h$ac_delim +ac_cv_have_uint16_t!$ac_cv_have_uint16_t$ac_delim +ac_cv_have_u_int16_t!$ac_cv_have_u_int16_t$ac_delim +ac_cv_have___int16!$ac_cv_have___int16$ac_delim +LIBOBJS!$LIBOBJS$ac_delim +LTLIBOBJS!$LTLIBOBJS$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 26; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS <conf$$subs.sed +rm -f conf$$subs.sed +cat >>$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g +CEOF$ac_eof +_ACEOF + + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`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 || +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" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`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 + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + :H) + # + # CONFIG_HEADER + # +_ACEOF + +# Transform confdefs.h into a sed script `conftest.defines', that +# substitutes the proper values into config.h.in to produce config.h. +rm -f conftest.defines conftest.tail +# First, append a space to every undef/define line, to ease matching. +echo 's/$/ /' >conftest.defines +# Then, protect against being on the right side of a sed subst, or in +# an unquoted here document, in config.status. If some macros were +# called several times there might be several #defines for the same +# symbol, which is useless. But do not sort them, since the last +# AC_DEFINE must be honored. +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where +# NAME is the cpp macro being defined, VALUE is the value it is being given. +# PARAMS is the parameter list in the macro definition--in most cases, it's +# just an empty string. +ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' +ac_dB='\\)[ (].*,\\1define\\2' +ac_dC=' ' +ac_dD=' ,' + +uniq confdefs.h | + sed -n ' + t rset + :rset + s/^[ ]*#[ ]*define[ ][ ]*// + t ok + d + :ok + s/[\\&,]/\\&/g + s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p + s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p + ' >>conftest.defines + +# Remove the space that was appended to ease matching. +# Then replace #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +# (The regexp can be short, since the line contains either #define or #undef.) +echo 's/ $// +s,^[ #]*u.*,/* & */,' >>conftest.defines + +# Break up conftest.defines: +ac_max_sed_lines=50 + +# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" +# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" +# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" +# et cetera. +ac_in='$ac_file_inputs' +ac_out='"$tmp/out1"' +ac_nxt='"$tmp/out2"' + +while : +do + # Write a here document: + cat >>$CONFIG_STATUS <<_ACEOF + # First, check the format of the line: + cat >"\$tmp/defines.sed" <<\\CEOF +/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def +/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def +b +:def +_ACEOF + sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS + ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in + sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail + grep . conftest.tail >/dev/null || break + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines conftest.tail + +echo "ac_result=$ac_in" >>$CONFIG_STATUS +cat >>$CONFIG_STATUS <<\_ACEOF + if test x"$ac_file" != x-; then + echo "/* $configure_input */" >"$tmp/config.h" + cat "$ac_result" >>"$tmp/config.h" + if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f $ac_file + mv "$tmp/config.h" $ac_file + fi + else + echo "/* $configure_input */" + cat "$ac_result" + fi + rm -f "$tmp/out12" +# Compute $ac_file's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $ac_file | $ac_file:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $ac_file" >`$as_dirname -- $ac_file || +$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X$ac_file : 'X\(//\)[^/]' \| \ + X$ac_file : 'X\(//\)$' \| \ + X$ac_file : 'X\(/\)' \| . 2>/dev/null || +echo X$ac_file | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 +echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir=$dirpart/$fdir + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`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 || +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" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + + esac +done # for ac_tag + + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/dtm_release/lib/util/gflags-1.1/configure.ac b/dtm_release/lib/util/gflags-1.1/configure.ac new file mode 100644 index 0000000000000000000000000000000000000000..62b814193739bad3f587083eb631503d2ba5275b --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/configure.ac @@ -0,0 +1,97 @@ +## Process this file with autoconf to produce configure. +## In general, the safest way to proceed is to run ./autogen.sh + +# make sure we're interpreted by some minimal autoconf +AC_PREREQ(2.57) + +AC_INIT(gflags, 1.1, opensource@google.com) +# The argument here is just something that should be in the current directory +# (for sanity checking) +AC_CONFIG_SRCDIR(README) +AM_INIT_AUTOMAKE +AM_CONFIG_HEADER(src/config.h) + +# Checks for programs. +AC_PROG_CC +AC_PROG_CPP +AC_PROG_CXX +AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc +AC_CANONICAL_HOST + +# Populate $host_cpu, $host_os, etc. +AC_CANONICAL_HOST +case $host_os in + *mingw*) + # Disabling fast install keeps libtool from creating wrapper scripts + # around the executables it builds. Such scripts have caused failures on + # MinGW. Using this option means an extra link step is executed during + # "make install". + AC_DISABLE_FAST_INSTALL + ;; + *) + AC_ENABLE_FAST_INSTALL + ;; +esac + +# Uncomment this if you'll be exporting libraries (.so's) +AC_PROG_LIBTOOL +AC_SUBST(LIBTOOL_DEPS) + +# Check whether some low-level functions/files are available +AC_HEADER_STDC + +# These are tested for by AC_HEADER_STDC, but I check again to set the var +AC_CHECK_HEADER(stdint.h, ac_cv_have_stdint_h=1, ac_cv_have_stdint_h=0) +AC_CHECK_HEADER(sys/types.h, ac_cv_have_systypes_h=1, ac_cv_have_systypes_h=0) +AC_CHECK_HEADER(inttypes.h, ac_cv_have_inttypes_h=1, ac_cv_have_inttypes_h=0) +AC_CHECK_HEADERS([fnmatch.h]) + +# These are the types I need. We look for them in either stdint.h, +# sys/types.h, or inttypes.h, all of which are part of the default-includes. +AC_CHECK_TYPE(uint16_t, ac_cv_have_uint16_t=1, ac_cv_have_uint16_t=0) +AC_CHECK_TYPE(u_int16_t, ac_cv_have_u_int16_t=1, ac_cv_have_u_int16_t=0) +AC_CHECK_TYPE(__int16, ac_cv_have___int16=1, ac_cv_have___int16=0) + +AC_CHECK_FUNCS([strtoll strtoq]) + +AX_C___ATTRIBUTE__ +# We only care about __attribute__ ((unused)) +if test x"$ac_cv___attribute__" = x"yes"; then + ac_cv___attribute__unused="__attribute__ ((unused))" +else + ac_cv___attribute__unused= +fi + +ACX_PTHREAD + +# Find out what namespace 'normal' STL code lives in, and also what namespace +# the user wants our classes to be defined in +AC_CXX_STL_NAMESPACE +AC_DEFINE_GOOGLE_NAMESPACE(google) + +# Solaris 10 6/06 has a bug where /usr/sfw/lib/libstdc++.la is empty. +# If so, we replace it with our own version. +LIBSTDCXX_LA_LINKER_FLAG= +if test -f /usr/sfw/lib/libstdc++.la && ! test -s /usr/sfw/lib/libstdc++.la +then + LIBSTDCXX_LA_LINKER_FLAG='-L$(top_srcdir)/src/solaris' +fi +AC_SUBST(LIBSTDCXX_LA_LINKER_FLAG) + +# These are what's needed by gflags.h.in +AC_SUBST(ac_google_start_namespace) +AC_SUBST(ac_google_end_namespace) +AC_SUBST(ac_google_namespace) +AC_SUBST(ac_cv___attribute__unused) +AC_SUBST(ac_cv_have_stdint_h) +AC_SUBST(ac_cv_have_systypes_h) +AC_SUBST(ac_cv_have_inttypes_h) +AC_SUBST(ac_cv_have_uint16_t) +AC_SUBST(ac_cv_have_u_int16_t) +AC_SUBST(ac_cv_have___int16) + +## Check out ../autoconf/ for other macros you can call to do useful stuff + +# Write generated configuration file, and also .h files +AC_CONFIG_FILES([Makefile src/gflags/gflags.h src/gflags/gflags_completions.h]) +AC_OUTPUT diff --git a/dtm_release/lib/util/gflags-1.1/depcomp b/dtm_release/lib/util/gflags-1.1/depcomp new file mode 100755 index 0000000000000000000000000000000000000000..04701da536f33a7c39d7bb01b87a70ae3a776df5 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/depcomp @@ -0,0 +1,530 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2005-07-09.11 + +# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. + +# 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 2, 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to <bug-automake@gnu.org>. +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + stat=$? + + if test -f "$tmpdepfile"; then : + else + stripped=`echo "$stripped" | sed 's,^.*/,,'` + tmpdepfile="$stripped.u" + fi + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + outname="$stripped.o" + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mecanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/dtm_release/lib/util/gflags-1.1/doc/designstyle.css b/dtm_release/lib/util/gflags-1.1/doc/designstyle.css new file mode 100644 index 0000000000000000000000000000000000000000..f5d1ec2f767a6106e977f22d23d6854b49a95fb0 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/doc/designstyle.css @@ -0,0 +1,115 @@ +body { + background-color: #ffffff; + color: black; + margin-right: 1in; + margin-left: 1in; +} + + +h1, h2, h3, h4, h5, h6 { + color: #3366ff; + font-family: sans-serif; +} +@media print { + /* Darker version for printing */ + h1, h2, h3, h4, h5, h6 { + color: #000080; + font-family: helvetica, sans-serif; + } +} + +h1 { + text-align: center; + font-size: 18pt; +} +h2 { + margin-left: -0.5in; +} +h3 { + margin-left: -0.25in; +} +h4 { + margin-left: -0.125in; +} +hr { + margin-left: -1in; +} + +/* Definition lists: definition term bold */ +dt { + font-weight: bold; +} + +address { + text-align: right; +} +/* Use the <code> tag for bits of code and <var> for variables and objects. */ +code,pre,samp,var { + color: #006000; +} +/* Use the <file> tag for file and directory paths and names. */ +file { + color: #905050; + font-family: monospace; +} +/* Use the <kbd> tag for stuff the user should type. */ +kbd { + color: #600000; +} +div.note p { + float: right; + width: 3in; + margin-right: 0%; + padding: 1px; + border: 2px solid #6060a0; + background-color: #fffff0; +} + +UL.nobullets { + list-style-type: none; + list-style-image: none; + margin-left: -1em; +} + +/* +body:after { + content: "Google Confidential"; +} +*/ + +/* pretty printing styles. See prettify.js */ +.str { color: #080; } +.kwd { color: #008; } +.com { color: #800; } +.typ { color: #606; } +.lit { color: #066; } +.pun { color: #660; } +.pln { color: #000; } +.tag { color: #008; } +.atn { color: #606; } +.atv { color: #080; } +pre.prettyprint { padding: 2px; border: 1px solid #888; } + +.embsrc { background: #eee; } + +@media print { + .str { color: #060; } + .kwd { color: #006; font-weight: bold; } + .com { color: #600; font-style: italic; } + .typ { color: #404; font-weight: bold; } + .lit { color: #044; } + .pun { color: #440; } + .pln { color: #000; } + .tag { color: #006; font-weight: bold; } + .atn { color: #404; } + .atv { color: #060; } +} + +/* Table Column Headers */ +.hdr { + color: #006; + font-weight: bold; + background-color: #dddddd; } +.hdr2 { + color: #006; + background-color: #eeeeee; } \ No newline at end of file diff --git a/dtm_release/lib/util/gflags-1.1/doc/gflags.html b/dtm_release/lib/util/gflags-1.1/doc/gflags.html new file mode 100644 index 0000000000000000000000000000000000000000..ec0b1c7b079f9b8e5ebe2d31a9ed91ed66d12ae6 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/doc/gflags.html @@ -0,0 +1,498 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> + +<html> +<head> +<title>How To Use Google Commandline Flags</title> + +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<link href="http://www.google.com/favicon.ico" type="image/x-icon" + rel="shortcut icon"> +<link href="designstyle.css" type="text/css" rel="stylesheet"> +<style type="text/css"> +<!-- + ol.bluelist li { + color: #3366ff; + font-family: sans-serif; + } + ol.bluelist li p { + color: #000; + font-family: "Times Roman", times, serif; + } + ul.blacklist li { + color: #000; + font-family: "Times Roman", times, serif; + } +//--> +</style> +</head> + +<body> + +<h1>How To Use Google Commandline Flags (gflags)</h1> +<small>(as of +<script type=text/javascript> + var lm = new Date(document.lastModified); + document.write(lm.toDateString()); +</script>) +</small> +<br> + + +<h2> <A NAME=intro>Introduction, and Comparison to Other Commandline + Flags Libraries</A> </h2> + +<p><b>Commandline flags</b> are flags that users specify on the +command line when they run an executable. In the command</p> +<pre> + fgrep -l -f /var/tmp/foo johannes brahms +</pre> +<p><code>-l</code> and <code>-f /var/tmp/foo</code> are the two +commandline flags. (<code>johannes</code> and <code>brahms</code>, +which don't start with a dash, are <b>commandline arguments</b>.)</p> + +<p>Typically, an application lists what flags the user is allowed to +pass in, and what arguments they take -- in this example, +<code>-l</code> takes no argument, and <code>-f</code> takes a +string (in particular, a filename) as an argument. Users can use a +library to help parse the commandline and store the flags in some data +structure.</p> + +<p>Google's commandline flags library differs from other libraries, +such as <code>getopt()</code>, in that flag definitions can be +scattered around the source code, and not just listed in one place +such as <code>main()</code>. In practice, this means that a single +source-code file will define and use flags that are meaningful to that +file. Any application that links in that file will get the flags, and +the google commandline flags library will automatically handle that +flag appropriately.</p> + +<p>There's significant gain in flexibility, and ease of code reuse, +due to this technique. However, there is a danger that two files will +define the same flag, and then give an error when they're linked +together.</p> + +<p>The rest of this document describes how to use the commandlineflag +library. It's a C++ library, so examples are in C++. However, there +is a Python port with the same functionality, and this discussion +translates directly to Python.</p> + + +<h2> <A name=define>DEFINE: Defining Flags In Program</A> </h2> + +<p> Defining a flag is easy: just use the appropriate macro for the +type you want the flag to be, as defined at the bottom of +<code>gflags/gflags.h</code>. Here's an example file, +<code>foo.cc</code>:</p> + +<pre> + #include <gflags/gflags.h> + + DEFINE_bool(big_menu, true, "Include 'advanced' options in the menu listing"); + DEFINE_string(languages, "english,french,german", + "comma-separated list of languages to offer in the 'lang' menu"); +</pre> + +<p><code>DEFINE_bool</code> defines a boolean flag. Here are the +types supported:</p> +<ul> + <li> <code>DEFINE_bool</code>: boolean + <li> <code>DEFINE_int32</code>: 32-bit integer + <li> <code>DEFINE_int64</code>: 64-bit integer + <li> <code>DEFINE_uint64</code>: unsigned 64-bit integer + <li> <code>DEFINE_double</code>: double + <li> <code>DEFINE_string</code>: C++ string +</ul> + +<p>Note that there are no 'complex' types like lists: the "languages" +flag in our example is a list of strings, but is defined of type +"string", not "list_of_string" or similar. This is by design. We'd +rather use only simple types for the flags, and allow for complex, +arbitrary parsing routines to parse them, then to try to put the logic +inside the flags library proper.</p> + +<p>All DEFINE macros take the same three arguments: the name of the +flag, its default value, and a 'help' string that describes its use. +The 'help' string is displayed when the user runs the application with +the <A HREF="#special"><code>--help</code> flag</A>.</p> + +<p>You can define a flag in any source-code file in your executable. +Only define a flag once! If you want to access a flag in more than +one source file, DEFINE it in one file, and <A +HREF="#declare">DECLARE</A> it in the others. Even better, DEFINE it +in <code>foo.cc</code> and DECLARE it in <code>foo.h</code>; then +everyone who <code>#includes foo.h</code> can use the flag.</p> + +<p>Note that while most functions in this library are defined in the +<code>google</code> namespace, <code>DEFINE_foo</code> (and +<code>DECLARE_foo</code>, <A HREF="#declare">below</A>), should always +be in the global namespace.</p> + + +<h2> <A name=using>Accessing the Flag</A> </h2> + +<p>All defined flags are available to the program as just a normal +variable, with the prefix <code>FLAGS_</code> prepended. In the above +example, the macros define two variables, <code>FLAGS_big_menu</code> +(a bool), and <code>FLAGS_languages</code> (a C++ string).</p> + +<p>You can read and write to the flag just like any other +variable:</p> +<pre> + if (FLAGS_consider_made_up_languages) + FLAGS_languages += ",klingon"; // implied by --consider_made_up_languages + if (FLAGS_languages.find("finnish") != string::npos) + HandleFinnish(); +</pre> + +<p>You can also get and set flag values via special functions in +<code>gflags.h</code>. That's a rarer use case, though.</p> + + +<h2> <A name=declare>DECLARE: Using the Flag in a Different File</A> </h2> + +<p>Accessing a flag in the manner of the previous section only works +if the flag was <code>DEFINE</code>-ed at the top of the file. If it +wasn't, you'll get an 'unknown variable' error.</p> + +<p>The <code>DECLARE_type</code> macro is available when you want to +use a flag that's defined in another file. For instance, if I were +writing <code>bar.cc</code> but wanted to access the big_menu, flag, I +would put this near the top of <code>bar.cc</code>:</p> +<pre> + DECLARE_bool(big_menu); +</pre> + +<p>This is functionally equivalent to saying <code>extern +FLAGS_big_menu</code>.</p> + +<p>Note that such an extern declaration introduces a dependency +between your file and the file that defines the <code>big_menu</code> +flag: <code>foo.cc</code>, in this case. Such implicit dependencies +can be difficult to manage in large projects. For that reason we +recommend the following guideline:</p> + +<blockquote> +If you DEFINE a flag in <code>foo.cc</code>, either don't DECLARE it +at all, only DECLARE it in tightly related tests, or only DECLARE +it in <code>foo.h</code>. +</blockquote> + +<p>You should go the do-not-DECLARE route when the flag is only needed +by <code>foo.cc</code>, and not in any other file. If you want to +modify the value of the flag in the related test file to see if it is +functioning as expected, DECLARE it in the <code>foo_test.cc</code> +file. + +<p>If the flag does span multiple files, DECLARE it in the associated +<code>.h</code> file, and make others <code>#include</code> that +<code>.h</code> file if they want to access the flag. The +<code>#include</code> will make explicit the dependency between the +two files. This causes the flag to be a global variable.</p> + + +<h2> <A name=validate>RegisterFlagValidator: Sanity-checking Flag Values</A> </h2> + +<p>After DEFINE-ing a flag, you may optionally register a validator +function with the flag. If you do this, after the flag is parsed from +the commandline, and whenever its value is changes via a call to +<code>SetCommandLineOption()</code>, the validator function is called +with the new value as an argument. The validator function should +return 'true' if the flag value is valid, and false otherwise. +If the function returns false for the new setting of the +flag, the flag will retain its current value. If it returns false for the +default value, InitGoogle will die. + +<p>Here is an example use of this functionality:</p> +<pre> +static bool ValidatePort(const char* flagname, int32 value) { + if (value > 0 && value < 32768) // value is ok + return true; + printf("Invalid value for --%s: %d\n", flagname, (int)value); + return false; +} +DEFINE_int32(port, 0, "What port to listen on"); +static const bool port_dummy = RegisterFlagValidator(&FLAGS_port, &ValidatePort); +</pre> + +<p>By doing the registration at global initialization time (right +after the DEFINE), we ensure that the registration happens before +the commandline is parsed at the beginning of <code>main()</code>.</p> + +<p><code>RegisterFlagValidator()</code> returns true if the +registration is successful. It return false if the registration fails +because a) the first argument does not refer to a commandline flag, or +b) a different validator has already been registered for this flag.</p> + + +<h2> <A name=together>Putting It Together: How to Set Up Flags</A> </h2> + +<p>The final piece is the one that tells the executable to process the +commandline flags, and set the <code>FLAGS_*</code> variables to the +appropriate, non-default value based on what is seen on the +commandline. This is equivalent to the <code>getopt()</code> call in +the getopt library, but has much less overhead to use. In fact, it's +just a single function call:</p> + +<pre> + google::ParseCommandLineFlags(&argc, &argv, true); +</pre> + +<p>Usually, this code is at the beginning of <code>main()</code>. +<code>argc</code> and <code>argv</code> are exactly as passed in to +<code>main()</code>. This routine might modify them, which is why +pointers to them are passed in.</p> + +<p>The last argument is called "remove_flags". If true, then +<code>ParseCommandLineFlags</code> removes the flags and their +arguments from <code>argv</code>, and modifies <code>argc</code> +appropriately. In this case, after the function call, +<code>argv</code> will hold only commandline arguments, and not +commandline flags.</p> + +<p>If, on the other hand, <code>remove_flags</code> is false, then +<code>ParseCommandLineFlags</code> will leave argc unchanged, but will +rearrange the arguments in argv so that the flags are all at the +beginning. For example, if the input is <code>"/bin/foo" "arg1" "-q" +"arg2"</code> (which is legal but weird), the function will rearrange +<code>argv</code> so it reads <code>"/bin/foo", "-q", "arg1", +"arg2"</code>. In this case, <code>ParseCommandLineFlags</code> +returns the index into argv that holds the first commandline argument: +that is, the index past the last flag. (In this example, it would +return 2, since <code>argv[2]</code> points to <code>arg1</code>.)</p> + +<p>In either case, the <code>FLAGS_*</code> variables are modified +based on what was <A HREF="#commandline">passed in on the +commandline</A>.</p> + + +<h2> <A name=commandline>Setting Flags on the Command Line</A> </h2> + +<p>The reason you make something a flag instead of a compile-time +constant, is so users can specify a non-default value on the +commandline. Here's how they might do it for an application that +links in <code>foo.cc</code>:</p> +<pre> + app_containing_foo --nobig_menu -languages="chinese,japanese,korean" ... +</pre> + +<p>This sets <code>FLAGS_big_menu = false;</code> and +<code>FLAGS_languages = "chinese,japanese,korean"</code>, when +<code>ParseCommandLineFlags</code> is run.</p> + +<p>Note the atypical syntax for setting a boolean flag to false: +putting "no" in front of its name. There's a fair bit of flexibility +to how flags may be specified. Here's an example of all the ways to +specify the "languages" flag:</p> +<ul> + <li> <code>app_containing_foo --languages="chinese,japanese,korean"</code> + <li> <code>app_containing_foo -languages="chinese,japanese,korean"</code> + <li> <code>app_containing_foo --languages "chinese,japanese,korean"</code> + <li> <code>app_containing_foo -languages "chinese,japanese,korean"</code> +</ul> + +<p>For boolean flags, the possibilities are slightly different:</p> +<ul> + <li> <code>app_containing_foo --big_menu</code> + <li> <code>app_containing_foo --nobig_menu</code> + <li> <code>app_containing_foo --big_menu=true</code> + <li> <code>app_containing_foo --big_menu=false</code> +</ul> +<p>(as well as the single-dash variant on all of these).</p> + +<p>Despite this flexibility, we recommend using only a single form: +<code>--variable=value</code> for non-boolean flags, and +<code>--variable/--novariable</code> for boolean flags. This +consistency will make your code more readable, and is also the format +required for certain special-use cases like <A +HREF="#flagfiles">flagfiles</A>.</p> + +<p>It is a fatal error to specify a flag on the commandline that has +not been DEFINED somewhere in the executable. If you need that +functionality for some reason -- say you want to use the same set of +flags for several executables, but not all of them DEFINE every flag +in your list -- you can specify <A +HREF="#special"><code>--undefok</code></A> to suppress the error.</p> + +<p>As in getopt(), <code>--</code> by itself will terminate flags +processing. So in <code>foo -f1 1 -- -f2 2</code>, <code>f1</code> is +considered a flag, but <code>-f2</code> is not.</p> + +<p>Note that flags do not have single-letter synonyms, like they do in +the getopt library, nor do we allow "combining" flags behind a +single dash, as in <code>ls -la</code>.</p> + + +<h2> <A name="special">Special Flags</code> </h2> + +<p>There are a few flags defined by the commandlineflags module +itself, and are available to all applications. These fall into three +categories. First are the 'reporting' flags that, when found, cause +the application to print some information about itself and exit.</p> + +<table><tr valign=top> + <td><code>--help</code></td> + <td>shows all flags from all files, sorted by file and then by name; + shows the flagname, its default value, and its help string</td> +</tr><tr valign=top> + <td><code>--helpfull</code></td> + <td>same as -help, but unambiguously asks for all flags + (in case -help changes in the future)</td> +</tr><tr valign=top> + <td><code>--helpshort</code></td> + <td>shows only flags for the file that includes <code>main()</code></td> +</tr><tr valign=top> + <td><code>--helpxml</code></td> + <td>like --help, but output is in xml for easier parsing</td> +</tr><tr valign=top> + <td><code>--helpon=FILE </code></td> + <td>shows only flags defined in FILE.*</td> +</tr><tr valign=top> + <td><code>--helpmatch=S</code></td> + <td>shows only flags defined in *S*.*</td> +</tr><tr valign=top> + <td><code>--helppackage</code></td> + <td>shows flags defined in files in same directory as <code>main()</code></td> +</tr><tr valign=top> + <td><code>--version</code></td> + <td>prints version info for the executable</td> +</tr></table> + +<p>Second are the flags that affect how other flags are parsed.</p> + +<table><tr valign=top> + <td><code>--undefok=flagname,flagname,...</code></td> + <td>for those names listed as the argument to <code>--undefok</code>, + suppress the normal error-exit that occurs when + <code>--name</code> is seen on the commandline, but + <code>name</code> has not been DEFINED anywhere in the + application +</table> + +<p>Third are the 'recursive' flags, that cause other flag values to be +set: <code>--fromenv</code>, <code>--tryfromenv</code>, +<code>--flagfile</code>. These are described below in more +detail.</p> + +<h3> <code>--fromenv</code> </h3> + +<p><code>--fromenv=foo,bar</code> says to read the values for the +<code>foo</code> and <code>bar</code> flags from the environment. +In concert with this flag, you must actually set the values in the +environment, via a line like one of the two below:</p> +<pre> + export FLAGS_foo=xxx; export FLAGS_bar=yyy # sh + setenv FLAGS_foo xxx; setenv FLAGS_bar yyy # tcsh +</pre> +<p>This is equivalent to specifying <code>--foo=xxx</code>, +<code>--bar=yyy</code> on the commandline.</p> + +<p>Note it is a fatal error to say <code>--fromenv=foo</code> if +<code>foo</code> is not DEFINED somewhere in the application. (Though +you can suppress this error via <code>--undefok=foo</code>, just like +for any other flag.)</p> + +<p>It is also a fatal error to say <code>--fromenv=foo</code> if +<code>FLAGS_foo</code> is not actually defined in the environment.</p> + +<h3> <code>--tryfromenv</code> </h3> + +<p><code>--tryfromenv</code> is exactly like <code>--fromenv</code>, +except it is <b>not</b> a fatal error to say +<code>--tryfromenv=foo</code> if <code>FLAGS_foo</code> is not +actually defined in the environment. Instead, in such cases, +<code>FLAGS_foo</code> just keeps its default value as specified in +the application.</p> + +<p>Note it is still an error to say <code>--tryfromenv=foo</code> if +<code>foo</code> is not DEFINED somewhere in the application.</p> + +<h3> <code>--flagfile</code> </h3> + +<p><code>--flagfile=f</code> tells the commandlineflags module to read +the file <code>f</code>, and to run all the flag-assignments found in +that file as if these flags had been specified on the commandline.</p> + +<p>In its simplest form, <code>f</code> should just be a list of flag +assignments, one per line. Unlike on the commandline, the equals sign +separating a flagname from its argument is <i>required</i> for +flagfiles. An example flagfile, <code>/tmp/myflags</code>:</p> +<pre> +--nobig_menus +--languages=english,french +</pre> + +<p>With this flagfile, the following two lines are equivalent:<p> +<pre> + ./myapp --foo --nobig_menus --languages=english,french --bar + ./myapp --foo --flagfile=/tmp/myflags --bar +</pre> + +<p>Note that many errors are silently suppressed in flagfiles. In +particular, unrecognized flagnames are silently ignored, as are flags +that are missing a required value (e.g., a flagfile that just says +<code>--languages</code>).</p> + +<p>The general format of a flagfile is a bit more complicated than the +simple, common case above. It is: a sequence of filenames, one per +line, followed by a sequence of flags, one per line, repeated as many +times as desired. Filenames in a flagfile can use wildcards +(<code>*</code> and <code>?</code>), and the sequence of flags located +after a sequence of filenames is processed only if the current +executable's name matches one of the filenames. It is possible to +start the flagfile with a sequence of flags instead of a sequence of +filenames; if such a sequence of flags is present, these flags are +applied to the current executable no matter what it is.</p> + +<p>Lines that start with a <code>#</code> are ignored as comments. +Leading whitespace is also ignored in flagfiles, as are blank +lines.</p> + +<p>It is possible for a flagfile to use the <code>--flagfile</code> +flag to include another flagfile.</p> + +<p>Flags are always processed in the expected order. That is, +processing begins by examining the flags specified directly on the +command line. If a flagfile is specified, its contents are processed, +and then processing continues with remaining flags from the command +line.</p> + + +<h2> <A name="api">The API</code> </h2> + +<p>In addition to accessing <code>FLAGS_foo</code> directly, it is +possible to access the flags programmatically, through an API. It is +also possible to access information about a flag, such as its default +value and help-string. A <code>FlagSaver</code> makes it easy to +modify flags and then automatically undo the modifications later. +Finally, there are somewhat unrelated, but useful, routines to easily +access parts of <code>argv</code> outside main, including the program +name (<code>argv[0]</code>).</p> + +<p>For more information about these routines, and other useful helper +methods such as <code>google::SetUsageMessage</code>, see +<code>gflags.h</code>.</p> + + +<h2> <A name="misc">Miscellaneous Notes</code> </h2> + +<p>If your application has code like this:</p> +<pre> + #define STRIP_FLAG_HELP 1 // this must go before the #include! + #include <gflags/gflags.h> +</pre> +<p>we will remove the help messages from the compiled source. This can +reduce the size of the resulting binary somewhat, and may also be +useful for security reasons.</p> + + +<hr> +<address> +Craig Silverstein<br> +<script type=text/javascript> + var lm = new Date(document.lastModified); + document.write(lm.toDateString()); +</script> +</address> + +</body> +</html> diff --git a/dtm_release/lib/util/gflags-1.1/gflags_nothreads_unittest b/dtm_release/lib/util/gflags-1.1/gflags_nothreads_unittest new file mode 100755 index 0000000000000000000000000000000000000000..28dd7c4d5cf4589f09c4b9326ae83b5cf931b733 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/gflags_nothreads_unittest @@ -0,0 +1,117 @@ +#! /bin/sh + +# gflags_nothreads_unittest - temporary wrapper script for .libs/gflags_nothreads_unittest +# Generated by ltmain.sh - GNU libtool 1.5.22 Debian 1.5.22-2 (1.1220.2.365 2005/12/18 22:14:06) +# +# The gflags_nothreads_unittest program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='/bin/sed -e 1s/^X//' +sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command="(cd /u/sgerrish/src1/topics/lib/util/gflags-1.1; LIBRARY_PATH=\"/n/fs/topics/lib/:/u/blei/local/lib:/n/fs/topics/lib/gsl/lib/:/n/fs/topics/lib/:/u/blei/local/lib:/n/fs/topics/lib/gsl/lib/:/n/fs/topics/lib/:/u/blei/local/lib:/n/fs/topics/lib/gsl/lib/:\"; export LIBRARY_PATH; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; LD_LIBRARY_PATH=\"/u/sgerrish/.local/lib\"; export LD_LIBRARY_PATH; PATH=\"/usr/local/bin:/u/blei/local/bin/:/usr/local/bin:/u/blei/local/bin/:/usr/local/bin:/u/blei/local/bin/:/usr/local/texlive/2008/bin/x86_64-linux:/u/sgerrish/bin:/usr/local/bin:/usr/lib64/qt-3.3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin:/usr/X11R6/bin:/usr/local/java/jdk/bin:/usr/local/java/jre/bin:/usr/bin:/bin:/usr/sbin:/usr/X11R6/bin:/u/department/bin:/usr/local/maple/bin:/n/fs/grad/sgerrish/bin:/usr/local/gnu/bin:/usr/local/bin:/usr/sbin:/usr/local/X11/bin:/usr/X11R6/bin:/u/department/bin:/usr/lib/lp/postscript:/u/sgerrish/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin\"; export PATH; g++ -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -g -O2 -o \$progdir/\$file gflags_unittest.o ./.libs/libgflags_nothreads.so -Wl,--rpath -Wl,/u/sgerrish/src1/topics/lib/util/gflags-1.1/.libs)" + +# This environment variable determines our operation mode. +if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then + # install mode needs the following variable: + notinst_deplibs=' libgflags_nothreads.la' +else + # When we are sourced in execute mode, $file and $echo are already set. + if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then + echo="echo" + file="$0" + # Make sure echo works. + if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : + else + # Restart under the correct shell, and then maybe $echo will work. + exec /bin/sh "$0" --no-reexec ${1+"$@"} + fi + fi + + # Find the directory that this script lives in. + thisdir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "x$thisdir" = "x$file" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'` + while test -n "$file"; do + destdir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + + # If there was a directory component, then change thisdir. + if test "x$destdir" != "x$file"; then + case "$destdir" in + [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;; + *) thisdir="$thisdir/$destdir" ;; + esac + fi + + file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'` + done + + # Try to get the absolute directory name. + absdir=`cd "$thisdir" && pwd` + test -n "$absdir" && thisdir="$absdir" + + program=lt-'gflags_nothreads_unittest' + progdir="$thisdir/.libs" + + if test ! -f "$progdir/$program" || \ + { file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | /bin/sed 1q`; \ + test "X$file" != "X$progdir/$program"; }; then + + file="$$-$program" + + if test ! -d "$progdir"; then + mkdir "$progdir" + else + rm -f "$progdir/$file" + fi + + # relink executable if necessary + if test -n "$relink_command"; then + if relink_command_output=`eval $relink_command 2>&1`; then : + else + echo "$relink_command_output" >&2 + rm -f "$progdir/$file" + exit 1 + fi + fi + + mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null || + { rm -f "$progdir/$program"; + mv -f "$progdir/$file" "$progdir/$program"; } + rm -f "$progdir/$file" + fi + + if test -f "$progdir/$program"; then + if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then + # Run the actual program with our arguments. + + exec "$progdir/$program" ${1+"$@"} + + $echo "$0: cannot exec $program ${1+"$@"}" + exit 1 + fi + else + # The program doesn't exist. + $echo "$0: error: \`$progdir/$program' does not exist" 1>&2 + $echo "This script is just a wrapper for $program." 1>&2 + echo "See the libtool documentation for more information." 1>&2 + exit 1 + fi +fi diff --git a/dtm_release/lib/util/gflags-1.1/gflags_unittest b/dtm_release/lib/util/gflags-1.1/gflags_unittest new file mode 100755 index 0000000000000000000000000000000000000000..4e8af1f24f82a2951c2446f44605f806f48f45c0 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/gflags_unittest @@ -0,0 +1,117 @@ +#! /bin/sh + +# gflags_unittest - temporary wrapper script for .libs/gflags_unittest +# Generated by ltmain.sh - GNU libtool 1.5.22 Debian 1.5.22-2 (1.1220.2.365 2005/12/18 22:14:06) +# +# The gflags_unittest program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='/bin/sed -e 1s/^X//' +sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command="(cd /u/sgerrish/src1/topics/lib/util/gflags-1.1; LIBRARY_PATH=\"/n/fs/topics/lib/:/u/blei/local/lib:/n/fs/topics/lib/gsl/lib/:/n/fs/topics/lib/:/u/blei/local/lib:/n/fs/topics/lib/gsl/lib/:/n/fs/topics/lib/:/u/blei/local/lib:/n/fs/topics/lib/gsl/lib/:\"; export LIBRARY_PATH; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; LD_LIBRARY_PATH=\"/u/sgerrish/.local/lib\"; export LD_LIBRARY_PATH; PATH=\"/usr/local/bin:/u/blei/local/bin/:/usr/local/bin:/u/blei/local/bin/:/usr/local/bin:/u/blei/local/bin/:/usr/local/texlive/2008/bin/x86_64-linux:/u/sgerrish/bin:/usr/local/bin:/usr/lib64/qt-3.3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin:/usr/X11R6/bin:/usr/local/java/jdk/bin:/usr/local/java/jre/bin:/usr/bin:/bin:/usr/sbin:/usr/X11R6/bin:/u/department/bin:/usr/local/maple/bin:/n/fs/grad/sgerrish/bin:/usr/local/gnu/bin:/usr/local/bin:/usr/sbin:/usr/local/X11/bin:/usr/X11R6/bin:/u/department/bin:/usr/lib/lp/postscript:/u/sgerrish/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin\"; export PATH; g++ -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -g -O2 -o \$progdir/\$file -pthread gflags_unittest-gflags_unittest.o ./.libs/libgflags.so -Wl,--rpath -Wl,/u/sgerrish/src1/topics/lib/util/gflags-1.1/.libs)" + +# This environment variable determines our operation mode. +if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then + # install mode needs the following variable: + notinst_deplibs=' libgflags.la' +else + # When we are sourced in execute mode, $file and $echo are already set. + if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then + echo="echo" + file="$0" + # Make sure echo works. + if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : + else + # Restart under the correct shell, and then maybe $echo will work. + exec /bin/sh "$0" --no-reexec ${1+"$@"} + fi + fi + + # Find the directory that this script lives in. + thisdir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "x$thisdir" = "x$file" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'` + while test -n "$file"; do + destdir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + + # If there was a directory component, then change thisdir. + if test "x$destdir" != "x$file"; then + case "$destdir" in + [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;; + *) thisdir="$thisdir/$destdir" ;; + esac + fi + + file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'` + done + + # Try to get the absolute directory name. + absdir=`cd "$thisdir" && pwd` + test -n "$absdir" && thisdir="$absdir" + + program=lt-'gflags_unittest' + progdir="$thisdir/.libs" + + if test ! -f "$progdir/$program" || \ + { file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | /bin/sed 1q`; \ + test "X$file" != "X$progdir/$program"; }; then + + file="$$-$program" + + if test ! -d "$progdir"; then + mkdir "$progdir" + else + rm -f "$progdir/$file" + fi + + # relink executable if necessary + if test -n "$relink_command"; then + if relink_command_output=`eval $relink_command 2>&1`; then : + else + echo "$relink_command_output" >&2 + rm -f "$progdir/$file" + exit 1 + fi + fi + + mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null || + { rm -f "$progdir/$program"; + mv -f "$progdir/$file" "$progdir/$program"; } + rm -f "$progdir/$file" + fi + + if test -f "$progdir/$program"; then + if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then + # Run the actual program with our arguments. + + exec "$progdir/$program" ${1+"$@"} + + $echo "$0: cannot exec $program ${1+"$@"}" + exit 1 + fi + else + # The program doesn't exist. + $echo "$0: error: \`$progdir/$program' does not exist" 1>&2 + $echo "This script is just a wrapper for $program." 1>&2 + echo "See the libtool documentation for more information." 1>&2 + exit 1 + fi +fi diff --git a/dtm_release/lib/util/gflags-1.1/gflags_unittest2 b/dtm_release/lib/util/gflags-1.1/gflags_unittest2 new file mode 100755 index 0000000000000000000000000000000000000000..cc143f3091c993c0a015c82dd5579d32fb876c86 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/gflags_unittest2 @@ -0,0 +1,117 @@ +#! /bin/sh + +# gflags_unittest2 - temporary wrapper script for .libs/gflags_unittest2 +# Generated by ltmain.sh - GNU libtool 1.5.22 Debian 1.5.22-2 (1.1220.2.365 2005/12/18 22:14:06) +# +# The gflags_unittest2 program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='/bin/sed -e 1s/^X//' +sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command="(cd /u/sgerrish/src1/topics/lib/util/gflags-1.1; LIBRARY_PATH=\"/n/fs/topics/lib/:/u/blei/local/lib:/n/fs/topics/lib/gsl/lib/:/n/fs/topics/lib/:/u/blei/local/lib:/n/fs/topics/lib/gsl/lib/:/n/fs/topics/lib/:/u/blei/local/lib:/n/fs/topics/lib/gsl/lib/:\"; export LIBRARY_PATH; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; LD_LIBRARY_PATH=\"/u/sgerrish/.local/lib\"; export LD_LIBRARY_PATH; PATH=\"/usr/local/bin:/u/blei/local/bin/:/usr/local/bin:/u/blei/local/bin/:/usr/local/bin:/u/blei/local/bin/:/usr/local/texlive/2008/bin/x86_64-linux:/u/sgerrish/bin:/usr/local/bin:/usr/lib64/qt-3.3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin:/usr/X11R6/bin:/usr/local/java/jdk/bin:/usr/local/java/jre/bin:/usr/bin:/bin:/usr/sbin:/usr/X11R6/bin:/u/department/bin:/usr/local/maple/bin:/n/fs/grad/sgerrish/bin:/usr/local/gnu/bin:/usr/local/bin:/usr/sbin:/usr/local/X11/bin:/usr/X11R6/bin:/u/department/bin:/usr/lib/lp/postscript:/u/sgerrish/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin\"; export PATH; g++ -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -g -O2 -o \$progdir/\$file gflags_unittest-main.o ./.libs/libgflags_nothreads.so -Wl,--rpath -Wl,/u/sgerrish/src1/topics/lib/util/gflags-1.1/.libs)" + +# This environment variable determines our operation mode. +if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then + # install mode needs the following variable: + notinst_deplibs=' libgflags_nothreads.la' +else + # When we are sourced in execute mode, $file and $echo are already set. + if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then + echo="echo" + file="$0" + # Make sure echo works. + if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : + else + # Restart under the correct shell, and then maybe $echo will work. + exec /bin/sh "$0" --no-reexec ${1+"$@"} + fi + fi + + # Find the directory that this script lives in. + thisdir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "x$thisdir" = "x$file" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'` + while test -n "$file"; do + destdir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + + # If there was a directory component, then change thisdir. + if test "x$destdir" != "x$file"; then + case "$destdir" in + [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;; + *) thisdir="$thisdir/$destdir" ;; + esac + fi + + file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'` + done + + # Try to get the absolute directory name. + absdir=`cd "$thisdir" && pwd` + test -n "$absdir" && thisdir="$absdir" + + program=lt-'gflags_unittest2' + progdir="$thisdir/.libs" + + if test ! -f "$progdir/$program" || \ + { file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | /bin/sed 1q`; \ + test "X$file" != "X$progdir/$program"; }; then + + file="$$-$program" + + if test ! -d "$progdir"; then + mkdir "$progdir" + else + rm -f "$progdir/$file" + fi + + # relink executable if necessary + if test -n "$relink_command"; then + if relink_command_output=`eval $relink_command 2>&1`; then : + else + echo "$relink_command_output" >&2 + rm -f "$progdir/$file" + exit 1 + fi + fi + + mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null || + { rm -f "$progdir/$program"; + mv -f "$progdir/$file" "$progdir/$program"; } + rm -f "$progdir/$file" + fi + + if test -f "$progdir/$program"; then + if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then + # Run the actual program with our arguments. + + exec "$progdir/$program" ${1+"$@"} + + $echo "$0: cannot exec $program ${1+"$@"}" + exit 1 + fi + else + # The program doesn't exist. + $echo "$0: error: \`$progdir/$program' does not exist" 1>&2 + $echo "This script is just a wrapper for $program." 1>&2 + echo "See the libtool documentation for more information." 1>&2 + exit 1 + fi +fi diff --git a/dtm_release/lib/util/gflags-1.1/gflags_unittest3 b/dtm_release/lib/util/gflags-1.1/gflags_unittest3 new file mode 100755 index 0000000000000000000000000000000000000000..895b19389198c351ce89666900649689f090aa31 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/gflags_unittest3 @@ -0,0 +1,117 @@ +#! /bin/sh + +# gflags_unittest3 - temporary wrapper script for .libs/gflags_unittest3 +# Generated by ltmain.sh - GNU libtool 1.5.22 Debian 1.5.22-2 (1.1220.2.365 2005/12/18 22:14:06) +# +# The gflags_unittest3 program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='/bin/sed -e 1s/^X//' +sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command="(cd /u/sgerrish/src1/topics/lib/util/gflags-1.1; LIBRARY_PATH=\"/n/fs/topics/lib/:/u/blei/local/lib:/n/fs/topics/lib/gsl/lib/:/n/fs/topics/lib/:/u/blei/local/lib:/n/fs/topics/lib/gsl/lib/:/n/fs/topics/lib/:/u/blei/local/lib:/n/fs/topics/lib/gsl/lib/:\"; export LIBRARY_PATH; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; LD_LIBRARY_PATH=\"/u/sgerrish/.local/lib\"; export LD_LIBRARY_PATH; PATH=\"/usr/local/bin:/u/blei/local/bin/:/usr/local/bin:/u/blei/local/bin/:/usr/local/bin:/u/blei/local/bin/:/usr/local/texlive/2008/bin/x86_64-linux:/u/sgerrish/bin:/usr/local/bin:/usr/lib64/qt-3.3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin:/usr/X11R6/bin:/usr/local/java/jdk/bin:/usr/local/java/jre/bin:/usr/bin:/bin:/usr/sbin:/usr/X11R6/bin:/u/department/bin:/usr/local/maple/bin:/n/fs/grad/sgerrish/bin:/usr/local/gnu/bin:/usr/local/bin:/usr/sbin:/usr/local/X11/bin:/usr/X11R6/bin:/u/department/bin:/usr/lib/lp/postscript:/u/sgerrish/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin:/n/fs/topics/lib/protobuf/bin:/n/fs/topics/lib/graphviz/bin:/n/fs/topics/lib/gsl/bin:/n/fs/topics/lib/gslwrap/bin:/n/fs/topics/lib/morpha:/n/fs/topics/lib/ghc/bin:/n/fs/topics/lib/hbc/bin:/n/fs/topics/lib/ant/bin:/n/fs/topics/lib/treetagger/cmd:/n/fs/topics/lib/treetagger/bin:/n/fs/topics/lib/plsi/bin\"; export PATH; g++ -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -g -O2 -o \$progdir/\$file gflags_unittest_main.o ./.libs/libgflags_nothreads.so -Wl,--rpath -Wl,/u/sgerrish/src1/topics/lib/util/gflags-1.1/.libs)" + +# This environment variable determines our operation mode. +if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then + # install mode needs the following variable: + notinst_deplibs=' libgflags_nothreads.la' +else + # When we are sourced in execute mode, $file and $echo are already set. + if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then + echo="echo" + file="$0" + # Make sure echo works. + if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : + else + # Restart under the correct shell, and then maybe $echo will work. + exec /bin/sh "$0" --no-reexec ${1+"$@"} + fi + fi + + # Find the directory that this script lives in. + thisdir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "x$thisdir" = "x$file" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'` + while test -n "$file"; do + destdir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + + # If there was a directory component, then change thisdir. + if test "x$destdir" != "x$file"; then + case "$destdir" in + [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;; + *) thisdir="$thisdir/$destdir" ;; + esac + fi + + file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'` + done + + # Try to get the absolute directory name. + absdir=`cd "$thisdir" && pwd` + test -n "$absdir" && thisdir="$absdir" + + program=lt-'gflags_unittest3' + progdir="$thisdir/.libs" + + if test ! -f "$progdir/$program" || \ + { file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | /bin/sed 1q`; \ + test "X$file" != "X$progdir/$program"; }; then + + file="$$-$program" + + if test ! -d "$progdir"; then + mkdir "$progdir" + else + rm -f "$progdir/$file" + fi + + # relink executable if necessary + if test -n "$relink_command"; then + if relink_command_output=`eval $relink_command 2>&1`; then : + else + echo "$relink_command_output" >&2 + rm -f "$progdir/$file" + exit 1 + fi + fi + + mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null || + { rm -f "$progdir/$program"; + mv -f "$progdir/$file" "$progdir/$program"; } + rm -f "$progdir/$file" + fi + + if test -f "$progdir/$program"; then + if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then + # Run the actual program with our arguments. + + exec "$progdir/$program" ${1+"$@"} + + $echo "$0: cannot exec $program ${1+"$@"}" + exit 1 + fi + else + # The program doesn't exist. + $echo "$0: error: \`$progdir/$program' does not exist" 1>&2 + $echo "This script is just a wrapper for $program." 1>&2 + echo "See the libtool documentation for more information." 1>&2 + exit 1 + fi +fi diff --git a/dtm_release/lib/util/gflags-1.1/install-sh b/dtm_release/lib/util/gflags-1.1/install-sh new file mode 100755 index 0000000000000000000000000000000000000000..4d4a9519eaf88b18fb157dfe5fae59c1c5d005c7 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/install-sh @@ -0,0 +1,323 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2005-05-14.22 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +chmodcmd="$chmodprog 0755" +chowncmd= +chgrpcmd= +stripcmd= +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src= +dst= +dir_arg= +dstarg= +no_target_directory= + +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" + +while test -n "$1"; do + case $1 in + -c) shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit $?;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; + + --version) echo "$0 $scriptversion"; exit $?;; + + *) # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + test -n "$dir_arg$dstarg" && break + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done + break;; + esac +done + +if test -z "$1"; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + src= + + if test -d "$dst"; then + mkdircmd=: + chmodcmd= + else + mkdircmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dst=$dst/`basename "$src"` + fi + fi + + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" + + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + shift + IFS=$oIFS + + pathcomp= + + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test -d "$pathcomp" || exit + fi + pathcomp=$pathcomp/ + done + fi + + if test -n "$dir_arg"; then + $doit $mkdircmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } + + else + dstfile=`basename "$dst"` + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap '(exit $?); exit' 1 2 13 15 + + # Copy the file name to the temp name. + $doit $cpprog "$src" "$dsttmp" && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit 1 + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } + fi || { (exit 1); exit 1; } +done + +# The final little trick to "correctly" pass the exit status to the exit trap. +{ + (exit 0); exit 0 +} + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/dtm_release/lib/util/gflags-1.1/libtool b/dtm_release/lib/util/gflags-1.1/libtool new file mode 100755 index 0000000000000000000000000000000000000000..433bcbacfb043572d29986989ad035d016dc607f --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/libtool @@ -0,0 +1,7848 @@ +#! /bin/sh + +# libtoolT - Provide generalized library-building support services. +# Generated automatically by (GNU gflags 1.1) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 +# +# 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 2 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A sed program that does not truncate output. +SED="/bin/sed" + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="/bin/sed -e 1s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# The names of the tagged configurations supported by this script. +available_tags=" CXX F77" + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host opus.CS.Princeton.EDU: + +# Shell to use when invoking shell scripts. +SHELL="/bin/sh" + +# Whether or not to build shared libraries. +build_libtool_libs=yes + +# Whether or not to build static libraries. +build_old_libs=yes + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=no + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=no + +# Whether or not to optimize for fast installation. +fast_install=yes + +# The host system. +host_alias= +host=x86_64-unknown-linux-gnu +host_os=linux-gnu + +# The build system. +build_alias= +build=x86_64-unknown-linux-gnu +build_os=linux-gnu + +# An echo program that does not interpret backslashes. +echo="echo" + +# The archiver. +AR="ar" +AR_FLAGS="cru" + +# A C compiler. +LTCC="gcc" + +# LTCC compiler flags. +LTCFLAGS="-g -O2" + +# A language-specific compiler. +CC="gcc" + +# Is the compiler the GNU C compiler? +with_gcc=yes + +# An ERE matcher. +EGREP="/bin/grep -E" + +# The linker used to build libraries. +LD="/usr/local/bin/ld -m elf_x86_64" + +# Whether we need hard or soft links. +LN_S="ln -s" + +# A BSD-compatible nm program. +NM="/usr/local/bin/nm -B" + +# A symbol stripping program +STRIP="strip" + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=file + +# Used on cygwin: DLL creation program. +DLLTOOL="dlltool" + +# Used on cygwin: object dumper. +OBJDUMP="objdump" + +# Used on cygwin: assembler. +AS="as" + +# The name of the directory that contains temporary libtool files. +objdir=.libs + +# How to create reloadable object files. +reload_flag=" -r" +reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" + +# How to pass a linker flag through the compiler. +wl="-Wl," + +# Object file suffix (normally "o"). +objext="o" + +# Old archive suffix (normally "a"). +libext="a" + +# Shared library suffix (normally ".so"). +shrext_cmds='.so' + +# Executable file suffix (normally ""). +exeext="" + +# Additional compiler flags for building library objects. +pic_flag=" -fPIC -DPIC" +pic_mode=default + +# What is the maximum length of a command? +max_cmd_len=98304 + +# Does compiler simultaneously support -c and -o options? +compiler_c_o="yes" + +# Must we lock files when doing compilation? +need_locks="no" + +# Do we need the lib prefix for modules? +need_lib_prefix=no + +# Do we need a version for libraries? +need_version=no + +# Whether dlopen is supported. +dlopen_support=unknown + +# Whether dlopen of programs is supported. +dlopen_self=unknown + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=unknown + +# Compiler flag to prevent dynamic linking. +link_static_flag="-static" + +# Compiler flag to turn off builtin functions. +no_builtin_flag=" -fno-builtin" + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec="\${wl}--export-dynamic" + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive" + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec="" + +# Library versioning type. +version_type=linux + +# Format of library name prefix. +libname_spec="lib\$name" + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}" + +# The coded name of the library, if different from the real name. +soname_spec="\${libname}\${release}\${shared_ext}\$major" + +# Commands used to build and install an old-style archive. +RANLIB="ranlib" +old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib" +old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib" +old_postuninstall_cmds="" + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds="" + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds="" + +# Commands used to build and install a shared archive. +archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib" +archive_expsym_cmds="\$echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~ + cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~ + \$echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~ + \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib" +postinstall_cmds="" +postuninstall_cmds="" + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds="" +module_expsym_cmds="" + +# Commands to strip libraries. +old_striplib="strip --strip-debug" +striplib="strip --strip-unneeded" + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects="" + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects="" + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps="" + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps="" + +# The directories searched by this compiler when creating a shared +# library +compiler_lib_search_dirs="" + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path="" + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method="pass_all" + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd="\$MAGIC_CMD" + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag="" + +# Flag that forces no undefined symbols. +no_undefined_flag="" + +# Commands used to finish a libtool library installation in a directory. +finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir" + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval="" + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'" + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'" + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'" + +# This is the shared library runtime path variable. +runpath_var=LD_RUN_PATH + +# This is the shared library path variable. +shlibpath_var=LD_LIBRARY_PATH + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=no + +# How to hardcode a shared library path into an executable. +hardcode_action=immediate + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=yes + +# Flag to hardcode $libdir into a binary during linking. +# This must work even if $libdir does not exist. +hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir" + +# If ld is used when linking, flag to hardcode $libdir into +# a binary during linking. This must work even if $libdir does +# not exist. +hardcode_libdir_flag_spec_ld="" + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator="" + +# Set to yes if using DIR/libNAME during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=no + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=no + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=unsupported + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=no + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=no + +# Compile-time system search path for libraries +sys_lib_search_path_spec="/n/fs/topics/lib /u/blei/local/lib64 /n/fs/topics/lib/gsl/lib /usr/lib/gcc/x86_64-redhat-linux/4.1.2 /usr/lib64 /lib64" + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/mysql /usr/lib64/mysql /usr/lib/qt-3.3/lib /usr/lib64/qt-3.3/lib /usr/local/lib " + +# Fix the shell variable $srcfile for the compiler. +fix_srcfile_path="" + +# Set to yes if exported symbols are required. +always_export_symbols=no + +# The commands to list exported symbols. +export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds="" + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*" + +# Symbols that must always be exported. +include_expsyms="" + +# ### END LIBTOOL CONFIG + +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun configure. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 +# +# 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 2 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +basename="s,^.*/,,g" + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + +# The name of this program: +progname=`echo "$progpath" | $SED $basename` +modename="$progname" + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION="1.5.22 Debian 1.5.22-2" +TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes. +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$progpath" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<EOF +$* +EOF + exit $EXIT_SUCCESS +fi + +default_mode= +help="Try \`$progname --help' for more information." +magic="%%%MAGIC variable%%%" +mkdir="mkdir" +mv="mv -f" +rm="rm -f" + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed="${SED}"' -e 1s/^X//' +sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + SP2NL='tr \040 \012' + NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + SP2NL='tr \100 \n' + NL2SP='tr \r\n \100\100' + ;; +esac + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +# We save the old values to restore during execute mode. +if test "${LC_ALL+set}" = set; then + save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL +fi +if test "${LANG+set}" = set; then + save_LANG="$LANG"; LANG=C; export LANG +fi + +# Make sure IFS has a sensible default +lt_nl=' +' +IFS=" $lt_nl" + +if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + $echo "$modename: not configured to build any kind of library" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +duplicate_deps=no +preserve_args= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +##################################### +# Shell function definitions: +# This seems to be the best place for them + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $mkdir "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || { + $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 + exit $EXIT_FAILURE + } + fi + + $echo "X$my_tmpdir" | $Xsed +} + + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +func_win32_libid () +{ + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ + $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | \ + $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $echo $win32_libid_type +} + + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case "$@ " in + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit $EXIT_FAILURE +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 + exit $EXIT_FAILURE + fi +} + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + my_status="" + + $show "${rm}r $my_gentop" + $run ${rm}r "$my_gentop" + $show "$mkdir $my_gentop" + $run $mkdir "$my_gentop" + my_status=$? + if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then + exit $my_status + fi + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` + my_xdir="$my_gentop/$my_xlib" + + $show "${rm}r $my_xdir" + $run ${rm}r "$my_xdir" + $show "$mkdir $my_xdir" + $run $mkdir "$my_xdir" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then + exit $exit_status + fi + case $host in + *-darwin*) + $show "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + if test -z "$run"; then + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` + darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` + if test -n "$darwin_arches"; then + darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + $show "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we have a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + lipo -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + ${rm}r unfat-$$ + cd "$darwin_orig_dir" + else + cd "$darwin_orig_dir" + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + fi # $run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + func_extract_archives_result="$my_oldobjs" +} +# End of Shell function definitions +##################################### + +# Darwin sucks +eval std_shrext=\"$shrext_cmds\" + +disable_libs=no + +# Parse our command line options once, thoroughly. +while test "$#" -gt 0 +do + arg="$1" + shift + + case $arg in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + execute_dlfiles) + execute_dlfiles="$execute_dlfiles $arg" + ;; + tag) + tagname="$arg" + preserve_args="${preserve_args}=$arg" + + # Check whether tagname contains only valid characters + case $tagname in + *[!-_A-Za-z0-9,/]*) + $echo "$progname: invalid tag name: $tagname" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $tagname in + CC) + # Don't test for the "default" C tag, as we know, it's there, but + # not specially marked. + ;; + *) + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then + taglist="$taglist $tagname" + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" + else + $echo "$progname: ignoring unknown tag $tagname" 1>&2 + fi + ;; + esac + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case $arg in + --help) + show_help=yes + ;; + + --version) + $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + $echo + $echo "Copyright (C) 2005 Free Software Foundation, Inc." + $echo "This is free software; see the source for copying conditions. There is NO" + $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + exit $? + ;; + + --config) + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath + # Now print the configurations for the tags. + for tagname in $taglist; do + ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" + done + exit $? + ;; + + --debug) + $echo "$progname: enabling shell trace mode" + set -x + preserve_args="$preserve_args $arg" + ;; + + --dry-run | -n) + run=: + ;; + + --features) + $echo "host: $host" + if test "$build_libtool_libs" = yes; then + $echo "enable shared libraries" + else + $echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + $echo "enable static libraries" + else + $echo "disable static libraries" + fi + exit $? + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --preserve-dup-deps) duplicate_deps="yes" ;; + + --quiet | --silent) + show=: + preserve_args="$preserve_args $arg" + ;; + + --tag) + prevopt="--tag" + prev=tag + preserve_args="$preserve_args --tag" + ;; + --tag=*) + set tag "$optarg" ${1+"$@"} + shift + prev=tag + preserve_args="$preserve_args --tag" + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE +fi + +case $disable_libs in +no) + ;; +shared) + build_libtool_libs=no + build_old_libs=yes + ;; +static) + build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` + ;; +esac + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 + $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 + case $nonopt in + *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) + mode=link + for arg + do + case $arg in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case $mode in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + if test -n "$libobj" ; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit $EXIT_FAILURE + fi + arg_mode=target + continue + ;; + + -static | -prefer-pic | -prefer-non-pic) + later="$later $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + base_compile="$base_compile $lastarg" + continue + ;; + + * ) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + case $lastarg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, and some SunOS ksh mistreat backslash-escaping + # in scan sets (worked around with variable expansion), + # and furthermore cannot handle '|' '&' '(' ')' in scan sets + # at all, so we specify them separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + base_compile="$base_compile $lastarg" + done # for arg + + case $arg_mode in + arg) + $echo "$modename: you must specify an argument for -Xcompile" + exit $EXIT_FAILURE + ;; + target) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit $EXIT_FAILURE + ;; + *) + # Get the name of the library object. + [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSifmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.ii) xform=ii ;; + *.class) xform=class ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + *.java) xform=java ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` + case $qlibobj in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qlibobj="\"$qlibobj\"" ;; + esac + test "X$libobj" != "X$qlibobj" \ + && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." + objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir= + else + xdir=$xdir/ + fi + lobj=${xdir}$objdir/$objname + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $run ln "$progpath" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + $echo "$srcfile" > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` + case $qsrcfile in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qsrcfile="\"$qsrcfile\"" ;; + esac + + $run $rm "$libobj" "${libobj}T" + + # Create a libtool object file (analogous to a ".la" file), + # but don't create it if we're doing a dry run. + test -z "$run" && cat > ${libobj}T <<EOF +# $libobj - a libtool object file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +EOF + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + if test ! -d "${xdir}$objdir"; then + $show "$mkdir ${xdir}$objdir" + $run $mkdir ${xdir}$objdir + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then + exit $exit_status + fi + fi + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + command="$command -o $lobj" + fi + + $run $rm "$lobj" "$output_obj" + + $show "$command" + if $run eval "$command"; then : + else + test -n "$output_obj" && $run $rm $removelist + exit $EXIT_FAILURE + fi + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + $show "$mv $output_obj $lobj" + if $run $mv $output_obj $lobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the PIC object to the libtool object file. + test -z "$run" && cat >> ${libobj}T <<EOF +pic_object='$objdir/$objname' + +EOF + + # Allow error messages only from the first compilation. + if test "$suppress_opt" = yes; then + suppress_output=' >/dev/null 2>&1' + fi + else + # No PIC object so indicate it doesn't exist in the libtool + # object file. + test -z "$run" && cat >> ${libobj}T <<EOF +pic_object=none + +EOF + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $qsrcfile" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + $run $rm "$obj" "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + $run $rm $removelist + exit $EXIT_FAILURE + fi + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the non-PIC object the libtool object file. + # Only append if the libtool object file exists. + test -z "$run" && cat >> ${libobj}T <<EOF +# Name of the non-PIC object. +non_pic_object='$objname' + +EOF + else + # Append the name of the non-PIC object the libtool object file. + # Only append if the libtool object file exists. + test -z "$run" && cat >> ${libobj}T <<EOF +# Name of the non-PIC object. +non_pic_object=none + +EOF + fi + + $run $mv "${libobj}T" "${libobj}" + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi + + exit $EXIT_SUCCESS + ;; + + # libtool link mode + link | relink) + modename="$modename: link" + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args="$nonopt" + base_compile="$nonopt $@" + compile_command="$nonopt" + finalize_command="$nonopt" + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + + avoid_version=no + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + non_pic_objects= + notinst_path= # paths that contain not-installed libtool libraries + precious_files_regex= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -all-static | -static) + if test "X$arg" = "X-all-static"; then + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + fi + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test + ;; + *) qarg=$arg ;; + esac + libtool_args="$libtool_args $qarg" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit $EXIT_FAILURE + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat $save_arg` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + done + else + $echo "$modename: link input file \`$save_arg' does not exist" + exit $EXIT_FAILURE + fi + arg=$save_arg + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit $EXIT_FAILURE + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + compile_command="$compile_command $wl$qarg" + finalize_command="$finalize_command $wl$qarg" + continue + ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + darwin_framework|darwin_framework_skip) + test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + prev= + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: more than one -exported-symbols argument is not allowed" + exit $EXIT_FAILURE + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework|-arch|-isysroot) + case " $CC " in + *" ${arg} ${1} "* | *" ${arg} ${1} "*) + prev=darwin_framework_skip ;; + *) compiler_flags="$compiler_flags $arg" + prev=darwin_framework ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + notinst_path="$notinst_path $dir" + fi + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs -framework System" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + -model) + compile_command="$compile_command $arg" + compiler_flags="$compiler_flags $arg" + finalize_command="$finalize_command $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m* pass through architecture-specific compiler args for GCC + # -m*, -t[45]*, -txscale* pass through architecture-specific + # compiler args for GCC + # -pg pass through profiling flag for GCC + # @file GCC response files + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ + -t[45]*|-txscale*|@*) + + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + compiler_flags="$compiler_flags $arg" + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # The PATH hackery in wrapper scripts is required on Windows + # in order for the loader to find any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit $EXIT_FAILURE + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $wl$flag" + linker_flags="$linker_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + + *.$objext) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done # argument parsing loop + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + # Create the object directory. + if test ! -d "$output_objdir"; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then + exit $exit_status + fi + fi + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + case $host in + *cygwin* | *mingw* | *pw32*) + # don't eliminate duplications in $postdeps and $predeps + duplicate_compiler_generated_deps=yes + ;; + *) + duplicate_compiler_generated_deps=$duplicate_deps + ;; + esac + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if test "X$duplicate_deps" = "Xyes" ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit $EXIT_FAILURE + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + for pass in $passes; do + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) + libs="$deplibs %DEPLIBS%" + test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" + ;; + esac + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + compiler_flags="$compiler_flags $deplib" + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if (${SED} -e '2q' $lib | + grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + library_names= + old_library= + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + if eval $echo \"$deplib\" 2>/dev/null \ + | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + $echo + $echo "*** Warning: Trying to link with static lib archive $deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because the file extensions .$libext of this argument makes me believe" + $echo "*** that it is just a static archive that I should not used here." + else + $echo + $echo "*** Warning: Linking the shared library $output against the" + $echo "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test "$found" = yes || test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 + exit $EXIT_FAILURE + fi + + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit $EXIT_FAILURE + fi + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi + fi # $installed = yes + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $absdir" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes ; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + # This is a shared library + + # Warn about portability, can't link against -module's on + # some systems (darwin) + if test "$shouldnotlink" = yes && test "$pass" = link ; then + $echo + if test "$linkmode" = prog; then + $echo "*** Warning: Linking the executable $output against the loadable module" + else + $echo "*** Warning: Linking the shared library $output against the loadable module" + fi + $echo "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw*) + major=`expr $current - $age` + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`$echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + save_ifs="$IFS"; IFS='~' + cmds=$extract_expsyms_cmds + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + save_ifs="$IFS"; IFS='~' + cmds=$old_archive_from_expsyms_cmds + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a module then we can not link against + # it, someone is ignoring the new warnings I added + if /usr/bin/file -L $add 2> /dev/null | + $EGREP ": [^:]* bundle" >/dev/null ; then + $echo "** Warning, lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $echo + $echo "** And there doesn't seem to be a static archive available" + $echo "** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit $EXIT_FAILURE + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + $echo + $echo "*** Warning: This system can not link to static lib archive $lib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + $echo "*** But as you try to build a module library, libtool will still create " + $echo "*** a static module, that should work as long as the dlopening application" + $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="$absdir/$objdir" + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="$absdir" + fi + depdepl= + case $host in + *-*-darwin*) + # we do not want to link against static libs, + # but need to link against shared + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$path/$depdepl" ; then + depdepl="$path/$depdepl" + fi + # do not add paths which are already there + case " $newlib_search_path " in + *" $path "*) ;; + *) newlib_search_path="$newlib_search_path $path";; + esac + fi + path="" + ;; + *) + path="-L$path" + ;; + esac + ;; + -l*) + case $host in + *-*-darwin*) + # Again, we only want to link against shared libraries + eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` + for tmp in $newlib_search_path ; do + if test -f "$tmp/lib$tmp_libs.dylib" ; then + eval depdepl="$tmp/lib$tmp_libs.dylib" + break + fi + done + path="" + ;; + *) continue ;; + esac + ;; + *) continue ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + case " $deplibs " in + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit $EXIT_FAILURE + else + $echo + $echo "*** Warning: Linking the shared library $output against the non-libtool" + $echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + if test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test "$#" -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$2" + number_minor="$3" + number_revision="$4" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + current=`expr $number_major + $number_minor - 1` + age="$number_minor" + revision="$number_minor" + ;; + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE + ;; + esac + ;; + no) + current="$2" + revision="$3" + age="$4" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + if test "$age" -gt "$current"; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + minor_current=`expr $current + 1` + verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + irix | nonstopux) + major=`expr $current - $age + 1` + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=.`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + major=`expr $current - $age` + versuffix="-$major" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + fi + + if test "$mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$echo "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + removelist="$removelist $p" + ;; + *) ;; + esac + done + if test -n "$removelist"; then + $show "${rm}r $removelist" + $run ${rm}r $removelist + fi + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + for path in $notinst_path; do + lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` + deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` + dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` + done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs -framework System" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c <<EOF + int main() { return 0; } +EOF + $rm conftest + $LTCC $LTCFLAGS -o conftest conftest.c $deplibs + if test "$?" -eq 0 ; then + ldd_output=`ldd conftest` + for i in $deplibs; do + name=`expr $i : '-l\(.*\)'` + # If $name is empty we are operating on a -L argument. + if test "$name" != "" && test "$name" -ne "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $i "*) + newdeplibs="$newdeplibs $i" + i="" + ;; + esac + fi + if test -n "$i" ; then + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + $echo + $echo "*** Warning: dynamic linker does not accept needed library $i." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which I believe you do not have" + $echo "*** because a test_compile did reveal that the linker did not use it for" + $echo "*** its dynamic dependency list that programs get resolved with at runtime." + fi + fi + else + newdeplibs="$newdeplibs $i" + fi + done + else + # Error occurred in the first compile. Let's try to salvage + # the situation: Compile a separate program for each library. + for i in $deplibs; do + name=`expr $i : '-l\(.*\)'` + # If $name is empty we are operating on a -L argument. + if test "$name" != "" && test "$name" != "0"; then + $rm conftest + $LTCC $LTCFLAGS -o conftest conftest.c $i + # Did it work? + if test "$?" -eq 0 ; then + ldd_output=`ldd conftest` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $i "*) + newdeplibs="$newdeplibs $i" + i="" + ;; + esac + fi + if test -n "$i" ; then + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + $echo + $echo "*** Warning: dynamic linker does not accept needed library $i." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because a test_compile did reveal that the linker did not use this one" + $echo "*** as a dynamic dependency that programs can get resolved with at runtime." + fi + fi + else + droppeddeps=yes + $echo + $echo "*** Warning! Library $i is needed by this library but I was not able to" + $echo "*** make it link in! You will probably need to install it or some" + $echo "*** library that it depends on before this library will be fully" + $echo "*** functional. Installing it before continuing would be even better." + fi + else + newdeplibs="$newdeplibs $i" + fi + done + fi + ;; + file_magic*) + set dummy $deplibs_check_method + file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name=`expr $a_deplib : '-l\(.*\)'` + # If $name is empty we are operating on a -L argument. + if test "$name" != "" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for file magic test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a file magic. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name=`expr $a_deplib : '-l\(.*\)'` + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval $echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a regex pattern. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` + done + fi + if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ + | grep . >/dev/null; then + $echo + if test "X$deplibs_check_method" = "Xnone"; then + $echo "*** Warning: inter-library dependencies are not supported in this platform." + else + $echo "*** Warning: inter-library dependencies are not known to be supported." + fi + $echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + $echo + $echo "*** Warning: libtool could not satisfy all declared inter-library" + $echo "*** dependencies of module $libname. Therefore, libtool will create" + $echo "*** a static module, that should work as long as the dlopening" + $echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + $echo "*** The inter-library dependencies that have been dropped here will be" + $echo "*** automatically added whenever a program is linked with this library" + $echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + $echo + $echo "*** Since this library must not contain undefined symbols," + $echo "*** because either the platform does not support them or" + $echo "*** it was explicitly requested with -no-undefined," + $echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + deplibs="$new_libs" + + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + linknames="$linknames $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + if len=`expr "X$cmd" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + $show "$cmd" + $run eval "$cmd" || exit $? + skipped_export=false + else + # The command line is too long to execute in one step. + $show "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise. + $echo "creating reloadable object files..." + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + output_la=`$echo "X$output" | $Xsed -e "$basename"` + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + delfiles= + last_robj= + k=1 + output=$output_objdir/$output_la-${k}.$objext + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + eval test_cmds=\"$reload_cmds $objlist $last_robj\" + if test "X$objlist" = X || + { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len"; }; then + objlist="$objlist $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + k=`expr $k + 1` + output=$output_objdir/$output_la-${k}.$objext + objlist=$obj + len=1 + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + + if ${skipped_export-false}; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + libobjs=$output + # Append the command to create the export file. + eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" + fi + + # Set up a command to remove the reloadable object files + # after they are used. + i=0 + while test "$i" -lt "$k" + do + i=`expr $i + 1` + delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" + done + + $echo "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + + # Append the command to remove the reloadable object files + # to the just-reset $cmds. + eval cmds=\"\$cmds~\$rm $delfiles\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case $output in + *.lo) + if test -n "$objs$old_deplibs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit $EXIT_FAILURE + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + cmds=$reload_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $run eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + cmds=$reload_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + esac + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + if test "$tagname" = CXX ; then + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + fi + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case $dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $run $rm $export_symbols + $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + else + $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval '$echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | + if sort -k 3 </dev/null >/dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + $echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +" + + case $host in + *cygwin* | *mingw* ) + $echo >> "$output_objdir/$dlsyms" "\ +/* DATA imports from DLLs on WIN32 can't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs */ +struct { +" + ;; + * ) + $echo >> "$output_objdir/$dlsyms" "\ +const struct { +" + ;; + esac + + + $echo >> "$output_objdir/$dlsyms" "\ + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{\ +" + + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + case $host in + *cygwin* | *mingw* ) + if test -f "$output_objdir/${outputname}.def" ; then + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + else + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + fi + ;; + * ) + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + esac + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + exit_status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $exit_status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + output_name=`basename $output` + output_path=`dirname $output` + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $rm $cwrappersource $cwrapper + trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + cat > $cwrappersource <<EOF + +/* $cwrappersource - temporary wrapper executable for $objdir/$outputname + Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP + + The $output program cannot be directly executed until all the libtool + libraries that it depends on are installed. + + This wrapper executable should never be moved out of the build directory. + If it is, it will not operate correctly. + + Currently, it simply execs the wrapper *script* "/bin/sh $output", + but could eventually absorb all of the scripts functionality and + exec $objdir/$outputname directly. +*/ +EOF + cat >> $cwrappersource<<"EOF" +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <malloc.h> +#include <stdarg.h> +#include <assert.h> +#include <string.h> +#include <ctype.h> +#include <sys/stat.h> + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +/* -DDEBUG is fairly common in CFLAGS. */ +#undef DEBUG +#if defined DEBUGWRAPPER +# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) +#else +# define DEBUG(format, ...) +#endif + +const char *program_name = NULL; + +void * xmalloc (size_t num); +char * xstrdup (const char *string); +const char * base_name (const char *name); +char * find_executable(const char *wrapper); +int check_executable(const char *path); +char * strendzap(char *str, const char *pat); +void lt_fatal (const char *message, ...); + +int +main (int argc, char *argv[]) +{ + char **newargz; + int i; + + program_name = (char *) xstrdup (base_name (argv[0])); + DEBUG("(main) argv[0] : %s\n",argv[0]); + DEBUG("(main) program_name : %s\n",program_name); + newargz = XMALLOC(char *, argc+2); +EOF + + cat >> $cwrappersource <<EOF + newargz[0] = (char *) xstrdup("$SHELL"); +EOF + + cat >> $cwrappersource <<"EOF" + newargz[1] = find_executable(argv[0]); + if (newargz[1] == NULL) + lt_fatal("Couldn't find %s", argv[0]); + DEBUG("(main) found exe at : %s\n",newargz[1]); + /* we know the script has the same name, without the .exe */ + /* so make sure newargz[1] doesn't end in .exe */ + strendzap(newargz[1],".exe"); + for (i = 1; i < argc; i++) + newargz[i+1] = xstrdup(argv[i]); + newargz[argc+1] = NULL; + + for (i=0; i<argc+1; i++) + { + DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); + ; + } + +EOF + + case $host_os in + mingw*) + cat >> $cwrappersource <<EOF + execv("$SHELL",(char const **)newargz); +EOF + ;; + *) + cat >> $cwrappersource <<EOF + execv("$SHELL",newargz); +EOF + ;; + esac + + cat >> $cwrappersource <<"EOF" + return 127; +} + +void * +xmalloc (size_t num) +{ + void * p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL +; +} + +const char * +base_name (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha ((unsigned char)name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return base; +} + +int +check_executable(const char * path) +{ + struct stat st; + + DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); + if ((!path) || (!*path)) + return 0; + + if ((stat (path, &st) >= 0) && + ( + /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ +#if defined (S_IXOTH) + ((st.st_mode & S_IXOTH) == S_IXOTH) || +#endif +#if defined (S_IXGRP) + ((st.st_mode & S_IXGRP) == S_IXGRP) || +#endif + ((st.st_mode & S_IXUSR) == S_IXUSR)) + ) + return 1; + else + return 0; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise */ +char * +find_executable (const char* wrapper) +{ + int has_slash = 0; + const char* p; + const char* p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char* concat_name; + + DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char* path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char* q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR(*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + return NULL; +} + +char * +strendzap(char *str, const char *pat) +{ + size_t len, patlen; + + assert(str != NULL); + assert(pat != NULL); + + len = strlen(str); + patlen = strlen(pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp(str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char * mode, + const char * message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} +EOF + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource + ;; + esac + $rm $output + trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='${SED} -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $echo >> $output "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + $echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $echo \"\$relink_command_output\" >&2 + $rm \"\$progdir/\$file\" + exit $EXIT_FAILURE + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + $echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit $EXIT_FAILURE + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + $echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit $EXIT_FAILURE + fi +fi\ +" + chmod +x $output + fi + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "copying selected object files to avoid basename conflicts..." + + if test -z "$gentop"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$gentop"; then + exit $exit_status + fi + fi + + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + counter=`expr $counter + 1` + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + $run ln "$obj" "$gentop/$newobj" || + $run cp "$obj" "$gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + + eval cmds=\"$old_archive_cmds\" + + if len=`expr "X$cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + $echo "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + for obj in $save_oldobjs + do + oldobjs="$objlist $obj" + objlist="$objlist $obj" + eval test_cmds=\"$old_archive_cmds\" + if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + eval cmd=\"$cmd\" + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdlfiles="$newdlfiles $libdir/$name" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdlprefiles="$newdlprefiles $libdir/$name" + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" + fi + $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $echo >> $output "\ +relink_command=\"$relink_command\"" + fi + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? + ;; + esac + exit $EXIT_SUCCESS + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $echo "X$nonopt" | grep shtool > /dev/null; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + case " $install_prog " in + *[\\\ /]cp\ *) ;; + *) prev=$arg ;; + esac + ;; + -g | -m | -o) prev=$arg ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test "$#" -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + library_names= + old_library= + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + if test "$inst_prefix_dir" = "$destdir"; then + $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 + exit $EXIT_FAILURE + fi + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + exit $EXIT_FAILURE + fi + fi + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run eval "$striplib $destdir/$realname" || exit $? + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" + $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + cmds=$postinstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + file=`$echo $file|${SED} 's,.exe$,,'` + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin*|*mingw*) + wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` + ;; + *) + wrapper=$file + ;; + esac + if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # + # If there is no directory component, then add one. + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; + esac + + # Check the variables that should have been set. + if test -z "$notinst_deplibs"; then + $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 + exit $EXIT_FAILURE + fi + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + relink_command= + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # + # If there is no directory component, then add one. + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; + esac + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir=`func_mktempdir` + file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` + ;; + esac + ;; + esac + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + if test -n "$stripme" && test -n "$old_striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + + # Do each command in the postinstall commands. + cmds=$old_postinstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + cmds=$finish_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit $EXIT_SUCCESS + + $echo "X----------------------------------------------------------------------" | $Xsed + $echo "Libraries have been installed in:" + for libdir in $libdirs; do + $echo " $libdir" + done + $echo + $echo "If you ever happen to want to link against installed libraries" + $echo "in a given directory, LIBDIR, you must either use libtool, and" + $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + $echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + $echo " during execution" + fi + if test -n "$runpath_var"; then + $echo " - add LIBDIR to the \`$runpath_var' environment variable" + $echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + $echo + $echo "See any operating system documentation about shared libraries for" + $echo "more information, such as the ld(1) and ld.so(8) manual pages." + $echo "X----------------------------------------------------------------------" | $Xsed + exit $EXIT_SUCCESS + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit $EXIT_FAILURE + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit $EXIT_FAILURE + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit $EXIT_SUCCESS + fi + ;; + + # libtool clean and uninstall mode + clean | uninstall) + modename="$modename: $mode" + rm="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) rm="$rm $arg"; rmforce=yes ;; + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + rmdirs= + + origobjdir="$objdir" + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$origobjdir" + else + objdir="$dir/$origobjdir" + fi + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + + case "$mode" in + clean) + case " $library_names " in + # " " in the beginning catches empty $dlname + *" $dlname "*) ;; + *) rmfiles="$rmfiles $objdir/$dlname" ;; + esac + test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + cmds=$postuninstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + cmds=$old_postuninstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + + # Read the .lo file + . $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" \ + && test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" \ + && test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + file=`$echo $file|${SED} 's,.exe$,,'` + noexename=`$echo $name|${SED} 's,.exe$,,'` + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$noexename + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + objdir="$origobjdir" + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit $EXIT_FAILURE + fi +fi # test -z "$show_help" + +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit $EXIT_FAILURE +fi + +# We need to display help for each of the modes. +case $mode in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + --version print version information + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE. + +Report bugs to <bug-libtool@gnu.org>." + exit $EXIT_SUCCESS + ;; + +clean) + $echo \ +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; +esac + +$echo +$echo "Try \`$modename --help' for more information about other modes." + +exit $? + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +disable_libs=shared +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +disable_libs=static +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: +# ### BEGIN LIBTOOL TAG CONFIG: CXX + +# Libtool was configured on host opus.CS.Princeton.EDU: + +# Shell to use when invoking shell scripts. +SHELL="/bin/sh" + +# Whether or not to build shared libraries. +build_libtool_libs=yes + +# Whether or not to build static libraries. +build_old_libs=yes + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=no + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=no + +# Whether or not to optimize for fast installation. +fast_install=yes + +# The host system. +host_alias= +host=x86_64-unknown-linux-gnu +host_os=linux-gnu + +# The build system. +build_alias= +build=x86_64-unknown-linux-gnu +build_os=linux-gnu + +# An echo program that does not interpret backslashes. +echo="echo" + +# The archiver. +AR="ar" +AR_FLAGS="cru" + +# A C compiler. +LTCC="gcc" + +# LTCC compiler flags. +LTCFLAGS="-g -O2" + +# A language-specific compiler. +CC="g++" + +# Is the compiler the GNU C compiler? +with_gcc=yes + +# An ERE matcher. +EGREP="/bin/grep -E" + +# The linker used to build libraries. +LD="/usr/local/bin/ld -m elf_x86_64" + +# Whether we need hard or soft links. +LN_S="ln -s" + +# A BSD-compatible nm program. +NM="/usr/local/bin/nm -B" + +# A symbol stripping program +STRIP="strip" + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=file + +# Used on cygwin: DLL creation program. +DLLTOOL="dlltool" + +# Used on cygwin: object dumper. +OBJDUMP="objdump" + +# Used on cygwin: assembler. +AS="as" + +# The name of the directory that contains temporary libtool files. +objdir=.libs + +# How to create reloadable object files. +reload_flag=" -r" +reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" + +# How to pass a linker flag through the compiler. +wl="-Wl," + +# Object file suffix (normally "o"). +objext="o" + +# Old archive suffix (normally "a"). +libext="a" + +# Shared library suffix (normally ".so"). +shrext_cmds='.so' + +# Executable file suffix (normally ""). +exeext="" + +# Additional compiler flags for building library objects. +pic_flag=" -fPIC -DPIC" +pic_mode=default + +# What is the maximum length of a command? +max_cmd_len=98304 + +# Does compiler simultaneously support -c and -o options? +compiler_c_o="yes" + +# Must we lock files when doing compilation? +need_locks="no" + +# Do we need the lib prefix for modules? +need_lib_prefix=no + +# Do we need a version for libraries? +need_version=no + +# Whether dlopen is supported. +dlopen_support=unknown + +# Whether dlopen of programs is supported. +dlopen_self=unknown + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=unknown + +# Compiler flag to prevent dynamic linking. +link_static_flag="-static" + +# Compiler flag to turn off builtin functions. +no_builtin_flag=" -fno-builtin" + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec="\${wl}--export-dynamic" + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive" + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec="" + +# Library versioning type. +version_type=linux + +# Format of library name prefix. +libname_spec="lib\$name" + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}" + +# The coded name of the library, if different from the real name. +soname_spec="\${libname}\${release}\${shared_ext}\$major" + +# Commands used to build and install an old-style archive. +RANLIB="ranlib" +old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib" +old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib" +old_postuninstall_cmds="" + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds="" + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds="" + +# Commands used to build and install a shared archive. +archive_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib" +archive_expsym_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib" +postinstall_cmds="" +postuninstall_cmds="" + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds="" +module_expsym_cmds="" + +# Commands to strip libraries. +old_striplib="strip --strip-debug" +striplib="strip --strip-unneeded" + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects="/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtbeginS.o" + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects="/usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtendS.o /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crtn.o" + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps="" + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s" + +# The directories searched by this compiler when creating a shared +# library +compiler_lib_search_dirs="/n/fs/topics/lib /u/blei/local/lib/../lib64 /n/fs/topics/lib/gsl/lib /n/fs/topics/lib /u/blei/local/lib/../lib64 /n/fs/topics/lib/gsl/lib /n/fs/topics/lib /u/blei/local/lib/../lib64 /n/fs/topics/lib/gsl/lib . /usr/lib/gcc/x86_64-redhat-linux/4.1.2 /usr/lib/gcc/x86_64-redhat-linux/4.1.2 /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64 /lib/../lib64 /usr/lib/../lib64" + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path="-L/n/fs/topics/lib -L/u/blei/local/lib/../lib64 -L/n/fs/topics/lib/gsl/lib -L/n/fs/topics/lib -L/u/blei/local/lib/../lib64 -L/n/fs/topics/lib/gsl/lib -L/n/fs/topics/lib -L/u/blei/local/lib/../lib64 -L/n/fs/topics/lib/gsl/lib -L. -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2 -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2 -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64" + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method="pass_all" + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd="\$MAGIC_CMD" + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag="" + +# Flag that forces no undefined symbols. +no_undefined_flag="" + +# Commands used to finish a libtool library installation in a directory. +finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir" + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval="" + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'" + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'" + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'" + +# This is the shared library runtime path variable. +runpath_var=LD_RUN_PATH + +# This is the shared library path variable. +shlibpath_var=LD_LIBRARY_PATH + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=no + +# How to hardcode a shared library path into an executable. +hardcode_action=immediate + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=yes + +# Flag to hardcode $libdir into a binary during linking. +# This must work even if $libdir does not exist. +hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir" + +# If ld is used when linking, flag to hardcode $libdir into +# a binary during linking. This must work even if $libdir does +# not exist. +hardcode_libdir_flag_spec_ld="" + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator="" + +# Set to yes if using DIR/libNAME during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=no + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=no + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=unsupported + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=no + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=no + +# Compile-time system search path for libraries +sys_lib_search_path_spec="/n/fs/topics/lib /u/blei/local/lib64 /n/fs/topics/lib/gsl/lib /usr/lib/gcc/x86_64-redhat-linux/4.1.2 /usr/lib64 /lib64" + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/mysql /usr/lib64/mysql /usr/lib/qt-3.3/lib /usr/lib64/qt-3.3/lib /usr/local/lib " + +# Fix the shell variable $srcfile for the compiler. +fix_srcfile_path="" + +# Set to yes if exported symbols are required. +always_export_symbols=no + +# The commands to list exported symbols. +export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds="" + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*" + +# Symbols that must always be exported. +include_expsyms="" + +# ### END LIBTOOL TAG CONFIG: CXX + +# ### BEGIN LIBTOOL TAG CONFIG: F77 + +# Libtool was configured on host opus.CS.Princeton.EDU: + +# Shell to use when invoking shell scripts. +SHELL="/bin/sh" + +# Whether or not to build shared libraries. +build_libtool_libs=yes + +# Whether or not to build static libraries. +build_old_libs=yes + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=no + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=no + +# Whether or not to optimize for fast installation. +fast_install=yes + +# The host system. +host_alias= +host=x86_64-unknown-linux-gnu +host_os=linux-gnu + +# The build system. +build_alias= +build=x86_64-unknown-linux-gnu +build_os=linux-gnu + +# An echo program that does not interpret backslashes. +echo="echo" + +# The archiver. +AR="ar" +AR_FLAGS="cru" + +# A C compiler. +LTCC="gcc" + +# LTCC compiler flags. +LTCFLAGS="-g -O2" + +# A language-specific compiler. +CC="g77" + +# Is the compiler the GNU C compiler? +with_gcc=yes + +# An ERE matcher. +EGREP="/bin/grep -E" + +# The linker used to build libraries. +LD="/usr/local/bin/ld -m elf_x86_64" + +# Whether we need hard or soft links. +LN_S="ln -s" + +# A BSD-compatible nm program. +NM="/usr/local/bin/nm -B" + +# A symbol stripping program +STRIP="strip" + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=file + +# Used on cygwin: DLL creation program. +DLLTOOL="dlltool" + +# Used on cygwin: object dumper. +OBJDUMP="objdump" + +# Used on cygwin: assembler. +AS="as" + +# The name of the directory that contains temporary libtool files. +objdir=.libs + +# How to create reloadable object files. +reload_flag=" -r" +reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" + +# How to pass a linker flag through the compiler. +wl="-Wl," + +# Object file suffix (normally "o"). +objext="o" + +# Old archive suffix (normally "a"). +libext="a" + +# Shared library suffix (normally ".so"). +shrext_cmds='.so' + +# Executable file suffix (normally ""). +exeext="" + +# Additional compiler flags for building library objects. +pic_flag=" -fPIC" +pic_mode=default + +# What is the maximum length of a command? +max_cmd_len=98304 + +# Does compiler simultaneously support -c and -o options? +compiler_c_o="yes" + +# Must we lock files when doing compilation? +need_locks="no" + +# Do we need the lib prefix for modules? +need_lib_prefix=no + +# Do we need a version for libraries? +need_version=no + +# Whether dlopen is supported. +dlopen_support=unknown + +# Whether dlopen of programs is supported. +dlopen_self=unknown + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=unknown + +# Compiler flag to prevent dynamic linking. +link_static_flag="-static" + +# Compiler flag to turn off builtin functions. +no_builtin_flag="" + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec="\${wl}--export-dynamic" + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive" + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec="" + +# Library versioning type. +version_type=linux + +# Format of library name prefix. +libname_spec="lib\$name" + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}" + +# The coded name of the library, if different from the real name. +soname_spec="\${libname}\${release}\${shared_ext}\$major" + +# Commands used to build and install an old-style archive. +RANLIB="ranlib" +old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib" +old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib" +old_postuninstall_cmds="" + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds="" + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds="" + +# Commands used to build and install a shared archive. +archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib" +archive_expsym_cmds="\$echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~ + cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~ + \$echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~ + \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib" +postinstall_cmds="" +postuninstall_cmds="" + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds="" +module_expsym_cmds="" + +# Commands to strip libraries. +old_striplib="strip --strip-debug" +striplib="strip --strip-unneeded" + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects="" + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects="" + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps="" + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps="" + +# The directories searched by this compiler when creating a shared +# library +compiler_lib_search_dirs="" + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path="" + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method="pass_all" + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd="\$MAGIC_CMD" + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag="" + +# Flag that forces no undefined symbols. +no_undefined_flag="" + +# Commands used to finish a libtool library installation in a directory. +finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir" + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval="" + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'" + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'" + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'" + +# This is the shared library runtime path variable. +runpath_var=LD_RUN_PATH + +# This is the shared library path variable. +shlibpath_var=LD_LIBRARY_PATH + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=no + +# How to hardcode a shared library path into an executable. +hardcode_action=immediate + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=yes + +# Flag to hardcode $libdir into a binary during linking. +# This must work even if $libdir does not exist. +hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir" + +# If ld is used when linking, flag to hardcode $libdir into +# a binary during linking. This must work even if $libdir does +# not exist. +hardcode_libdir_flag_spec_ld="" + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator="" + +# Set to yes if using DIR/libNAME during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=no + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=no + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=unsupported + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=no + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=no + +# Compile-time system search path for libraries +sys_lib_search_path_spec="/n/fs/topics/lib /u/blei/local/lib64 /n/fs/topics/lib/gsl/lib /usr/lib/gcc/x86_64-redhat-linux/4.1.2 /usr/lib64 /lib64" + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/mysql /usr/lib64/mysql /usr/lib/qt-3.3/lib /usr/lib64/qt-3.3/lib /usr/local/lib " + +# Fix the shell variable $srcfile for the compiler. +fix_srcfile_path="" + +# Set to yes if exported symbols are required. +always_export_symbols=no + +# The commands to list exported symbols. +export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds="" + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*" + +# Symbols that must always be exported. +include_expsyms="" + +# ### END LIBTOOL TAG CONFIG: F77 + diff --git a/dtm_release/lib/util/gflags-1.1/ltmain.sh b/dtm_release/lib/util/gflags-1.1/ltmain.sh new file mode 100644 index 0000000000000000000000000000000000000000..8fc56db8fc6e3d4895dc6145236caa94f408a325 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/ltmain.sh @@ -0,0 +1,6871 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun configure. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 +# +# 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 2 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +basename="s,^.*/,,g" + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + +# The name of this program: +progname=`echo "$progpath" | $SED $basename` +modename="$progname" + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION="1.5.22 Debian 1.5.22-2" +TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes. +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$progpath" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<EOF +$* +EOF + exit $EXIT_SUCCESS +fi + +default_mode= +help="Try \`$progname --help' for more information." +magic="%%%MAGIC variable%%%" +mkdir="mkdir" +mv="mv -f" +rm="rm -f" + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed="${SED}"' -e 1s/^X//' +sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + SP2NL='tr \040 \012' + NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + SP2NL='tr \100 \n' + NL2SP='tr \r\n \100\100' + ;; +esac + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +# We save the old values to restore during execute mode. +if test "${LC_ALL+set}" = set; then + save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL +fi +if test "${LANG+set}" = set; then + save_LANG="$LANG"; LANG=C; export LANG +fi + +# Make sure IFS has a sensible default +lt_nl=' +' +IFS=" $lt_nl" + +if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + $echo "$modename: not configured to build any kind of library" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +duplicate_deps=no +preserve_args= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +##################################### +# Shell function definitions: +# This seems to be the best place for them + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $mkdir "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || { + $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 + exit $EXIT_FAILURE + } + fi + + $echo "X$my_tmpdir" | $Xsed +} + + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +func_win32_libid () +{ + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ + $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | \ + $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $echo $win32_libid_type +} + + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case "$@ " in + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit $EXIT_FAILURE +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 + exit $EXIT_FAILURE + fi +} + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + my_status="" + + $show "${rm}r $my_gentop" + $run ${rm}r "$my_gentop" + $show "$mkdir $my_gentop" + $run $mkdir "$my_gentop" + my_status=$? + if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then + exit $my_status + fi + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` + my_xdir="$my_gentop/$my_xlib" + + $show "${rm}r $my_xdir" + $run ${rm}r "$my_xdir" + $show "$mkdir $my_xdir" + $run $mkdir "$my_xdir" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then + exit $exit_status + fi + case $host in + *-darwin*) + $show "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + if test -z "$run"; then + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` + darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` + if test -n "$darwin_arches"; then + darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + $show "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we have a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + lipo -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + ${rm}r unfat-$$ + cd "$darwin_orig_dir" + else + cd "$darwin_orig_dir" + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + fi # $run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + func_extract_archives_result="$my_oldobjs" +} +# End of Shell function definitions +##################################### + +# Darwin sucks +eval std_shrext=\"$shrext_cmds\" + +disable_libs=no + +# Parse our command line options once, thoroughly. +while test "$#" -gt 0 +do + arg="$1" + shift + + case $arg in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + execute_dlfiles) + execute_dlfiles="$execute_dlfiles $arg" + ;; + tag) + tagname="$arg" + preserve_args="${preserve_args}=$arg" + + # Check whether tagname contains only valid characters + case $tagname in + *[!-_A-Za-z0-9,/]*) + $echo "$progname: invalid tag name: $tagname" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $tagname in + CC) + # Don't test for the "default" C tag, as we know, it's there, but + # not specially marked. + ;; + *) + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then + taglist="$taglist $tagname" + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" + else + $echo "$progname: ignoring unknown tag $tagname" 1>&2 + fi + ;; + esac + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case $arg in + --help) + show_help=yes + ;; + + --version) + $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + $echo + $echo "Copyright (C) 2005 Free Software Foundation, Inc." + $echo "This is free software; see the source for copying conditions. There is NO" + $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + exit $? + ;; + + --config) + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath + # Now print the configurations for the tags. + for tagname in $taglist; do + ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" + done + exit $? + ;; + + --debug) + $echo "$progname: enabling shell trace mode" + set -x + preserve_args="$preserve_args $arg" + ;; + + --dry-run | -n) + run=: + ;; + + --features) + $echo "host: $host" + if test "$build_libtool_libs" = yes; then + $echo "enable shared libraries" + else + $echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + $echo "enable static libraries" + else + $echo "disable static libraries" + fi + exit $? + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --preserve-dup-deps) duplicate_deps="yes" ;; + + --quiet | --silent) + show=: + preserve_args="$preserve_args $arg" + ;; + + --tag) + prevopt="--tag" + prev=tag + preserve_args="$preserve_args --tag" + ;; + --tag=*) + set tag "$optarg" ${1+"$@"} + shift + prev=tag + preserve_args="$preserve_args --tag" + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE +fi + +case $disable_libs in +no) + ;; +shared) + build_libtool_libs=no + build_old_libs=yes + ;; +static) + build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` + ;; +esac + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 + $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 + case $nonopt in + *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) + mode=link + for arg + do + case $arg in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case $mode in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + if test -n "$libobj" ; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit $EXIT_FAILURE + fi + arg_mode=target + continue + ;; + + -static | -prefer-pic | -prefer-non-pic) + later="$later $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + base_compile="$base_compile $lastarg" + continue + ;; + + * ) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + case $lastarg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, and some SunOS ksh mistreat backslash-escaping + # in scan sets (worked around with variable expansion), + # and furthermore cannot handle '|' '&' '(' ')' in scan sets + # at all, so we specify them separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + base_compile="$base_compile $lastarg" + done # for arg + + case $arg_mode in + arg) + $echo "$modename: you must specify an argument for -Xcompile" + exit $EXIT_FAILURE + ;; + target) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit $EXIT_FAILURE + ;; + *) + # Get the name of the library object. + [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSifmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.ii) xform=ii ;; + *.class) xform=class ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + *.java) xform=java ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` + case $qlibobj in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qlibobj="\"$qlibobj\"" ;; + esac + test "X$libobj" != "X$qlibobj" \ + && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." + objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir= + else + xdir=$xdir/ + fi + lobj=${xdir}$objdir/$objname + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $run ln "$progpath" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + $echo "$srcfile" > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` + case $qsrcfile in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qsrcfile="\"$qsrcfile\"" ;; + esac + + $run $rm "$libobj" "${libobj}T" + + # Create a libtool object file (analogous to a ".la" file), + # but don't create it if we're doing a dry run. + test -z "$run" && cat > ${libobj}T <<EOF +# $libobj - a libtool object file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +EOF + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + if test ! -d "${xdir}$objdir"; then + $show "$mkdir ${xdir}$objdir" + $run $mkdir ${xdir}$objdir + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then + exit $exit_status + fi + fi + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + command="$command -o $lobj" + fi + + $run $rm "$lobj" "$output_obj" + + $show "$command" + if $run eval "$command"; then : + else + test -n "$output_obj" && $run $rm $removelist + exit $EXIT_FAILURE + fi + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + $show "$mv $output_obj $lobj" + if $run $mv $output_obj $lobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the PIC object to the libtool object file. + test -z "$run" && cat >> ${libobj}T <<EOF +pic_object='$objdir/$objname' + +EOF + + # Allow error messages only from the first compilation. + if test "$suppress_opt" = yes; then + suppress_output=' >/dev/null 2>&1' + fi + else + # No PIC object so indicate it doesn't exist in the libtool + # object file. + test -z "$run" && cat >> ${libobj}T <<EOF +pic_object=none + +EOF + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $qsrcfile" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + $run $rm "$obj" "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + $run $rm $removelist + exit $EXIT_FAILURE + fi + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the non-PIC object the libtool object file. + # Only append if the libtool object file exists. + test -z "$run" && cat >> ${libobj}T <<EOF +# Name of the non-PIC object. +non_pic_object='$objname' + +EOF + else + # Append the name of the non-PIC object the libtool object file. + # Only append if the libtool object file exists. + test -z "$run" && cat >> ${libobj}T <<EOF +# Name of the non-PIC object. +non_pic_object=none + +EOF + fi + + $run $mv "${libobj}T" "${libobj}" + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi + + exit $EXIT_SUCCESS + ;; + + # libtool link mode + link | relink) + modename="$modename: link" + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args="$nonopt" + base_compile="$nonopt $@" + compile_command="$nonopt" + finalize_command="$nonopt" + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + + avoid_version=no + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + non_pic_objects= + notinst_path= # paths that contain not-installed libtool libraries + precious_files_regex= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -all-static | -static) + if test "X$arg" = "X-all-static"; then + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + fi + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test + ;; + *) qarg=$arg ;; + esac + libtool_args="$libtool_args $qarg" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit $EXIT_FAILURE + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat $save_arg` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + done + else + $echo "$modename: link input file \`$save_arg' does not exist" + exit $EXIT_FAILURE + fi + arg=$save_arg + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit $EXIT_FAILURE + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + compile_command="$compile_command $wl$qarg" + finalize_command="$finalize_command $wl$qarg" + continue + ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + darwin_framework|darwin_framework_skip) + test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + prev= + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: more than one -exported-symbols argument is not allowed" + exit $EXIT_FAILURE + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework|-arch|-isysroot) + case " $CC " in + *" ${arg} ${1} "* | *" ${arg} ${1} "*) + prev=darwin_framework_skip ;; + *) compiler_flags="$compiler_flags $arg" + prev=darwin_framework ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + notinst_path="$notinst_path $dir" + fi + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs -framework System" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + -model) + compile_command="$compile_command $arg" + compiler_flags="$compiler_flags $arg" + finalize_command="$finalize_command $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m* pass through architecture-specific compiler args for GCC + # -m*, -t[45]*, -txscale* pass through architecture-specific + # compiler args for GCC + # -pg pass through profiling flag for GCC + # @file GCC response files + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ + -t[45]*|-txscale*|@*) + + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + compiler_flags="$compiler_flags $arg" + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # The PATH hackery in wrapper scripts is required on Windows + # in order for the loader to find any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit $EXIT_FAILURE + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $wl$flag" + linker_flags="$linker_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + + *.$objext) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done # argument parsing loop + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + # Create the object directory. + if test ! -d "$output_objdir"; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then + exit $exit_status + fi + fi + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + case $host in + *cygwin* | *mingw* | *pw32*) + # don't eliminate duplications in $postdeps and $predeps + duplicate_compiler_generated_deps=yes + ;; + *) + duplicate_compiler_generated_deps=$duplicate_deps + ;; + esac + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if test "X$duplicate_deps" = "Xyes" ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit $EXIT_FAILURE + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + for pass in $passes; do + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) + libs="$deplibs %DEPLIBS%" + test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" + ;; + esac + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + compiler_flags="$compiler_flags $deplib" + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if (${SED} -e '2q' $lib | + grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + library_names= + old_library= + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + if eval $echo \"$deplib\" 2>/dev/null \ + | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + $echo + $echo "*** Warning: Trying to link with static lib archive $deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because the file extensions .$libext of this argument makes me believe" + $echo "*** that it is just a static archive that I should not used here." + else + $echo + $echo "*** Warning: Linking the shared library $output against the" + $echo "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test "$found" = yes || test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 + exit $EXIT_FAILURE + fi + + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit $EXIT_FAILURE + fi + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi + fi # $installed = yes + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $absdir" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes ; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + # This is a shared library + + # Warn about portability, can't link against -module's on + # some systems (darwin) + if test "$shouldnotlink" = yes && test "$pass" = link ; then + $echo + if test "$linkmode" = prog; then + $echo "*** Warning: Linking the executable $output against the loadable module" + else + $echo "*** Warning: Linking the shared library $output against the loadable module" + fi + $echo "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw*) + major=`expr $current - $age` + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`$echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + save_ifs="$IFS"; IFS='~' + cmds=$extract_expsyms_cmds + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + save_ifs="$IFS"; IFS='~' + cmds=$old_archive_from_expsyms_cmds + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a module then we can not link against + # it, someone is ignoring the new warnings I added + if /usr/bin/file -L $add 2> /dev/null | + $EGREP ": [^:]* bundle" >/dev/null ; then + $echo "** Warning, lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $echo + $echo "** And there doesn't seem to be a static archive available" + $echo "** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit $EXIT_FAILURE + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + $echo + $echo "*** Warning: This system can not link to static lib archive $lib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + $echo "*** But as you try to build a module library, libtool will still create " + $echo "*** a static module, that should work as long as the dlopening application" + $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="$absdir/$objdir" + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="$absdir" + fi + depdepl= + case $host in + *-*-darwin*) + # we do not want to link against static libs, + # but need to link against shared + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$path/$depdepl" ; then + depdepl="$path/$depdepl" + fi + # do not add paths which are already there + case " $newlib_search_path " in + *" $path "*) ;; + *) newlib_search_path="$newlib_search_path $path";; + esac + fi + path="" + ;; + *) + path="-L$path" + ;; + esac + ;; + -l*) + case $host in + *-*-darwin*) + # Again, we only want to link against shared libraries + eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` + for tmp in $newlib_search_path ; do + if test -f "$tmp/lib$tmp_libs.dylib" ; then + eval depdepl="$tmp/lib$tmp_libs.dylib" + break + fi + done + path="" + ;; + *) continue ;; + esac + ;; + *) continue ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + case " $deplibs " in + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit $EXIT_FAILURE + else + $echo + $echo "*** Warning: Linking the shared library $output against the non-libtool" + $echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + if test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test "$#" -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$2" + number_minor="$3" + number_revision="$4" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + current=`expr $number_major + $number_minor - 1` + age="$number_minor" + revision="$number_minor" + ;; + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE + ;; + esac + ;; + no) + current="$2" + revision="$3" + age="$4" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + if test "$age" -gt "$current"; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + minor_current=`expr $current + 1` + verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + irix | nonstopux) + major=`expr $current - $age + 1` + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=.`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + major=`expr $current - $age` + versuffix="-$major" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + fi + + if test "$mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$echo "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + removelist="$removelist $p" + ;; + *) ;; + esac + done + if test -n "$removelist"; then + $show "${rm}r $removelist" + $run ${rm}r $removelist + fi + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + for path in $notinst_path; do + lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` + deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` + dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` + done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs -framework System" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c <<EOF + int main() { return 0; } +EOF + $rm conftest + $LTCC $LTCFLAGS -o conftest conftest.c $deplibs + if test "$?" -eq 0 ; then + ldd_output=`ldd conftest` + for i in $deplibs; do + name=`expr $i : '-l\(.*\)'` + # If $name is empty we are operating on a -L argument. + if test "$name" != "" && test "$name" -ne "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $i "*) + newdeplibs="$newdeplibs $i" + i="" + ;; + esac + fi + if test -n "$i" ; then + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + $echo + $echo "*** Warning: dynamic linker does not accept needed library $i." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which I believe you do not have" + $echo "*** because a test_compile did reveal that the linker did not use it for" + $echo "*** its dynamic dependency list that programs get resolved with at runtime." + fi + fi + else + newdeplibs="$newdeplibs $i" + fi + done + else + # Error occurred in the first compile. Let's try to salvage + # the situation: Compile a separate program for each library. + for i in $deplibs; do + name=`expr $i : '-l\(.*\)'` + # If $name is empty we are operating on a -L argument. + if test "$name" != "" && test "$name" != "0"; then + $rm conftest + $LTCC $LTCFLAGS -o conftest conftest.c $i + # Did it work? + if test "$?" -eq 0 ; then + ldd_output=`ldd conftest` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $i "*) + newdeplibs="$newdeplibs $i" + i="" + ;; + esac + fi + if test -n "$i" ; then + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + $echo + $echo "*** Warning: dynamic linker does not accept needed library $i." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because a test_compile did reveal that the linker did not use this one" + $echo "*** as a dynamic dependency that programs can get resolved with at runtime." + fi + fi + else + droppeddeps=yes + $echo + $echo "*** Warning! Library $i is needed by this library but I was not able to" + $echo "*** make it link in! You will probably need to install it or some" + $echo "*** library that it depends on before this library will be fully" + $echo "*** functional. Installing it before continuing would be even better." + fi + else + newdeplibs="$newdeplibs $i" + fi + done + fi + ;; + file_magic*) + set dummy $deplibs_check_method + file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name=`expr $a_deplib : '-l\(.*\)'` + # If $name is empty we are operating on a -L argument. + if test "$name" != "" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for file magic test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a file magic. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name=`expr $a_deplib : '-l\(.*\)'` + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval $echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a regex pattern. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` + done + fi + if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ + | grep . >/dev/null; then + $echo + if test "X$deplibs_check_method" = "Xnone"; then + $echo "*** Warning: inter-library dependencies are not supported in this platform." + else + $echo "*** Warning: inter-library dependencies are not known to be supported." + fi + $echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + $echo + $echo "*** Warning: libtool could not satisfy all declared inter-library" + $echo "*** dependencies of module $libname. Therefore, libtool will create" + $echo "*** a static module, that should work as long as the dlopening" + $echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + $echo "*** The inter-library dependencies that have been dropped here will be" + $echo "*** automatically added whenever a program is linked with this library" + $echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + $echo + $echo "*** Since this library must not contain undefined symbols," + $echo "*** because either the platform does not support them or" + $echo "*** it was explicitly requested with -no-undefined," + $echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + deplibs="$new_libs" + + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + linknames="$linknames $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + if len=`expr "X$cmd" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + $show "$cmd" + $run eval "$cmd" || exit $? + skipped_export=false + else + # The command line is too long to execute in one step. + $show "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise. + $echo "creating reloadable object files..." + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + output_la=`$echo "X$output" | $Xsed -e "$basename"` + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + delfiles= + last_robj= + k=1 + output=$output_objdir/$output_la-${k}.$objext + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + eval test_cmds=\"$reload_cmds $objlist $last_robj\" + if test "X$objlist" = X || + { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len"; }; then + objlist="$objlist $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + k=`expr $k + 1` + output=$output_objdir/$output_la-${k}.$objext + objlist=$obj + len=1 + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + + if ${skipped_export-false}; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + libobjs=$output + # Append the command to create the export file. + eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" + fi + + # Set up a command to remove the reloadable object files + # after they are used. + i=0 + while test "$i" -lt "$k" + do + i=`expr $i + 1` + delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" + done + + $echo "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + + # Append the command to remove the reloadable object files + # to the just-reset $cmds. + eval cmds=\"\$cmds~\$rm $delfiles\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case $output in + *.lo) + if test -n "$objs$old_deplibs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit $EXIT_FAILURE + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + cmds=$reload_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $run eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + cmds=$reload_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + esac + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + if test "$tagname" = CXX ; then + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + fi + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case $dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $run $rm $export_symbols + $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + else + $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval '$echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | + if sort -k 3 </dev/null >/dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + $echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +" + + case $host in + *cygwin* | *mingw* ) + $echo >> "$output_objdir/$dlsyms" "\ +/* DATA imports from DLLs on WIN32 can't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs */ +struct { +" + ;; + * ) + $echo >> "$output_objdir/$dlsyms" "\ +const struct { +" + ;; + esac + + + $echo >> "$output_objdir/$dlsyms" "\ + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{\ +" + + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + case $host in + *cygwin* | *mingw* ) + if test -f "$output_objdir/${outputname}.def" ; then + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + else + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + fi + ;; + * ) + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + esac + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + exit_status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $exit_status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + output_name=`basename $output` + output_path=`dirname $output` + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $rm $cwrappersource $cwrapper + trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + cat > $cwrappersource <<EOF + +/* $cwrappersource - temporary wrapper executable for $objdir/$outputname + Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP + + The $output program cannot be directly executed until all the libtool + libraries that it depends on are installed. + + This wrapper executable should never be moved out of the build directory. + If it is, it will not operate correctly. + + Currently, it simply execs the wrapper *script* "/bin/sh $output", + but could eventually absorb all of the scripts functionality and + exec $objdir/$outputname directly. +*/ +EOF + cat >> $cwrappersource<<"EOF" +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <malloc.h> +#include <stdarg.h> +#include <assert.h> +#include <string.h> +#include <ctype.h> +#include <sys/stat.h> + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +/* -DDEBUG is fairly common in CFLAGS. */ +#undef DEBUG +#if defined DEBUGWRAPPER +# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) +#else +# define DEBUG(format, ...) +#endif + +const char *program_name = NULL; + +void * xmalloc (size_t num); +char * xstrdup (const char *string); +const char * base_name (const char *name); +char * find_executable(const char *wrapper); +int check_executable(const char *path); +char * strendzap(char *str, const char *pat); +void lt_fatal (const char *message, ...); + +int +main (int argc, char *argv[]) +{ + char **newargz; + int i; + + program_name = (char *) xstrdup (base_name (argv[0])); + DEBUG("(main) argv[0] : %s\n",argv[0]); + DEBUG("(main) program_name : %s\n",program_name); + newargz = XMALLOC(char *, argc+2); +EOF + + cat >> $cwrappersource <<EOF + newargz[0] = (char *) xstrdup("$SHELL"); +EOF + + cat >> $cwrappersource <<"EOF" + newargz[1] = find_executable(argv[0]); + if (newargz[1] == NULL) + lt_fatal("Couldn't find %s", argv[0]); + DEBUG("(main) found exe at : %s\n",newargz[1]); + /* we know the script has the same name, without the .exe */ + /* so make sure newargz[1] doesn't end in .exe */ + strendzap(newargz[1],".exe"); + for (i = 1; i < argc; i++) + newargz[i+1] = xstrdup(argv[i]); + newargz[argc+1] = NULL; + + for (i=0; i<argc+1; i++) + { + DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); + ; + } + +EOF + + case $host_os in + mingw*) + cat >> $cwrappersource <<EOF + execv("$SHELL",(char const **)newargz); +EOF + ;; + *) + cat >> $cwrappersource <<EOF + execv("$SHELL",newargz); +EOF + ;; + esac + + cat >> $cwrappersource <<"EOF" + return 127; +} + +void * +xmalloc (size_t num) +{ + void * p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL +; +} + +const char * +base_name (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha ((unsigned char)name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return base; +} + +int +check_executable(const char * path) +{ + struct stat st; + + DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); + if ((!path) || (!*path)) + return 0; + + if ((stat (path, &st) >= 0) && + ( + /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ +#if defined (S_IXOTH) + ((st.st_mode & S_IXOTH) == S_IXOTH) || +#endif +#if defined (S_IXGRP) + ((st.st_mode & S_IXGRP) == S_IXGRP) || +#endif + ((st.st_mode & S_IXUSR) == S_IXUSR)) + ) + return 1; + else + return 0; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise */ +char * +find_executable (const char* wrapper) +{ + int has_slash = 0; + const char* p; + const char* p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char* concat_name; + + DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char* path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char* q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR(*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + return NULL; +} + +char * +strendzap(char *str, const char *pat) +{ + size_t len, patlen; + + assert(str != NULL); + assert(pat != NULL); + + len = strlen(str); + patlen = strlen(pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp(str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char * mode, + const char * message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} +EOF + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource + ;; + esac + $rm $output + trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='${SED} -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $echo >> $output "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + $echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $echo \"\$relink_command_output\" >&2 + $rm \"\$progdir/\$file\" + exit $EXIT_FAILURE + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + $echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit $EXIT_FAILURE + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + $echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit $EXIT_FAILURE + fi +fi\ +" + chmod +x $output + fi + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "copying selected object files to avoid basename conflicts..." + + if test -z "$gentop"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$gentop"; then + exit $exit_status + fi + fi + + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + counter=`expr $counter + 1` + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + $run ln "$obj" "$gentop/$newobj" || + $run cp "$obj" "$gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + + eval cmds=\"$old_archive_cmds\" + + if len=`expr "X$cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + $echo "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + for obj in $save_oldobjs + do + oldobjs="$objlist $obj" + objlist="$objlist $obj" + eval test_cmds=\"$old_archive_cmds\" + if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + eval cmd=\"$cmd\" + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdlfiles="$newdlfiles $libdir/$name" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdlprefiles="$newdlprefiles $libdir/$name" + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" + fi + $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $echo >> $output "\ +relink_command=\"$relink_command\"" + fi + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? + ;; + esac + exit $EXIT_SUCCESS + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $echo "X$nonopt" | grep shtool > /dev/null; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + case " $install_prog " in + *[\\\ /]cp\ *) ;; + *) prev=$arg ;; + esac + ;; + -g | -m | -o) prev=$arg ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test "$#" -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + library_names= + old_library= + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + if test "$inst_prefix_dir" = "$destdir"; then + $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 + exit $EXIT_FAILURE + fi + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + exit $EXIT_FAILURE + fi + fi + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run eval "$striplib $destdir/$realname" || exit $? + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" + $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + cmds=$postinstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + file=`$echo $file|${SED} 's,.exe$,,'` + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin*|*mingw*) + wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` + ;; + *) + wrapper=$file + ;; + esac + if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # + # If there is no directory component, then add one. + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; + esac + + # Check the variables that should have been set. + if test -z "$notinst_deplibs"; then + $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 + exit $EXIT_FAILURE + fi + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + relink_command= + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # + # If there is no directory component, then add one. + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; + esac + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir=`func_mktempdir` + file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` + ;; + esac + ;; + esac + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + if test -n "$stripme" && test -n "$old_striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + + # Do each command in the postinstall commands. + cmds=$old_postinstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + cmds=$finish_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit $EXIT_SUCCESS + + $echo "X----------------------------------------------------------------------" | $Xsed + $echo "Libraries have been installed in:" + for libdir in $libdirs; do + $echo " $libdir" + done + $echo + $echo "If you ever happen to want to link against installed libraries" + $echo "in a given directory, LIBDIR, you must either use libtool, and" + $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + $echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + $echo " during execution" + fi + if test -n "$runpath_var"; then + $echo " - add LIBDIR to the \`$runpath_var' environment variable" + $echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + $echo + $echo "See any operating system documentation about shared libraries for" + $echo "more information, such as the ld(1) and ld.so(8) manual pages." + $echo "X----------------------------------------------------------------------" | $Xsed + exit $EXIT_SUCCESS + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit $EXIT_FAILURE + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit $EXIT_FAILURE + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit $EXIT_SUCCESS + fi + ;; + + # libtool clean and uninstall mode + clean | uninstall) + modename="$modename: $mode" + rm="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) rm="$rm $arg"; rmforce=yes ;; + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + rmdirs= + + origobjdir="$objdir" + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$origobjdir" + else + objdir="$dir/$origobjdir" + fi + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + + case "$mode" in + clean) + case " $library_names " in + # " " in the beginning catches empty $dlname + *" $dlname "*) ;; + *) rmfiles="$rmfiles $objdir/$dlname" ;; + esac + test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + cmds=$postuninstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + cmds=$old_postuninstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + + # Read the .lo file + . $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" \ + && test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" \ + && test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + file=`$echo $file|${SED} 's,.exe$,,'` + noexename=`$echo $name|${SED} 's,.exe$,,'` + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$noexename + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + objdir="$origobjdir" + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit $EXIT_FAILURE + fi +fi # test -z "$show_help" + +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit $EXIT_FAILURE +fi + +# We need to display help for each of the modes. +case $mode in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + --version print version information + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE. + +Report bugs to <bug-libtool@gnu.org>." + exit $EXIT_SUCCESS + ;; + +clean) + $echo \ +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; +esac + +$echo +$echo "Try \`$modename --help' for more information about other modes." + +exit $? + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +disable_libs=shared +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +disable_libs=static +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/dtm_release/lib/util/gflags-1.1/m4/ac_have_attribute.m4 b/dtm_release/lib/util/gflags-1.1/m4/ac_have_attribute.m4 new file mode 100644 index 0000000000000000000000000000000000000000..19f4021e9901a13159a8928855da3c0e4fde95f3 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/m4/ac_have_attribute.m4 @@ -0,0 +1,16 @@ +AC_DEFUN([AX_C___ATTRIBUTE__], [ + AC_MSG_CHECKING(for __attribute__) + AC_CACHE_VAL(ac_cv___attribute__, [ + AC_TRY_COMPILE( + [#include <stdlib.h> + static void foo(void) __attribute__ ((unused)); + void foo(void) { exit(1); }], + [], + ac_cv___attribute__=yes, + ac_cv___attribute__=no + )]) + if test "$ac_cv___attribute__" = "yes"; then + AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__]) + fi + AC_MSG_RESULT($ac_cv___attribute__) +]) diff --git a/dtm_release/lib/util/gflags-1.1/m4/acx_pthread.m4 b/dtm_release/lib/util/gflags-1.1/m4/acx_pthread.m4 new file mode 100644 index 0000000000000000000000000000000000000000..2cf20de144a11be2aa603b04ea511244191037b7 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/m4/acx_pthread.m4 @@ -0,0 +1,363 @@ +# This was retrieved from +# http://svn.0pointer.de/viewvc/trunk/common/acx_pthread.m4?revision=1277&root=avahi +# See also (perhaps for new versions?) +# http://svn.0pointer.de/viewvc/trunk/common/acx_pthread.m4?root=avahi +# +# We've rewritten the inconsistency check code (from avahi), to work +# more broadly. In particular, it no longer assumes ld accepts -zdefs. +# This caused a restructing of the code, but the functionality has only +# changed a little. + +dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +dnl +dnl @summary figure out how to build C programs using POSIX threads +dnl +dnl This macro figures out how to build C programs using POSIX threads. +dnl It sets the PTHREAD_LIBS output variable to the threads library and +dnl linker flags, and the PTHREAD_CFLAGS output variable to any special +dnl C compiler flags that are needed. (The user can also force certain +dnl compiler flags/libs to be tested by setting these environment +dnl variables.) +dnl +dnl Also sets PTHREAD_CC to any special C compiler that is needed for +dnl multi-threaded programs (defaults to the value of CC otherwise). +dnl (This is necessary on AIX to use the special cc_r compiler alias.) +dnl +dnl NOTE: You are assumed to not only compile your program with these +dnl flags, but also link it with them as well. e.g. you should link +dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS +dnl $LIBS +dnl +dnl If you are only building threads programs, you may wish to use +dnl these variables in your default LIBS, CFLAGS, and CC: +dnl +dnl LIBS="$PTHREAD_LIBS $LIBS" +dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +dnl CC="$PTHREAD_CC" +dnl +dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute +dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to +dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +dnl +dnl ACTION-IF-FOUND is a list of shell commands to run if a threads +dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to +dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the +dnl default action will define HAVE_PTHREAD. +dnl +dnl Please let the authors know if this macro fails on any platform, or +dnl if you have any other suggestions or comments. This macro was based +dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with +dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros +dnl posted by Alejandro Forero Cuervo to the autoconf macro repository. +dnl We are also grateful for the helpful feedback of numerous users. +dnl +dnl @category InstalledPackages +dnl @author Steven G. Johnson <stevenj@alum.mit.edu> +dnl @version 2006-05-29 +dnl @license GPLWithACException +dnl +dnl Checks for GCC shared/pthread inconsistency based on work by +dnl Marcin Owsiany <marcin@owsiany.pl> + + +AC_DEFUN([ACX_PTHREAD], [ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_LANG_SAVE +AC_LANG_C +acx_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on True64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) + AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) + AC_MSG_RESULT($acx_pthread_ok) + if test x"$acx_pthread_ok" = xno; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. + +acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) +# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) +# -pthreads: Solaris/gcc +# -mthreads: Mingw32/gcc, Lynx/gcc +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads too; +# also defines -D_REENTRANT) +# ... -mt is also the pthreads flag for HP/aCC +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case "${host_cpu}-${host_os}" in + *solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthreads/-mt/ + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + + acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" + ;; +esac + +if test x"$acx_pthread_ok" = xno; then +for flag in $acx_pthread_flags; do + + case $flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $flag]) + PTHREAD_CFLAGS="$flag" + ;; + + pthread-config) + AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no) + if test x"$acx_pthread_config" = xno; then continue; fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$flag]) + PTHREAD_LIBS="-l$flag" + ;; + esac + + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + AC_TRY_LINK([#include <pthread.h>], + [pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], + [acx_pthread_ok=yes]) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + AC_MSG_RESULT($acx_pthread_ok) + if test "x$acx_pthread_ok" = xyes; then + break; + fi + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$acx_pthread_ok" = xyes; then + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + AC_MSG_CHECKING([for joinable pthread attribute]) + attr_name=unknown + for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;], + [attr_name=$attr; break]) + done + AC_MSG_RESULT($attr_name) + if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then + AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, + [Define to necessary symbol if this constant + uses a non-standard name on your system.]) + fi + + AC_MSG_CHECKING([if more special flags are required for pthreads]) + flag=no + case "${host_cpu}-${host_os}" in + *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; + *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; + esac + AC_MSG_RESULT(${flag}) + if test "x$flag" != xno; then + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + fi + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + # More AIX lossage: must compile with xlc_r or cc_r + if test x"$GCC" != xyes; then + AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) + else + PTHREAD_CC=$CC + fi + + # The next part tries to detect GCC inconsistency with -shared on some + # architectures and systems. The problem is that in certain + # configurations, when -shared is specified, GCC "forgets" to + # internally use various flags which are still necessary. + + # + # Prepare the flags + # + save_CFLAGS="$CFLAGS" + save_LIBS="$LIBS" + save_CC="$CC" + + # Try with the flags determined by the earlier checks. + # + # -Wl,-z,defs forces link-time symbol resolution, so that the + # linking checks with -shared actually have any value + # + # FIXME: -fPIC is required for -shared on many architectures, + # so we specify it here, but the right way would probably be to + # properly detect whether it is actually required. + CFLAGS="-shared -fPIC -Wl,-z,defs $CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CC="$PTHREAD_CC" + + # In order not to create several levels of indentation, we test + # the value of "$done" until we find the cure or run out of ideas. + done="no" + + # First, make sure the CFLAGS we added are actually accepted by our + # compiler. If not (and OS X's ld, for instance, does not accept -z), + # then we can't do this test. + if test x"$done" = xno; then + AC_MSG_CHECKING([whether to check for GCC pthread/shared inconsistencies]) + AC_TRY_LINK(,, , [done=yes]) + + if test "x$done" = xyes ; then + AC_MSG_RESULT([no]) + else + AC_MSG_RESULT([yes]) + fi + fi + + if test x"$done" = xno; then + AC_MSG_CHECKING([whether -pthread is sufficient with -shared]) + AC_TRY_LINK([#include <pthread.h>], + [pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], + [done=yes]) + + if test "x$done" = xyes; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi + + # + # Linux gcc on some architectures such as mips/mipsel forgets + # about -lpthread + # + if test x"$done" = xno; then + AC_MSG_CHECKING([whether -lpthread fixes that]) + LIBS="-lpthread $PTHREAD_LIBS $save_LIBS" + AC_TRY_LINK([#include <pthread.h>], + [pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], + [done=yes]) + + if test "x$done" = xyes; then + AC_MSG_RESULT([yes]) + PTHREAD_LIBS="-lpthread $PTHREAD_LIBS" + else + AC_MSG_RESULT([no]) + fi + fi + # + # FreeBSD 4.10 gcc forgets to use -lc_r instead of -lc + # + if test x"$done" = xno; then + AC_MSG_CHECKING([whether -lc_r fixes that]) + LIBS="-lc_r $PTHREAD_LIBS $save_LIBS" + AC_TRY_LINK([#include <pthread.h>], + [pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], + [done=yes]) + + if test "x$done" = xyes; then + AC_MSG_RESULT([yes]) + PTHREAD_LIBS="-lc_r $PTHREAD_LIBS" + else + AC_MSG_RESULT([no]) + fi + fi + if test x"$done" = xno; then + # OK, we have run out of ideas + AC_MSG_WARN([Impossible to determine how to use pthreads with shared libraries]) + + # so it's not safe to assume that we may use pthreads + acx_pthread_ok=no + fi + + CFLAGS="$save_CFLAGS" + LIBS="$save_LIBS" + CC="$save_CC" +else + PTHREAD_CC="$CC" +fi + +AC_SUBST(PTHREAD_LIBS) +AC_SUBST(PTHREAD_CFLAGS) +AC_SUBST(PTHREAD_CC) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$acx_pthread_ok" = xyes; then + ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) + : +else + acx_pthread_ok=no + $2 +fi +AC_LANG_RESTORE +])dnl ACX_PTHREAD diff --git a/dtm_release/lib/util/gflags-1.1/m4/google_namespace.m4 b/dtm_release/lib/util/gflags-1.1/m4/google_namespace.m4 new file mode 100644 index 0000000000000000000000000000000000000000..7f244cc084cc9f34f86a18cc4ea89c53fe1d9930 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/m4/google_namespace.m4 @@ -0,0 +1,42 @@ +# Allow users to override the namespace we define our application's classes in +# Arg $1 is the default namespace to use if --enable-namespace isn't present. + +# In general, $1 should be 'google', so we put all our exported symbols in a +# unique namespace that is not likely to conflict with anyone else. However, +# when it makes sense -- for instance, when publishing stl-like code -- you +# may want to go with a different default, like 'std'. + +# We guarantee the invariant that GOOGLE_NAMESPACE starts with ::, +# unless it's the empty string. Thus, it's always safe to do +# GOOGLE_NAMESPACE::foo and be sure you're getting the foo that's +# actually in the google namespace, and not some other namespace that +# the namespace rules might kick in. + +AC_DEFUN([AC_DEFINE_GOOGLE_NAMESPACE], + [google_namespace_default=[$1] + AC_ARG_ENABLE(namespace, [ --enable-namespace=FOO to define these Google + classes in the FOO namespace. --disable-namespace + to define them in the global namespace. Default + is to define them in namespace $1.], + [case "$enableval" in + yes) google_namespace="$google_namespace_default" ;; + no) google_namespace="" ;; + *) google_namespace="$enableval" ;; + esac], + [google_namespace="$google_namespace_default"]) + if test -n "$google_namespace"; then + ac_google_namespace="::$google_namespace" + ac_google_start_namespace="namespace $google_namespace {" + ac_google_end_namespace="}" + else + ac_google_namespace="" + ac_google_start_namespace="" + ac_google_end_namespace="" + fi + AC_DEFINE_UNQUOTED(GOOGLE_NAMESPACE, $ac_google_namespace, + Namespace for Google classes) + AC_DEFINE_UNQUOTED(_START_GOOGLE_NAMESPACE_, $ac_google_start_namespace, + Puts following code inside the Google namespace) + AC_DEFINE_UNQUOTED(_END_GOOGLE_NAMESPACE_, $ac_google_end_namespace, + Stops putting the code inside the Google namespace) +]) diff --git a/dtm_release/lib/util/gflags-1.1/m4/namespaces.m4 b/dtm_release/lib/util/gflags-1.1/m4/namespaces.m4 new file mode 100644 index 0000000000000000000000000000000000000000..d78dbe4cc2e483809c3e4395a07af4b3afb5cac7 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/m4/namespaces.m4 @@ -0,0 +1,15 @@ +# Checks whether the compiler implements namespaces +AC_DEFUN([AC_CXX_NAMESPACES], + [AC_CACHE_CHECK(whether the compiler implements namespaces, + ac_cv_cxx_namespaces, + [AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([namespace Outer { + namespace Inner { int i = 0; }}], + [using namespace Outer::Inner; return i;], + ac_cv_cxx_namespaces=yes, + ac_cv_cxx_namespaces=no) + AC_LANG_RESTORE]) + if test "$ac_cv_cxx_namespaces" = yes; then + AC_DEFINE(HAVE_NAMESPACES, 1, [define if the compiler implements namespaces]) + fi]) diff --git a/dtm_release/lib/util/gflags-1.1/m4/stl_namespace.m4 b/dtm_release/lib/util/gflags-1.1/m4/stl_namespace.m4 new file mode 100644 index 0000000000000000000000000000000000000000..989ad80696a3139ca1152301bd539ae3d92b3643 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/m4/stl_namespace.m4 @@ -0,0 +1,25 @@ +# We check what namespace stl code like vector expects to be executed in + +AC_DEFUN([AC_CXX_STL_NAMESPACE], + [AC_CACHE_CHECK( + what namespace STL code is in, + ac_cv_cxx_stl_namespace, + [AC_REQUIRE([AC_CXX_NAMESPACES]) + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([#include <vector>], + [vector<int> t; return 0;], + ac_cv_cxx_stl_namespace=none) + AC_TRY_COMPILE([#include <vector>], + [std::vector<int> t; return 0;], + ac_cv_cxx_stl_namespace=std) + AC_LANG_RESTORE]) + if test "$ac_cv_cxx_stl_namespace" = none; then + AC_DEFINE(STL_NAMESPACE,, + [the namespace where STL code like vector<> is defined]) + fi + if test "$ac_cv_cxx_stl_namespace" = std; then + AC_DEFINE(STL_NAMESPACE,std, + [the namespace where STL code like vector<> is defined]) + fi +]) diff --git a/dtm_release/lib/util/gflags-1.1/missing b/dtm_release/lib/util/gflags-1.1/missing new file mode 100755 index 0000000000000000000000000000000000000000..894e786e16c1d0d94dfc08d6b475270fe1418d6a --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/missing @@ -0,0 +1,360 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2005-06-08.21 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. + +# 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 2, 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to <bug-automake@gnu.org>." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case "$1" in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/dtm_release/lib/util/gflags-1.1/mkinstalldirs b/dtm_release/lib/util/gflags-1.1/mkinstalldirs new file mode 100755 index 0000000000000000000000000000000000000000..259dbfcd35789bd0f087803d193cfd924f9a5f34 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/mkinstalldirs @@ -0,0 +1,158 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy + +scriptversion=2005-06-29.22 + +# Original author: Noah Friedman <friedman@prep.ai.mit.edu> +# Created: 1993-05-16 +# Public domain. +# +# This file is maintained in Automake, please report +# bugs to <bug-automake@gnu.org> or send patches to +# <automake-patches@gnu.org>. + +errstatus=0 +dirmode= + +usage="\ +Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... + +Create each directory DIR (with mode MODE, if specified), including all +leading file name components. + +Report bugs to <bug-automake@gnu.org>." + +# process command line arguments +while test $# -gt 0 ; do + case $1 in + -h | --help | --h*) # -h for help + echo "$usage" + exit $? + ;; + -m) # -m PERM arg + shift + test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } + dirmode=$1 + shift + ;; + --version) + echo "$0 $scriptversion" + exit $? + ;; + --) # stop option processing + shift + break + ;; + -*) # unknown option + echo "$usage" 1>&2 + exit 1 + ;; + *) # first non-opt arg + break + ;; + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in + 0) exit 0 ;; +esac + +# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and +# mkdir -p a/c at the same time, both will detect that a is missing, +# one will create a, then the other will try to create a and die with +# a "File exists" error. This is a problem when calling mkinstalldirs +# from a parallel make. We use --version in the probe to restrict +# ourselves to GNU mkdir, which is thread-safe. +case $dirmode in + '') + if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + test -d ./-p && rmdir ./-p + test -d ./--version && rmdir ./--version + fi + ;; + *) + if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && + test ! -d ./--version; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + else + # Clean up after NextStep and OpenStep mkdir. + for d in ./-m ./-p ./--version "./$dirmode"; + do + test -d $d && rmdir $d + done + fi + ;; +esac + +for file +do + case $file in + /*) pathcomp=/ ;; + *) pathcomp= ;; + esac + oIFS=$IFS + IFS=/ + set fnord $file + shift + IFS=$oIFS + + for d + do + test "x$d" = x && continue + + pathcomp=$pathcomp$d + case $pathcomp in + -*) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + lasterr= + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp=$pathcomp/ + done +done + +exit $errstatus + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/dtm_release/lib/util/gflags-1.1/packages/deb.sh b/dtm_release/lib/util/gflags-1.1/packages/deb.sh new file mode 100755 index 0000000000000000000000000000000000000000..31b423c12faac250e8b2440ff5fa237bbed597c1 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/packages/deb.sh @@ -0,0 +1,74 @@ +#!/bin/bash -e + +# This takes one commandline argument, the name of the package. If no +# name is given, then we'll end up just using the name associated with +# an arbitrary .tar.gz file in the rootdir. That's fine: there's probably +# only one. +# +# Run this from the 'packages' directory, just under rootdir + +## Set LIB to lib if exporting a library, empty-string else +LIB= +#LIB=lib + +PACKAGE="$1" +VERSION="$2" + +# We can only build Debian packages, if the Debian build tools are installed +if [ \! -x /usr/bin/debuild ]; then + echo "Cannot find /usr/bin/debuild. Not building Debian packages." 1>&2 + exit 0 +fi + +# Double-check we're in the packages directory, just under rootdir +if [ \! -r ../Makefile -a \! -r ../INSTALL ]; then + echo "Must run $0 in the 'packages' directory, under the root directory." 1>&2 + echo "Also, you must run \"make dist\" before running this script." 1>&2 + exit 0 +fi + +# Find the top directory for this package +topdir="${PWD%/*}" + +# Find the tar archive built by "make dist" +archive="${PACKAGE}-${VERSION}" +archive_with_underscore="${PACKAGE}_${VERSION}" +if [ -z "${archive}" ]; then + echo "Cannot find ../$PACKAGE*.tar.gz. Run \"make dist\" first." 1>&2 + exit 0 +fi + +# Create a pristine directory for building the Debian package files +trap 'rm -rf '`pwd`/tmp'; exit $?' EXIT SIGHUP SIGINT SIGTERM + +rm -rf tmp +mkdir -p tmp +cd tmp + +# Debian has very specific requirements about the naming of build +# directories, and tar archives. It also wants to write all generated +# packages to the parent of the source directory. We accommodate these +# requirements by building directly from the tar file. +ln -s "${topdir}/${archive}.tar.gz" "${LIB}${archive}.orig.tar.gz" +# Some version of debuilder want foo.orig.tar.gz with _ between versions. +ln -s "${topdir}/${archive}.tar.gz" "${LIB}${archive_with_underscore}.orig.tar.gz" +tar zfx "${LIB}${archive}.orig.tar.gz" +[ -n "${LIB}" ] && mv "${archive}" "${LIB}${archive}" +cd "${LIB}${archive}" +# This is one of those 'specific requirements': where the deb control files live +cp -a "packages/deb" "debian" + +# Now, we can call Debian's standard build tool +debuild -uc -us +cd ../.. # get back to the original top-level dir + +# We'll put the result in a subdirectory that's named after the OS version +# we've made this .deb file for. +destdir="debian-$(cat /etc/debian_version 2>/dev/null || echo UNKNOWN)" + +rm -rf "$destdir" +mkdir -p "$destdir" +mv $(find tmp -mindepth 1 -maxdepth 1 -type f) "$destdir" + +echo +echo "The Debian package files are located in $PWD/$destdir" diff --git a/dtm_release/lib/util/gflags-1.1/packages/deb/changelog b/dtm_release/lib/util/gflags-1.1/packages/deb/changelog new file mode 100644 index 0000000000000000000000000000000000000000..70c3526e1867a39ef25fe34b40a193760c510e6f --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/packages/deb/changelog @@ -0,0 +1,87 @@ +gflags (1.1-1) unstable; urgency=low + + * New upstream release. + * Renamed package to gflags, from google-gflags, to match the package + and library names used in the .rpm file, and in the tarball. + + -- Google Inc. <opensource@google.com> Tue, 14 Apr 2009 12:35:25 -0700 + +google-gflags (1.0-1) unstable; urgency=low + + * New upstream release. + + -- Google Inc. <opensource@google.com> Fri, 03 Oct 2008 15:16:46 -0700 + +google-gflags (1.0rc2-1) unstable; urgency=low + + * New upstream release. + + -- Google Inc. <opensource@google.com> Tue, 18 Sep 2008 12:58:05 -0700 + +google-gflags (1.0rc1-1) unstable; urgency=low + + * New upstream release. + + -- Google Inc. <opensource@google.com> Tue, 19 Aug 2008 16:15:48 -0700 + +google-gflags (0.9-1) unstable; urgency=low + + * New upstream release. + + -- Google Inc. <opensource@google.com> Mon, 21 Jul 2008 23:01:38 -0700 + +google-gflags (0.8-1) unstable; urgency=low + + * New upstream release. + + -- Google Inc. <opensource@google.com> Wed, 26 Mar 2008 15:20:18 -0700 + +google-gflags (0.7-1) unstable; urgency=low + + * New upstream release. + + -- Google Inc. <opensource@google.com> Thu, 18 Oct 2007 11:33:20 -0700 + +google-gflags (0.6-2) unstable; urgency=low + + * Somehow 0.6-1 was missing the lib* control files, so the .deb produced + was empty. Fix that to get an actual valid .deb file. + + -- Google Inc. <opensource@google.com> Wed, 15 Aug 2007 12:32:01 -0700 + +google-gflags (0.6-1) unstable; urgency=low + + * New upstream release. + + -- Google Inc. <opensource@google.com> Wed, 15 Aug 2007 07:35:51 -0700 + +google-gflags (0.5-1) unstable; urgency=low + + * New upstream release. + + -- Google Inc. <opensource@google.com> Tue, 12 Jun 2007 15:23:42 -0700 + +google-gflags (0.4-1) unstable; urgency=low + + * New upstream release. + + -- Google Inc. <opensource@google.com> Thu, 19 Apr 2007 15:18:43 -0700 + +google-gflags (0.3-1) unstable; urgency=low + + * New upstream release. + + -- Google Inc. <opensource@google.com> Mon, 22 Jan 2007 15:33:06 -0800 + +google-gflags (0.2-1) unstable; urgency=low + + * New upstream release. + + -- Google Inc. <opensource@google.com> Wed, 28 Mar 2007 12:15:56 -0700 + +google-gflags (0.1-1) unstable; urgency=low + + * Initial release. + + -- Google Inc. <opensource@google.com> Wed, 13 Dec 2006 11:33:30 -0800 + diff --git a/dtm_release/lib/util/gflags-1.1/packages/deb/compat b/dtm_release/lib/util/gflags-1.1/packages/deb/compat new file mode 100644 index 0000000000000000000000000000000000000000..b8626c4cff2849624fb67f87cd0ad72b163671ad --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/packages/deb/compat @@ -0,0 +1 @@ +4 diff --git a/dtm_release/lib/util/gflags-1.1/packages/deb/control b/dtm_release/lib/util/gflags-1.1/packages/deb/control new file mode 100644 index 0000000000000000000000000000000000000000..dcfdd161c785e88f74d27ffbfec1596b6268c28e --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/packages/deb/control @@ -0,0 +1,25 @@ +Source: gflags +Priority: optional +Maintainer: Google Inc. <opensource@google.com> +Build-Depends: debhelper (>= 4.0.0), binutils +Standards-Version: 3.6.1 + +Package: libgflags-dev +Section: libdevel +Architecture: any +Depends: libgflags0 (= ${Source-Version}) +Description: a library that implements commandline flags + processing. As such it's a replacement for getopt(). It has increased + flexibility, including built-in support for C++ types like string, and + the ability to define flags in the source file in which they're used. + The devel package contains static and debug libraries and header files + for developing applications that use the gflags package. + +Package: libgflags0 +Section: libs +Architecture: any +Depends: ${shlibs:Depends} +Description: a library that implements commandline flags + processing. As such it's a replacement for getopt(). It has increased + flexibility, including built-in support for C++ types like string, and + the ability to define flags in the source file in which they're used. diff --git a/dtm_release/lib/util/gflags-1.1/packages/deb/copyright b/dtm_release/lib/util/gflags-1.1/packages/deb/copyright new file mode 100644 index 0000000000000000000000000000000000000000..24b489ad011478c893bd1be8137cc20daf074826 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/packages/deb/copyright @@ -0,0 +1,35 @@ +This package was debianized by Google Inc. <opensource@google.com> on +13 December 2006. + +It was downloaded from http://code.google.com/ + +Upstream Author: opensource@google.com + +Copyright (c) 2006, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/dtm_release/lib/util/gflags-1.1/packages/deb/docs b/dtm_release/lib/util/gflags-1.1/packages/deb/docs new file mode 100644 index 0000000000000000000000000000000000000000..6405ee88c1debb138fa8bb2e3aecd68300fe344e --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/packages/deb/docs @@ -0,0 +1,8 @@ +AUTHORS +COPYING +ChangeLog +INSTALL +NEWS +README +doc/designstyle.css +doc/gflags.html diff --git a/dtm_release/lib/util/gflags-1.1/packages/deb/libgflags-dev.dirs b/dtm_release/lib/util/gflags-1.1/packages/deb/libgflags-dev.dirs new file mode 100644 index 0000000000000000000000000000000000000000..99c10c5a345b67b25004ad9d47e22432b27b9817 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/packages/deb/libgflags-dev.dirs @@ -0,0 +1,4 @@ +usr/lib +usr/include +usr/include/google +usr/include/gflags diff --git a/dtm_release/lib/util/gflags-1.1/packages/deb/libgflags-dev.install b/dtm_release/lib/util/gflags-1.1/packages/deb/libgflags-dev.install new file mode 100644 index 0000000000000000000000000000000000000000..28c47a7ba0b9dc4e6de9f1954a3c8924c07cbeaf --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/packages/deb/libgflags-dev.install @@ -0,0 +1,10 @@ +usr/include/google/* +usr/include/gflags/* +usr/lib/lib*.so +usr/lib/lib*.a +usr/lib/*.la +debian/tmp/usr/include/google/* +debian/tmp/usr/include/gflags/* +debian/tmp/usr/lib/lib*.so +debian/tmp/usr/lib/lib*.a +debian/tmp/usr/lib/*.la diff --git a/dtm_release/lib/util/gflags-1.1/packages/deb/libgflags0.dirs b/dtm_release/lib/util/gflags-1.1/packages/deb/libgflags0.dirs new file mode 100644 index 0000000000000000000000000000000000000000..14f5b95d7f480e37c9af9aebb8b7f3c5167e58e8 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/packages/deb/libgflags0.dirs @@ -0,0 +1,2 @@ +usr/lib +usr/bin diff --git a/dtm_release/lib/util/gflags-1.1/packages/deb/libgflags0.install b/dtm_release/lib/util/gflags-1.1/packages/deb/libgflags0.install new file mode 100644 index 0000000000000000000000000000000000000000..434db3224033ddcebadf856e6c2f98cae3b93450 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/packages/deb/libgflags0.install @@ -0,0 +1,4 @@ +usr/lib/lib*.so.* +debian/tmp/usr/lib/lib*.so.* +usr/bin/* +debian/tmp/usr/bin/* diff --git a/dtm_release/lib/util/gflags-1.1/packages/deb/rules b/dtm_release/lib/util/gflags-1.1/packages/deb/rules new file mode 100755 index 0000000000000000000000000000000000000000..f520befd259d3a1361c9c8f730e72415cf1f2aac --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/packages/deb/rules @@ -0,0 +1,117 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + + +CFLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +# shared library versions, option 1 +#version=2.0.5 +#major=2 +# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so +version=`ls src/.libs/lib*.so.* | \ + awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'` +major=`ls src/.libs/lib*.so.* | \ + awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'` + +config.status: configure + dh_testdir + # Add here commands to configure the package. + CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info + + +build: build-stamp +build-stamp: config.status + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + + # Add here commands to clean up after the build process. + -$(MAKE) distclean +ifneq "$(wildcard /usr/share/misc/config.sub)" "" + cp -f /usr/share/misc/config.sub config.sub +endif +ifneq "$(wildcard /usr/share/misc/config.guess)" "" + cp -f /usr/share/misc/config.guess config.guess +endif + + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/tmp + $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs ChangeLog + dh_installdocs + dh_installexamples + dh_install --sourcedir=debian/tmp +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_python + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install diff --git a/dtm_release/lib/util/gflags-1.1/packages/rpm.sh b/dtm_release/lib/util/gflags-1.1/packages/rpm.sh new file mode 100755 index 0000000000000000000000000000000000000000..5395dc02b82a32b423750f881e969a09962253a8 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/packages/rpm.sh @@ -0,0 +1,75 @@ +#!/bin/sh -e + +# Run this from the 'packages' directory, just under rootdir + +# We can only build rpm packages, if the rpm build tools are installed +if [ \! -x /usr/bin/rpmbuild ] +then + echo "Cannot find /usr/bin/rpmbuild. Not building an rpm." 1>&2 + exit 0 +fi + +# Check the commandline flags +PACKAGE="$1" +VERSION="$2" +fullname="${PACKAGE}-${VERSION}" +archive=../$fullname.tar.gz + +if [ -z "$1" -o -z "$2" ] +then + echo "Usage: $0 <package name> <package version>" 1>&2 + exit 0 +fi + +# Double-check we're in the packages directory, just under rootdir +if [ \! -r ../Makefile -a \! -r ../INSTALL ] +then + echo "Must run $0 in the 'packages' directory, under the root directory." 1>&2 + echo "Also, you must run \"make dist\" before running this script." 1>&2 + exit 0 +fi + +if [ \! -r "$archive" ] +then + echo "Cannot find $archive. Run \"make dist\" first." 1>&2 + exit 0 +fi + +# Create the directory where the input lives, and where the output should live +RPM_SOURCE_DIR="/tmp/rpmsource-$fullname" +RPM_BUILD_DIR="/tmp/rpmbuild-$fullname" + +trap 'rm -rf $RPM_SOURCE_DIR $RPM_BUILD_DIR; exit $?' EXIT SIGHUP SIGINT SIGTERM + +rm -rf "$RPM_SOURCE_DIR" "$RPM_BUILD_DIR" +mkdir "$RPM_SOURCE_DIR" +mkdir "$RPM_BUILD_DIR" + +cp "$archive" "$RPM_SOURCE_DIR" + +rpmbuild -bb rpm/rpm.spec \ + --define "NAME $PACKAGE" \ + --define "VERSION $VERSION" \ + --define "_sourcedir $RPM_SOURCE_DIR" \ + --define "_builddir $RPM_BUILD_DIR" \ + --define "_rpmdir $RPM_SOURCE_DIR" + +# We put the output in a directory based on what system we've built for +destdir=rpm-unknown +if [ -r /etc/issue ] +then + grep "Red Hat.*release 7" /etc/issue >/dev/null 2>&1 && destdir=rh7 + grep "Red Hat.*release 8" /etc/issue >/dev/null 2>&1 && destdir=rh8 + grep "Red Hat.*release 9" /etc/issue >/dev/null 2>&1 && destdir=rh9 + if grep Fedora /etc/issue >/dev/null; then + destdir=fc`grep Fedora /etc/issue | cut -d' ' -f 4`; + fi +fi + +rm -rf "$destdir" +mkdir -p "$destdir" +# We want to get not only the main package but devel etc, hence the middle * +mv "$RPM_SOURCE_DIR"/*/"${PACKAGE}"-*"${VERSION}"*.rpm "$destdir" + +echo +echo "The rpm package file(s) are located in $PWD/$destdir" diff --git a/dtm_release/lib/util/gflags-1.1/packages/rpm/rpm.spec b/dtm_release/lib/util/gflags-1.1/packages/rpm/rpm.spec new file mode 100644 index 0000000000000000000000000000000000000000..ba3b509f75a9ac7045e8bc1402014208c7eb0863 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/packages/rpm/rpm.spec @@ -0,0 +1,79 @@ +%define RELEASE 1 +%define rel %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE} +%define prefix /usr + +Name: %NAME +Summary: A commandline flags library that allows for distributed flags +Version: %VERSION +Release: %rel +Group: Development/Libraries +URL: http://code.google.com/p/google-gflags +License: BSD +Vendor: Google +Packager: Google Inc. <opensource@google.com> +Source: http://%{NAME}.googlecode.com/files/%{NAME}-%{VERSION}.tar.gz +Distribution: Redhat 7 and above. +Buildroot: %{_tmppath}/%{name}-root +Prefix: %prefix + +%description +The %name package contains a library that implements commandline flags +processing. As such it's a replacement for getopt(). It has increased +flexibility, including built-in support for C++ types like string, and +the ability to define flags in the source file in which they're used. + +%package devel +Summary: A commandline flags library that allows for distributed flags +Group: Development/Libraries +Requires: %{NAME} = %{VERSION} + +%description devel +The %name-devel package contains static and debug libraries and header +files for developing applications that use the %name package. + +%changelog + * Tue Dec 13 2006 <opensource@google.com> + - First draft + +%prep +%setup + +%build +./configure +make prefix=%prefix + +%install +rm -rf $RPM_BUILD_ROOT +make prefix=$RPM_BUILD_ROOT%{prefix} install + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root) + +## Mark all installed files within /usr/share/doc/{package name} as +## documentation. This depends on the following two lines appearing in +## Makefile.am: +## docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION) +## dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README +%docdir %{prefix}/share/doc/%{NAME}-%{VERSION} +%{prefix}/share/doc/%{NAME}-%{VERSION}/* + +%{prefix}/lib/libgflags.so.0 +%{prefix}/lib/libgflags.so.0.0.0 +%{prefix}/lib/libgflags_nothreads.so.0 +%{prefix}/lib/libgflags_nothreads.so.0.0.0 +%{prefix}/bin/gflags_completions.sh + +%files devel +%defattr(-,root,root) + +%{prefix}/include/google +%{prefix}/include/gflags +%{prefix}/lib/libgflags.a +%{prefix}/lib/libgflags.la +%{prefix}/lib/libgflags.so +%{prefix}/lib/libgflags_nothreads.a +%{prefix}/lib/libgflags_nothreads.la +%{prefix}/lib/libgflags_nothreads.so diff --git a/dtm_release/lib/util/gflags-1.1/python/gflags.py b/dtm_release/lib/util/gflags-1.1/python/gflags.py new file mode 100644 index 0000000000000000000000000000000000000000..03301cd7915cd45a0b853a92a79412f3b0a7b7fd --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/python/gflags.py @@ -0,0 +1,2090 @@ +#!/usr/bin/env python + +# Copyright (c) 2007, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# --- +# Author: Chad Lester +# Design and style contributions by: +# Amit Patel, Bogdan Cocosel, Daniel Dulitz, Eric Tiedemann, +# Eric Veach, Laurence Gonsalves, Matthew Springer +# Code reorganized a bit by Craig Silverstein + +""" +This module is used to define and parse command line flags. + +This module defines a *distributed* flag-definition policy: rather +than an application having to define all flags in or near main(), each +python module defines flags that are useful to it. When one python +module imports another, it gains access to the other's flags. (This +is implemented by having all modules share a common, global registry +object containing all the flag information.) + +Flags are defined through the use of one of the DEFINE_xxx functions. +The specific function used determines how the flag is parsed, checked, +and optionally type-converted, when it's seen on the command line. + + +IMPLEMENTATION: DEFINE_* creates a 'Flag' object and registers it with +a 'FlagValues' object (typically the global FlagValues FLAGS, defined +here). The 'FlagValues' object can scan the command line arguments +and pass flag arguments to the corresponding 'Flag' objects for +value-checking and type conversion. The converted flag values are +available as members of the 'FlagValues' object. + +Code can access the flag through a FlagValues object, for instancee +gflags.FLAGS.myflag. Typically, the __main__ module passes the +command line arguments to gflags.FLAGS for parsing. + +At bottom, this module calls getopt(), so getopt functionality is +supported, including short- and long-style flags, and the use of -- to +terminate flags. + +Methods defined by the flag module will throw 'FlagsError' exceptions. +The exception argument will be a human-readable string. + + +FLAG TYPES: This is a list of the DEFINE_*'s that you can do. All +flags take a name, default value, help-string, and optional 'short' +name (one-letter name). Some flags have other arguments, which are +described with the flag. + +DEFINE_string: takes any input, and interprets it as a string. + +DEFINE_bool or +DEFINE_boolean: typically does not take an argument: say --myflag to + set FLAGS.myflag to true, or --nomyflag to set + FLAGS.myflag to false. Alternately, you can say + --myflag=true or --myflag=t or --myflag=1 or + --myflag=false or --myflag=f or --myflag=0 + +DEFINE_float: takes an input and interprets it as a floating point + number. Takes optional args lower_bound and + upper_bound; if the number specified on the command line + is out of range, it will raise a FlagError. + +DEFINE_integer: takes an input and interprets it as an integer. Takes + optional args lower_bound and upper_bound as for floats. + +DEFINE_enum: takes a list of strings which represents legal values. If + the command-line value is not in this list, raise a flag + error. Otherwise, assign to FLAGS.flag as a string. + +DEFINE_list: Takes a comma-separated list of strings on the commandline. + Stores them in a python list object. + +DEFINE_spaceseplist: Takes a space-separated list of strings on the + commandline. Stores them in a python list object. + +DEFINE_multistring: The same as DEFINE_string, except the flag can be + specified more than once on the commandline. The + result is a python list object (list of strings), + even if the flag is only on the command line once. + +DEFINE_multi_int: The same as DEFINE_integer, except the flag can be + specified more than once on the commandline. The + result is a python list object (list of ints), + even if the flag is only on the command line once. + + +SPECIAL FLAGS: There are a few flags that have special meaning: + --help (or -?) prints a list of all the flags in a human-readable fashion + --helpshort prints a list of all the flags in the 'main' .py file only + --flagfile=foo read flags from foo. + --undefok=f1,f2 ignore unrecognized option errors for f1,f2. + For boolean flags, you should use --undefok=boolflag, and + --boolflag and --noboolflag will be accepted. Do not use + --undefok=noboolflag. + -- as in getopt(), terminates flag-processing + + +NOTE ON --flagfile: + +Flags may be loaded from text files in addition to being specified on +the commandline. + +Any flags you don't feel like typing, throw them in a file, one flag +per line, for instance: + --myflag=myvalue + --nomyboolean_flag +You then specify your file with the special flag +'--flagfile=somefile'. You CAN recursively nest flagfile= tokens OR +use multiple files on the command line. Lines beginning with a single +hash '#' or a double slash '//' are comments in your flagfile. + +Any flagfile=<file> will be interpreted as having a relative path from +the current working directory rather than from the place the file was +included from: + myPythonScript.py --flagfile=config/somefile.cfg + +If somefile.cfg includes further --flagfile= directives, these will be +referenced relative to the original CWD, not from the directory the +including flagfile was found in! + +The caveat applies to people who are including a series of nested +files in a different dir than they are executing out of. Relative +path names are always from CWD, not from the directory of the parent +include flagfile. We do now support '~' expanded directory names. + +Absolute path names ALWAYS work! + + +EXAMPLE USAGE: + + import gflags + FLAGS = gflags.FLAGS + + # Flag names are globally defined! So in general, we need to be + # careful to pick names that are unlikely to be used by other libraries. + # If there is a conflict, we'll get an error at import time. + gflags.DEFINE_string('name', 'Mr. President', 'your name') + gflags.DEFINE_integer('age', None, 'your age in years', lower_bound=0) + gflags.DEFINE_boolean('debug', 0, 'produces debugging output') + gflags.DEFINE_enum('gender', 'male', ['male', 'female'], 'your gender') + + def main(argv): + try: + argv = FLAGS(argv) # parse flags + except gflags.FlagsError, e: + print '%s\\nUsage: %s ARGS\\n%s' % (e, sys.argv[0], FLAGS) + sys.exit(1) + if FLAGS.debug: print 'non-flag arguments:', argv + print 'Happy Birthday', FLAGS.name + if FLAGS.age is not None: + print 'You are a %s, who is %d years old' % (FLAGS.gender, FLAGS.age) + + if __name__ == '__main__': + main(sys.argv) + + +KEY FLAGS: + +As we already explained, each module gains access to all flags defined +by all the other modules it transitively imports. In the case of +non-trivial scripts, this means a lot of flags ... For documentation +purposes, it is good to identify the flags that are key (i.e., really +important) to a module. Clearly, the concept of "key flag" is a +subjective one. When trying to determine whether a flag is key to a +module or not, assume that you are trying to explain your module to a +potential user: which flags would you really like to mention first? + +We'll describe shortly how to declare which flags are key to a module. +For the moment, assume we know the set of key flags for each module. +Assume we are using the special flags --help and --helpshort to get +information on the available flags: + + --help prints the help for all flags (those declared in the main + module and those declared in the transitively imported modules). + Hence, --help generates complete but usually overly-verbose flag + information. + + --helpshort prints only the help for the flags that are key to the + main module. + +The set of key flags for a module M is composed of: + +1. Flags defined by module M by calling a DEFINE_* function. + +2. Flags that module M explictly declares as key by using the function + + DECLARE_key_flag(<flag_name>) + +3. Key flags of other modules that M specifies by using the function + + ADOPT_module_key_flags(<other_module>) + + This is a "bulk" declaration of key flags: each flag that is key + for <other_module> becomes key for the current module too. + +Notice that if you do not use the functions described at points 2 and +3 above, then --helpshort prints information only about the flags +defined by the main module of our script. In many cases, this +behavior is good enough. But if you move part of the main module code +(together with the related flags) into a different module, then it is +nice to use DECLARE_key_flag / ADOPT_module_key_flags and make sure +--helpshort lists all relevant flags (otherwise, your code refactoring +may confuse your users). + +Note: each of DECLARE_key_flag / ADOPT_module_key_flags has its own +pluses and minuses: DECLARE_key_flag is more targeted and may lead a +more focused --helpshort documentation. ADOPT_module_key_flags is +good for cases when an entire module is considered key to the current +script. Also, it does not require updates to client scripts when a +new flag is added to the module. + + +EXAMPLE USAGE 2 (WITH KEY FLAGS): + +Consider an application that contains the following three files (two +auxiliary modules and a main module): + +File libfoo.py: + + import gflags + + gflags.DEFINE_integer('num_replicas', 3, 'Number of replicas to start') + gflags.DEFINE_boolean('rpc2', True, 'Turn on the usage of RPC2.') + + ... some code ... + +File libbar.py: + + import gflags + + gflags.DEFINE_string('bar_gfs_path', '/gfs/path', + 'Path to the GFS files for libbar.') + gflags.DEFINE_string('email_for_bar_errors', 'bar-team@google.com', + 'Email address for bug reports about module libbar.') + gflags.DEFINE_boolean('bar_risky_hack', False, + 'Turn on an experimental and buggy optimization.') + + ... some code ... + +File myscript.py: + + import gflags + import libfoo + import libbar + + gflags.DEFINE_integer('num_iterations', 0, 'Number of iterations.') + + # Declare that all flags that are key for libfoo are + # key for this module too. + gflags.ADOPT_module_key_flags(libfoo) + + # Declare that the flag --bar_gfs_path (defined in libbar) is key + # for this module. + gflags.DECLARE_key_flag('bar_gfs_path') + + ... some code ... + + +When myscript is invoked with the flag --helpshort, the resulted help +message lists information about all the key flags for myscript: +--num_iterations, --num_replicas, --rpc2, and --bar_gfs_path (in +addition to the special flags --help and --helpshort). + +Of course, myscript uses all the flags declared by it (in this case, +just --num_replicas) or by any of the modules it transitively imports +(e.g., the modules libfoo, libbar). E.g., it can access the value of +FLAGS.bar_risky_hack, even if --bar_risky_hack is not declared as a +key flag for myscript. +""" + +import getopt +import os +import re +import sys + +# Are we running at least python 2.2? +try: + if tuple(sys.version_info[:3]) < (2,2,0): + raise NotImplementedError("requires python 2.2.0 or later") +except AttributeError: # a very old python, that lacks sys.version_info + raise NotImplementedError("requires python 2.2.0 or later") + +# If we're not running at least python 2.2.1, define True, False, and bool. +# Thanks, Guido, for the code. +try: + True, False, bool +except NameError: + False = 0 + True = 1 + def bool(x): + if x: + return True + else: + return False + +# Are we running under pychecker? +_RUNNING_PYCHECKER = 'pychecker.python' in sys.modules + + +def _GetCallingModule(): + """ + Get the name of the module that's calling into this module; e.g., + the module calling a DEFINE_foo... function. + """ + # Walk down the stack to find the first globals dict that's not ours. + for depth in range(1, sys.getrecursionlimit()): + if not sys._getframe(depth).f_globals is globals(): + module_name = __GetModuleName(sys._getframe(depth).f_globals) + if module_name is not None: + return module_name + raise AssertionError, "No module was found" + + +# module exceptions: +class FlagsError(Exception): + """The base class for all flags errors""" + +class DuplicateFlag(FlagsError): + """Raised if there is a flag naming conflict""" + +# A DuplicateFlagError conveys more information than +# a DuplicateFlag. Since there are external modules +# that create DuplicateFlags, the interface to +# DuplicateFlag shouldn't change. +class DuplicateFlagError(DuplicateFlag): + def __init__(self, flagname, flag_values): + self.flagname = flagname + message = "The flag '%s' is defined twice." % self.flagname + flags_by_module = flag_values.FlagsByModuleDict() + for module in flags_by_module: + for flag in flags_by_module[module]: + if flag.name == flagname: + message = message + " First from " + module + "," + break + message = message + " Second from " + _GetCallingModule() + Exception.__init__(self, message) + +class IllegalFlagValue(FlagsError): "The flag command line argument is illegal" + +class UnrecognizedFlag(FlagsError): + """Raised if a flag is unrecognized""" + +# An UnrecognizedFlagError conveys more information than +# an UnrecognizedFlag. Since there are external modules +# that create DuplicateFlags, the interface to +# DuplicateFlag shouldn't change. +class UnrecognizedFlagError(UnrecognizedFlag): + def __init__(self, flagname): + self.flagname = flagname + Exception.__init__(self, "Unknown command line flag '%s'" % flagname) + +# Global variable used by expvar +_exported_flags = {} +_help_width = 80 # width of help output + + +def GetHelpWidth(): + """ + Length of help to be used in TextWrap + """ + global _help_width + return _help_width + + +def CutCommonSpacePrefix(text): + """ + Cut out a common space prefix. If the first line does not start with a space + it is left as is and only in the remaining lines a common space prefix is + being searched for. That means the first line will stay untouched. This is + especially useful to turn doc strings into help texts. This is because some + people prefer to have the doc comment start already after the apostrophy and + then align the following lines while others have the apostrophies on a + seperately line. The function also drops trailing empty lines and ignores + empty lines following the initial content line while calculating the initial + common whitespace. + + Args: + text: text to work on + + Returns: + the resulting text + """ + text_lines = text.splitlines() + # Drop trailing empty lines + while text_lines and not text_lines[-1]: + text_lines = text_lines[:-1] + if text_lines: + # We got some content, is the first line starting with a space? + if text_lines[0] and text_lines[0][0].isspace(): + text_first_line = [] + else: + text_first_line = [text_lines.pop(0)] + # Calculate length of common leading whitesppace (only over content lines) + common_prefix = os.path.commonprefix([line for line in text_lines if line]) + space_prefix_len = len(common_prefix) - len(common_prefix.lstrip()) + # If we have a common space prefix, drop it from all lines + if space_prefix_len: + for index in xrange(len(text_lines)): + if text_lines[index]: + text_lines[index] = text_lines[index][space_prefix_len:] + return '\n'.join(text_first_line + text_lines) + return '' + + +def TextWrap(text, length=None, indent='', firstline_indent=None, tabs=' '): + """ + Wrap a given text to a maximum line length and return it. + We turn lines that only contain whitespace into empty lines. + We keep new lines. + We also keep tabs (e.g. we do not treat tabs as spaces). + + Args: + text: text to wrap + length: maximum length of a line, includes indentation + if this is None then use GetHelpWidth() + indent: indent for all but first line + firstline_indent: indent for first line, if None then fall back to indent + tabs: replacement for tabs + + Returns: + wrapped text + + Raises: + FlagsError: if indent not shorter than length + FlagsError: if firstline_indent not shorter than length + """ + # Get defaults where callee used None + if length is None: + length = GetHelpWidth() + if indent is None: + indent = '' + if len(indent) >= length: + raise FlagsError('Indent must be shorter than length') + # In line we will be holding the current line which is to be started with + # indent (or firstline_indent if available) and then appended with words. + if firstline_indent is None: + firstline_indent = '' + line = indent + else: + line = firstline_indent + if len(firstline_indent) >= length: + raise FlagsError('First iline indent must be shorter than length') + + # If the callee does not care about tabs we simply convert them to spaces + # If callee wanted tabs to be single space then we do that already here. + if not tabs or tabs == ' ': + text = text.replace('\t', ' ') + else: + tabs_are_whitespace = not tabs.strip() + + line_regex = re.compile('([ ]*)(\t*)([^ \t]+)', re.MULTILINE) + + # Split the text into lines and the lines with the regex above. The resulting + # lines are collected in result[]. For each split we get the spaces, the tabs + # and the next non white space (e.g. next word). + result = [] + for text_line in text.splitlines(): + # Store result length so we can find out whether processing the next line + # gave any new content + old_result_len = len(result) + # Process next line with line_regex. For optimization we do an rstrip(). + # - process tabs (changes either line or word, see below) + # - process word (first try to squeeze on line, then wrap or force wrap) + # Spaces found on the line are ignored, they get added while wrapping as + # needed. + for spaces, current_tabs, word in line_regex.findall(text_line.rstrip()): + # If tabs weren't converted to spaces, handle them now + if current_tabs: + # If the last thing we added was a space anyway then drop it. But + # let's not get rid of the indentation. + if (((result and line != indent) or + (not result and line != firstline_indent)) and line[-1] == ' '): + line = line[:-1] + # Add the tabs, if that means adding whitespace, just add it at the + # line, the rstrip() code while shorten the line down if necessary + if tabs_are_whitespace: + line += tabs * len(current_tabs) + else: + # if not all tab replacement is whitespace we prepend it to the word + word = tabs * len(current_tabs) + word + # Handle the case where word cannot be squeezed onto current last line + if len(line) + len(word) > length and len(indent) + len(word) <= length: + result.append(line.rstrip()) + line = indent + word + word = '' + # No space left on line or can we append a space? + if len(line) + 1 >= length: + result.append(line.rstrip()) + line = indent + else: + line += ' ' + # Add word and shorten it up to allowed line length. Restart next line + # with indent and repeat, or add a space if we're done (word finished) + # This deals with words that caanot fit on one line (e.g. indent + word + # longer than allowed line length). + while len(line) + len(word) >= length: + line += word + result.append(line[:length]) + word = line[length:] + line = indent + # Default case, simply append the word and a space + if word: + line += word + ' ' + # End of input line. If we have content we finish the line. If the + # current line is just the indent but we had content in during this + # original line then we need to add an emoty line. + if (result and line != indent) or (not result and line != firstline_indent): + result.append(line.rstrip()) + elif len(result) == old_result_len: + result.append('') + line = indent + + return '\n'.join(result) + + +def DocToHelp(doc): + """ + Takes a __doc__ string and reformats it as help. + """ + # Get rid of starting and ending white space. Using lstrip() or even strip() + # could drop more than maximum of first line and right space of last line. + doc = doc.strip() + + # Get rid of all empty lines + whitespace_only_line = re.compile('^[ \t]+$', re.M) + doc = whitespace_only_line.sub('', doc) + + # Cut out common space at line beginnings + doc = CutCommonSpacePrefix(doc) + + # Just like this module's comment, comments tend to be aligned somehow. + # In other words they all start with the same amount of white space + # 1) keep double new lines + # 2) keep ws after new lines if not empty line + # 3) all other new lines shall be changed to a space + # Solution: Match new lines between non white space and replace with space. + doc = re.sub('(?<=\S)\n(?=\S)', ' ', doc, re.M) + + return doc + + +def __GetModuleName(globals_dict): + """Given a globals dict, returns the name of the module that defines it. + + Args: + globals_dict: A dictionary that should correspond to an + environment providing the values of the globals. + + Returns: + A string (the name of the module) or None (if the module could not + be identified. + """ + for name, module in sys.modules.iteritems(): + if getattr(module, '__dict__', None) is globals_dict: + if name == '__main__': + return sys.argv[0] + return name + return None + + +def _GetMainModule(): + """Get the module name from which execution started.""" + for depth in range(1, sys.getrecursionlimit()): + try: + globals_of_main = sys._getframe(depth).f_globals + except ValueError: + return __GetModuleName(globals_of_main) + raise AssertionError, "No module was found" + + +class FlagValues: + """ + Used as a registry for 'Flag' objects. + + A 'FlagValues' can then scan command line arguments, passing flag + arguments through to the 'Flag' objects that it owns. It also + provides easy access to the flag values. Typically only one + 'FlagValues' object is needed by an application: gflags.FLAGS + + This class is heavily overloaded: + + 'Flag' objects are registered via __setitem__: + FLAGS['longname'] = x # register a new flag + + The .value member of the registered 'Flag' objects can be accessed as + members of this 'FlagValues' object, through __getattr__. Both the + long and short name of the original 'Flag' objects can be used to + access its value: + FLAGS.longname # parsed flag value + FLAGS.x # parsed flag value (short name) + + Command line arguments are scanned and passed to the registered 'Flag' + objects through the __call__ method. Unparsed arguments, including + argv[0] (e.g. the program name) are returned. + argv = FLAGS(sys.argv) # scan command line arguments + + The original registered Flag objects can be retrieved through the use + of the dictionary-like operator, __getitem__: + x = FLAGS['longname'] # access the registered Flag object + + The str() operator of a 'FlagValues' object provides help for all of + the registered 'Flag' objects. + """ + + def __init__(self): + # Since everything in this class is so heavily overloaded, + # the only way of defining and using fields is to access __dict__ + # directly. + + # Dictionary: flag name (string) -> Flag object. + self.__dict__['__flags'] = {} + # Dictionary: module name (string) -> list of Flag objects that + # are defined by that module. + self.__dict__['__flags_by_module'] = {} + # Dictionary: module name (string) -> list of Flag objects that + # are key for that module. + self.__dict__['__key_flags_by_module'] = {} + + def FlagDict(self): + return self.__dict__['__flags'] + + def FlagsByModuleDict(self): + """Returns the dictionary of module_name -> list of defined flags. + + Returns: + A dictionary. Its keys are module names (strings). Its values + are lists of Flag objects. + """ + return self.__dict__['__flags_by_module'] + + def KeyFlagsByModuleDict(self): + """Returns the dictionary of module_name -> list of key flags. + + Returns: + A dictionary. Its keys are module names (strings). Its values + are lists of Flag objects. + """ + return self.__dict__['__key_flags_by_module'] + + def _RegisterFlagByModule(self, module_name, flag): + """Record the module that defines a specific flag. + + We keep track of which flag is defined by which module so that + we can later sort the flags by module. + + Args: + module_name: A string, the name of a Python module. + flag: A Flag object, a flag that is key to the module. + """ + flags_by_module = self.FlagsByModuleDict() + flags_by_module.setdefault(module_name, []).append(flag) + + def _RegisterKeyFlagForModule(self, module_name, flag): + """Specify that a flag is a key flag for a module. + + Args: + module_name: A string, the name of a Python module. + flag: A Flag object, a flag that is key to the module. + """ + key_flags_by_module = self.KeyFlagsByModuleDict() + # The list of key flags for the module named module_name. + key_flags = key_flags_by_module.setdefault(module_name, []) + # Add flag, but avoid duplicates. + if flag not in key_flags: + key_flags.append(flag) + + def _GetFlagsDefinedByModule(self, module): + """Returns the list of flags defined by a module. + + Args: + module: A module object or a module name (a string). + + Returns: + A fresh list of Flag objects. The caller may update this list + as he wishes: none of these changes will affect the internals + of this FlagValue object. + """ + if not isinstance(module, str): + module = module.__name__ + + return list(self.FlagsByModuleDict().get(module, [])) + + def _GetKeyFlagsForModule(self, module): + """Returns the list of key flags for a module. + + Args: + module: A module object or a module name (a string) + + Returns: + A list of Flag objects. This is a new list, disjoint from the + internals of this FlagValue object. Hence, the caller may + mutate this list as he wishes: none of these changes will + affect this FlagValue object. + """ + if not isinstance(module, str): + module = module.__name__ + + # Any flag is a key flag for the module that defined it. NOTE: + # key_flags is a fresh list: we can update it without affecting + # the internals of this FlagValues object. + key_flags = self._GetFlagsDefinedByModule(module) + + # Take into account flags explicitly declared as key for a module. + for flag in self.KeyFlagsByModuleDict().get(module, []): + if flag not in key_flags: + key_flags.append(flag) + return key_flags + + def AppendFlagValues(self, flag_values): + """Append flags registered in another FlagValues instance. + + Args: + flag_values: registry to copy from + """ + for flag_name, flag in flag_values.FlagDict().iteritems(): + # Flags with shortnames will appear here twice (once with under + # its normal name, and again with its short name). To prevent + # problems (DuplicateFlagError) that occur when doubly + # registering flags, we perform a check to make sure that the + # entry we're looking at is for its normal name. + if flag_name == flag.name: + self[flag_name] = flag + + def __setitem__(self, name, flag): + """ + Register a new flag variable. + """ + fl = self.FlagDict() + if not isinstance(flag, Flag): + raise IllegalFlagValue, flag + if not isinstance(name, type("")): + raise FlagsError, "Flag name must be a string" + if len(name) == 0: + raise FlagsError, "Flag name cannot be empty" + # If running under pychecker, duplicate keys are likely to be defined. + # Disable check for duplicate keys when pycheck'ing. + if (fl.has_key(name) and not flag.allow_override and + not fl[name].allow_override and not _RUNNING_PYCHECKER): + raise DuplicateFlagError(name, self) + short_name = flag.short_name + if short_name is not None: + if (fl.has_key(short_name) and not flag.allow_override and + not fl[short_name].allow_override and not _RUNNING_PYCHECKER): + raise DuplicateFlagError(short_name, self) + fl[short_name] = flag + fl[name] = flag + global _exported_flags + _exported_flags[name] = flag + + def __getitem__(self, name): + """ + Retrieve the flag object. + """ + return self.FlagDict()[name] + + def __getattr__(self, name): + """ + Retrieve the .value member of a flag object. + """ + fl = self.FlagDict() + if not fl.has_key(name): + raise AttributeError, name + return fl[name].value + + def __setattr__(self, name, value): + """ + Set the .value member of a flag object. + """ + fl = self.FlagDict() + fl[name].value = value + return value + + def _FlagIsRegistered(self, flag_obj): + """Checks whether a Flag object is registered under some name. + + Note: this is not as trivial as it seems: in addition to its + normal name, a flag may have a short name too. In + self.FlagDict(), both the normal and the short name are mapped to + the same flag object. E.g., calling only "del FLAGS.short_name" + is not unregistering the corresponding Flag object (it is still + registered under the longer name). + + Args: + flag_obj: A Flag object. + + Returns: + A boolean: True iff flag_obj is registered under some name. + """ + flag_dict = self.FlagDict() + # Check whether flag_obj is registered under its long name. + name = flag_obj.name + if flag_dict.get(name, None) == flag_obj: + return True + # Check whether flag_obj is registered under its short name. + short_name = flag_obj.short_name + if (short_name is not None and + flag_dict.get(short_name, None) == flag_obj): + return True + # The flag cannot be registered under any other name, so we do not + # need to do a full search through the values of self.FlagDict(). + return False + + def __delattr__(self, flag_name): + """Delete a previously-defined flag from a flag object. + + This method makes sure we can delete a flag by using + + del flag_values_object.<flag_name> + + E.g., + + flags.DEFINE_integer('foo', 1, 'Integer flag.') + del flags.FLAGS.foo + + Args: + flag_name: A string, the name of the flag to be deleted. + + Raises: + AttributeError: When there is no registered flag named flag_name. + """ + fl = self.FlagDict() + if flag_name not in fl: + raise AttributeError(flag_name) + + flag_obj = fl[flag_name] + del fl[flag_name] + + if not self._FlagIsRegistered(flag_obj): + # If the Flag object indicated by flag_name is no longer + # registered (please see the docstring of _FlagIsRegistered), + # then we delete the occurences of the flag object in all our + # internal dictionaries. + self.__RemoveFlagFromDictByModule(self.FlagsByModuleDict(), flag_obj) + self.__RemoveFlagFromDictByModule(self.KeyFlagsByModuleDict(), flag_obj) + + def __RemoveFlagFromDictByModule(self, flags_by_module_dict, flag_obj): + """Removes a flag object from a module -> list of flags dictionary. + + Args: + flags_by_module_dict: A dictionary that maps module names to + lists of flags. + flag_obj: A flag object. + """ + for unused_module, flags_in_module in flags_by_module_dict.iteritems(): + # while (as opposed to if) takes care of multiple occurences + # of a flag in the list for the same module. + while flag_obj in flags_in_module: + flags_in_module.remove(flag_obj) + + def SetDefault(self, name, value): + """ + Change the default value of the named flag object. + """ + fl = self.FlagDict() + if not fl.has_key(name): + raise AttributeError, name + fl[name].SetDefault(value) + + def __contains__(self, name): + """ + Return True if name is a value (flag) in the dict. + """ + return name in self.FlagDict() + + has_key = __contains__ # a synonym for __contains__() + + def __iter__(self): + return self.FlagDict().iterkeys() + + def __call__(self, argv): + """ + Searches argv for flag arguments, parses them and then sets the flag + values as attributes of this FlagValues object. All unparsed + arguments are returned. Flags are parsed using the GNU Program + Argument Syntax Conventions, using getopt: + + http://www.gnu.org/software/libc/manual/html_mono/libc.html#Getopt + + Args: + argv: argument list. Can be of any type that may be converted to a list. + + Returns: + The list of arguments not parsed as options, including argv[0] + + Raises: + FlagsError: on any parsing error + """ + # Support any sequence type that can be converted to a list + argv = list(argv) + + shortopts = "" + longopts = [] + + fl = self.FlagDict() + + # This pre parses the argv list for --flagfile=<> options. + argv = self.ReadFlagsFromFiles(argv) + + # Correct the argv to support the google style of passing boolean + # parameters. Boolean parameters may be passed by using --mybool, + # --nomybool, --mybool=(true|false|1|0). getopt does not support + # having options that may or may not have a parameter. We replace + # instances of the short form --mybool and --nomybool with their + # full forms: --mybool=(true|false). + original_argv = list(argv) # list() makes a copy + shortest_matches = None + for name, flag in fl.items(): + if not flag.boolean: + continue + if shortest_matches is None: + # Determine the smallest allowable prefix for all flag names + shortest_matches = self.ShortestUniquePrefixes(fl) + no_name = 'no' + name + prefix = shortest_matches[name] + no_prefix = shortest_matches[no_name] + + # Replace all occurences of this boolean with extended forms + for arg_idx in range(1, len(argv)): + arg = argv[arg_idx] + if arg.find('=') >= 0: continue + if arg.startswith('--'+prefix) and ('--'+name).startswith(arg): + argv[arg_idx] = ('--%s=true' % name) + elif arg.startswith('--'+no_prefix) and ('--'+no_name).startswith(arg): + argv[arg_idx] = ('--%s=false' % name) + + # Loop over all of the flags, building up the lists of short options and + # long options that will be passed to getopt. Short options are + # specified as a string of letters, each letter followed by a colon if it + # takes an argument. Long options are stored in an array of strings. + # Each string ends with an '=' if it takes an argument. + for name, flag in fl.items(): + longopts.append(name + "=") + if len(name) == 1: # one-letter option: allow short flag type also + shortopts += name + if not flag.boolean: + shortopts += ":" + + longopts.append('undefok=') + undefok_flags = [] + + # In case --undefok is specified, loop to pick up unrecognized + # options one by one. + unrecognized_opts = [] + args = argv[1:] + while True: + try: + optlist, unparsed_args = getopt.getopt(args, shortopts, longopts) + break + except getopt.GetoptError, e: + if not e.opt or e.opt in fl: + # Not an unrecognized option, reraise the exception as a FlagsError + raise FlagsError(e) + # Handle an unrecognized option. + unrecognized_opts.append(e.opt) + # Remove offender from args and try again + for arg_index in range(len(args)): + if ((args[arg_index] == '--' + e.opt) or + (args[arg_index] == '-' + e.opt) or + args[arg_index].startswith('--' + e.opt + '=')): + args = args[0:arg_index] + args[arg_index+1:] + break + else: + # We should have found the option, so we don't expect to get + # here. We could assert, but raising the original exception + # might work better. + raise FlagsError(e) + + for name, arg in optlist: + if name == '--undefok': + flag_names = arg.split(',') + undefok_flags.extend(flag_names) + # For boolean flags, if --undefok=boolflag is specified, then we should + # also accept --noboolflag, in addition to --boolflag. + # Since we don't know the type of the undefok'd flag, this will affect + # non-boolean flags as well. + # NOTE: You shouldn't use --undefok=noboolflag, because then we will + # accept --nonoboolflag here. We are choosing not to do the conversion + # from noboolflag -> boolflag because of the ambiguity that flag names + # can start with 'no'. + undefok_flags.extend('no' + name for name in flag_names) + continue + if name.startswith('--'): + # long option + name = name[2:] + short_option = 0 + else: + # short option + name = name[1:] + short_option = 1 + if fl.has_key(name): + flag = fl[name] + if flag.boolean and short_option: arg = 1 + flag.Parse(arg) + + # If there were unrecognized options, raise an exception unless + # the options were named via --undefok. + for opt in unrecognized_opts: + if opt not in undefok_flags: + raise UnrecognizedFlagError(opt) + + if unparsed_args: + # unparsed_args becomes the first non-flag detected by getopt to + # the end of argv. Because argv may have been modified above, + # return original_argv for this region. + return argv[:1] + original_argv[-len(unparsed_args):] + else: + return argv[:1] + + def Reset(self): + """ + Reset the values to the point before FLAGS(argv) was called. + """ + for f in self.FlagDict().values(): + f.Unparse() + + def RegisteredFlags(self): + """Return a list of the names of all registered flags. + + Returns: + A list of all names and short names which flags are registered under. + """ + return self.FlagDict().keys() + + def FlagValuesDict(self): + """ + Return a dictionary with flag names as keys and flag values as values. + """ + flag_values = {} + + for flag_name in self.RegisteredFlags(): + flag = self.FlagDict()[flag_name] + flag_values[flag_name] = flag.value + + return flag_values + + def __str__(self): + """ + Generate a help string for all known flags. + """ + return self.GetHelp() + + def GetHelp(self, prefix=""): + """ + Generate a help string for all known flags. + """ + helplist = [] + + flags_by_module = self.FlagsByModuleDict() + if flags_by_module: + + modules = flags_by_module.keys() + modules.sort() + + # Print the help for the main module first, if possible. + main_module = _GetMainModule() + if main_module in modules: + modules.remove(main_module) + modules = [ main_module ] + modules + + for module in modules: + self.__RenderOurModuleFlags(module, helplist) + + self.__RenderModuleFlags('gflags', + _SPECIAL_FLAGS.FlagDict().values(), + helplist) + + else: + # Just print one long list of flags. + self.__RenderFlagList( + self.FlagDict().values() + _SPECIAL_FLAGS.FlagDict().values(), + helplist, prefix) + + return '\n'.join(helplist) + + def __RenderModuleFlags(self, module, flags, output_lines, prefix=""): + """ + Generate a help string for a given module. + """ + output_lines.append('\n%s%s:' % (prefix, module)) + self.__RenderFlagList(flags, output_lines, prefix + " ") + + def __RenderOurModuleFlags(self, module, output_lines, prefix=""): + """ + Generate a help string for a given module. + """ + flags = self._GetFlagsDefinedByModule(module) + if flags: + self.__RenderModuleFlags(module, flags, output_lines, prefix) + + def __RenderOurModuleKeyFlags(self, module, output_lines, prefix=""): + """Generate a help string for the key flags of a given module. + + Args: + module: A module object or a module name (a string). + output_lines: A list of strings. The generated help message + lines will be appended to this list. + prefix: A string that is prepended to each generated help line. + """ + key_flags = self._GetKeyFlagsForModule(module) + if key_flags: + self.__RenderModuleFlags(module, key_flags, output_lines, prefix) + + def MainModuleHelp(self): + """Returns: A string describing the key flags of the main module.""" + helplist = [] + self.__RenderOurModuleKeyFlags(_GetMainModule(), helplist) + return '\n'.join(helplist) + + def __RenderFlagList(self, flaglist, output_lines, prefix=" "): + fl = self.FlagDict() + special_fl = _SPECIAL_FLAGS.FlagDict() + flaglist = [(flag.name, flag) for flag in flaglist] + flaglist.sort() + flagset = {} + for (name, flag) in flaglist: + # It's possible this flag got deleted or overridden since being + # registered in the per-module flaglist. Check now against the + # canonical source of current flag information, the FlagDict. + if fl.get(name, None) != flag and special_fl.get(name, None) != flag: + # a different flag is using this name now + continue + # only print help once + if flagset.has_key(flag): continue + flagset[flag] = 1 + flaghelp = "" + if flag.short_name: flaghelp += "-%s," % flag.short_name + if flag.boolean: + flaghelp += "--[no]%s" % flag.name + ":" + else: + flaghelp += "--%s" % flag.name + ":" + flaghelp += " " + if flag.help: + flaghelp += flag.help + flaghelp = TextWrap(flaghelp, indent=prefix+" ", + firstline_indent=prefix) + if flag.default_as_str: + flaghelp += "\n" + flaghelp += TextWrap("(default: %s)" % flag.default_as_str, + indent=prefix+" ") + if flag.parser.syntactic_help: + flaghelp += "\n" + flaghelp += TextWrap("(%s)" % flag.parser.syntactic_help, + indent=prefix+" ") + output_lines.append(flaghelp) + + def get(self, name, default): + """ + Retrieve the .value member of a flag object, or default if .value is None + """ + + value = self.__getattr__(name) + if value is not None: # Can't do if not value, b/c value might be '0' or "" + return value + else: + return default + + def ShortestUniquePrefixes(self, fl): + """ + Returns a dictionary mapping flag names to their shortest unique prefix. + """ + # Sort the list of flag names + sorted_flags = [] + for name, flag in fl.items(): + sorted_flags.append(name) + if flag.boolean: + sorted_flags.append('no%s' % name) + sorted_flags.sort() + + # For each name in the sorted list, determine the shortest unique prefix + # by comparing itself to the next name and to the previous name (the latter + # check uses cached info from the previous loop). + shortest_matches = {} + prev_idx = 0 + for flag_idx in range(len(sorted_flags)): + curr = sorted_flags[flag_idx] + if flag_idx == (len(sorted_flags) - 1): + next = None + else: + next = sorted_flags[flag_idx+1] + next_len = len(next) + for curr_idx in range(len(curr)): + if (next is None + or curr_idx >= next_len + or curr[curr_idx] != next[curr_idx]): + # curr longer than next or no more chars in common + shortest_matches[curr] = curr[:max(prev_idx, curr_idx) + 1] + prev_idx = curr_idx + break + else: + # curr shorter than (or equal to) next + shortest_matches[curr] = curr + prev_idx = curr_idx + 1 # next will need at least one more char + return shortest_matches + + def __IsFlagFileDirective(self, flag_string): + """ Detects the --flagfile= token. + Takes a string which might contain a '--flagfile=<foo>' directive. + Returns a Boolean. + """ + if isinstance(flag_string, type("")): + if flag_string.startswith('--flagfile='): + return 1 + elif flag_string == '--flagfile': + return 1 + elif flag_string.startswith('-flagfile='): + return 1 + elif flag_string == '-flagfile': + return 1 + else: + return 0 + return 0 + + def ExtractFilename(self, flagfile_str): + """Function to remove the --flagfile= (or variant) and return just the + filename part. We can get strings that look like: + --flagfile=foo, -flagfile=foo. + The case of --flagfile foo and -flagfile foo shouldn't be hitting this + function, as they are dealt with in the level above this funciton. + """ + if flagfile_str.startswith('--flagfile='): + return os.path.expanduser((flagfile_str[(len('--flagfile=')):]).strip()) + elif flagfile_str.startswith('-flagfile='): + return os.path.expanduser((flagfile_str[(len('-flagfile=')):]).strip()) + else: + raise FlagsError('Hit illegal --flagfile type: %s' % flagfile_str) + return '' + + + def __GetFlagFileLines(self, filename, parsed_file_list): + """Function to open a flag file, return its useful (!=comments,etc) lines. + Takes: + A filename to open and read + A list of files we have already read THAT WILL BE CHANGED + Returns: + List of strings. See the note below. + + NOTE(springer): This function checks for a nested --flagfile=<foo> + tag and handles the lower file recursively. It returns a list off + all the lines that _could_ contain command flags. This is + EVERYTHING except whitespace lines and comments (lines starting + with '#' or '//'). + """ + line_list = [] # All line from flagfile. + flag_line_list = [] # Subset of lines w/o comments, blanks, flagfile= tags. + try: + file_obj = open(filename, 'r') + except IOError, e_msg: + print e_msg + print 'ERROR:: Unable to open flagfile: %s' % (filename) + return flag_line_list + + line_list = file_obj.readlines() + file_obj.close() + parsed_file_list.append(filename) + + # This is where we check each line in the file we just read. + for line in line_list: + if line.isspace(): + pass + # Checks for comment (a line that starts with '#'). + elif (line.startswith('#') or line.startswith('//')): + pass + # Checks for a nested "--flagfile=<bar>" flag in the current file. + # If we find one, recursively parse down into that file. + elif self.__IsFlagFileDirective(line): + sub_filename = self.ExtractFilename(line) + # We do a little safety check for reparsing a file we've already done. + if not sub_filename in parsed_file_list: + included_flags = self.__GetFlagFileLines(sub_filename, parsed_file_list) + flag_line_list.extend(included_flags) + else: # Case of hitting a circularly included file. + print >>sys.stderr, ('Warning: Hit circular flagfile dependency: %s' + % sub_filename) + else: + # Any line that's not a comment or a nested flagfile should + # get copied into 2nd position, this leaves earlier arguements + # further back in the list, which makes them have higher priority. + flag_line_list.append(line.strip()) + return flag_line_list + + def ReadFlagsFromFiles(self, argv): + """Process command line args, but also allow args to be read from file + Usage: + Takes: a list of strings, usually sys.argv, which may contain one or more + flagfile directives of the form --flagfile="./filename" + References: Global gflags.FLAG class instance + Returns: a new list which has the original list combined with what we + read from any flagfile(s). + + This function should be called before the normal FLAGS(argv) call. + This function simply scans the input list for a flag that looks like: + --flagfile=<somefile> + Then it opens <somefile>, reads all valid key and value pairs and inserts + them into the input list between the first item of the list and any + subsequent items in the list. + Note that your application's flags are still defined the usual way using + gflags DEFINE_flag() type functions. + + Notes (assuming we're getting a commandline of some sort as our input): + --> Any flags on the command line we were passed in _should_ always take + precedence!!! + --> a further "--flagfile=<otherfile.cfg>" CAN be nested in a flagfile. + It will be processed after the parent flag file is done. + --> For duplicate flags, first one we hit should "win". + --> In a flagfile, a line beginning with # or // is a comment + --> Entirely blank lines _should_ be ignored + """ + parsed_file_list = [] + rest_of_args = argv + new_argv = [] + while rest_of_args: + current_arg = rest_of_args[0] + rest_of_args = rest_of_args[1:] + if self.__IsFlagFileDirective(current_arg): + # This handles the case of -(-)flagfile foo. Inthis case the next arg + # really is part of this one. + if current_arg == '--flagfile' or current_arg =='-flagfile': + if not rest_of_args: + raise IllegalFlagValue, '--flagfile with no argument' + flag_filename = os.path.expanduser(rest_of_args[0]) + rest_of_args = rest_of_args[1:] + else: + # This handles the case of (-)-flagfile=foo. + flag_filename = self.ExtractFilename(current_arg) + new_argv = (new_argv[:1] + + self.__GetFlagFileLines(flag_filename, parsed_file_list) + + new_argv[1:]) + else: + new_argv.append(current_arg) + + return new_argv + + def FlagsIntoString(self): + """ + Retrieve a string version of all the flags with assignments stored + in this FlagValues object. Should mirror the behavior of the c++ + version of FlagsIntoString. Each flag assignment is seperated by + a newline. + """ + s = '' + for flag in self.FlagDict().values(): + if flag.value is not None: + s += flag.Serialize() + '\n' + return s + + def AppendFlagsIntoFile(self, filename): + """ + Appends all flags found in this FlagInfo object to the file + specified. Output will be in the format of a flagfile. This + should mirror the behavior of the c++ version of + AppendFlagsIntoFile. + """ + out_file = open(filename, 'a') + out_file.write(self.FlagsIntoString()) + out_file.close() +# end of FlagValues definition + +# The global FlagValues instance +FLAGS = FlagValues() + + +class Flag: + """ + 'Flag' objects define the following fields: + .name - the name for this flag + .default - the default value for this flag + .default_as_str - default value as repr'd string, e.g., "'true'" (or None) + .value - the most recent parsed value of this flag; set by Parse() + .help - a help string or None if no help is available + .short_name - the single letter alias for this flag (or None) + .boolean - if 'true', this flag does not accept arguments + .present - true if this flag was parsed from command line flags. + .parser - an ArgumentParser object + .serializer - an ArgumentSerializer object + .allow_override - the flag may be redefined without raising an error + + The only public method of a 'Flag' object is Parse(), but it is + typically only called by a 'FlagValues' object. The Parse() method is + a thin wrapper around the 'ArgumentParser' Parse() method. The parsed + value is saved in .value, and the .present member is updated. If this + flag was already present, a FlagsError is raised. + + Parse() is also called during __init__ to parse the default value and + initialize the .value member. This enables other python modules to + safely use flags even if the __main__ module neglects to parse the + command line arguments. The .present member is cleared after __init__ + parsing. If the default value is set to None, then the __init__ + parsing step is skipped and the .value member is initialized to None. + + Note: The default value is also presented to the user in the help + string, so it is important that it be a legal value for this flag. + """ + def __init__(self, parser, serializer, name, default, help_string, + short_name=None, boolean=0, allow_override=0): + self.name = name + + if not help_string: + help_string = '(no help available)' + + self.help = help_string + self.short_name = short_name + self.boolean = boolean + self.present = 0 + self.parser = parser + self.serializer = serializer + self.allow_override = allow_override + self.value = None + + self.SetDefault(default) + + def __GetParsedValueAsString(self, value): + if value is None: + return None + if self.serializer: + return repr(self.serializer.Serialize(value)) + if self.boolean: + if value: + return repr('true') + else: + return repr('false') + return repr(str(value)) + + def Parse(self, argument): + try: + self.value = self.parser.Parse(argument) + except ValueError, e: # recast ValueError as IllegalFlagValue + raise IllegalFlagValue, ("flag --%s: " % self.name) + str(e) + self.present += 1 + + def Unparse(self): + if self.default is None: + self.value = None + else: + self.Parse(self.default) + self.present = 0 + + def Serialize(self): + if self.value is None: + return '' + if self.boolean: + if self.value: + return "--%s" % self.name + else: + return "--no%s" % self.name + else: + if not self.serializer: + raise FlagsError, "Serializer not present for flag %s" % self.name + return "--%s=%s" % (self.name, self.serializer.Serialize(self.value)) + + def SetDefault(self, value): + """ + Change the default value, and current value, of this flag object + """ + # We can't allow a None override because it may end up not being + # passed to C++ code when we're overriding C++ flags. So we + # cowardly bail out until someone fixes the semantics of trying to + # pass None to a C++ flag. See swig_flags.Init() for details on + # this behavior. + if value is None and self.allow_override: + raise DuplicateFlag, self.name + + self.default = value + self.Unparse() + self.default_as_str = self.__GetParsedValueAsString(self.value) +# End of Flag definition + +class ArgumentParser: + """ + This is a base class used to parse and convert arguments. + + The Parse() method checks to make sure that the string argument is a + legal value and convert it to a native type. If the value cannot be + converted, it should throw a 'ValueError' exception with a human + readable explanation of why the value is illegal. + + Subclasses should also define a syntactic_help string which may be + presented to the user to describe the form of the legal values. + """ + syntactic_help = "" + def Parse(self, argument): + """ + The default implementation of Parse() accepts any value of argument, + simply returning it unmodified. + """ + return argument + +class ArgumentSerializer: + """ + This is the base class for generating string representations of a + flag value + """ + def Serialize(self, value): + return str(value) + +class ListSerializer(ArgumentSerializer): + def __init__(self, list_sep): + self.list_sep = list_sep + + def Serialize(self, value): + return self.list_sep.join([str(x) for x in value]) + + +# The DEFINE functions are explained in the module doc string. + +def DEFINE(parser, name, default, help, flag_values=FLAGS, serializer=None, + **args): + """ + This creates a generic 'Flag' object that parses its arguments with a + 'Parser' and registers it with a 'FlagValues' object. + + Developers who need to create their own 'Parser' classes should call + this module function. to register their flags. For example: + + DEFINE(DatabaseSpec(), "dbspec", "mysql:db0:readonly:hr", + "The primary database") + """ + DEFINE_flag(Flag(parser, serializer, name, default, help, **args), + flag_values) + +def DEFINE_flag(flag, flag_values=FLAGS): + """ + This registers a 'Flag' object with a 'FlagValues' object. By + default, the global FLAGS 'FlagValue' object is used. + + Typical users will use one of the more specialized DEFINE_xxx + functions, such as DEFINE_string or DEFINE_integer. But developers + who need to create Flag objects themselves should use this function to + register their flags. + """ + # copying the reference to flag_values prevents pychecker warnings + fv = flag_values + fv[flag.name] = flag + # Tell flag_values who's defining the flag. + if isinstance(flag_values, FlagValues): + # Regarding the above isinstance test: some users pass funny + # values of flag_values (e.g., {}) in order to avoid the flag + # registration (in the past, there used to be a flag_values == + # FLAGS test here) and redefine flags with the same name (e.g., + # debug). To avoid breaking their code, we perform the + # registration only if flag_values is a real FlagValues object. + flag_values._RegisterFlagByModule(_GetCallingModule(), flag) + + +def _InternalDeclareKeyFlags(flag_names, flag_values=FLAGS): + """Declare a flag as key for the calling module. + + Internal function. User code should call DECLARE_key_flag or + ADOPT_module_key_flags instead. + + Args: + flag_names: A list of strings that are names of already-registered + Flag objects. + flag_values: A FlagValues object. This should almost never need + to be overridden. + + Raises: + UnrecognizedFlagError: when we refer to a flag that was not + defined yet. + """ + module = _GetCallingModule() + + for flag_name in flag_names: + if flag_name not in flag_values: + raise UnrecognizedFlagError(flag_name) + flag = flag_values.FlagDict()[flag_name] + flag_values._RegisterKeyFlagForModule(module, flag) + + +def DECLARE_key_flag(flag_name, flag_values=FLAGS): + """Declare one flag as key to the current module. + + Key flags are flags that are deemed really important for a module. + They are important when listing help messages; e.g., if the + --helpshort command-line flag is used, then only the key flags of + the main module are listed (instead of all flags, as in the case of + --help). + + Sample usage: + + flags.DECLARED_key_flag('flag_1') + + Args: + flag_name: A string, the name of an already declared flag. + (Redeclaring flags as key, including flags implicitly key + because they were declared in this module, is a no-op.) + flag_values: A FlagValues object. This should almost never + need to be overridden. + """ + _InternalDeclareKeyFlags([flag_name], flag_values=flag_values) + + +def ADOPT_module_key_flags(module, flag_values=FLAGS): + """Declare that all flags key to a module are key to the current module. + + Args: + module: A module object. + flag_values: A FlagValues object. This should almost never need + to be overridden. + + Raises: + FlagsError: When given an argument that is a module name (a + string), instead of a module object. + """ + # NOTE(salcianu): an even better test would be if not + # isinstance(module, types.ModuleType) but I didn't want to import + # types for such a tiny use. + if isinstance(module, str): + raise FlagsError('Received module name %s; expected a module object.' + % module) + _InternalDeclareKeyFlags( + [f.name for f in flag_values._GetKeyFlagsForModule(module.__name__)], + flag_values=flag_values) + + +############################### +################# STRING FLAGS +############################### + +def DEFINE_string(name, default, help, flag_values=FLAGS, **args): + """ + This registers a flag whose value can be any string. + """ + parser = ArgumentParser() + serializer = ArgumentSerializer() + DEFINE(parser, name, default, help, flag_values, serializer, **args) + + +############################### +################ BOOLEAN FLAGS +############################### +#### and the special HELP flag +############################### + +class BooleanParser(ArgumentParser): + """ + A boolean value + """ + + def Convert(self, argument): + """ + convert the argument to a boolean; raise ValueError on errors + """ + if type(argument) == str: + if argument.lower() in ['true', 't', '1']: + return True + elif argument.lower() in ['false', 'f', '0']: + return False + + bool_argument = bool(argument) + if argument == bool_argument: + # The argument is a valid boolean (True, False, 0, or 1), and not just + # something that always converts to bool (list, string, int, etc.). + return bool_argument + + raise ValueError('Non-boolean argument to boolean flag', argument) + + def Parse(self, argument): + val = self.Convert(argument) + return val + +class BooleanFlag(Flag): + """ + A basic boolean flag. Boolean flags do not take any arguments, and + their value is either True (1) or False (0). The false value is + specified on the command line by prepending the word 'no' to either + the long or short flag name. + + For example, if a Boolean flag was created whose long name was 'update' + and whose short name was 'x', then this flag could be explicitly unset + through either --noupdate or --nox. + """ + def __init__(self, name, default, help, short_name=None, **args): + p = BooleanParser() + Flag.__init__(self, p, None, name, default, help, short_name, 1, **args) + if not self.help: self.help = "a boolean value" + +def DEFINE_boolean(name, default, help, flag_values=FLAGS, **args): + """ + This registers a boolean flag - one that does not take an argument. + If a user wants to specify a false value explicitly, the long option + beginning with 'no' must be used: i.e. --noflag + + This flag will have a value of None, True or False. None is possible if + default=None and the user does not specify the flag on the command + line. + """ + DEFINE_flag(BooleanFlag(name, default, help, **args), flag_values) + +# Match C++ API to unconfuse C++ people. +DEFINE_bool = DEFINE_boolean + +class HelpFlag(BooleanFlag): + """ + HelpFlag is a special boolean flag that prints usage information and + raises a SystemExit exception if it is ever found in the command + line arguments. Note this is called with allow_override=1, so other + apps can define their own --help flag, replacing this one, if they want. + """ + def __init__(self): + BooleanFlag.__init__(self, "help", 0, "show this help", + short_name="?", allow_override=1) + def Parse(self, arg): + if arg: + doc = sys.modules["__main__"].__doc__ + flags = str(FLAGS) + print doc or ("\nUSAGE: %s [flags]\n" % sys.argv[0]) + if flags: + print "flags:" + print flags + sys.exit(1) + +class HelpshortFlag(BooleanFlag): + """ + HelpshortFlag is a special boolean flag that prints usage + information for the "main" module, and rasies a SystemExit exception + if it is ever found in the command line arguments. Note this is + called with allow_override=1, so other apps can define their own + --helpshort flag, replacing this one, if they want. + """ + def __init__(self): + BooleanFlag.__init__(self, "helpshort", 0, + "show usage only for this module", allow_override=1) + def Parse(self, arg): + if arg: + doc = sys.modules["__main__"].__doc__ + flags = FLAGS.MainModuleHelp() + print doc or ("\nUSAGE: %s [flags]\n" % sys.argv[0]) + if flags: + print "flags:" + print flags + sys.exit(1) + + +############################### +################## FLOAT FLAGS +############################### + +class FloatParser(ArgumentParser): + """ + A floating point value; optionally bounded to a given upper and lower + bound. + """ + number_article = "a" + number_name = "number" + syntactic_help = " ".join((number_article, number_name)) + + def __init__(self, lower_bound=None, upper_bound=None): + self.lower_bound = lower_bound + self.upper_bound = upper_bound + sh = self.syntactic_help + if lower_bound != None and upper_bound != None: + sh = ("%s in the range [%s, %s]" % (sh, lower_bound, upper_bound)) + elif lower_bound == 1: + sh = "a positive %s" % self.number_name + elif upper_bound == -1: + sh = "a negative %s" % self.number_name + elif lower_bound == 0: + sh = "a non-negative %s" % self.number_name + elif upper_bound != None: + sh = "%s <= %s" % (self.number_name, upper_bound) + elif lower_bound != None: + sh = "%s >= %s" % (self.number_name, lower_bound) + self.syntactic_help = sh + + def Convert(self, argument): + """ + convert the argument to a float; raise ValueError on errors + """ + return float(argument) + + def Parse(self, argument): + val = self.Convert(argument) + if ((self.lower_bound != None and val < self.lower_bound) or + (self.upper_bound != None and val > self.upper_bound)): + raise ValueError, "%s is not %s" % (val, self.syntactic_help) + return val + +def DEFINE_float(name, default, help, lower_bound=None, upper_bound=None, + flag_values = FLAGS, **args): + """ + This registers a flag whose value must be a float. If lower_bound, + or upper_bound are set, then this flag must be within the given range. + """ + parser = FloatParser(lower_bound, upper_bound) + serializer = ArgumentSerializer() + DEFINE(parser, name, default, help, flag_values, serializer, **args) + + +############################### +################ INTEGER FLAGS +############################### + +class IntegerParser(FloatParser): + """ + An integer value; optionally bounded to a given upper or lower bound. + """ + number_article = "an" + number_name = "integer" + syntactic_help = " ".join((number_article, number_name)) + def Convert(self, argument): + __pychecker__ = 'no-returnvalues' + if type(argument) == str: + base = 10 + if len(argument) > 2 and argument[0] == "0" and argument[1] == "x": + base=16 + try: + return int(argument, base) + # ValueError is thrown when argument is a string, and overflows an int. + except ValueError: + return long(argument, base) + else: + try: + return int(argument) + # OverflowError is thrown when argument is numeric, and overflows an int. + except OverflowError: + return long(argument) + +def DEFINE_integer(name, default, help, lower_bound=None, upper_bound=None, + flag_values = FLAGS, **args): + """ + This registers a flag whose value must be an integer. If lower_bound, + or upper_bound are set, then this flag must be within the given range. + """ + parser = IntegerParser(lower_bound, upper_bound) + serializer = ArgumentSerializer() + DEFINE(parser, name, default, help, flag_values, serializer, **args) + + +############################### +################### ENUM FLAGS +############################### + +class EnumParser(ArgumentParser): + """ + A string enum value + """ + + def __init__(self, enum_values=None): + self.enum_values = enum_values + + def Parse(self, argument): + """ + If enum_values is not specified, any string is allowed + """ + if self.enum_values and argument not in self.enum_values: + raise ValueError, ("value should be one of <%s>" + % "|".join(self.enum_values)) + return argument + +class EnumFlag(Flag): + """ + A basic enum flag. The flag's value can be any string from the list + of enum_values. + """ + def __init__(self, name, default, help, enum_values=[], + short_name=None, **args): + p = EnumParser(enum_values) + g = ArgumentSerializer() + Flag.__init__(self, p, g, name, default, help, short_name, **args) + if not self.help: self.help = "an enum string" + self.help = "<%s>: %s" % ("|".join(enum_values), self.help) + +def DEFINE_enum(name, default, enum_values, help, flag_values=FLAGS, + **args): + """ + This registers a flag whose value can be a string from a set of + specified values. + """ + DEFINE_flag(EnumFlag(name, default, help, enum_values, ** args), + flag_values) + + +############################### +################### LIST FLAGS +############################### + +class BaseListParser(ArgumentParser): + """ + A base class for a string list parser. + To extend, inherit from this class, and call + + BaseListParser.__init__(self, token, name) + + where token is a character used to tokenize, and + name is a description of the separator + """ + + def __init__(self, token=None, name=None): + assert name + self._token = token + self._name = name + self.syntactic_help = "a %s separated list" % self._name + + def Parse(self, argument): + if argument == '': + return [] + else: + return [s.strip() for s in argument.split(self._token)] + + +class ListParser(BaseListParser): + """ + A string list parser (comma-separated) + """ + + def __init__(self): + BaseListParser.__init__(self, ',', 'comma') + +class WhitespaceSeparatedListParser(BaseListParser): + """ + A string list parser (whitespace-separated) + """ + + def __init__(self): + BaseListParser.__init__(self, None, 'whitespace') + + +def DEFINE_list(name, default, help, flag_values=FLAGS, **args): + """ + This registers a flag whose value is a list of strings, separated by commas + """ + parser = ListParser() + serializer = ListSerializer(',') + DEFINE(parser, name, default, help, flag_values, serializer, **args) + +def DEFINE_spaceseplist(name, default, help, flag_values=FLAGS, **args): + """ + This registers a flag whose value is a list of strings, separated by any + whitespace + """ + parser = WhitespaceSeparatedListParser() + serializer = ListSerializer(' ') + DEFINE(parser, name, default, help, flag_values, serializer, **args) + + +############################### +################## MULTI FLAGS +############################### + +class MultiFlag(Flag): + """ + MultiFlag is a specialized subclass of Flag that accumulates + multiple values in a list when a command-line option appears + multiple times. + + See the __doc__ for Flag for most behavior of this class. Only + differences in behavior are described here: + * the default value may be a single value -OR- a list of values + * the value of the flag is always a list, even if the option was only + supplied once, and even if the default value is a single value + """ + def __init__(self, *args, **kwargs): + Flag.__init__(self, *args, **kwargs) + + self.help = (self.help + + ';\n repeat this option to specify a list of values') + + def Parse(self, arguments): + """Parse one or more arguments with the installed parser. + + Arguments: + arguments: a single argument or a list of arguments (typically a list + of default values); single arguments will be converted internally into + a list containing one item + """ + if not isinstance(arguments, list): + # Default value may be a list of values. Most other arguments will not + # be, so convert them into a single-item list to make processing simpler + # below. + arguments = [ arguments ] + + if self.present: + # keep a backup reference to list of previously supplied option values + values = self.value + else: + # "erase" the defaults with an empty list + values = [] + + for item in arguments: + # have Flag superclass parse argument, overwriting self.value reference + Flag.Parse(self, item) # also increments self.present + values.append(self.value) + + # put list of option values back in member variable + self.value = values + + def Serialize(self): + if not self.serializer: + raise FlagsError, "Serializer not present for flag %s" % self.name + if self.value is None: + return '' + + s = '' + + multi_value = self.value + + for self.value in multi_value: + if s: s += ' ' + s += Flag.Serialize(self) + + self.value = multi_value + + return s + + +def DEFINE_multi(parser, serializer, name, default, help, flag_values=FLAGS, + **args): + """ + This creates a generic 'MultiFlag' object that parses its arguments with a + 'Parser' and registers it with a 'FlagValues' object. + + Developers who need to create their own 'Parser' classes for options which + can appear multiple times can call this module function to register their + flags. + """ + DEFINE_flag(MultiFlag(parser, serializer, name, default, help, **args), flag_values) + +def DEFINE_multistring(name, default, help, flag_values=FLAGS, **args): + """ + This registers a flag whose value can be a list of any strings. Use the flag + on the command line multiple times to place multiple string values into the + list. The 'default' may be a single string (which will be converted into a + single-element list) or a list of strings. + """ + parser = ArgumentParser() + serializer = ArgumentSerializer() + DEFINE_multi(parser, serializer, name, default, help, flag_values, **args) + +def DEFINE_multi_int(name, default, help, lower_bound=None, upper_bound=None, + flag_values=FLAGS, **args): + """ + This registers a flag whose value can be a list of any integers. Use the + flag on the command line multiple times to place multiple integer values + into the list. The 'default' may be a single integer (which will be + converted into a single-element list) or a list of integers. + """ + parser = IntegerParser(lower_bound, upper_bound) + serializer = ArgumentSerializer() + DEFINE_multi(parser, serializer, name, default, help, flag_values, **args) + + +# Now register the flags that we want to exist in all applications. +# These are all defined with allow_override=1, so user-apps can use +# these flagnames for their own purposes, if they want. +DEFINE_flag(HelpFlag()) +DEFINE_flag(HelpshortFlag()) + +# Define special flags here so that help may be generated for them. +_SPECIAL_FLAGS = FlagValues() + +DEFINE_string( + 'flagfile', "", + "Insert flag definitions from the given file into the command line.", + _SPECIAL_FLAGS) + +DEFINE_string( + 'undefok', "", + "comma-separated list of flag names that it is okay to specify " + "on the command line even if the program does not define a flag " + "with that name. IMPORTANT: flags in this list that have " + "arguments MUST use the --flag=value format.", _SPECIAL_FLAGS) diff --git a/dtm_release/lib/util/gflags-1.1/python/gflags2man.py b/dtm_release/lib/util/gflags-1.1/python/gflags2man.py new file mode 100755 index 0000000000000000000000000000000000000000..f346564301e9843bd2c1b785f532f35b72dc9b84 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/python/gflags2man.py @@ -0,0 +1,536 @@ +#!/usr/bin/env python +# +# Copyright (c) 2007, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""gflags2man runs a Google flags base program and generates a man page. + +Run the program, parse the output, and then format that into a man +page. + +Usage: + gflags2man <program> [program] ... +""" + +# TODO(csilvers): work with windows paths (\) as well as unix (/) + +# This may seem a bit of an end run, but it: doesn't bloat flags, can +# support python/java/C++, supports older executables, and can be +# extended to other document formats. +# Inspired by help2man. + +__author__ = 'Dan Christian' + +import os +import re +import sys +import stat +import time + +import gflags + +_VERSION = '0.1' + + +def _GetDefaultDestDir(): + home = os.environ.get('HOME', '') + homeman = os.path.join(home, 'man', 'man1') + if home and os.path.exists(homeman): + return homeman + else: + return os.environ.get('TMPDIR', '/tmp') + +FLAGS = gflags.FLAGS +gflags.DEFINE_string('dest_dir', _GetDefaultDestDir(), + 'Directory to write resulting manpage to.' + ' Specify \'-\' for stdout') +gflags.DEFINE_string('help_flag', '--help', + 'Option to pass to target program in to get help') +gflags.DEFINE_integer('v', 0, 'verbosity level to use for output') + +_MIN_VALID_USAGE_MSG = 9 # if fewer lines than this, help is suspect + + +class Logging: + """A super-simple logging class""" + def error(self, msg): print >>sys.stderr, "ERROR: ", msg + def warn(self, msg): print >>sys.stderr, "WARNING: ", msg + def info(self, msg): print msg + def debug(self, msg): self.vlog(1, msg) + def vlog(self, level, msg): + if FLAGS.v >= level: print msg +logging = Logging() + + +def GetRealPath(filename): + """Given an executable filename, find in the PATH or find absolute path. + Args: + filename An executable filename (string) + Returns: + Absolute version of filename. + None if filename could not be found locally, absolutely, or in PATH + """ + if os.path.isabs(filename): # already absolute + return filename + + if filename.startswith('./') or filename.startswith('../'): # relative + return os.path.abspath(filename) + + path = os.getenv('PATH', '') + for directory in path.split(':'): + tryname = os.path.join(directory, filename) + if os.path.exists(tryname): + if not os.path.isabs(directory): # relative directory + return os.path.abspath(tryname) + return tryname + if os.path.exists(filename): + return os.path.abspath(filename) + return None # could not determine + +class Flag(object): + """The information about a single flag.""" + + def __init__(self, flag_desc, help): + """Create the flag object. + Args: + flag_desc The command line forms this could take. (string) + help The help text (string) + """ + self.desc = flag_desc # the command line forms + self.help = help # the help text + self.default = '' # default value + self.tips = '' # parsing/syntax tips + + +class ProgramInfo(object): + """All the information gleaned from running a program with --help.""" + + # Match a module block start, for python scripts --help + # "goopy.logging:" + module_py_re = re.compile(r'(\S.+):$') + # match the start of a flag listing + # " -v,--verbosity: Logging verbosity" + flag_py_re = re.compile(r'\s+(-\S+):\s+(.*)$') + # " (default: '0')" + flag_default_py_re = re.compile(r'\s+\(default:\s+\'(.*)\'\)$') + # " (an integer)" + flag_tips_py_re = re.compile(r'\s+\((.*)\)$') + + # Match a module block start, for c++ programs --help + # "google/base/commandlineflags" + module_c_re = re.compile(r'\s+Flags from (\S.+):$') + # match the start of a flag listing + # " -v,--verbosity: Logging verbosity" + flag_c_re = re.compile(r'\s+(-\S+)\s+(.*)$') + + # Match a module block start, for java programs --help + # "com.google.common.flags" + module_java_re = re.compile(r'\s+Flags for (\S.+):$') + # match the start of a flag listing + # " -v,--verbosity: Logging verbosity" + flag_java_re = re.compile(r'\s+(-\S+)\s+(.*)$') + + def __init__(self, executable): + """Create object with executable. + Args: + executable Program to execute (string) + """ + self.long_name = executable + self.name = os.path.basename(executable) # name + # Get name without extension (PAR files) + (self.short_name, self.ext) = os.path.splitext(self.name) + self.executable = GetRealPath(executable) # name of the program + self.output = [] # output from the program. List of lines. + self.desc = [] # top level description. List of lines + self.modules = {} # { section_name(string), [ flags ] } + self.module_list = [] # list of module names in their original order + self.date = time.localtime(time.time()) # default date info + + def Run(self): + """Run it and collect output. + + Returns: + 1 (true) If everything went well. + 0 (false) If there were problems. + """ + if not self.executable: + logging.error('Could not locate "%s"' % self.long_name) + return 0 + + finfo = os.stat(self.executable) + self.date = time.localtime(finfo[stat.ST_MTIME]) + + logging.info('Running: %s %s </dev/null 2>&1' + % (self.executable, FLAGS.help_flag)) + # --help output is often routed to stderr, so we combine with stdout. + # Re-direct stdin to /dev/null to encourage programs that + # don't understand --help to exit. + (child_stdin, child_stdout_and_stderr) = os.popen4( + [self.executable, FLAGS.help_flag]) + child_stdin.close() # '</dev/null' + self.output = child_stdout_and_stderr.readlines() + child_stdout_and_stderr.close() + if len(self.output) < _MIN_VALID_USAGE_MSG: + logging.error('Error: "%s %s" returned only %d lines: %s' + % (self.name, FLAGS.help_flag, + len(self.output), self.output)) + return 0 + return 1 + + def Parse(self): + """Parse program output.""" + (start_line, lang) = self.ParseDesc() + if start_line < 0: + return + if 'python' == lang: + self.ParsePythonFlags(start_line) + elif 'c' == lang: + self.ParseCFlags(start_line) + elif 'java' == lang: + self.ParseJavaFlags(start_line) + + def ParseDesc(self, start_line=0): + """Parse the initial description. + + This could be Python or C++. + + Returns: + (start_line, lang_type) + start_line Line to start parsing flags on (int) + lang_type Either 'python' or 'c' + (-1, '') if the flags start could not be found + """ + exec_mod_start = self.executable + ':' + + after_blank = 0 + start_line = 0 # ignore the passed-in arg for now (?) + for start_line in range(start_line, len(self.output)): # collect top description + line = self.output[start_line].rstrip() + # Python flags start with 'flags:\n' + if ('flags:' == line + and len(self.output) > start_line+1 + and '' == self.output[start_line+1].rstrip()): + start_line += 2 + logging.debug('Flags start (python): %s' % line) + return (start_line, 'python') + # SWIG flags just have the module name followed by colon. + if exec_mod_start == line: + logging.debug('Flags start (swig): %s' % line) + return (start_line, 'python') + # C++ flags begin after a blank line and with a constant string + if after_blank and line.startswith(' Flags from '): + logging.debug('Flags start (c): %s' % line) + return (start_line, 'c') + # java flags begin with a constant string + if line == 'where flags are': + logging.debug('Flags start (java): %s' % line) + start_line += 2 # skip "Standard flags:" + return (start_line, 'java') + + logging.debug('Desc: %s' % line) + self.desc.append(line) + after_blank = (line == '') + else: + logging.warn('Never found the start of the flags section for "%s"!' + % self.long_name) + return (-1, '') + + def ParsePythonFlags(self, start_line=0): + """Parse python/swig style flags.""" + modname = None # name of current module + modlist = [] + flag = None + for line_num in range(start_line, len(self.output)): # collect flags + line = self.output[line_num].rstrip() + if not line: # blank + continue + + mobj = self.module_py_re.match(line) + if mobj: # start of a new module + modname = mobj.group(1) + logging.debug('Module: %s' % line) + if flag: + modlist.append(flag) + self.module_list.append(modname) + self.modules.setdefault(modname, []) + modlist = self.modules[modname] + flag = None + continue + + mobj = self.flag_py_re.match(line) + if mobj: # start of a new flag + if flag: + modlist.append(flag) + logging.debug('Flag: %s' % line) + flag = Flag(mobj.group(1), mobj.group(2)) + continue + + if not flag: # continuation of a flag + logging.error('Flag info, but no current flag "%s"' % line) + mobj = self.flag_default_py_re.match(line) + if mobj: # (default: '...') + flag.default = mobj.group(1) + logging.debug('Fdef: %s' % line) + continue + mobj = self.flag_tips_py_re.match(line) + if mobj: # (tips) + flag.tips = mobj.group(1) + logging.debug('Ftip: %s' % line) + continue + if flag and flag.help: + flag.help += line # multiflags tack on an extra line + else: + logging.info('Extra: %s' % line) + if flag: + modlist.append(flag) + + def ParseCFlags(self, start_line=0): + """Parse C style flags.""" + modname = None # name of current module + modlist = [] + flag = None + for line_num in range(start_line, len(self.output)): # collect flags + line = self.output[line_num].rstrip() + if not line: # blank lines terminate flags + if flag: # save last flag + modlist.append(flag) + flag = None + continue + + mobj = self.module_c_re.match(line) + if mobj: # start of a new module + modname = mobj.group(1) + logging.debug('Module: %s' % line) + if flag: + modlist.append(flag) + self.module_list.append(modname) + self.modules.setdefault(modname, []) + modlist = self.modules[modname] + flag = None + continue + + mobj = self.flag_c_re.match(line) + if mobj: # start of a new flag + if flag: # save last flag + modlist.append(flag) + logging.debug('Flag: %s' % line) + flag = Flag(mobj.group(1), mobj.group(2)) + continue + + # append to flag help. type and default are part of the main text + if flag: + flag.help += ' ' + line.strip() + else: + logging.info('Extra: %s' % line) + if flag: + modlist.append(flag) + + def ParseJavaFlags(self, start_line=0): + """Parse Java style flags (com.google.common.flags).""" + # The java flags prints starts with a "Standard flags" "module" + # that doesn't follow the standard module syntax. + modname = 'Standard flags' # name of current module + self.module_list.append(modname) + self.modules.setdefault(modname, []) + modlist = self.modules[modname] + flag = None + + for line_num in range(start_line, len(self.output)): # collect flags + line = self.output[line_num].rstrip() + logging.vlog(2, 'Line: "%s"' % line) + if not line: # blank lines terminate module + if flag: # save last flag + modlist.append(flag) + flag = None + continue + + mobj = self.module_java_re.match(line) + if mobj: # start of a new module + modname = mobj.group(1) + logging.debug('Module: %s' % line) + if flag: + modlist.append(flag) + self.module_list.append(modname) + self.modules.setdefault(modname, []) + modlist = self.modules[modname] + flag = None + continue + + mobj = self.flag_java_re.match(line) + if mobj: # start of a new flag + if flag: # save last flag + modlist.append(flag) + logging.debug('Flag: %s' % line) + flag = Flag(mobj.group(1), mobj.group(2)) + continue + + # append to flag help. type and default are part of the main text + if flag: + flag.help += ' ' + line.strip() + else: + logging.info('Extra: %s' % line) + if flag: + modlist.append(flag) + + def Filter(self): + """Filter parsed data to create derived fields.""" + if not self.desc: + self.short_desc = '' + return + + for i in range(len(self.desc)): # replace full path with name + if self.desc[i].find(self.executable) >= 0: + self.desc[i] = self.desc[i].replace(self.executable, self.name) + + self.short_desc = self.desc[0] + word_list = self.short_desc.split(' ') + all_names = [ self.name, self.short_name, ] + # Since the short_desc is always listed right after the name, + # trim it from the short_desc + while word_list and (word_list[0] in all_names + or word_list[0].lower() in all_names): + del word_list[0] + self.short_desc = '' # signal need to reconstruct + if not self.short_desc and word_list: + self.short_desc = ' '.join(word_list) + + +class GenerateDoc(object): + """Base class to output flags information.""" + + def __init__(self, proginfo, directory='.'): + """Create base object. + Args: + proginfo A ProgramInfo object + directory Directory to write output into + """ + self.info = proginfo + self.dirname = directory + + def Output(self): + """Output all sections of the page.""" + self.Open() + self.Header() + self.Body() + self.Footer() + + def Open(self): raise NotImplementedError # define in subclass + def Header(self): raise NotImplementedError # define in subclass + def Body(self): raise NotImplementedError # define in subclass + def Footer(self): raise NotImplementedError # define in subclass + + +class GenerateMan(GenerateDoc): + """Output a man page.""" + + def __init__(self, proginfo, directory='.'): + """Create base object. + Args: + proginfo A ProgramInfo object + directory Directory to write output into + """ + GenerateDoc.__init__(self, proginfo, directory) + + def Open(self): + if self.dirname == '-': + logging.info('Writing to stdout') + self.fp = sys.stdout + else: + self.file_path = '%s.1' % os.path.join(self.dirname, self.info.name) + logging.info('Writing: %s' % self.file_path) + self.fp = open(self.file_path, 'w') + + def Header(self): + self.fp.write( + '.\\" DO NOT MODIFY THIS FILE! It was generated by gflags2man %s\n' + % _VERSION) + self.fp.write( + '.TH %s "1" "%s" "%s" "User Commands"\n' + % (self.info.name, time.strftime('%x', self.info.date), self.info.name)) + self.fp.write( + '.SH NAME\n%s \\- %s\n' % (self.info.name, self.info.short_desc)) + self.fp.write( + '.SH SYNOPSIS\n.B %s\n[\\fIFLAGS\\fR]...\n' % self.info.name) + + def Body(self): + self.fp.write( + '.SH DESCRIPTION\n.\\" Add any additional description here\n.PP\n') + for ln in self.info.desc: + self.fp.write('%s\n' % ln) + self.fp.write( + '.SH OPTIONS\n') + # This shows flags in the original order + for modname in self.info.module_list: + if modname.find(self.info.executable) >= 0: + mod = modname.replace(self.info.executable, self.info.name) + else: + mod = modname + self.fp.write('\n.P\n.I %s\n' % mod) + for flag in self.info.modules[modname]: + help_string = flag.help + if flag.default or flag.tips: + help_string += '\n.br\n' + if flag.default: + help_string += ' (default: \'%s\')' % flag.default + if flag.tips: + help_string += ' (%s)' % flag.tips + self.fp.write( + '.TP\n%s\n%s\n' % (flag.desc, help_string)) + + def Footer(self): + self.fp.write( + '.SH COPYRIGHT\nCopyright \(co %s Google.\n' + % time.strftime('%Y', self.info.date)) + self.fp.write('Gflags2man created this page from "%s %s" output.\n' + % (self.info.name, FLAGS.help_flag)) + self.fp.write('\nGflags2man was written by Dan Christian. ' + ' Note that the date on this' + ' page is the modification date of %s.\n' % self.info.name) + + +def main(argv): + argv = FLAGS(argv) # handles help as well + if len(argv) <= 1: + print >>sys.stderr, __doc__ + print >>sys.stderr, "flags:" + print >>sys.stderr, str(FLAGS) + return 1 + + for arg in argv[1:]: + prog = ProgramInfo(arg) + if not prog.Run(): + continue + prog.Parse() + prog.Filter() + doc = GenerateMan(prog, FLAGS.dest_dir) + doc.Output() + return 0 + +if __name__ == '__main__': + main(sys.argv) diff --git a/dtm_release/lib/util/gflags-1.1/python/gflags_unittest.py b/dtm_release/lib/util/gflags-1.1/python/gflags_unittest.py new file mode 100755 index 0000000000000000000000000000000000000000..53e3f8657317f3b535967cd9a81a7cbe5f16e3d4 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/python/gflags_unittest.py @@ -0,0 +1,1528 @@ +#!/usr/bin/env python + +# Copyright (c) 2007, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"Unittest for flags.py module" + +__pychecker__ = "no-local" # for unittest + + +import sys +import os +import shutil +import unittest + +# We use the name 'flags' internally in this test, for historical reasons. +# Don't do this yourself! :-) Just do 'import gflags; FLAGS=gflags.FLAGS; etc' +import gflags as flags +FLAGS=flags.FLAGS + +# For historic reasons, we use the name module_foo instead of +# test_module_foo, and module_bar instead of test_module_bar. +import test_module_foo as module_foo +import test_module_bar as module_bar + +def MultiLineEqual(expected_help, help): + """Returns True if expected_help == help. Otherwise returns False + and logs the difference in a human-readable way. + """ + if help == expected_help: + return True + + print "Error: FLAGS.MainModuleHelp() didn't return the expected result." + print "Got:" + print help + print "[End of got]" + + help_lines = help.split('\n') + expected_help_lines = expected_help.split('\n') + + num_help_lines = len(help_lines) + num_expected_help_lines = len(expected_help_lines) + + if num_help_lines != num_expected_help_lines: + print "Number of help lines = %d, expected %d" % ( + num_help_lines, num_expected_help_lines) + + num_to_match = min(num_help_lines, num_expected_help_lines) + + for i in range(num_to_match): + if help_lines[i] != expected_help_lines[i]: + print "One discrepancy: Got:" + print help_lines[i] + print "Expected:" + print expected_help_lines[i] + break + else: + # If we got here, found no discrepancy, print first new line. + if num_help_lines > num_expected_help_lines: + print "New help line:" + print help_lines[num_expected_help_lines] + elif num_expected_help_lines > num_help_lines: + print "Missing expected help line:" + print expected_help_lines[num_help_lines] + else: + print "Bug in this test -- discrepancy detected but not found." + + return False + + +class FlagsUnitTest(unittest.TestCase): + "Flags Unit Test" + + def assertListEqual(self, list1, list2): + """Asserts that, when sorted, list1 and list2 are identical.""" + sorted_list1 = list1[:] + sorted_list2 = list2[:] + sorted_list1.sort() + sorted_list2.sort() + self.assertEqual(sorted_list1, sorted_list2) + + def assertMultiLineEqual(self, expected, actual): + self.assert_(MultiLineEqual(expected, actual)) + + + def test_flags(self): + + ############################################## + # Test normal usage with no (expected) errors. + + # Define flags + number_test_framework_flags = len(FLAGS.RegisteredFlags()) + repeatHelp = "how many times to repeat (0-5)" + flags.DEFINE_integer("repeat", 4, repeatHelp, + lower_bound=0, short_name='r') + flags.DEFINE_string("name", "Bob", "namehelp") + flags.DEFINE_boolean("debug", 0, "debughelp") + flags.DEFINE_boolean("q", 1, "quiet mode") + flags.DEFINE_boolean("quack", 0, "superstring of 'q'") + flags.DEFINE_boolean("noexec", 1, "boolean flag with no as prefix") + flags.DEFINE_integer("x", 3, "how eXtreme to be") + flags.DEFINE_integer("l", 0x7fffffff00000000L, "how long to be") + flags.DEFINE_list('letters', 'a,b,c', "a list of letters") + flags.DEFINE_enum("kwery", None, ['who', 'what', 'why', 'where', 'when'], + "?") + + # Specify number of flags defined above. The short_name defined + # for 'repeat' counts as an extra flag. + number_defined_flags = 10 + 1 + self.assertEqual(len(FLAGS.RegisteredFlags()), + number_defined_flags + number_test_framework_flags) + + assert FLAGS.repeat == 4, "integer default values not set:" + FLAGS.repeat + assert FLAGS.name == 'Bob', "default values not set:" + FLAGS.name + assert FLAGS.debug == 0, "boolean default values not set:" + FLAGS.debug + assert FLAGS.q == 1, "boolean default values not set:" + FLAGS.q + assert FLAGS.x == 3, "integer default values not set:" + FLAGS.x + assert FLAGS.l == 0x7fffffff00000000L, ("integer default values not set:" + + FLAGS.l) + assert FLAGS.letters == ['a', 'b', 'c'], "list default values not set:" \ + + FLAGS.letters + assert FLAGS.kwery is None, ("enum default None value not set:" + + FLAGS.kwery) + + flag_values = FLAGS.FlagValuesDict() + assert flag_values['repeat'] == 4 + assert flag_values['name'] == 'Bob' + assert flag_values['debug'] == 0 + assert flag_values['r'] == 4 # short for of repeat + assert flag_values['q'] == 1 + assert flag_values['quack'] == 0 + assert flag_values['x'] == 3 + assert flag_values['l'] == 0x7fffffff00000000L + assert flag_values['letters'] == ['a', 'b', 'c'] + assert flag_values['kwery'] is None + + # Verify string form of defaults + assert FLAGS['repeat'].default_as_str == "'4'" + assert FLAGS['name'].default_as_str == "'Bob'" + assert FLAGS['debug'].default_as_str == "'false'" + assert FLAGS['q'].default_as_str == "'true'" + assert FLAGS['quack'].default_as_str == "'false'" + assert FLAGS['noexec'].default_as_str == "'true'" + assert FLAGS['x'].default_as_str == "'3'" + assert FLAGS['l'].default_as_str == "'9223372032559808512'" + assert FLAGS['letters'].default_as_str == "'a,b,c'" + + # Verify that the iterator for flags yields all the keys + keys = list(FLAGS) + keys.sort() + reg_flags = FLAGS.RegisteredFlags() + reg_flags.sort() + self.assertEqual(keys, reg_flags) + + # Parse flags + # .. empty command line + argv = ('./program',) + argv = FLAGS(argv) + assert len(argv) == 1, "wrong number of arguments pulled" + assert argv[0]=='./program', "program name not preserved" + + # .. non-empty command line + argv = ('./program', '--debug', '--name=Bob', '-q', '--x=8') + argv = FLAGS(argv) + assert len(argv) == 1, "wrong number of arguments pulled" + assert argv[0]=='./program', "program name not preserved" + assert FLAGS['debug'].present == 1 + FLAGS['debug'].present = 0 # Reset + assert FLAGS['name'].present == 1 + FLAGS['name'].present = 0 # Reset + assert FLAGS['q'].present == 1 + FLAGS['q'].present = 0 # Reset + assert FLAGS['x'].present == 1 + FLAGS['x'].present = 0 # Reset + + # Flags list + self.assertEqual(len(FLAGS.RegisteredFlags()), + number_defined_flags + number_test_framework_flags) + assert 'name' in FLAGS.RegisteredFlags() + assert 'debug' in FLAGS.RegisteredFlags() + assert 'repeat' in FLAGS.RegisteredFlags() + assert 'r' in FLAGS.RegisteredFlags() + assert 'q' in FLAGS.RegisteredFlags() + assert 'quack' in FLAGS.RegisteredFlags() + assert 'x' in FLAGS.RegisteredFlags() + assert 'l' in FLAGS.RegisteredFlags() + assert 'letters' in FLAGS.RegisteredFlags() + + # has_key + assert FLAGS.has_key('name') + assert not FLAGS.has_key('name2') + assert 'name' in FLAGS + assert 'name2' not in FLAGS + + # try deleting a flag + del FLAGS.r + self.assertEqual(len(FLAGS.RegisteredFlags()), + number_defined_flags - 1 + number_test_framework_flags) + assert not 'r' in FLAGS.RegisteredFlags() + + # .. command line with extra stuff + argv = ('./program', '--debug', '--name=Bob', 'extra') + argv = FLAGS(argv) + assert len(argv) == 2, "wrong number of arguments pulled" + assert argv[0]=='./program', "program name not preserved" + assert argv[1]=='extra', "extra argument not preserved" + assert FLAGS['debug'].present == 1 + FLAGS['debug'].present = 0 # Reset + assert FLAGS['name'].present == 1 + FLAGS['name'].present = 0 # Reset + + # Test reset + argv = ('./program', '--debug') + argv = FLAGS(argv) + assert len(argv) == 1, "wrong number of arguments pulled" + assert argv[0] == './program', "program name not preserved" + assert FLAGS['debug'].present == 1 + assert FLAGS['debug'].value + FLAGS.Reset() + assert FLAGS['debug'].present == 0 + assert not FLAGS['debug'].value + + # Test that reset restores default value when default value is None. + argv = ('./program', '--kwery=who') + argv = FLAGS(argv) + assert len(argv) == 1, "wrong number of arguments pulled" + assert argv[0] == './program', "program name not preserved" + assert FLAGS['kwery'].present == 1 + assert FLAGS['kwery'].value == 'who' + FLAGS.Reset() + assert FLAGS['kwery'].present == 0 + assert FLAGS['kwery'].value == None + + # Test integer argument passing + argv = ('./program', '--x', '0x12345') + argv = FLAGS(argv) + self.assertEquals(FLAGS.x, 0x12345) + self.assertEquals(type(FLAGS.x), int) + + argv = ('./program', '--x', '0x1234567890ABCDEF1234567890ABCDEF') + argv = FLAGS(argv) + self.assertEquals(FLAGS.x, 0x1234567890ABCDEF1234567890ABCDEF) + self.assertEquals(type(FLAGS.x), long) + + # Treat 0-prefixed parameters as base-10, not base-8 + argv = ('./program', '--x', '012345') + argv = FLAGS(argv) + self.assertEquals(FLAGS.x, 12345) + self.assertEquals(type(FLAGS.x), int) + + argv = ('./program', '--x', '0123459') + argv = FLAGS(argv) + self.assertEquals(FLAGS.x, 123459) + self.assertEquals(type(FLAGS.x), int) + + argv = ('./program', '--x', '0x123efg') + try: + argv = FLAGS(argv) + raise AssertionError("failed to detect invalid hex argument") + except flags.IllegalFlagValue: + pass + + argv = ('./program', '--x', '0X123efg') + try: + argv = FLAGS(argv) + raise AssertionError("failed to detect invalid hex argument") + except flags.IllegalFlagValue: + pass + + # Test boolean argument parsing + flags.DEFINE_boolean("test0", None, "test boolean parsing") + argv = ('./program', '--notest0') + argv = FLAGS(argv) + assert FLAGS.test0 == 0 + + flags.DEFINE_boolean("test1", None, "test boolean parsing") + argv = ('./program', '--test1') + argv = FLAGS(argv) + assert FLAGS.test1 == 1 + + FLAGS.test0 = None + argv = ('./program', '--test0=false') + argv = FLAGS(argv) + assert FLAGS.test0 == 0 + + FLAGS.test1 = None + argv = ('./program', '--test1=true') + argv = FLAGS(argv) + assert FLAGS.test1 == 1 + + FLAGS.test0 = None + argv = ('./program', '--test0=0') + argv = FLAGS(argv) + assert FLAGS.test0 == 0 + + FLAGS.test1 = None + argv = ('./program', '--test1=1') + argv = FLAGS(argv) + assert FLAGS.test1 == 1 + + # Test booleans that already have 'no' as a prefix + FLAGS.noexec = None + argv = ('./program', '--nonoexec', '--name', 'Bob') + argv = FLAGS(argv) + assert FLAGS.noexec == 0 + + FLAGS.noexec = None + argv = ('./program', '--name', 'Bob', '--noexec') + argv = FLAGS(argv) + assert FLAGS.noexec == 1 + + # Test unassigned booleans + flags.DEFINE_boolean("testnone", None, "test boolean parsing") + argv = ('./program',) + argv = FLAGS(argv) + assert FLAGS.testnone == None + + # Test get with default + flags.DEFINE_boolean("testget1", None, "test parsing with defaults") + flags.DEFINE_boolean("testget2", None, "test parsing with defaults") + flags.DEFINE_boolean("testget3", None, "test parsing with defaults") + flags.DEFINE_integer("testget4", None, "test parsing with defaults") + argv = ('./program','--testget1','--notestget2') + argv = FLAGS(argv) + assert FLAGS.get('testget1', 'foo') == 1 + assert FLAGS.get('testget2', 'foo') == 0 + assert FLAGS.get('testget3', 'foo') == 'foo' + assert FLAGS.get('testget4', 'foo') == 'foo' + + # test list code + lists = [['hello','moo','boo','1'], + [],] + + flags.DEFINE_list('testlist', '', 'test lists parsing') + flags.DEFINE_spaceseplist('testspacelist', '', 'tests space lists parsing') + + for name, sep in (('testlist', ','), ('testspacelist', ' '), + ('testspacelist', '\n')): + for lst in lists: + argv = ('./program', '--%s=%s' % (name, sep.join(lst))) + argv = FLAGS(argv) + self.assertEquals(getattr(FLAGS, name), lst) + + # Test help text + flagsHelp = str(FLAGS) + assert flagsHelp.find("repeat") != -1, "cannot find flag in help" + assert flagsHelp.find(repeatHelp) != -1, "cannot find help string in help" + + # Test flag specified twice + argv = ('./program', '--repeat=4', '--repeat=2', '--debug', '--nodebug') + argv = FLAGS(argv) + self.assertEqual(FLAGS.get('repeat', None), 2) + self.assertEqual(FLAGS.get('debug', None), 0) + + # Test MultiFlag with single default value + flags.DEFINE_multistring('s_str', 'sing1', + 'string option that can occur multiple times', + short_name='s') + self.assertEqual(FLAGS.get('s_str', None), [ 'sing1', ]) + + # Test MultiFlag with list of default values + multi_string_defs = [ 'def1', 'def2', ] + flags.DEFINE_multistring('m_str', multi_string_defs, + 'string option that can occur multiple times', + short_name='m') + self.assertEqual(FLAGS.get('m_str', None), multi_string_defs) + + # Test flag specified multiple times with a MultiFlag + argv = ('./program', '--m_str=str1', '-m', 'str2') + argv = FLAGS(argv) + self.assertEqual(FLAGS.get('m_str', None), [ 'str1', 'str2', ]) + + # Test single-letter flags; should support both single and double dash + argv = ('./program', '-q', '-x8') + argv = FLAGS(argv) + self.assertEqual(FLAGS.get('q', None), 1) + self.assertEqual(FLAGS.get('x', None), 8) + + argv = ('./program', '--q', '--x', '9', '--noqu') + argv = FLAGS(argv) + self.assertEqual(FLAGS.get('q', None), 1) + self.assertEqual(FLAGS.get('x', None), 9) + # --noqu should match '--noquack since it's a unique prefix + self.assertEqual(FLAGS.get('quack', None), 0) + + argv = ('./program', '--noq', '--x=10', '--qu') + argv = FLAGS(argv) + self.assertEqual(FLAGS.get('q', None), 0) + self.assertEqual(FLAGS.get('x', None), 10) + self.assertEqual(FLAGS.get('quack', None), 1) + + #################################### + # Test flag serialization code: + + oldtestlist = FLAGS.testlist + oldtestspacelist = FLAGS.testspacelist + + argv = ('./program', + FLAGS['test0'].Serialize(), + FLAGS['test1'].Serialize(), + FLAGS['testnone'].Serialize(), + FLAGS['s_str'].Serialize()) + argv = FLAGS(argv) + self.assertEqual(FLAGS['test0'].Serialize(), '--notest0') + self.assertEqual(FLAGS['test1'].Serialize(), '--test1') + self.assertEqual(FLAGS['testnone'].Serialize(), '') + self.assertEqual(FLAGS['s_str'].Serialize(), '--s_str=sing1') + + testlist1 = ['aa', 'bb'] + testspacelist1 = ['aa', 'bb', 'cc'] + FLAGS.testlist = list(testlist1) + FLAGS.testspacelist = list(testspacelist1) + argv = ('./program', + FLAGS['testlist'].Serialize(), + FLAGS['testspacelist'].Serialize()) + argv = FLAGS(argv) + self.assertEqual(FLAGS.testlist, testlist1) + self.assertEqual(FLAGS.testspacelist, testspacelist1) + + testlist1 = ['aa some spaces', 'bb'] + testspacelist1 = ['aa', 'bb,some,commas,', 'cc'] + FLAGS.testlist = list(testlist1) + FLAGS.testspacelist = list(testspacelist1) + argv = ('./program', + FLAGS['testlist'].Serialize(), + FLAGS['testspacelist'].Serialize()) + argv = FLAGS(argv) + self.assertEqual(FLAGS.testlist, testlist1) + self.assertEqual(FLAGS.testspacelist, testspacelist1) + + FLAGS.testlist = oldtestlist + FLAGS.testspacelist = oldtestspacelist + + #################################### + # Test flag-update: + + def ArgsString(): + flagnames = FLAGS.RegisteredFlags() + + flagnames.sort() + nonbool_flags = ['--%s %s' % (name, FLAGS.get(name, None)) + for name in flagnames + if not isinstance(FLAGS[name], flags.BooleanFlag)] + + truebool_flags = ['--%s' % (name) + for name in flagnames + if isinstance(FLAGS[name], flags.BooleanFlag) and + FLAGS.get(name, None)] + falsebool_flags = ['--no%s' % (name) + for name in flagnames + if isinstance(FLAGS[name], flags.BooleanFlag) and + not FLAGS.get(name, None)] + return ' '.join(nonbool_flags + truebool_flags + falsebool_flags) + + argv = ('./program', '--repeat=3', '--name=giants', '--nodebug') + FLAGS(argv) + self.assertEqual(FLAGS.get('repeat', None), 3) + self.assertEqual(FLAGS.get('name', None), 'giants') + self.assertEqual(FLAGS.get('debug', None), 0) + self.assertEqual(ArgsString(), + "--kwery None " + "--l 9223372032559808512 " + "--letters ['a', 'b', 'c'] " + "--m ['str1', 'str2'] --m_str ['str1', 'str2'] " + "--name giants " + "--repeat 3 " + "--s ['sing1'] --s_str ['sing1'] " + "--testget4 None --testlist [] " + "--testspacelist [] --x 10 " + "--noexec --quack " + "--test1 " + "--testget1 --no? --nodebug --nohelp --nohelpshort " + "--noq --notest0 --notestget2 " + "--notestget3 --notestnone") + + argv = ('./program', '--debug', '--m_str=upd1', '-s', 'upd2') + FLAGS(argv) + self.assertEqual(FLAGS.get('repeat', None), 3) + self.assertEqual(FLAGS.get('name', None), 'giants') + self.assertEqual(FLAGS.get('debug', None), 1) + + # items appended to existing non-default value lists for --m/--m_str + # new value overwrites default value (not appended to it) for --s/--s_str + self.assertEqual(ArgsString(), + "--kwery None " + "--l 9223372032559808512 " + "--letters ['a', 'b', 'c'] " + "--m ['str1', 'str2', 'upd1'] " + "--m_str ['str1', 'str2', 'upd1'] " + "--name giants " + "--repeat 3 " + "--s ['upd2'] --s_str ['upd2'] " + "--testget4 None --testlist [] " + "--testspacelist [] --x 10 " + "--debug --noexec --quack " + "--test1 " + "--testget1 --no? --nohelp --nohelpshort " + "--noq --notest0 --notestget2 " + "--notestget3 --notestnone") + + + #################################### + # Test all kind of error conditions. + + # Duplicate flag detection + try: + flags.DEFINE_boolean("run", 0, "runhelp", short_name='q') + raise AssertionError("duplicate flag detection failed") + except flags.DuplicateFlag, e: + pass + + try: + flags.DEFINE_boolean("zoom1", 0, "runhelp z1", short_name='z') + flags.DEFINE_boolean("zoom2", 0, "runhelp z2", short_name='z') + raise AssertionError("duplicate flag detection failed") + except flags.DuplicateFlag, e: + pass + + # Make sure allow_override works + try: + flags.DEFINE_boolean("dup1", 0, "runhelp d11", short_name='u', + allow_override=0) + flag = FLAGS.FlagDict()['dup1'] + self.assertEqual(flag.default, 0) + + flags.DEFINE_boolean("dup1", 1, "runhelp d12", short_name='u', + allow_override=1) + flag = FLAGS.FlagDict()['dup1'] + self.assertEqual(flag.default, 1) + except flags.DuplicateFlag, e: + raise AssertionError("allow_override did not permit a flag duplication") + + # Make sure allow_override works + try: + flags.DEFINE_boolean("dup2", 0, "runhelp d21", short_name='u', + allow_override=1) + flag = FLAGS.FlagDict()['dup2'] + self.assertEqual(flag.default, 0) + + flags.DEFINE_boolean("dup2", 1, "runhelp d22", short_name='u', + allow_override=0) + flag = FLAGS.FlagDict()['dup2'] + self.assertEqual(flag.default, 1) + except flags.DuplicateFlag, e: + raise AssertionError("allow_override did not permit a flag duplication") + + # Make sure allow_override doesn't work with None default + try: + flags.DEFINE_boolean("dup3", 0, "runhelp d31", short_name='u', + allow_override=0) + flag = FLAGS.FlagDict()['dup3'] + self.assertEqual(flag.default, 0) + + flags.DEFINE_boolean("dup3", None, "runhelp d32", short_name='u', + allow_override=1) + raise AssertionError('Cannot override a flag with a default of None') + except flags.DuplicateFlag, e: + pass + + # Make sure that when we override, the help string gets updated correctly + flags.DEFINE_boolean("dup3", 0, "runhelp d31", short_name='u', + allow_override=1) + flags.DEFINE_boolean("dup3", 1, "runhelp d32", short_name='u', + allow_override=1) + self.assert_(str(FLAGS).find('runhelp d31') == -1) + self.assert_(str(FLAGS).find('runhelp d32') != -1) + + # Make sure AppendFlagValues works + new_flags = flags.FlagValues() + flags.DEFINE_boolean("new1", 0, "runhelp n1", flag_values=new_flags) + flags.DEFINE_boolean("new2", 0, "runhelp n2", flag_values=new_flags) + self.assertEqual(len(new_flags.FlagDict()), 2) + old_len = len(FLAGS.FlagDict()) + FLAGS.AppendFlagValues(new_flags) + self.assertEqual(len(FLAGS.FlagDict())-old_len, 2) + self.assertEqual("new1" in FLAGS.FlagDict(), True) + self.assertEqual("new2" in FLAGS.FlagDict(), True) + + # Make sure AppendFlagValues works with flags with shortnames. + new_flags = flags.FlagValues() + flags.DEFINE_boolean("new3", 0, "runhelp n3", flag_values=new_flags) + flags.DEFINE_boolean("new4", 0, "runhelp n4", flag_values=new_flags, + short_name="n4") + self.assertEqual(len(new_flags.FlagDict()), 3) + old_len = len(FLAGS.FlagDict()) + FLAGS.AppendFlagValues(new_flags) + self.assertEqual(len(FLAGS.FlagDict())-old_len, 3) + self.assertTrue("new3" in FLAGS.FlagDict()) + self.assertTrue("new4" in FLAGS.FlagDict()) + self.assertTrue("n4" in FLAGS.FlagDict()) + self.assertEqual(FLAGS.FlagDict()['n4'], FLAGS.FlagDict()['new4']) + + # Make sure AppendFlagValues fails on duplicates + flags.DEFINE_boolean("dup4", 0, "runhelp d41") + new_flags = flags.FlagValues() + flags.DEFINE_boolean("dup4", 0, "runhelp d42", flag_values=new_flags) + try: + FLAGS.AppendFlagValues(new_flags) + raise AssertionError("ignore_copy was not set but caused no exception") + except flags.DuplicateFlag, e: + pass + + # Integer out of bounds + try: + argv = ('./program', '--repeat=-4') + FLAGS(argv) + raise AssertionError('integer bounds exception not raised:' + + str(FLAGS.repeat)) + except flags.IllegalFlagValue: + pass + + # Non-integer + try: + argv = ('./program', '--repeat=2.5') + FLAGS(argv) + raise AssertionError("malformed integer value exception not raised") + except flags.IllegalFlagValue: + pass + + # Missing required arugment + try: + argv = ('./program', '--name') + FLAGS(argv) + raise AssertionError("Flag argument required exception not raised") + except flags.FlagsError: + pass + + # Non-boolean arguments for boolean + try: + argv = ('./program', '--debug=goofup') + FLAGS(argv) + raise AssertionError("Illegal flag value exception not raised") + except flags.IllegalFlagValue: + pass + + try: + argv = ('./program', '--debug=42') + FLAGS(argv) + raise AssertionError("Illegal flag value exception not raised") + except flags.IllegalFlagValue: + pass + + + # Non-numeric argument for integer flag --repeat + try: + argv = ('./program', '--repeat', 'Bob', 'extra') + FLAGS(argv) + raise AssertionError("Illegal flag value exception not raised") + except flags.IllegalFlagValue: + pass + + ################################################ + # Code to test the flagfile=<> loading behavior + ################################################ + def _SetupTestFiles(self): + """ Creates and sets up some dummy flagfile files with bogus flags""" + + # Figure out where to create temporary files + tmp_path = '/tmp/flags_unittest' + if os.path.exists(tmp_path): + shutil.rmtree(tmp_path) + os.makedirs(tmp_path) + + try: + tmp_flag_file_1 = open((tmp_path + '/UnitTestFile1.tst'), 'w') + tmp_flag_file_2 = open((tmp_path + '/UnitTestFile2.tst'), 'w') + tmp_flag_file_3 = open((tmp_path + '/UnitTestFile3.tst'), 'w') + except IOError, e_msg: + print e_msg + print 'FAIL\n File Creation problem in Unit Test' + sys.exit(1) + + # put some dummy flags in our test files + tmp_flag_file_1.write('#A Fake Comment\n') + tmp_flag_file_1.write('--UnitTestMessage1=tempFile1!\n') + tmp_flag_file_1.write('\n') + tmp_flag_file_1.write('--UnitTestNumber=54321\n') + tmp_flag_file_1.write('--noUnitTestBoolFlag\n') + file_list = [tmp_flag_file_1.name] + # this one includes test file 1 + tmp_flag_file_2.write('//A Different Fake Comment\n') + tmp_flag_file_2.write('--flagfile=%s\n' % tmp_flag_file_1.name) + tmp_flag_file_2.write('--UnitTestMessage2=setFromTempFile2\n') + tmp_flag_file_2.write('\t\t\n') + tmp_flag_file_2.write('--UnitTestNumber=6789a\n') + file_list.append(tmp_flag_file_2.name) + # this file points to itself + tmp_flag_file_3.write('--flagfile=%s\n' % tmp_flag_file_3.name) + tmp_flag_file_3.write('--UnitTestMessage1=setFromTempFile3\n') + tmp_flag_file_3.write('#YAFC\n') + tmp_flag_file_3.write('--UnitTestBoolFlag\n') + file_list.append(tmp_flag_file_3.name) + + tmp_flag_file_1.close() + tmp_flag_file_2.close() + tmp_flag_file_3.close() + + return file_list # these are just the file names + # end SetupFiles def + + def _RemoveTestFiles(self, tmp_file_list): + """Closes the files we just created. tempfile deletes them for us """ + for file_name in tmp_file_list: + try: + os.remove(file_name) + except OSError, e_msg: + print '%s\n, Problem deleting test file' % e_msg + #end RemoveTestFiles def + + def __DeclareSomeFlags(self): + flags.DEFINE_string('UnitTestMessage1', 'Foo!', 'You Add Here.') + flags.DEFINE_string('UnitTestMessage2', 'Bar!', 'Hello, Sailor!') + flags.DEFINE_boolean('UnitTestBoolFlag', 0, 'Some Boolean thing') + flags.DEFINE_integer('UnitTestNumber', 12345, 'Some integer', + lower_bound=0) + flags.DEFINE_list('UnitTestList', "1,2,3", 'Some list') + + def _UndeclareSomeFlags(self): + FLAGS.__delattr__('UnitTestMessage1') + FLAGS.__delattr__('UnitTestMessage2') + FLAGS.__delattr__('UnitTestBoolFlag') + FLAGS.__delattr__('UnitTestNumber') + FLAGS.__delattr__('UnitTestList') + + #### Flagfile Unit Tests #### + def testMethod_flagfiles_1(self): + """ Test trivial case with no flagfile based options. """ + self.__DeclareSomeFlags() + fake_cmd_line = 'fooScript --UnitTestBoolFlag' + fake_argv = fake_cmd_line.split(' ') + FLAGS(fake_argv) + self.assertEqual( FLAGS.UnitTestBoolFlag, 1) + self.assertEqual( fake_argv, FLAGS.ReadFlagsFromFiles(fake_argv)) + self._UndeclareSomeFlags() + # end testMethodOne + + def testMethod_flagfiles_2(self): + """Tests parsing one file + arguments off simulated argv""" + self.__DeclareSomeFlags() + tmp_files = self._SetupTestFiles() + # specify our temp file on the fake cmd line + fake_cmd_line = 'fooScript --q --flagfile=%s' % tmp_files[0] + fake_argv = fake_cmd_line.split(' ') + + # We should see the original cmd line with the file's contents spliced in. + # Note that these will be in REVERSE order from order encountered in file + # This is done so arguements we encounter sooner will have priority. + expected_results = ['fooScript', + '--UnitTestMessage1=tempFile1!', + '--UnitTestNumber=54321', + '--noUnitTestBoolFlag', + '--q'] + test_results = FLAGS.ReadFlagsFromFiles(fake_argv) + self.assertEqual(expected_results, test_results) + self._RemoveTestFiles(tmp_files) + self._UndeclareSomeFlags() + # end testTwo def + + def testMethod_flagfiles_3(self): + """Tests parsing nested files + arguments of simulated argv""" + self.__DeclareSomeFlags() + tmp_files = self._SetupTestFiles() + # specify our temp file on the fake cmd line + fake_cmd_line = ('fooScript --UnitTestNumber=77 --flagfile=%s' + % tmp_files[1]) + fake_argv = fake_cmd_line.split(' ') + + expected_results = ['fooScript', + '--UnitTestMessage1=tempFile1!', + '--UnitTestNumber=54321', + '--noUnitTestBoolFlag', + '--UnitTestMessage2=setFromTempFile2', + '--UnitTestNumber=6789a', + '--UnitTestNumber=77'] + test_results = FLAGS.ReadFlagsFromFiles(fake_argv) + self.assertEqual(expected_results, test_results) + self._RemoveTestFiles(tmp_files) + self._UndeclareSomeFlags() + # end testThree def + + def testMethod_flagfiles_4(self): + """Tests parsing self-referential files + arguments of simulated argv. + This test should print a warning to stderr of some sort. + """ + self.__DeclareSomeFlags() + tmp_files = self._SetupTestFiles() + # specify our temp file on the fake cmd line + fake_cmd_line = ('fooScript --flagfile=%s --noUnitTestBoolFlag' + % tmp_files[2]) + fake_argv = fake_cmd_line.split(' ') + expected_results = ['fooScript', + '--UnitTestMessage1=setFromTempFile3', + '--UnitTestBoolFlag', + '--noUnitTestBoolFlag' ] + + test_results = FLAGS.ReadFlagsFromFiles(fake_argv) + self.assertEqual(expected_results, test_results) + self._RemoveTestFiles(tmp_files) + self._UndeclareSomeFlags() + + def test_flagfiles_user_path_expansion(self): + """Test that user directory referenced paths (ie. ~/foo) are correctly + expanded. This test depends on whatever account's running the unit test + to have read/write access to their own home directory, otherwise it'll + FAIL. + """ + self.__DeclareSomeFlags() + fake_flagfile_item_style_1 = '--flagfile=~/foo.file' + fake_flagfile_item_style_2 = '-flagfile=~/foo.file' + + expected_results = os.path.expanduser('~/foo.file') + + test_results = FLAGS.ExtractFilename(fake_flagfile_item_style_1) + self.assertEqual(expected_results, test_results) + + test_results = FLAGS.ExtractFilename(fake_flagfile_item_style_2) + self.assertEqual(expected_results, test_results) + + self._UndeclareSomeFlags() + + # end testFour def + + def test_no_touchy_non_flags(self): + """ + Test that the flags parser does not mutilate arguments which are + not supposed to be flags + """ + self.__DeclareSomeFlags() + fake_argv = ['fooScript', '--UnitTestBoolFlag', + 'command', '--command_arg1', '--UnitTestBoom', '--UnitTestB'] + argv = FLAGS(fake_argv) + self.assertEqual(argv, fake_argv[:1] + fake_argv[2:]) + self._UndeclareSomeFlags() + + def test_SetDefault(self): + """ + Test changing flag defaults. + """ + self.__DeclareSomeFlags() + # Test that SetDefault changes both the default and the value, + # and that the value is changed when one is given as an option. + FLAGS['UnitTestMessage1'].SetDefault('New value') + self.assertEqual(FLAGS.UnitTestMessage1, 'New value') + self.assertEqual(FLAGS['UnitTestMessage1'].default_as_str,"'New value'") + FLAGS([ 'dummyscript', '--UnitTestMessage1=Newer value' ]) + self.assertEqual(FLAGS.UnitTestMessage1, 'Newer value') + + # Test that setting the default to None works correctly. + FLAGS['UnitTestNumber'].SetDefault(None) + self.assertEqual(FLAGS.UnitTestNumber, None) + self.assertEqual(FLAGS['UnitTestNumber'].default_as_str, None) + FLAGS([ 'dummyscript', '--UnitTestNumber=56' ]) + self.assertEqual(FLAGS.UnitTestNumber, 56) + + # Test that setting the default to zero works correctly. + FLAGS['UnitTestNumber'].SetDefault(0) + self.assertEqual(FLAGS.UnitTestNumber, 0) + self.assertEqual(FLAGS['UnitTestNumber'].default_as_str, "'0'") + FLAGS([ 'dummyscript', '--UnitTestNumber=56' ]) + self.assertEqual(FLAGS.UnitTestNumber, 56) + + # Test that setting the default to "" works correctly. + FLAGS['UnitTestMessage1'].SetDefault("") + self.assertEqual(FLAGS.UnitTestMessage1, "") + self.assertEqual(FLAGS['UnitTestMessage1'].default_as_str, "''") + FLAGS([ 'dummyscript', '--UnitTestMessage1=fifty-six' ]) + self.assertEqual(FLAGS.UnitTestMessage1, "fifty-six") + + # Test that setting the default to false works correctly. + FLAGS['UnitTestBoolFlag'].SetDefault(False) + self.assertEqual(FLAGS.UnitTestBoolFlag, False) + self.assertEqual(FLAGS['UnitTestBoolFlag'].default_as_str, "'false'") + FLAGS([ 'dummyscript', '--UnitTestBoolFlag=true' ]) + self.assertEqual(FLAGS.UnitTestBoolFlag, True) + + # Test that setting a list default works correctly. + FLAGS['UnitTestList'].SetDefault('4,5,6') + self.assertEqual(FLAGS.UnitTestList, ['4', '5', '6']) + self.assertEqual(FLAGS['UnitTestList'].default_as_str, "'4,5,6'") + FLAGS([ 'dummyscript', '--UnitTestList=7,8,9' ]) + self.assertEqual(FLAGS.UnitTestList, ['7', '8', '9']) + + # Test that setting invalid defaults raises exceptions + self.assertRaises(flags.IllegalFlagValue, + FLAGS['UnitTestNumber'].SetDefault, 'oops') + self.assertRaises(flags.IllegalFlagValue, + FLAGS['UnitTestNumber'].SetDefault, -1) + self.assertRaises(flags.IllegalFlagValue, + FLAGS['UnitTestBoolFlag'].SetDefault, 'oops') + + self._UndeclareSomeFlags() + + def testMethod_ShortestUniquePrefixes(self): + """ + Test FlagValues.ShortestUniquePrefixes + """ + flags.DEFINE_string('a', '', '') + flags.DEFINE_string('abc', '', '') + flags.DEFINE_string('common_a_string', '', '') + flags.DEFINE_boolean('common_b_boolean', 0, '') + flags.DEFINE_boolean('common_c_boolean', 0, '') + flags.DEFINE_boolean('common', 0, '') + flags.DEFINE_integer('commonly', 0, '') + flags.DEFINE_boolean('zz', 0, '') + flags.DEFINE_integer('nozz', 0, '') + + shorter_flags = FLAGS.ShortestUniquePrefixes(FLAGS.FlagDict()) + + expected_results = {'nocommon_b_boolean': 'nocommon_b', + 'common_c_boolean': 'common_c', + 'common_b_boolean': 'common_b', + 'a': 'a', + 'abc': 'ab', + 'zz': 'z', + 'nozz': 'nozz', + 'common_a_string': 'common_a', + 'commonly': 'commonl', + 'nocommon_c_boolean': 'nocommon_c', + 'nocommon': 'nocommon', + 'common': 'common'} + + for name, shorter in expected_results.iteritems(): + self.assertEquals(shorter_flags[name], shorter) + + FLAGS.__delattr__('a') + FLAGS.__delattr__('abc') + FLAGS.__delattr__('common_a_string') + FLAGS.__delattr__('common_b_boolean') + FLAGS.__delattr__('common_c_boolean') + FLAGS.__delattr__('common') + FLAGS.__delattr__('commonly') + FLAGS.__delattr__('zz') + FLAGS.__delattr__('nozz') + + def test_twodasharg_first(self): + flags.DEFINE_string("twodash_name", "Bob", "namehelp") + flags.DEFINE_string("twodash_blame", "Rob", "blamehelp") + argv = ('./program', + '--', + '--twodash_name=Harry') + argv = FLAGS(argv) + self.assertEqual('Bob', FLAGS.twodash_name) + self.assertEqual(argv[1], '--twodash_name=Harry') + + def test_twodasharg_middle(self): + flags.DEFINE_string("twodash2_name", "Bob", "namehelp") + flags.DEFINE_string("twodash2_blame", "Rob", "blamehelp") + argv = ('./program', + '--twodash2_blame=Larry', + '--', + '--twodash2_name=Harry') + argv = FLAGS(argv) + self.assertEqual('Bob', FLAGS.twodash2_name) + self.assertEqual('Larry', FLAGS.twodash2_blame) + self.assertEqual(argv[1], '--twodash2_name=Harry') + + def test_onedasharg_first(self): + flags.DEFINE_string("onedash_name", "Bob", "namehelp") + flags.DEFINE_string("onedash_blame", "Rob", "blamehelp") + argv = ('./program', + '-', + '--onedash_name=Harry') + argv = FLAGS(argv) + self.assertEqual(argv[1], '-') + # TODO(csilvers): we should still parse --onedash_name=Harry as a + # flag, but currently we don't (we stop flag processing as soon as + # we see the first non-flag). + + def test_unrecognized_flags(self): + # Unknown flag --nosuchflag + try: + argv = ('./program', '--nosuchflag', '--name=Bob', 'extra') + FLAGS(argv) + raise AssertionError("Unknown flag exception not raised") + except flags.UnrecognizedFlag, e: + assert e.flagname == 'nosuchflag' + + # Unknown flag -w (short option) + try: + argv = ('./program', '-w', '--name=Bob', 'extra') + FLAGS(argv) + raise AssertionError("Unknown flag exception not raised") + except flags.UnrecognizedFlag, e: + assert e.flagname == 'w' + + # Unknown flag --nosuchflagwithparam=foo + try: + argv = ('./program', '--nosuchflagwithparam=foo', '--name=Bob', 'extra') + FLAGS(argv) + raise AssertionError("Unknown flag exception not raised") + except flags.UnrecognizedFlag, e: + assert e.flagname == 'nosuchflagwithparam' + + # Allow unknown flag --nosuchflag if specified with undefok + argv = ('./program', '--nosuchflag', '--name=Bob', + '--undefok=nosuchflag', 'extra') + argv = FLAGS(argv) + assert len(argv) == 2, "wrong number of arguments pulled" + assert argv[0]=='./program', "program name not preserved" + assert argv[1]=='extra', "extra argument not preserved" + + # Allow unknown flag --noboolflag if undefok=boolflag is specified + argv = ('./program', '--noboolflag', '--name=Bob', + '--undefok=boolflag', 'extra') + argv = FLAGS(argv) + assert len(argv) == 2, "wrong number of arguments pulled" + assert argv[0]=='./program', "program name not preserved" + assert argv[1]=='extra', "extra argument not preserved" + + # But not if the flagname is misspelled: + try: + argv = ('./program', '--nosuchflag', '--name=Bob', + '--undefok=nosuchfla', 'extra') + FLAGS(argv) + raise AssertionError("Unknown flag exception not raised") + except flags.UnrecognizedFlag, e: + assert e.flagname == 'nosuchflag' + + try: + argv = ('./program', '--nosuchflag', '--name=Bob', + '--undefok=nosuchflagg', 'extra') + FLAGS(argv) + raise AssertionError("Unknown flag exception not raised") + except flags.UnrecognizedFlag: + assert e.flagname == 'nosuchflag' + + # Allow unknown short flag -w if specified with undefok + argv = ('./program', '-w', '--name=Bob', '--undefok=w', 'extra') + argv = FLAGS(argv) + assert len(argv) == 2, "wrong number of arguments pulled" + assert argv[0]=='./program', "program name not preserved" + assert argv[1]=='extra', "extra argument not preserved" + + # Allow unknown flag --nosuchflagwithparam=foo if specified + # with undefok + argv = ('./program', '--nosuchflagwithparam=foo', '--name=Bob', + '--undefok=nosuchflagwithparam', 'extra') + argv = FLAGS(argv) + assert len(argv) == 2, "wrong number of arguments pulled" + assert argv[0]=='./program', "program name not preserved" + assert argv[1]=='extra', "extra argument not preserved" + + # Even if undefok specifies multiple flags + argv = ('./program', '--nosuchflag', '-w', '--nosuchflagwithparam=foo', + '--name=Bob', + '--undefok=nosuchflag,w,nosuchflagwithparam', + 'extra') + argv = FLAGS(argv) + assert len(argv) == 2, "wrong number of arguments pulled" + assert argv[0]=='./program', "program name not preserved" + assert argv[1]=='extra', "extra argument not preserved" + + # However, not if undefok doesn't specify the flag + try: + argv = ('./program', '--nosuchflag', '--name=Bob', + '--undefok=another_such', 'extra') + FLAGS(argv) + raise AssertionError("Unknown flag exception not raised") + except flags.UnrecognizedFlag, e: + assert e.flagname == 'nosuchflag' + + # Make sure --undefok doesn't mask other option errors. + try: + # Provide an option requiring a parameter but not giving it one. + argv = ('./program', '--undefok=name', '--name') + FLAGS(argv) + raise AssertionError("Missing option parameter exception not raised") + except flags.UnrecognizedFlag: + raise AssertionError("Wrong kind of error exception raised") + except flags.FlagsError: + pass + + # Test --undefok <list> + argv = ('./program', '--nosuchflag', '-w', '--nosuchflagwithparam=foo', + '--name=Bob', + '--undefok', + 'nosuchflag,w,nosuchflagwithparam', + 'extra') + argv = FLAGS(argv) + assert len(argv) == 2, "wrong number of arguments pulled" + assert argv[0]=='./program', "program name not preserved" + assert argv[1]=='extra', "extra argument not preserved" + + def test_nonglobal_flags(self): + """Test use of non-global FlagValues""" + nonglobal_flags = flags.FlagValues() + flags.DEFINE_string("nonglobal_flag", "Bob", "flaghelp", nonglobal_flags) + argv = ('./program', + '--nonglobal_flag=Mary', + 'extra') + argv = nonglobal_flags(argv) + assert len(argv) == 2, "wrong number of arguments pulled" + assert argv[0]=='./program', "program name not preserved" + assert argv[1]=='extra', "extra argument not preserved" + assert nonglobal_flags['nonglobal_flag'].value == 'Mary' + + def test_unrecognized_nonglobal_flags(self): + """Test unrecognized non-global flags""" + nonglobal_flags = flags.FlagValues() + argv = ('./program', + '--nosuchflag') + try: + argv = nonglobal_flags(argv) + raise AssertionError("Unknown flag exception not raised") + except flags.UnrecognizedFlag, e: + assert e.flagname == 'nosuchflag' + pass + + argv = ('./program', + '--nosuchflag', + '--undefok=nosuchflag') + + argv = nonglobal_flags(argv) + assert len(argv) == 1, "wrong number of arguments pulled" + assert argv[0]=='./program', "program name not preserved" + + def test_main_module_help(self): + """Test MainModuleHelp()""" + help = FLAGS.MainModuleHelp() + + # When this test is invoked on behalf of flags_unittest_2_2, + # the main module has not defined any flags. Since there's + # no easy way to run this script in our test environment + # directly from python2.2, don't bother to test the output + # of MainModuleHelp() in that scenario. + if sys.version.startswith('2.2.'): + return + + expected_help = "\n" + sys.argv[0] + ':' + """ + --[no]debug: debughelp + (default: 'false') + -u,--[no]dup1: runhelp d12 + (default: 'true') + -u,--[no]dup2: runhelp d22 + (default: 'true') + -u,--[no]dup3: runhelp d32 + (default: 'true') + --[no]dup4: runhelp d41 + (default: 'false') + -?,--[no]help: show this help + --[no]helpshort: show usage only for this module + --kwery: <who|what|why|where|when>: ? + --l: how long to be + (default: '9223372032559808512') + (an integer) + --letters: a list of letters + (default: 'a,b,c') + (a comma separated list) + -m,--m_str: string option that can occur multiple times; + repeat this option to specify a list of values + (default: "['def1', 'def2']") + --name: namehelp + (default: 'Bob') + --[no]noexec: boolean flag with no as prefix + (default: 'true') + --[no]q: quiet mode + (default: 'true') + --[no]quack: superstring of 'q' + (default: 'false') + -r,--repeat: how many times to repeat (0-5) + (default: '4') + (a non-negative integer) + -s,--s_str: string option that can occur multiple times; + repeat this option to specify a list of values + (default: "['sing1']") + --[no]test0: test boolean parsing + --[no]test1: test boolean parsing + --[no]testget1: test parsing with defaults + --[no]testget2: test parsing with defaults + --[no]testget3: test parsing with defaults + --testget4: test parsing with defaults + (an integer) + --testlist: test lists parsing + (default: '') + (a comma separated list) + --[no]testnone: test boolean parsing + --testspacelist: tests space lists parsing + (default: '') + (a whitespace separated list) + --x: how eXtreme to be + (default: '3') + (an integer) + -z,--[no]zoom1: runhelp z1 + (default: 'false')""" + + if not MultiLineEqual(expected_help, help): + self.fail() + + def test_create_flag_errors(self): + # Since the exception classes are exposed, nothing stops users + # from creating their own instances. This test makes sure that + # people modifying the flags module understand that the external + # mechanisms for creating the exceptions should continue to work. + e = flags.FlagsError() + e = flags.FlagsError("message") + e = flags.DuplicateFlag() + e = flags.DuplicateFlag("message") + e = flags.IllegalFlagValue() + e = flags.IllegalFlagValue("message") + e = flags.UnrecognizedFlag() + e = flags.UnrecognizedFlag("message") + + def testFlagValuesDelAttr(self): + """Checks that del FLAGS.flag_id works.""" + default_value = 'default value for testFlagValuesDelAttr' + # 1. Declare and delete a flag with no short name. + flags.DEFINE_string('delattr_foo', default_value, 'A simple flag.') + self.assertEquals(FLAGS.delattr_foo, default_value) + flag_obj = FLAGS['delattr_foo'] + # We also check that _FlagIsRegistered works as expected :) + self.assertTrue(FLAGS._FlagIsRegistered(flag_obj)) + del FLAGS.delattr_foo + self.assertFalse('delattr_foo' in FLAGS.FlagDict()) + self.assertFalse(FLAGS._FlagIsRegistered(flag_obj)) + # If the previous del FLAGS.delattr_foo did not work properly, the + # next definition will trigger a redefinition error. + flags.DEFINE_integer('delattr_foo', 3, 'A simple flag.') + del FLAGS.delattr_foo + + self.assertFalse('delattr_foo' in FLAGS.RegisteredFlags()) + + # 2. Declare and delete a flag with a short name. + flags.DEFINE_string('delattr_bar', default_value, 'flag with short name', + short_name='x5') + flag_obj = FLAGS['delattr_bar'] + self.assertTrue(FLAGS._FlagIsRegistered(flag_obj)) + del FLAGS.x5 + self.assertTrue(FLAGS._FlagIsRegistered(flag_obj)) + del FLAGS.delattr_bar + self.assertFalse(FLAGS._FlagIsRegistered(flag_obj)) + + # 3. Just like 2, but del FLAGS.name last + flags.DEFINE_string('delattr_bar', default_value, 'flag with short name', + short_name='x5') + flag_obj = FLAGS['delattr_bar'] + self.assertTrue(FLAGS._FlagIsRegistered(flag_obj)) + del FLAGS.delattr_bar + self.assertTrue(FLAGS._FlagIsRegistered(flag_obj)) + del FLAGS.x5 + self.assertFalse(FLAGS._FlagIsRegistered(flag_obj)) + + self.assertFalse('delattr_bar' in FLAGS.RegisteredFlags()) + self.assertFalse('x5' in FLAGS.RegisteredFlags()) + + def _GetNamesOfDefinedFlags(self, module, flag_values=FLAGS): + """Returns the list of names of flags defined by a module. + + Auxiliary for the testKeyFlags* methods. + + Args: + module: A module object or a string module name. + flag_values: A FlagValues object. + + Returns: + A list of strings. + """ + return [f.name for f in flag_values._GetFlagsDefinedByModule(module)] + + def _GetNamesOfKeyFlags(self, module, flag_values=FLAGS): + """Returns the list of names of key flags for a module. + + Auxiliary for the testKeyFlags* methods. + + Args: + module: A module object or a string module name. + flag_values: A FlagValues object. + + Returns: + A list of strings. + """ + return [f.name for f in flag_values._GetKeyFlagsForModule(module)] + + def testKeyFlags(self): + # Before starting any testing, make sure no flags are already + # defined for module_foo and module_bar. + self.assertListEqual(self._GetNamesOfKeyFlags(module_foo), []) + self.assertListEqual(self._GetNamesOfKeyFlags(module_bar), []) + self.assertListEqual(self._GetNamesOfDefinedFlags(module_foo), []) + self.assertListEqual(self._GetNamesOfDefinedFlags(module_bar), []) + + try: + # Defines a few flags in module_foo and module_bar. + module_foo.DefineFlags() + + # Part 1. Check that all flags defined by module_foo are key for + # that module, and similarly for module_bar. + for module in [module_foo, module_bar]: + self.assertListEqual(FLAGS._GetFlagsDefinedByModule(module), + FLAGS._GetKeyFlagsForModule(module)) + # Also check that each module defined the expected flags. + self.assertListEqual(self._GetNamesOfDefinedFlags(module), + module.NamesOfDefinedFlags()) + + # Part 2. Check that flags.DECLARE_key_flag works fine. + # Declare that some flags from module_bar are key for + # module_foo. + module_foo.DeclareKeyFlags() + + # Check that module_foo has the expected list of defined flags. + self.assertListEqual(self._GetNamesOfDefinedFlags(module_foo), + module_foo.NamesOfDefinedFlags()) + + # Check that module_foo has the expected list of key flags. + self.assertListEqual(self._GetNamesOfKeyFlags(module_foo), + module_foo.NamesOfDeclaredKeyFlags()) + + # Part 3. Check that flags.ADOPT_module_key_flags works fine. + # Trigger a call to flags.ADOPT_module_key_flags(module_bar) + # inside module_foo. This should declare a few more key + # flags in module_foo. + module_foo.DeclareExtraKeyFlags() + + # Check that module_foo has the expected list of key flags. + self.assertListEqual(self._GetNamesOfKeyFlags(module_foo), + module_foo.NamesOfDeclaredKeyFlags() + + module_foo.NamesOfDeclaredExtraKeyFlags()) + finally: + module_foo.RemoveFlags() + + def testKeyFlagsWithNonDefaultFlagValuesObject(self): + # Check that key flags work even when we use a FlagValues object + # that is not the default flags.FLAGS object. Otherwise, this + # test is similar to testKeyFlags, but it uses only module_bar. + # The other test module (module_foo) uses only the default values + # for the flag_values keyword arguments. This way, testKeyFlags + # and this method test both the default FlagValues, the explicitly + # specified one, and a mixed usage of the two. + + # A brand-new FlagValues object, to use instead of flags.FLAGS. + fv = flags.FlagValues() + + # Before starting any testing, make sure no flags are already + # defined for module_foo and module_bar. + self.assertListEqual( + self._GetNamesOfKeyFlags(module_bar, flag_values=fv), + []) + self.assertListEqual( + self._GetNamesOfDefinedFlags(module_bar, flag_values=fv), + []) + + module_bar.DefineFlags(flag_values=fv) + + # Check that all flags defined by module_bar are key for that + # module, and that module_bar defined the expected flags. + self.assertListEqual(fv._GetFlagsDefinedByModule(module_bar), + fv._GetKeyFlagsForModule(module_bar)) + self.assertListEqual( + self._GetNamesOfDefinedFlags(module_bar, flag_values=fv), + module_bar.NamesOfDefinedFlags()) + + # Pick two flags from module_bar, declare them as key for the + # current (i.e., main) module (via flags.DECLARE_key_flag), and + # check that we get the expected effect. The important thing is + # that we always use flags_values=fv (instead of the default + # FLAGS). + main_module = flags._GetMainModule() + names_of_flags_defined_by_bar = module_bar.NamesOfDefinedFlags() + flag_name_0 = names_of_flags_defined_by_bar[0] + flag_name_2 = names_of_flags_defined_by_bar[2] + + flags.DECLARE_key_flag(flag_name_0, flag_values=fv) + self.assertListEqual( + self._GetNamesOfKeyFlags(main_module, flag_values=fv), + [flag_name_0]) + + flags.DECLARE_key_flag(flag_name_2, flag_values=fv) + self.assertListEqual( + self._GetNamesOfKeyFlags(main_module, flag_values=fv), + [flag_name_0, flag_name_2]) + + flags.ADOPT_module_key_flags(module_bar, flag_values=fv) + key_flags = self._GetNamesOfKeyFlags(main_module, flag_values=fv) + # Order is irrelevant; hence, we sort both lists before comparison. + key_flags.sort() + names_of_flags_defined_by_bar.sort() + self.assertListEqual(key_flags, names_of_flags_defined_by_bar) + + def testMainModuleHelpWithKeyFlags(self): + # Similar to test_main_module_help, but this time we make sure to + # declare some key flags. + try: + help_flag_help = ( + " -?,--[no]help: show this help\n" + " --[no]helpshort: show usage only for this module") + + expected_help = "\n%s:\n%s" % (sys.argv[0], help_flag_help) + + # Safety check that the main module does not declare any flags + # at the beginning of this test. + self.assertMultiLineEqual(expected_help, FLAGS.MainModuleHelp()) + + # Define one flag in this main module and some flags in modules + # a and b. Also declare one flag from module a and one flag + # from module b as key flags for the main module. + flags.DEFINE_integer('main_module_int_fg', 1, + 'Integer flag in the main module.') + + main_module_int_fg_help = ( + " --main_module_int_fg: Integer flag in the main module.\n" + " (default: '1')\n" + " (an integer)") + + expected_help += "\n" + main_module_int_fg_help + self.assertMultiLineEqual(expected_help, FLAGS.MainModuleHelp()) + + # The following call should be a no-op: any flag declared by a + # module is automatically key for that module. + flags.DECLARE_key_flag('main_module_int_fg') + self.assertMultiLineEqual(expected_help, FLAGS.MainModuleHelp()) + + # The definition of a few flags in an imported module should not + # change the main module help. + module_foo.DefineFlags() + self.assertMultiLineEqual(expected_help, FLAGS.MainModuleHelp()) + + flags.DECLARE_key_flag('tmod_foo_bool') + tmod_foo_bool_help = ( + " --[no]tmod_foo_bool: Boolean flag from module foo.\n" + " (default: 'true')") + expected_help += "\n" + tmod_foo_bool_help + self.assertMultiLineEqual(expected_help, FLAGS.MainModuleHelp()) + + flags.DECLARE_key_flag('tmod_bar_z') + tmod_bar_z_help = ( + " --[no]tmod_bar_z: Another boolean flag from module bar.\n" + " (default: 'false')") + # Unfortunately, there is some flag sorting inside + # MainModuleHelp, so we can't keep incrementally extending + # the expected_help string ... + expected_help = ("\n%s:\n%s\n%s\n%s\n%s" % + (sys.argv[0], + help_flag_help, + main_module_int_fg_help, + tmod_bar_z_help, + tmod_foo_bool_help)) + self.assertMultiLineEqual(FLAGS.MainModuleHelp(), expected_help) + + finally: + # At the end, delete all the flag information we created. + FLAGS.__delattr__('main_module_int_fg') + module_foo.RemoveFlags() + + def test_ADOPT_module_key_flags(self): + # Check that ADOPT_module_key_flags raises an exception when + # called with a module name (as opposed to a module object). + self.assertRaises(flags.FlagsError, + flags.ADOPT_module_key_flags, + 'google3.pyglib.app') + + def test_GetCallingModule(self): + self.assertEqual(flags._GetCallingModule(), sys.argv[0]) + self.assertEqual( + module_foo.GetModuleName(), + 'google3.pyglib.tests.flags_modules_for_testing.module_foo') + self.assertEqual( + module_bar.GetModuleName(), + 'google3.pyglib.tests.flags_modules_for_testing.module_bar') + + # We execute the following exec statements for their side-effect + # (i.e., not raising an error). They emphasize the case that not + # all code resides in one of the imported modules: Python is a + # really dynamic language, where we can dynamically construct some + # code and execute it. + code = ("from google3.pyglib import flags\n" + "module_name = flags._GetCallingModule()") + exec code + + # Next two exec statements executes code with a global environment + # that is different from the global environment of any imported + # module. + exec code in {} + # vars(self) returns a dictionary corresponding to the symbol + # table of the self object. dict(...) makes a distinct copy of + # this dictionary, such that any new symbol definition by the + # exec-ed code (e.g., import flags, module_name = ...) does not + # affect the symbol table of self. + exec code in dict(vars(self)) + + # Next test is actually more involved: it checks not only that + # _GetCallingModule does not crash inside exec code, it also checks + # that it returns the expected value: the code executed via exec + # code is treated as being executed by the current module. We + # check it twice: first time by executing exec from the main + # module, second time by executing it from module_bar. + global_dict = {} + exec code in global_dict + self.assertEqual(global_dict['module_name'], + sys.argv[0]) + + global_dict = {} + module_bar.ExecuteCode(code, global_dict) + self.assertEqual( + global_dict['module_name'], + 'google3.pyglib.tests.flags_modules_for_testing.module_bar') + + +def main(): + unittest.main() + + +if __name__ == '__main__': + main() diff --git a/dtm_release/lib/util/gflags-1.1/python/setup.py b/dtm_release/lib/util/gflags-1.1/python/setup.py new file mode 100755 index 0000000000000000000000000000000000000000..f82c4fb1f5da8975262c9cd358cd770827912071 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/python/setup.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python + +# Copyright (c) 2007, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +from distutils.core import setup + +setup(name='gflags', + version='0.8', + description='Google Commandline Flags Module', + license='BSD', + author='Google Inc.', + author_email='opensource@google.com', + url='http://code.google.com/p/google-gflags', + py_modules=["gflags"], + data_files=[("bin", ["gflags2man.py"])]) diff --git a/dtm_release/lib/util/gflags-1.1/python/test_module_bar.py b/dtm_release/lib/util/gflags-1.1/python/test_module_bar.py new file mode 100755 index 0000000000000000000000000000000000000000..55541ff762153638904acc7957a3ee23b9abcc95 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/python/test_module_bar.py @@ -0,0 +1,135 @@ +#!/usr/bin/env python + +# Copyright (c) 2009, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Auxiliary module for testing flags.py. + +The purpose of this module is to define a few flags. We want to make +sure the unit tests for flags.py involve more than one module. +""" + +__author__ = 'Alex Salcianu' + +__pychecker__ = "no-local" # for unittest + +# We use the name 'flags' internally in this test, for historical reasons. +# Don't do this yourself! :-) Just do 'import gflags; FLAGS=gflags.FLAGS; etc' +import gflags as flags +FLAGS = flags.FLAGS + + +def DefineFlags(flag_values=FLAGS): + """Defines some flags. + + Args: + flag_values: The FlagValues object we want to register the flags + with. + """ + # The 'tmod_bar_' prefix (short for 'test_module_bar') ensures there + # is no name clash with the existing flags. + flags.DEFINE_boolean('tmod_bar_x', True, 'Boolean flag.', + flag_values=flag_values) + flags.DEFINE_string('tmod_bar_y', 'default', 'String flag.', + flag_values=flag_values) + flags.DEFINE_boolean('tmod_bar_z', False, + 'Another boolean flag from module bar.', + flag_values=flag_values) + flags.DEFINE_integer('tmod_bar_t', 4, 'Sample int flag.', + flag_values=flag_values) + flags.DEFINE_integer('tmod_bar_u', 5, 'Sample int flag.', + flag_values=flag_values) + flags.DEFINE_integer('tmod_bar_v', 6, 'Sample int flag.', + flag_values=flag_values) + + +def RemoveOneFlag(flag_name, flag_values=FLAGS): + """Removes the definition of one flag from flags.FLAGS. + + Note: if the flag is not defined in flags.FLAGS, this function does + not do anything (in particular, it does not raise any exception). + + Motivation: We use this function for cleanup *after* a test: if + there was a failure during a test and not all flags were declared, + we do not want the cleanup code to crash. + + Args: + flag_name: A string, the name of the flag to delete. + flag_values: The FlagValues object we remove the flag from. + """ + if flag_name in flag_values.FlagDict(): + flag_values.__delattr__(flag_name) + + +def NamesOfDefinedFlags(): + """Returns: List of names of the flags declared in this module.""" + return ['tmod_bar_x', + 'tmod_bar_y', + 'tmod_bar_z', + 'tmod_bar_t', + 'tmod_bar_u', + 'tmod_bar_v'] + + +def RemoveFlags(flag_values=FLAGS): + """Deletes the flag definitions done by the above DefineFlags(). + + Args: + flag_values: The FlagValues object we remove the flags from. + """ + for flag_name in NamesOfDefinedFlags(): + RemoveOneFlag(flag_name, flag_values=flag_values) + + +def GetModuleName(): + """Uses flags._GetCallingModule() to return the name of this module. + + For checking that _GetCallingModule works as expected. + + Returns: + A string, the name of this module. + """ + # Calling the protected _GetCallingModule generates a lint warning, + # but we do not have any other alternative to test that function. + return flags._GetCallingModule() + + +def ExecuteCode(code, global_dict): + """Executes some code in a given global environment. + + For testing of _GetCallingModule. + + Args: + code: A string, the code to be executed. + global_dict: A dictionary, the global environment that code should + be executed in. + """ + # Indeed, using exec generates a lint warning. But some user code + # actually uses exec, and we have to test for it ... + exec code in global_dict diff --git a/dtm_release/lib/util/gflags-1.1/python/test_module_foo.py b/dtm_release/lib/util/gflags-1.1/python/test_module_foo.py new file mode 100755 index 0000000000000000000000000000000000000000..9f2ab49e15885f9e17389ce2f8add966aba13573 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/python/test_module_foo.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python + +# Copyright (c) 2009, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Auxiliary module for testing flags.py. + +The purpose of this module is to define a few flags, and declare some +other flags as being important. We want to make sure the unit tests +for flags.py involve more than one module. +""" + +__author__ = 'Alex Salcianu' + +__pychecker__ = "no-local" # for unittest + +# We use the name 'flags' internally in this test, for historical reasons. +# Don't do this yourself! :-) Just do 'import gflags; FLAGS=gflags.FLAGS; etc' +import gflags as flags +FLAGS = flags.FLAGS + +# For historical reasons we use the name module_bar instead of test_module_bar. +import test_module_bar as module_bar + +DECLARED_KEY_FLAGS = ['tmod_bar_x', 'tmod_bar_z', 'tmod_bar_t'] + + +def DefineFlags(): + """Defines a few flags.""" + module_bar.DefineFlags() + # The 'tmod_foo_' prefix (short for 'test_module_foo') ensures that we + # have no name clash with existing flags. + flags.DEFINE_boolean('tmod_foo_bool', True, 'Boolean flag from module foo.') + flags.DEFINE_string('tmod_foo_str', 'default', 'String flag.') + flags.DEFINE_integer('tmod_foo_int', 3, 'Sample int flag.') + + +def DeclareKeyFlags(): + """Declares a few key flags.""" + for flag_name in DECLARED_KEY_FLAGS: + flags.DECLARE_key_flag(flag_name) + + +def DeclareExtraKeyFlags(): + """Declares some extra key flags.""" + flags.ADOPT_module_key_flags(module_bar) + + +def NamesOfDefinedFlags(): + """Returns: list of names of flags defined by this module.""" + return ['tmod_foo_bool', 'tmod_foo_str', 'tmod_foo_int'] + + +def NamesOfDeclaredKeyFlags(): + """Returns: list of names of key flags for this module.""" + return NamesOfDefinedFlags() + DECLARED_KEY_FLAGS + + +def NamesOfDeclaredExtraKeyFlags(): + """Returns the list of names of additional key flags for this module. + + These are the flags that became key for this module only as a result + of a call to DeclareExtraKeyFlags() above. I.e., the flags declared + by module_bar, that were not already declared as key for this + module. + + Returns: + The list of names of additional key flags for this module. + """ + names_of_extra_key_flags = list(module_bar.NamesOfDefinedFlags()) + for flag_name in NamesOfDeclaredKeyFlags(): + while flag_name in names_of_extra_key_flags: + names_of_extra_key_flags.remove(flag_name) + return names_of_extra_key_flags + + +def RemoveFlags(): + """Deletes the flag definitions done by the above DefineFlags().""" + for flag_name in NamesOfDefinedFlags(): + module_bar.RemoveOneFlag(flag_name) + module_bar.RemoveFlags() + + +def GetModuleName(): + """Uses flags._GetCallingModule() to return the name of this module. + + For checking that _GetCallingModule works as expected. + + Returns: + A string, the name of this module. + """ + # Calling the protected _GetCallingModule generates a lint warning, + # but we do not have any other alternative to test that function. + return flags._GetCallingModule() diff --git a/dtm_release/lib/util/gflags-1.1/removed.files b/dtm_release/lib/util/gflags-1.1/removed.files new file mode 100644 index 0000000000000000000000000000000000000000..422272b83d011d35b45743229853c5b87760976a --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/removed.files @@ -0,0 +1,25 @@ +./src/solaris/libstdc++.la +./.libs/libgflags_la-gflags.o +./.libs/libgflags_la-gflags_reporting.o +./.libs/libgflags_la-gflags_completions.o +./.libs/libgflags_nothreads_la-gflags.o +./.libs/libgflags_nothreads_la-gflags_reporting.o +./.libs/libgflags_nothreads_la-gflags_completions.o +./libgflags.la +./libgflags_la-gflags_reporting.o +./libgflags_la-gflags.o +./libgflags_la-gflags.lo +./libgflags_nothreads.la +./libgflags_la-gflags_reporting.lo +./libgflags_la-gflags_completions.o +./libgflags_la-gflags_completions.lo +./libgflags_nothreads_la-gflags.o +./libgflags_nothreads_la-gflags.lo +./libgflags_nothreads_la-gflags_reporting.o +./libgflags_nothreads_la-gflags_reporting.lo +./libgflags_nothreads_la-gflags_completions.o +./libgflags_nothreads_la-gflags_completions.lo +./gflags_unittest-gflags_unittest.o +./gflags_unittest.o +./gflags_unittest-main.o +./gflags_unittest_main.o diff --git a/dtm_release/lib/util/gflags-1.1/src/config.h b/dtm_release/lib/util/gflags-1.1/src/config.h new file mode 100644 index 0000000000000000000000000000000000000000..570ded558352f2e4271e7f2f03ebd7403d55773c --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/src/config.h @@ -0,0 +1,90 @@ +/* src/config.h. Generated from config.h.in by configure. */ +/* src/config.h.in. Generated from configure.ac by autoheader. */ + +/* Namespace for Google classes */ +#define GOOGLE_NAMESPACE ::google + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the <fnmatch.h> header file. */ +#define HAVE_FNMATCH_H 1 + +/* Define to 1 if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H 1 + +/* define if the compiler implements namespaces */ +#define HAVE_NAMESPACES 1 + +/* Define if you have POSIX threads libraries and header files. */ +#define HAVE_PTHREAD 1 + +/* Define to 1 if you have the <stdint.h> header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the <strings.h> header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strtoll' function. */ +#define HAVE_STRTOLL 1 + +/* Define to 1 if you have the `strtoq' function. */ +#define HAVE_STRTOQ 1 + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + +/* define if your compiler has __attribute__ */ +#define HAVE___ATTRIBUTE__ 1 + +/* Name of package */ +#define PACKAGE "gflags" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "opensource@google.com" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "gflags" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "gflags 1.1" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "gflags" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.1" + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +/* #undef PTHREAD_CREATE_JOINABLE */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* the namespace where STL code like vector<> is defined */ +#define STL_NAMESPACE std + +/* Version number of package */ +#define VERSION "1.1" + +/* Stops putting the code inside the Google namespace */ +#define _END_GOOGLE_NAMESPACE_ } + +/* Puts following code inside the Google namespace */ +#define _START_GOOGLE_NAMESPACE_ namespace google { diff --git a/dtm_release/lib/util/gflags-1.1/src/config.h.in b/dtm_release/lib/util/gflags-1.1/src/config.h.in new file mode 100644 index 0000000000000000000000000000000000000000..3aa2f5a83d224b0ed238159016c04c35968dfc30 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/src/config.h.in @@ -0,0 +1,89 @@ +/* src/config.h.in. Generated from configure.ac by autoheader. */ + +/* Namespace for Google classes */ +#undef GOOGLE_NAMESPACE + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the <fnmatch.h> header file. */ +#undef HAVE_FNMATCH_H + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* define if the compiler implements namespaces */ +#undef HAVE_NAMESPACES + +/* Define if you have POSIX threads libraries and header files. */ +#undef HAVE_PTHREAD + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strtoll' function. */ +#undef HAVE_STRTOLL + +/* Define to 1 if you have the `strtoq' function. */ +#undef HAVE_STRTOQ + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* define if your compiler has __attribute__ */ +#undef HAVE___ATTRIBUTE__ + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +#undef PTHREAD_CREATE_JOINABLE + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* the namespace where STL code like vector<> is defined */ +#undef STL_NAMESPACE + +/* Version number of package */ +#undef VERSION + +/* Stops putting the code inside the Google namespace */ +#undef _END_GOOGLE_NAMESPACE_ + +/* Puts following code inside the Google namespace */ +#undef _START_GOOGLE_NAMESPACE_ diff --git a/dtm_release/lib/util/gflags-1.1/src/gflags.cc b/dtm_release/lib/util/gflags-1.1/src/gflags.cc new file mode 100644 index 0000000000000000000000000000000000000000..c2417c81151045acbc1c7a24bd4f89b37f514b67 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/src/gflags.cc @@ -0,0 +1,1897 @@ +// Copyright (c) 2006, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// Author: Ray Sidney +// Revamped and reorganized by Craig Silverstein +// +// This file contains the implementation of all our command line flags +// stuff. Here's how everything fits together +// +// * FlagRegistry owns CommandLineFlags owns FlagValue. +// * FlagSaver holds a FlagRegistry (saves it at construct time, +// restores it at destroy time). +// * CommandLineFlagParser lives outside that hierarchy, but works on +// CommandLineFlags (modifying the FlagValues). +// * Free functions like SetCommandLineOption() work via one of the +// above (such as CommandLineFlagParser). +// +// In more detail: +// +// -- The main classes that hold flag data: +// +// FlagValue holds the current value of a flag. It's +// pseudo-templatized: every operation on a FlagValue is typed. It +// also deals with storage-lifetime issues (so flag values don't go +// away in a destructor), which is why we need a whole class to hold a +// variable's value. +// +// CommandLineFlag is all the information about a single command-line +// flag. It has a FlagValue for the flag's current value, but also +// the flag's name, type, etc. +// +// FlagRegistry is a collection of CommandLineFlags. There's the +// global registry, which is where flags defined via DEFINE_foo() +// live. But it's possible to define your own flag, manually, in a +// different registry you create. (In practice, multiple registries +// are used only by FlagSaver). +// +// A given FlagValue is owned by exactly one CommandLineFlag. A given +// CommandLineFlag is owned by exactly one FlagRegistry. FlagRegistry +// has a lock; any operation that writes to a FlagValue or +// CommandLineFlag owned by that registry must acquire the +// FlagRegistry lock before doing so. +// +// --- Some other classes and free functions: +// +// CommandLineFlagInfo is a client-exposed version of CommandLineFlag. +// Once it's instantiated, it has no dependencies or relationships +// with any other part of this file. +// +// FlagRegisterer is the helper class used by the DEFINE_* macros to +// allow work to be done at global initialization time. +// +// CommandLineFlagParser is the class that reads from the commandline +// and instantiates flag values based on that. It needs to poke into +// the innards of the FlagValue->CommandLineFlag->FlagRegistry class +// hierarchy to do that. It's careful to acquire the FlagRegistry +// lock before doing any writing or other non-const actions. +// +// GetCommandLineOption is just a hook into registry routines to +// retrieve a flag based on its name. SetCommandLineOption, on the +// other hand, hooks into CommandLineFlagParser. Other API functions +// are, similarly, mostly hooks into the functionality described above. + +#include "config.h" +// This comes first to ensure we define __STDC_FORMAT_MACROS in time. +#ifdef HAVE_INTTYPES_H +#ifndef __STDC_FORMAT_MACROS +# define __STDC_FORMAT_MACROS 1 // gcc requires this to get PRId64, etc. +#endif +#include <inttypes.h> +#endif // HAVE_INTTYPES_H +#include <stdio.h> // for snprintf +#include <ctype.h> +#include <errno.h> +#include <stdio.h> +#include <stdarg.h> // For va_list and related operations +#include <string.h> +#include <assert.h> +#ifdef HAVE_FNMATCH_H +#include <fnmatch.h> +#endif // HAVE_FNMATCH_H +#include <iostream> // for cerr +#include <string> +#include <map> +#include <vector> +#include <utility> // for pair<> +#include <algorithm> +#include "gflags/gflags.h" +#include "mutex.h" + +#ifndef PATH_SEPARATOR +#define PATH_SEPARATOR '/' +#endif + +// Work properly if either strtoll or strtoq is on this system +#ifdef HAVE_STRTOLL +# define strtoint64 strtoll +# define strtouint64 strtoull +#elif HAVE_STRTOQ +# define strtoint64 strtoq +# define strtouint64 strtouq +#else +// Neither strtoll nor strtoq are defined. I hope strtol works! +# define strtoint64 strtol +# define strtouint64 strtoul +#endif + +// If we have inttypes.h, it will have defined PRId32/etc for us. If +// not, take our best guess. +#ifndef PRId32 +# define PRId32 "d" +#endif +#ifndef PRId64 +# define PRId64 "lld" +#endif +#ifndef PRIu64 +# define PRIu64 "llu" +#endif + +using std::string; +using std::map; +using std::vector; +using std::pair; +using std::cerr; +using std::sort; + +// Special flags, type 1: the 'recursive' flags. They set another flag's val. +DEFINE_string(flagfile, "", + "load flags from file"); +DEFINE_string(fromenv, "", + "set flags from the environment" + " [use 'export FLAGS_flag1=value']"); +DEFINE_string(tryfromenv, "", + "set flags from the environment if present"); + +// Special flags, type 2: the 'parsing' flags. They modify how we parse. +DEFINE_string(undefok, "", + "comma-separated list of flag names that it is okay to specify " + "on the command line even if the program does not define a flag " + "with that name. IMPORTANT: flags in this list that have " + "arguments MUST use the flag=value format"); + +_START_GOOGLE_NAMESPACE_ + +// The help message indicating that the commandline flag has been +// 'stripped'. It will not show up when doing "-help" and its +// variants. The flag is stripped if STRIP_FLAG_HELP is set to 1 +// before including gflags/gflags.h. + +// This is used by this file, and also in commandlineflags_reporting.cc +const char kStrippedFlagHelp[] = "\001\002\003\004 (unknown) \004\003\002\001"; + +// This is used by the unittest to test error-exit code +void (*commandlineflags_exitfunc)(int) = &exit; // from stdlib.h + +namespace { + +// There are also 'reporting' flags, in commandlineflags_reporting.cc. + +static const char kError[] = "ERROR: "; + +// Indicates that undefined options are to be ignored. +// Enables deferred processing of flags in dynamically loaded libraries. +static bool allow_command_line_reparsing = false; + +static bool logging_is_probably_set_up = false; + +// This is a 'prototype' validate-function. 'Real' validate +// functions, take a flag-value as an argument: ValidateFn(bool) or +// ValidateFn(uint64). However, for easier storage, we strip off this +// argument and then restore it when actually calling the function on +// a flag value. +typedef bool (*ValidateFnProto)(); + +// Whether we should die when reporting an error. +enum DieWhenReporting { DIE, DO_NOT_DIE }; + +// Report Error and exit if requested. +static void ReportError(DieWhenReporting should_die, const char* format, ...) { + va_list ap; + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + if (should_die == DIE) + commandlineflags_exitfunc(1); // almost certainly exit() +} + + +// -------------------------------------------------------------------- +// FlagValue +// This represent the value a single flag might have. The major +// functionality is to convert from a string to an object of a +// given type, and back. Thread-compatible. +// -------------------------------------------------------------------- + +class CommandLineFlag; +class FlagValue { + public: + FlagValue(void* valbuf, const char* type); + ~FlagValue(); + + bool ParseFrom(const char* spec); + string ToString() const; + + private: + friend class CommandLineFlag; // for many things, including Validate() + friend class GOOGLE_NAMESPACE::FlagSaverImpl; // calls New() + friend class FlagRegistry; // checks value_buffer_ for flags_by_ptr_ map + template <typename T> friend T GetFromEnv(const char*, const char*, T); + friend bool TryParseLocked(const CommandLineFlag*, FlagValue*, + const char*, string*); // for New(), CopyFrom() + + enum ValueType {FV_BOOL, FV_INT32, FV_INT64, FV_UINT64, FV_DOUBLE, FV_STRING}; + + const char* TypeName() const; + bool Equal(const FlagValue& x) const; + FlagValue* New() const; // creates a new one with default value + void CopyFrom(const FlagValue& x); + + // Calls the given validate-fn on value_buffer_, and returns + // whatever it returns. But first casts validate_fn_proto to a + // function that takes our value as an argument (eg void + // (*validate_fn)(bool) for a bool flag). + bool Validate(const char* flagname, ValidateFnProto validate_fn_proto) const; + + void* value_buffer_; // points to the buffer holding our data + ValueType type_; // how to interpret value_ + + FlagValue(const FlagValue&); // no copying! + void operator=(const FlagValue&); +}; + + +// This could be a templated method of FlagValue, but doing so adds to the +// size of the .o. Since there's no type-safety here anyway, macro is ok. +#define VALUE_AS(type) *reinterpret_cast<type*>(value_buffer_) +#define OTHER_VALUE_AS(fv, type) *reinterpret_cast<type*>(fv.value_buffer_) +#define SET_VALUE_AS(type, value) VALUE_AS(type) = (value) + +FlagValue::FlagValue(void* valbuf, const char* type) : value_buffer_(valbuf) { + if (strcmp(type, "bool") == 0) type_ = FV_BOOL; + else if (strcmp(type, "int32") == 0) type_ = FV_INT32; + else if (strcmp(type, "int64") == 0) type_ = FV_INT64; + else if (strcmp(type, "uint64") == 0) type_ = FV_UINT64; + else if (strcmp(type, "double") == 0) type_ = FV_DOUBLE; + else if (strcmp(type, "string") == 0) type_ = FV_STRING; + else assert(false); // Unknown typename +} + +FlagValue::~FlagValue() { + switch (type_) { + case FV_BOOL: delete reinterpret_cast<bool*>(value_buffer_); break; + case FV_INT32: delete reinterpret_cast<int32*>(value_buffer_); break; + case FV_INT64: delete reinterpret_cast<int64*>(value_buffer_); break; + case FV_UINT64: delete reinterpret_cast<uint64*>(value_buffer_); break; + case FV_DOUBLE: delete reinterpret_cast<double*>(value_buffer_); break; + case FV_STRING: delete reinterpret_cast<string*>(value_buffer_); break; + } +} + +bool FlagValue::ParseFrom(const char* value) { + if (type_ == FV_BOOL) { + const char* kTrue[] = { "1", "t", "true", "y", "yes" }; + const char* kFalse[] = { "0", "f", "false", "n", "no" }; + for (size_t i = 0; i < sizeof(kTrue)/sizeof(*kTrue); ++i) { + if (strcasecmp(value, kTrue[i]) == 0) { + SET_VALUE_AS(bool, true); + return true; + } else if (strcasecmp(value, kFalse[i]) == 0) { + SET_VALUE_AS(bool, false); + return true; + } + } + return false; // didn't match a legal input + + } else if (type_ == FV_STRING) { + SET_VALUE_AS(string, value); + return true; + } + + // OK, it's likely to be numeric, and we'll be using a strtoXXX method. + if (value[0] == '\0') // empty-string is only allowed for string type. + return false; + char* end; + // Leading 0x puts us in base 16. But leading 0 does not put us in base 8! + // It caused too many bugs when we had that behavior. + int base = 10; // by default + if (value[0] == '0' && (value[1] == 'x' || value[1] == 'X')) + base = 16; + errno = 0; + + switch (type_) { + case FV_INT32: { + const int64 r = strtoint64(value, &end, base); + if (errno || end != value + strlen(value)) return false; // bad parse + if (static_cast<int32>(r) != r) // worked, but number out of range + return false; + SET_VALUE_AS(int32, static_cast<int32>(r)); + return true; + } + case FV_INT64: { + const int64 r = strtoint64(value, &end, base); + if (errno || end != value + strlen(value)) return false; // bad parse + SET_VALUE_AS(int64, r); + return true; + } + case FV_UINT64: { + while (*value == ' ') value++; + if (*value == '-') return false; // negative number + const uint64 r = strtouint64(value, &end, base); + if (errno || end != value + strlen(value)) return false; // bad parse + SET_VALUE_AS(uint64, r); + return true; + } + case FV_DOUBLE: { + const double r = strtod(value, &end); + if (errno || end != value + strlen(value)) return false; // bad parse + SET_VALUE_AS(double, r); + return true; + } + default: { + assert(false); // unknown type + return false; + } + } +} + +string FlagValue::ToString() const { + char intbuf[64]; // enough to hold even the biggest number + switch (type_) { + case FV_BOOL: + return VALUE_AS(bool) ? "true" : "false"; + case FV_INT32: + snprintf(intbuf, sizeof(intbuf), "%"PRId32, VALUE_AS(int32)); + return intbuf; + case FV_INT64: + snprintf(intbuf, sizeof(intbuf), "%"PRId64, VALUE_AS(int64)); + return intbuf; + case FV_UINT64: + snprintf(intbuf, sizeof(intbuf), "%"PRIu64, VALUE_AS(uint64)); + return intbuf; + case FV_DOUBLE: + snprintf(intbuf, sizeof(intbuf), "%.17g", VALUE_AS(double)); + return intbuf; + case FV_STRING: + return VALUE_AS(string); + default: + assert(false); + return ""; // unknown type + } +} + +bool FlagValue::Validate(const char* flagname, + ValidateFnProto validate_fn_proto) const { + switch (type_) { + case FV_BOOL: + return reinterpret_cast<bool (*)(const char*, bool)>( + validate_fn_proto)(flagname, VALUE_AS(bool)); + case FV_INT32: + return reinterpret_cast<bool (*)(const char*, int32)>( + validate_fn_proto)(flagname, VALUE_AS(int32)); + case FV_INT64: + return reinterpret_cast<bool (*)(const char*, int64)>( + validate_fn_proto)(flagname, VALUE_AS(int64)); + case FV_UINT64: + return reinterpret_cast<bool (*)(const char*, uint64)>( + validate_fn_proto)(flagname, VALUE_AS(uint64)); + case FV_DOUBLE: + return reinterpret_cast<bool (*)(const char*, double)>( + validate_fn_proto)(flagname, VALUE_AS(double)); + case FV_STRING: + return reinterpret_cast<bool (*)(const char*, const string&)>( + validate_fn_proto)(flagname, VALUE_AS(string)); + default: + assert(false); // unknown type + return false; + } +} + +const char* FlagValue::TypeName() const { + switch (type_) { + case FV_BOOL: return "bool"; + case FV_INT32: return "int32"; + case FV_INT64: return "int64"; + case FV_UINT64: return "uint64"; + case FV_DOUBLE: return "double"; + case FV_STRING: return "string"; + default: assert(false); return ""; // unknown type + } +} + +bool FlagValue::Equal(const FlagValue& x) const { + if (type_ != x.type_) + return false; + switch (type_) { + case FV_BOOL: return VALUE_AS(bool) == OTHER_VALUE_AS(x, bool); + case FV_INT32: return VALUE_AS(int32) == OTHER_VALUE_AS(x, int32); + case FV_INT64: return VALUE_AS(int64) == OTHER_VALUE_AS(x, int64); + case FV_UINT64: return VALUE_AS(uint64) == OTHER_VALUE_AS(x, uint64); + case FV_DOUBLE: return VALUE_AS(double) == OTHER_VALUE_AS(x, double); + case FV_STRING: return VALUE_AS(string) == OTHER_VALUE_AS(x, string); + default: assert(false); return false; // unknown type + } +} + +FlagValue* FlagValue::New() const { + switch (type_) { + case FV_BOOL: return new FlagValue(new bool(false), "bool"); + case FV_INT32: return new FlagValue(new int32(0), "int32"); + case FV_INT64: return new FlagValue(new int64(0), "int64"); + case FV_UINT64: return new FlagValue(new uint64(0), "uint64"); + case FV_DOUBLE: return new FlagValue(new double(0.0), "double"); + case FV_STRING: return new FlagValue(new string, "string"); + default: assert(false); return NULL; // unknown type + } +} + +void FlagValue::CopyFrom(const FlagValue& x) { + assert(type_ == x.type_); + switch (type_) { + case FV_BOOL: SET_VALUE_AS(bool, OTHER_VALUE_AS(x, bool)); break; + case FV_INT32: SET_VALUE_AS(int32, OTHER_VALUE_AS(x, int32)); break; + case FV_INT64: SET_VALUE_AS(int64, OTHER_VALUE_AS(x, int64)); break; + case FV_UINT64: SET_VALUE_AS(uint64, OTHER_VALUE_AS(x, uint64)); break; + case FV_DOUBLE: SET_VALUE_AS(double, OTHER_VALUE_AS(x, double)); break; + case FV_STRING: SET_VALUE_AS(string, OTHER_VALUE_AS(x, string)); break; + default: assert(false); // unknown type + } +} + +// -------------------------------------------------------------------- +// CommandLineFlag +// This represents a single flag, including its name, description, +// default value, and current value. Mostly this serves as a +// struct, though it also knows how to register itself. +// All CommandLineFlags are owned by a (exactly one) +// FlagRegistry. If you wish to modify fields in this class, you +// should acquire the FlagRegistry lock for the registry that owns +// this flag. +// -------------------------------------------------------------------- + +class CommandLineFlag { + public: + // Note: we take over memory-ownership of current_val and default_val. + CommandLineFlag(const char* name, const char* help, const char* filename, + FlagValue* current_val, FlagValue* default_val); + ~CommandLineFlag(); + + const char* name() const { return name_; } + const char* help() const { return help_; } + const char* filename() const { return file_; } + const char* CleanFileName() const; // nixes irrelevant prefix such as homedir + string current_value() const { return current_->ToString(); } + string default_value() const { return defvalue_->ToString(); } + const char* type_name() const { return defvalue_->TypeName(); } + ValidateFnProto validate_function() const { return validate_fn_proto_; } + + void FillCommandLineFlagInfo(struct CommandLineFlagInfo* result); + + // If validate_fn_proto_ is non-NULL, calls it on value, returns result. + bool Validate(const FlagValue& value) const; + bool ValidateCurrent() const { return Validate(*current_); } + + private: + // for SetFlagLocked() and setting flags_by_ptr_ + friend class FlagRegistry; + friend class GOOGLE_NAMESPACE::FlagSaverImpl; // for cloning the values + friend bool GetCommandLineOption(const char*, string*, bool*); + // set validate_fn + friend bool AddFlagValidator(const void*, ValidateFnProto); + + // This copies all the non-const members: modified, processed, defvalue, etc. + void CopyFrom(const CommandLineFlag& src); + + void UpdateModifiedBit(); + + const char* const name_; // Flag name + const char* const help_; // Help message + const char* const file_; // Which file did this come from? + bool modified_; // Set after default assignment? + FlagValue* defvalue_; // Default value for flag + FlagValue* current_; // Current value for flag + // This is a casted, 'generic' version of validate_fn, which actually + // takes a flag-value as an arg (void (*validate_fn)(bool), say). + // When we pass this to current_->Validate(), it will cast it back to + // the proper type. This may be NULL to mean we have no validate_fn. + ValidateFnProto validate_fn_proto_; + + CommandLineFlag(const CommandLineFlag&); // no copying! + void operator=(const CommandLineFlag&); +}; + +CommandLineFlag::CommandLineFlag(const char* name, const char* help, + const char* filename, + FlagValue* current_val, FlagValue* default_val) + : name_(name), help_(help), file_(filename), modified_(false), + defvalue_(default_val), current_(current_val), validate_fn_proto_(NULL) { +} + +CommandLineFlag::~CommandLineFlag() { + delete current_; + delete defvalue_; +} + +const char* CommandLineFlag::CleanFileName() const { + // Compute top-level directory & file that this appears in + // search full path backwards. + // Stop going backwards at kRootDir; and skip by the first slash. + static const char kRootDir[] = ""; // can set this to root directory, + // e.g. "myproject" + + if (sizeof(kRootDir)-1 == 0) // no prefix to strip + return filename(); + + const char* clean_name = filename() + strlen(filename()) - 1; + while ( clean_name > filename() ) { + if (*clean_name == PATH_SEPARATOR) { + if (strncmp(clean_name, kRootDir, sizeof(kRootDir)-1) == 0) { + // ".../myproject/base/logging.cc" ==> "base/logging.cc" + clean_name += sizeof(kRootDir)-1; // past "/myproject/" + break; + } + } + --clean_name; + } + while ( *clean_name == PATH_SEPARATOR ) ++clean_name; // Skip any slashes + return clean_name; +} + +void CommandLineFlag::FillCommandLineFlagInfo( + CommandLineFlagInfo* result) { + result->name = name(); + result->type = type_name(); + result->description = help(); + result->current_value = current_value(); + result->default_value = default_value(); + result->filename = CleanFileName(); + UpdateModifiedBit(); + result->is_default = !modified_; + result->has_validator_fn = validate_function() != NULL; +} + +void CommandLineFlag::UpdateModifiedBit() { + // Update the "modified" bit in case somebody bypassed the + // Flags API and wrote directly through the FLAGS_name variable. + if (!modified_ && !current_->Equal(*defvalue_)) { + modified_ = true; + } +} + +void CommandLineFlag::CopyFrom(const CommandLineFlag& src) { + // Note we only copy the non-const members; others are fixed at construct time + if (modified_ != src.modified_) modified_ = src.modified_; + if (!current_->Equal(*src.current_)) current_->CopyFrom(*src.current_); + if (!defvalue_->Equal(*src.defvalue_)) defvalue_->CopyFrom(*src.defvalue_); + if (validate_fn_proto_ != src.validate_fn_proto_) + validate_fn_proto_ = src.validate_fn_proto_; +} + +bool CommandLineFlag::Validate(const FlagValue& value) const { + if (validate_function() == NULL) + return true; + else + return value.Validate(name(), validate_function()); +} + + +// -------------------------------------------------------------------- +// FlagRegistry +// A FlagRegistry singleton object holds all flag objects indexed +// by their names so that if you know a flag's name (as a C +// string), you can access or set it. If the function is named +// FooLocked(), you must own the registry lock before calling +// the function; otherwise, you should *not* hold the lock, and +// the function will acquire it itself if needed. +// -------------------------------------------------------------------- + +struct StringCmp { // Used by the FlagRegistry map class to compare char*'s + bool operator() (const char* s1, const char* s2) const { + return (strcmp(s1, s2) < 0); + } +}; + +class FlagRegistry { + public: + FlagRegistry() { } + + void Lock() { lock_.Lock(); } + void Unlock() { lock_.Unlock(); } + + // Store a flag in this registry. Takes ownership of the given pointer. + void RegisterFlag(CommandLineFlag* flag); + + // Returns the flag object for the specified name, or NULL if not found. + CommandLineFlag* FindFlagLocked(const char* name); + + // Returns the flag object whose current-value is stored at flag_ptr. + // That is, for whom current_->value_buffer_ == flag_ptr + CommandLineFlag* FindFlagViaPtrLocked(const void* flag_ptr); + + // A fancier form of FindFlag that works correctly if name is of the + // form flag=value. In that case, we set key to point to flag, and + // modify v to point to the value (if present), and return the flag + // with the given name. If the flag does not exist, returns NULL + // and sets error_message. + CommandLineFlag* SplitArgumentLocked(const char* argument, + string* key, const char** v, + string* error_message); + + // Set the value of a flag. If the flag was successfully set to + // value, set msg to indicate the new flag-value, and return true. + // Otherwise, set msg to indicate the error, leave flag unchanged, + // and return false. msg can be NULL. + bool SetFlagLocked(CommandLineFlag* flag, const char* value, + FlagSettingMode set_mode, string* msg); + + static FlagRegistry* GlobalRegistry(); // returns a singleton registry + + private: + friend class GOOGLE_NAMESPACE::FlagSaverImpl; // reads all the flags in order to copy them + friend class CommandLineFlagParser; // for ValidateAllFlags + friend void GOOGLE_NAMESPACE::GetAllFlags(vector<CommandLineFlagInfo>*); + + // The map from name to flag, for FindFlagLocked(). + typedef map<const char*, CommandLineFlag*, StringCmp> FlagMap; + typedef FlagMap::iterator FlagIterator; + typedef FlagMap::const_iterator FlagConstIterator; + FlagMap flags_; + + // The map from current-value pointer to flag, fo FindFlagViaPtrLocked(). + typedef map<const void*, CommandLineFlag*> FlagPtrMap; + FlagPtrMap flags_by_ptr_; + + Mutex lock_; + + static FlagRegistry* global_registry_; // a singleton registry + static Mutex global_registry_lock_; // guards creation of global_registry_ + + // Disallow + FlagRegistry(const FlagRegistry&); + FlagRegistry& operator=(const FlagRegistry&); +}; + +FlagRegistry* FlagRegistry::global_registry_ = NULL; +Mutex FlagRegistry::global_registry_lock_; + +FlagRegistry* FlagRegistry::GlobalRegistry() { + MutexLock acquire_lock(&global_registry_lock_); + if (!global_registry_) { + global_registry_ = new FlagRegistry; + } + return global_registry_; +} + +void FlagRegistry::RegisterFlag(CommandLineFlag* flag) { + Lock(); + pair<FlagIterator, bool> ins = + flags_.insert(pair<const char*, CommandLineFlag*>(flag->name(), flag)); + if (ins.second == false) { // means the name was already in the map + if (strcmp(ins.first->second->filename(), flag->filename()) != 0) { + ReportError(DIE, "ERROR: flag '%s' was defined more than once " + "(in files '%s' and '%s').\n", + flag->name(), + ins.first->second->filename(), + flag->filename()); + } else { + ReportError(DIE, "ERROR: something wrong with flag '%s' in file '%s'. " + "One possibility: file '%s' is being linked both statically " + "and dynamically into this executable.\n", + flag->name(), + flag->filename(), flag->filename()); + } + } + // Also add to the flags_by_ptr_ map. + flags_by_ptr_[flag->current_->value_buffer_] = flag; + Unlock(); +} + +CommandLineFlag* FlagRegistry::FindFlagLocked(const char* name) { + FlagConstIterator i = flags_.find(name); + if (i == flags_.end()) { + return NULL; + } else { + return i->second; + } +} + +CommandLineFlag* FlagRegistry::FindFlagViaPtrLocked(const void* flag_ptr) { + FlagPtrMap::const_iterator i = flags_by_ptr_.find(flag_ptr); + if (i == flags_by_ptr_.end()) { + return NULL; + } else { + return i->second; + } +} + +CommandLineFlag* FlagRegistry::SplitArgumentLocked(const char* arg, + string* key, + const char** v, + string* error_message) { + // Find the flag object for this option + const char* flag_name; + const char* value = strchr(arg, '='); + if (value == NULL) { + key->assign(arg); + *v = NULL; + } else { + // Strip out the "=value" portion from arg + key->assign(arg, value-arg); + *v = ++value; // advance past the '=' + } + flag_name = key->c_str(); + + CommandLineFlag* flag = FindFlagLocked(flag_name); + + if (flag == NULL) { + // If we can't find the flag-name, then we should return an error. + // The one exception is if 1) the flag-name is 'nox', 2) there + // exists a flag named 'x', and 3) 'x' is a boolean flag. + // In that case, we want to return flag 'x'. + if (!(flag_name[0] == 'n' && flag_name[1] == 'o')) { + // flag-name is not 'nox', so we're not in the exception case. + *error_message = (string(kError) + + "unknown command line flag '" + *key + "'\n"); + return NULL; + } + flag = FindFlagLocked(flag_name+2); + if (flag == NULL) { + // No flag named 'x' exists, so we're not in the exception case. + *error_message = (string(kError) + + "unknown command line flag '" + *key + "'\n"); + return NULL; + } + if (strcmp(flag->type_name(), "bool") != 0) { + // 'x' exists but is not boolean, so we're not in the exception case. + *error_message = (string(kError) + + "boolean value (" + *key + ") specified for " + + flag->type_name() + " command line flag\n"); + return NULL; + } + // We're in the exception case! + // Make up a fake value to replace the "no" we stripped out + key->assign(flag_name+2); // the name without the "no" + *v = "0"; + } + + // Assign a value if this is a boolean flag + if (*v == NULL && strcmp(flag->type_name(), "bool") == 0) { + *v = "1"; // the --nox case was already handled, so this is the --x case + } + + return flag; +} + +bool TryParseLocked(const CommandLineFlag* flag, FlagValue* flag_value, + const char* value, string* msg) { + // Use tenative_value, not flag_value, until we know value is valid. + FlagValue* tentative_value = flag_value->New(); + if (!tentative_value->ParseFrom(value)) { + if (msg) { + *msg += (string(kError) + "illegal value '" + value + + + "' specified for " + flag->type_name() + " flag '" + + flag->name() + "'\n"); + } + delete tentative_value; + return false; + } else if (!flag->Validate(*tentative_value)) { + if (msg) { + *msg += (string(kError) + "failed validation of new value " + + "'" + tentative_value->ToString() + "' for flag '" + + + flag->name() + "'\n"); + } + delete tentative_value; + return false; + } else { + flag_value->CopyFrom(*tentative_value); + if (msg) { + *msg += (string(flag->name()) + " set to " + flag_value->ToString() + + "\n"); + } + delete tentative_value; + return true; + } +} + +bool FlagRegistry::SetFlagLocked(CommandLineFlag* flag, + const char* value, + FlagSettingMode set_mode, + string* msg) { + flag->UpdateModifiedBit(); + switch (set_mode) { + case SET_FLAGS_VALUE: { + // set or modify the flag's value + if (!TryParseLocked(flag, flag->current_, value, msg)) + return false; + flag->modified_ = true; + break; + } + case SET_FLAG_IF_DEFAULT: { + // set the flag's value, but only if it hasn't been set by someone else + if (!flag->modified_) { + if (!TryParseLocked(flag, flag->current_, value, msg)) + return false; + flag->modified_ = true; + } else { + *msg = string(flag->name()) + " set to " + flag->current_value(); + } + break; + } + case SET_FLAGS_DEFAULT: { + // modify the flag's default-value + if (!TryParseLocked(flag, flag->defvalue_, value, msg)) + return false; + if (!flag->modified_) { + // Need to set both defvalue *and* current, in this case + TryParseLocked(flag, flag->current_, value, NULL); + } + break; + } + default: { + // unknown set_mode + assert(false); + return false; + } + } + + return true; +} + +class FlagRegistryLock { + public: + explicit FlagRegistryLock(FlagRegistry* fr) : fr_(fr) { fr_->Lock(); } + ~FlagRegistryLock() { fr_->Unlock(); } + private: + FlagRegistry *const fr_; +}; + +// -------------------------------------------------------------------- +// CommandLineFlagParser +// Parsing is done in two stages. In the first, we go through +// argv. For every flag-like arg we can make sense of, we parse +// it and set the appropriate FLAGS_* variable. For every flag- +// like arg we can't make sense of, we store it in a vector, +// along with an explanation of the trouble. In stage 2, we +// handle the 'reporting' flags like --help and --mpm_version. +// (This is via a call to HandleCommandLineHelpFlags(), in +// gflags_reporting.cc.) +// An optional stage 3 prints out the error messages. +// This is a bit of a simplification. For instance, --flagfile +// is handled as soon as it's seen in stage 1, not in stage 2. +// -------------------------------------------------------------------- + +class CommandLineFlagParser { + public: + // The argument is the flag-registry to register the parsed flags in + explicit CommandLineFlagParser(FlagRegistry* reg) : registry_(reg) {} + ~CommandLineFlagParser() {} + + // Stage 1: Every time this is called, it reads all flags in argv. + // However, it ignores all flags that have been successfully set + // before. Typically this is only called once, so this 'reparsing' + // behavior isn't important. It can be useful when trying to + // reparse after loading a dll, though. + uint32 ParseNewCommandLineFlags(int* argc, char*** argv, bool remove_flags); + + // Stage 2: print reporting info and exit, if requested. + // In gflags_reporting.cc:HandleCommandLineHelpFlags(). + + // Stage 3: validate all the commandline flags that have validators + // registered. + void ValidateAllFlags(); + + // Stage 4: report any errors and return true if any were found. + bool ReportErrors(); + + // Set a particular command line option. "newval" is a string + // describing the new value that the option has been set to. If + // option_name does not specify a valid option name, or value is not + // a valid value for option_name, newval is empty. Does recursive + // processing for --flagfile and --fromenv. Returns the new value + // if everything went ok, or empty-string if not. (Actually, the + // return-string could hold many flag/value pairs due to --flagfile.) + // NB: Must have called registry_->Lock() before calling this function. + string ProcessSingleOptionLocked(CommandLineFlag* flag, + const char* value, + FlagSettingMode set_mode); + + // Set a whole batch of command line options as specified by contentdata, + // which is in flagfile format (and probably has been read from a flagfile). + // Returns the new value if everything went ok, or empty-string if + // not. (Actually, the return-string could hold many flag/value + // pairs due to --flagfile.) + // NB: Must have called registry_->Lock() before calling this function. + string ProcessOptionsFromStringLocked(const string& contentdata, + FlagSettingMode set_mode); + + // These are the 'recursive' flags, defined at the top of this file. + // Whenever we see these flags on the commandline, we must take action. + // These are called by ProcessSingleOptionLocked and, similarly, return + // new values if everything went ok, or the empty-string if not. + string ProcessFlagfileLocked(const string& flagval, FlagSettingMode set_mode); + // diff fromenv/tryfromenv + string ProcessFromenvLocked(const string& flagval, FlagSettingMode set_mode, + bool errors_are_fatal); + + private: + FlagRegistry* const registry_; + map<string, string> error_flags_; // map from name to error message + // This could be a set<string>, but we reuse the map to minimize the .o size + map<string, string> undefined_names_; // --[flag] name was not registered +}; + + +// Parse a list of (comma-separated) flags. +static void ParseFlagList(const char* value, vector<string>* flags) { + for (const char *p = value; p && *p; value = p) { + p = strchr(value, ','); + int len; + if (p) { + len = static_cast<int>(p - value); + p++; + } else { + len = static_cast<int>(strlen(value)); + } + + if (len == 0) + ReportError(DIE, "ERROR: empty flaglist entry\n"); + if (value[0] == '-') + ReportError(DIE, "ERROR: flag \"%*s\" begins with '-'\n", len, value); + + flags->push_back(string(value, len)); + } +} + +// Snarf an entire file into a C++ string. This is just so that we +// can do all the I/O in one place and not worry about it everywhere. +// Plus, it's convenient to have the whole file contents at hand. +// Adds a newline at the end of the file. +#define PFATAL(s) do { perror(s); commandlineflags_exitfunc(1); } while (0) + +static string ReadFileIntoString(const char* filename) { + const int kBufSize = 8092; + char buffer[kBufSize]; + string s; + FILE* fp = fopen(filename, "r"); + if (!fp) PFATAL(filename); + size_t n; + while ( (n=fread(buffer, 1, kBufSize, fp)) > 0 ) { + if (ferror(fp)) PFATAL(filename); + s.append(buffer, n); + } + fclose(fp); + return s; +} + +uint32 CommandLineFlagParser::ParseNewCommandLineFlags(int* argc, char*** argv, + bool remove_flags) { + const char *program_name = strrchr((*argv)[0], PATH_SEPARATOR); // nix path + program_name = (program_name == NULL ? (*argv)[0] : program_name+1); + + int first_nonopt = *argc; // for non-options moved to the end + + registry_->Lock(); + for (int i = 1; i < first_nonopt; i++) { + char* arg = (*argv)[i]; + + // Like getopt(), we permute non-option flags to be at the end. + if (arg[0] != '-' || // must be a program argument + (arg[0] == '-' && arg[1] == '\0')) { // "-" is an argument, not a flag + memmove((*argv) + i, (*argv) + i+1, (*argc - (i+1)) * sizeof((*argv)[i])); + (*argv)[*argc-1] = arg; // we go last + first_nonopt--; // we've been pushed onto the stack + i--; // to undo the i++ in the loop + continue; + } + + if (arg[0] == '-') arg++; // allow leading '-' + if (arg[0] == '-') arg++; // or leading '--' + + // -- alone means what it does for GNU: stop options parsing + if (*arg == '\0') { + first_nonopt = i+1; + break; + } + + // Find the flag object for this option + string key; + const char* value; + string error_message; + CommandLineFlag* flag = registry_->SplitArgumentLocked(arg, &key, &value, + &error_message); + if (flag == NULL) { + undefined_names_[key] = ""; // value isn't actually used + error_flags_[key] = error_message; + continue; + } + + if (value == NULL) { + // Boolean options are always assigned a value by SplitArgumentLocked() + assert(strcmp(flag->type_name(), "bool") != 0); + if (i+1 >= first_nonopt) { + // This flag needs a value, but there is nothing available + error_flags_[key] = (string(kError) + "flag '" + (*argv)[i] + "'" + + " is missing its argument"); + if (flag->help() && flag->help()[0] > '\001') { + // Be useful in case we have a non-stripped description. + error_flags_[key] += string("; flag description: ") + flag->help(); + } + error_flags_[key] += "\n"; + break; // we treat this as an unrecoverable error + } else { + value = (*argv)[++i]; // read next arg for value + } + } + + // TODO(csilvers): only set a flag if we hadn't set it before here + ProcessSingleOptionLocked(flag, value, SET_FLAGS_VALUE); + } + registry_->Unlock(); + + if (remove_flags) { // Fix up argc and argv by removing command line flags + (*argv)[first_nonopt-1] = (*argv)[0]; + (*argv) += (first_nonopt-1); + (*argc) -= (first_nonopt-1); + first_nonopt = 1; // because we still don't count argv[0] + } + + logging_is_probably_set_up = true; // because we've parsed --logdir, etc. + + return first_nonopt; +} + +string CommandLineFlagParser::ProcessFlagfileLocked(const string& flagval, + FlagSettingMode set_mode) { + if (flagval.empty()) + return ""; + + string msg; + vector<string> filename_list; + ParseFlagList(flagval.c_str(), &filename_list); // take a list of filenames + for (size_t i = 0; i < filename_list.size(); ++i) { + const char* file = filename_list[i].c_str(); + msg += ProcessOptionsFromStringLocked(ReadFileIntoString(file), set_mode); + } + return msg; +} + +string CommandLineFlagParser::ProcessFromenvLocked(const string& flagval, + FlagSettingMode set_mode, + bool errors_are_fatal) { + if (flagval.empty()) + return ""; + + string msg; + vector<string> flaglist; + ParseFlagList(flagval.c_str(), &flaglist); + + for (size_t i = 0; i < flaglist.size(); ++i) { + const char* flagname = flaglist[i].c_str(); + CommandLineFlag* flag = registry_->FindFlagLocked(flagname); + if (flag == NULL) { + error_flags_[flagname] = (string(kError) + "unknown command line flag" + + " '" + flagname + "'" + + " (via --fromenv or --tryfromenv)\n"); + undefined_names_[flagname] = ""; + continue; + } + + const string envname = string("FLAGS_") + string(flagname); + const char* envval = getenv(envname.c_str()); + if (!envval) { + if (errors_are_fatal) { + error_flags_[flagname] = (string(kError) + envname + + " not found in environment\n"); + } + continue; + } + + // Avoid infinite recursion. + if ((strcmp(envval, "fromenv") == 0) || + (strcmp(envval, "tryfromenv") == 0)) { + error_flags_[flagname] = (string(kError) + "infinite recursion on " + + "environment flag '" + envval + "'\n"); + continue; + } + + msg += ProcessSingleOptionLocked(flag, envval, set_mode); + } + return msg; +} + +string CommandLineFlagParser::ProcessSingleOptionLocked( + CommandLineFlag* flag, const char* value, FlagSettingMode set_mode) { + string msg; + if (value && !registry_->SetFlagLocked(flag, value, set_mode, &msg)) { + error_flags_[flag->name()] = msg; + return ""; + } + + // The recursive flags, --flagfile and --fromenv and --tryfromenv, + // must be dealt with as soon as they're seen. They will emit + // messages of their own. + if (strcmp(flag->name(), "flagfile") == 0) { + msg += ProcessFlagfileLocked(FLAGS_flagfile, set_mode); + + } else if (strcmp(flag->name(), "fromenv") == 0) { + // last arg indicates envval-not-found is fatal (unlike in --tryfromenv) + msg += ProcessFromenvLocked(FLAGS_fromenv, set_mode, true); + + } else if (strcmp(flag->name(), "tryfromenv") == 0) { + msg += ProcessFromenvLocked(FLAGS_tryfromenv, set_mode, false); + } + + return msg; +} + +void CommandLineFlagParser::ValidateAllFlags() { + FlagRegistryLock frl(registry_); + for (FlagRegistry::FlagConstIterator i = registry_->flags_.begin(); + i != registry_->flags_.end(); ++i) { + if (!i->second->ValidateCurrent()) { + // only set a message if one isn't already there. (If there's + // an error message, our job is done, even if it's not exactly + // the same error.) + if (error_flags_[i->second->name()].empty()) + error_flags_[i->second->name()] = + string(kError) + "--" + i->second->name() + + " must be set on the commandline" + " (default value fails validation)\n"; + } + } +} + +bool CommandLineFlagParser::ReportErrors() { + // error_flags_ indicates errors we saw while parsing. + // But we ignore undefined-names if ok'ed by --undef_ok + if (!FLAGS_undefok.empty()) { + vector<string> flaglist; + ParseFlagList(FLAGS_undefok.c_str(), &flaglist); + for (size_t i = 0; i < flaglist.size(); ++i) { + // We also deal with --no<flag>, in case the flagname was boolean + const string no_version = string("no") + flaglist[i]; + if (undefined_names_.find(flaglist[i]) != undefined_names_.end()) { + error_flags_[flaglist[i]] = ""; // clear the error message + } else if (undefined_names_.find(no_version) != undefined_names_.end()) { + error_flags_[no_version] = ""; + } + } + } + // Likewise, if they decided to allow reparsing, all undefined-names + // are ok; we just silently ignore them now, and hope that a future + // parse will pick them up somehow. + if (allow_command_line_reparsing) { + for (map<string, string>::const_iterator it = undefined_names_.begin(); + it != undefined_names_.end(); ++it) + error_flags_[it->first] = ""; // clear the error message + } + + bool found_error = false; + string error_message; + for (map<string, string>::const_iterator it = error_flags_.begin(); + it != error_flags_.end(); ++it) { + if (!it->second.empty()) { + error_message.append(it->second.data(), it->second.size()); + found_error = true; + } + } + if (found_error) + ReportError(DO_NOT_DIE, "%s", error_message.c_str()); + return found_error; +} + +string CommandLineFlagParser::ProcessOptionsFromStringLocked( + const string& contentdata, FlagSettingMode set_mode) { + string retval; + const char* flagfile_contents = contentdata.c_str(); + bool flags_are_relevant = true; // set to false when filenames don't match + bool in_filename_section = false; + + const char* line_end = flagfile_contents; + // We read this file a line at a time. + for (; line_end; flagfile_contents = line_end + 1) { + while (*flagfile_contents && isspace(*flagfile_contents)) + ++flagfile_contents; + line_end = strchr(flagfile_contents, '\n'); + size_t len = line_end ? static_cast<size_t>(line_end - flagfile_contents) + : strlen(flagfile_contents); + string line(flagfile_contents, len); + + // Each line can be one of four things: + // 1) A comment line -- we skip it + // 2) An empty line -- we skip it + // 3) A list of filenames -- starts a new filenames+flags section + // 4) A --flag=value line -- apply if previous filenames match + if (line.empty() || line[0] == '#') { + // comment or empty line; just ignore + + } else if (line[0] == '-') { // flag + in_filename_section = false; // instead, it was a flag-line + if (!flags_are_relevant) // skip this flag; applies to someone else + continue; + + const char* name_and_val = line.c_str() + 1; // skip the leading - + if (*name_and_val == '-') + name_and_val++; // skip second - too + string key; + const char* value; + string error_message; + CommandLineFlag* flag = registry_->SplitArgumentLocked(name_and_val, + &key, &value, + &error_message); + // By API, errors parsing flagfile lines are silently ignored. + if (flag == NULL) { + // "WARNING: flagname '" + key + "' not found\n" + } else if (value == NULL) { + // "WARNING: flagname '" + key + "' missing a value\n" + } else { + retval += ProcessSingleOptionLocked(flag, value, set_mode); + } + + } else { // a filename! + if (!in_filename_section) { // start over: assume filenames don't match + in_filename_section = true; + flags_are_relevant = false; + } + + // Split the line up at spaces into glob-patterns + const char* space = line.c_str(); // just has to be non-NULL + for (const char* word = line.c_str(); *space; word = space+1) { + if (flags_are_relevant) // we can stop as soon as we match + break; + space = strchr(word, ' '); + if (space == NULL) + space = word + strlen(word); + const string glob(word, space - word); + // We try matching both against the full argv0 and basename(argv0) +#ifdef HAVE_FNMATCH_H + if (fnmatch(glob.c_str(), + ProgramInvocationName(), + FNM_PATHNAME) == 0 || + fnmatch(glob.c_str(), + ProgramInvocationShortName(), + FNM_PATHNAME) == 0) { +#else // !HAVE_FNMATCH_H + if ((glob == ProgramInvocationName()) || + (glob == ProgramInvocationShortName())) { +#endif // HAVE_FNMATCH_H + flags_are_relevant = true; + } + } + } + } + return retval; +} + +// -------------------------------------------------------------------- +// GetFromEnv() +// AddFlagValidator() +// These are helper functions for routines like BoolFromEnv() and +// RegisterFlagValidator, defined below. They're defined here so +// they can live in the unnamed namespace (which makes friendship +// declarations for these classes possible). +// -------------------------------------------------------------------- + +template<typename T> +T GetFromEnv(const char *varname, const char* type, T dflt) { + const char* const valstr = getenv(varname); + if (!valstr) + return dflt; + FlagValue ifv(new T, type); + if (!ifv.ParseFrom(valstr)) + ReportError(DIE, "ERROR: error parsing env variable '%s' with value '%s'\n", + varname, valstr); + return OTHER_VALUE_AS(ifv, T); +} + +bool AddFlagValidator(const void* flag_ptr, ValidateFnProto validate_fn_proto) { + // We want a lock around this routine, in case two threads try to + // add a validator (hopefully the same one!) at once. We could use + // our own thread, but we need to loook at the registry anyway, so + // we just steal that one. + FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); + FlagRegistryLock frl(registry); + // First, find the flag whose current-flag storage is 'flag'. + // This is the CommandLineFlag whose current_->value_buffer_ == flag + CommandLineFlag* flag = registry->FindFlagViaPtrLocked(flag_ptr); + if (!flag) { + // WARNING << "Ignoring RegisterValidateFunction() for flag pointer " + // << flag_ptr << ": no flag found at that address"; + return false; + } else if (validate_fn_proto == flag->validate_function()) { + return true; // ok to register the same function over and over again + } else if (validate_fn_proto != NULL && flag->validate_function() != NULL) { + // WARNING << "Ignoring RegisterValidateFunction() for flag '" + // << flag->name() << "': validate-fn already registered"; + return false; + } else { + flag->validate_fn_proto_ = validate_fn_proto; + return true; + } +} + +} // end unnamed namespaces + + +// Now define the functions that are exported via the .h file + +// -------------------------------------------------------------------- +// FlagRegisterer +// This class exists merely to have a global constructor (the +// kind that runs before main(), that goes an initializes each +// flag that's been declared. Note that it's very important we +// don't have a destructor that deletes flag_, because that would +// cause us to delete current_storage/defvalue_storage as well, +// which can cause a crash if anything tries to access the flag +// values in a global destructor. +// -------------------------------------------------------------------- + +// TODO(csilvers): When we're ready to have this error be a fatal one, +// change this to give a compilation error (via COMPILE_ASSERT(false)). +bool FlagsTypeWarn(const char *name) { + cerr << "Flag " << name << " is of type bool, but its default" + << " value is not a boolean. NOTE: This will soon be a" + << " compilations error!"; + return false; +} + +FlagRegisterer::FlagRegisterer(const char* name, const char* type, + const char* help, const char* filename, + void* current_storage, void* defvalue_storage) { + if (help == NULL) + help = ""; + // FlagValue expects the type-name to not include any namespace + // components, so we get rid of those, if any. + if (strchr(type, ':')) + type = strrchr(type, ':') + 1; + FlagValue* current = new FlagValue(current_storage, type); + FlagValue* defvalue = new FlagValue(defvalue_storage, type); + // Importantly, flag_ will never be deleted, so storage is always good. + CommandLineFlag* flag = new CommandLineFlag(name, help, filename, + current, defvalue); + FlagRegistry::GlobalRegistry()->RegisterFlag(flag); // default registry +} + +// -------------------------------------------------------------------- +// GetAllFlags() +// The main way the FlagRegistry class exposes its data. This +// returns, as strings, all the info about all the flags in +// the main registry, sorted first by filename they are defined +// in, and then by flagname. +// -------------------------------------------------------------------- + +struct FilenameFlagnameCmp { + bool operator()(const CommandLineFlagInfo& a, + const CommandLineFlagInfo& b) const { + int cmp = strcmp(a.filename.c_str(), b.filename.c_str()); + if (cmp == 0) + cmp = strcmp(a.name.c_str(), b.name.c_str()); // secondary sort key + return cmp < 0; + } +}; + +void GetAllFlags(vector<CommandLineFlagInfo>* OUTPUT) { + FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); + registry->Lock(); + for (FlagRegistry::FlagConstIterator i = registry->flags_.begin(); + i != registry->flags_.end(); ++i) { + CommandLineFlagInfo fi; + i->second->FillCommandLineFlagInfo(&fi); + OUTPUT->push_back(fi); + } + registry->Unlock(); + // Now sort the flags, first by filename they occur in, then alphabetically + sort(OUTPUT->begin(), OUTPUT->end(), FilenameFlagnameCmp()); +} + +// -------------------------------------------------------------------- +// SetArgv() +// GetArgvs() +// GetArgv() +// GetArgv0() +// ProgramInvocationName() +// ProgramInvocationShortName() +// SetUsageMessage() +// ProgramUsage() +// Functions to set and get argv. Typically the setter is called +// by ParseCommandLineFlags. Also can get the ProgramUsage string, +// set by SetUsageMessage. +// -------------------------------------------------------------------- + +// These values are not protected by a Mutex because they are normally +// set only once during program startup. +static const char* argv0 = "UNKNOWN"; // just the program name +static const char* cmdline = ""; // the entire command-line +static vector<string> argvs; +static uint32 argv_sum = 0; +static const char* program_usage = NULL; + +void SetArgv(int argc, const char** argv) { + static bool called_set_argv = false; + if (called_set_argv) // we already have an argv for you + return; + + called_set_argv = true; + + assert(argc > 0); // every program has at least a progname + argv0 = strdup(argv[0]); // small memory leak, but fn only called once + assert(argv0); + + string cmdline_string; // easier than doing strcats + for (int i = 0; i < argc; i++) { + if (i != 0) { + cmdline_string += " "; + } + cmdline_string += argv[i]; + argvs.push_back(argv[i]); + } + cmdline = strdup(cmdline_string.c_str()); // another small memory leak + assert(cmdline); + + // Compute a simple sum of all the chars in argv + for (const char* c = cmdline; *c; c++) + argv_sum += *c; +} + +const vector<string>& GetArgvs() { return argvs; } +const char* GetArgv() { return cmdline; } +const char* GetArgv0() { return argv0; } +uint32 GetArgvSum() { return argv_sum; } +const char* ProgramInvocationName() { // like the GNU libc fn + return GetArgv0(); +} +const char* ProgramInvocationShortName() { // like the GNU libc fn + const char* slash = strrchr(argv0, '/'); +#ifdef OS_WINDOWS + if (!slash) slash = strrchr(argv0, '\\'); +#endif + return slash ? slash + 1 : argv0; +} + +void SetUsageMessage(const string& usage) { + if (program_usage != NULL) + ReportError(DIE, "ERROR: SetUsageMessage() called twice\n"); + program_usage = strdup(usage.c_str()); // small memory leak +} + +const char* ProgramUsage() { + if (program_usage) { + return program_usage; + } + return "Warning: SetUsageMessage() never called"; +} + +// -------------------------------------------------------------------- +// GetCommandLineOption() +// GetCommandLineFlagInfo() +// GetCommandLineFlagInfoOrDie() +// SetCommandLineOption() +// SetCommandLineOptionWithMode() +// The programmatic way to set a flag's value, using a string +// for its name rather than the variable itself (that is, +// SetCommandLineOption("foo", x) rather than FLAGS_foo = x). +// There's also a bit more flexibility here due to the various +// set-modes, but typically these are used when you only have +// that flag's name as a string, perhaps at runtime. +// All of these work on the default, global registry. +// For GetCommandLineOption, return false if no such flag +// is known, true otherwise. We clear "value" if a suitable +// flag is found. +// -------------------------------------------------------------------- + + +bool GetCommandLineOption(const char* name, string* value) { + if (NULL == name) + return false; + assert(value); + + FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); + FlagRegistryLock frl(registry); + CommandLineFlag* flag = registry->FindFlagLocked(name); + if (flag == NULL) { + return false; + } else { + *value = flag->current_value(); + return true; + } +} + +bool GetCommandLineFlagInfo(const char* name, CommandLineFlagInfo* OUTPUT) { + if (NULL == name) return false; + FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); + FlagRegistryLock frl(registry); + CommandLineFlag* flag = registry->FindFlagLocked(name); + if (flag == NULL) { + return false; + } else { + assert(OUTPUT); + flag->FillCommandLineFlagInfo(OUTPUT); + return true; + } +} + +CommandLineFlagInfo GetCommandLineFlagInfoOrDie(const char* name) { + CommandLineFlagInfo info; + if (!GetCommandLineFlagInfo(name, &info)) { + fprintf(stderr, "FATAL ERROR: flag name '%s' doesn't exit", name); + commandlineflags_exitfunc(1); // almost certainly exit() + } + return info; +} + +string SetCommandLineOptionWithMode(const char* name, const char* value, + FlagSettingMode set_mode) { + string result; + FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); + FlagRegistryLock frl(registry); + CommandLineFlag* flag = registry->FindFlagLocked(name); + if (flag) { + CommandLineFlagParser parser(registry); + result = parser.ProcessSingleOptionLocked(flag, value, set_mode); + if (!result.empty()) { // in the error case, we've already logged + // You could consider logging this change, if you wanted to know it: + //fprintf(stderr, "%sFLAGS_%s\n", + // (set_mode == SET_FLAGS_DEFAULT ? "default value of " : ""), + // result); + } + } + // The API of this function is that we return empty string on error + return result; +} + +string SetCommandLineOption(const char* name, const char* value) { + return SetCommandLineOptionWithMode(name, value, SET_FLAGS_VALUE); +} + +// -------------------------------------------------------------------- +// FlagSaver +// FlagSaverImpl +// This class stores the states of all flags at construct time, +// and restores all flags to that state at destruct time. +// Its major implementation challenge is that it never modifies +// pointers in the 'main' registry, so global FLAG_* vars always +// point to the right place. +// -------------------------------------------------------------------- + +class FlagSaverImpl { + public: + // Constructs an empty FlagSaverImpl object. + explicit FlagSaverImpl(FlagRegistry* main_registry) + : main_registry_(main_registry) { } + ~FlagSaverImpl() { + // reclaim memory from each of our CommandLineFlags + vector<CommandLineFlag*>::const_iterator it; + for (it = backup_registry_.begin(); it != backup_registry_.end(); ++it) + delete *it; + } + + // Saves the flag states from the flag registry into this object. + // It's an error to call this more than once. + // Must be called when the registry mutex is not held. + void SaveFromRegistry() { + FlagRegistryLock frl(main_registry_); + assert(backup_registry_.empty()); // call only once! + for (FlagRegistry::FlagConstIterator it = main_registry_->flags_.begin(); + it != main_registry_->flags_.end(); + ++it) { + const CommandLineFlag* main = it->second; + // Sets up all the const variables in backup correctly + CommandLineFlag* backup = new CommandLineFlag( + main->name(), main->help(), main->filename(), + main->current_->New(), main->defvalue_->New()); + // Sets up all the non-const variables in backup correctly + backup->CopyFrom(*main); + backup_registry_.push_back(backup); // add it to a convenient list + } + } + + // Restores the saved flag states into the flag registry. We + // assume no flags were added or deleted from the registry since + // the SaveFromRegistry; if they were, that's trouble! Must be + // called when the registry mutex is not held. + void RestoreToRegistry() { + FlagRegistryLock frl(main_registry_); + vector<CommandLineFlag*>::const_iterator it; + for (it = backup_registry_.begin(); it != backup_registry_.end(); ++it) { + CommandLineFlag* main = main_registry_->FindFlagLocked((*it)->name()); + if (main != NULL) { // if NULL, flag got deleted from registry(!) + main->CopyFrom(**it); + } + } + } + + private: + FlagRegistry* const main_registry_; + vector<CommandLineFlag*> backup_registry_; + + FlagSaverImpl(const FlagSaverImpl&); // no copying! + void operator=(const FlagSaverImpl&); +}; + +FlagSaver::FlagSaver() + : impl_(new FlagSaverImpl(FlagRegistry::GlobalRegistry())) { + impl_->SaveFromRegistry(); +} + +FlagSaver::~FlagSaver() { + impl_->RestoreToRegistry(); + delete impl_; +} + + +// -------------------------------------------------------------------- +// CommandlineFlagsIntoString() +// ReadFlagsFromString() +// AppendFlagsIntoFile() +// ReadFromFlagsFile() +// These are mostly-deprecated routines that stick the +// commandline flags into a file/string and read them back +// out again. I can see a use for CommandlineFlagsIntoString, +// for creating a flagfile, but the rest don't seem that useful +// -- some, I think, are a poor-man's attempt at FlagSaver -- +// and are included only until we can delete them from callers. +// Note they don't save --flagfile flags (though they do save +// the result of having called the flagfile, of course). +// -------------------------------------------------------------------- + +static string TheseCommandlineFlagsIntoString( + const vector<CommandLineFlagInfo>& flags) { + vector<CommandLineFlagInfo>::const_iterator i; + + size_t retval_space = 0; + for (i = flags.begin(); i != flags.end(); ++i) { + // An (over)estimate of how much space it will take to print this flag + retval_space += i->name.length() + i->current_value.length() + 5; + } + + string retval; + retval.reserve(retval_space); + for (i = flags.begin(); i != flags.end(); ++i) { + retval += "--"; + retval += i->name; + retval += "="; + retval += i->current_value; + retval += "\n"; + } + return retval; +} + +string CommandlineFlagsIntoString() { + vector<CommandLineFlagInfo> sorted_flags; + GetAllFlags(&sorted_flags); + return TheseCommandlineFlagsIntoString(sorted_flags); +} + +bool ReadFlagsFromString(const string& flagfilecontents, + const char* /*prog_name*/, // TODO(csilvers): nix this + bool errors_are_fatal) { + FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); + FlagSaverImpl saved_states(registry); + saved_states.SaveFromRegistry(); + + CommandLineFlagParser parser(registry); + registry->Lock(); + parser.ProcessOptionsFromStringLocked(flagfilecontents, SET_FLAGS_VALUE); + registry->Unlock(); + // Should we handle --help and such when reading flags from a string? Sure. + HandleCommandLineHelpFlags(); + if (parser.ReportErrors()) { + // Error. Restore all global flags to their previous values. + if (errors_are_fatal) + commandlineflags_exitfunc(1); // almost certainly exit() + saved_states.RestoreToRegistry(); + return false; + } + return true; +} + +// TODO(csilvers): nix prog_name in favor of ProgramInvocationShortName() +bool AppendFlagsIntoFile(const string& filename, const char *prog_name) { + FILE *fp = fopen(filename.c_str(), "a"); + if (!fp) { + return false; + } + + if (prog_name) + fprintf(fp, "%s\n", prog_name); + + vector<CommandLineFlagInfo> flags; + GetAllFlags(&flags); + // But we don't want --flagfile, which leads to weird recursion issues + vector<CommandLineFlagInfo>::iterator i; + for (i = flags.begin(); i != flags.end(); ++i) { + if (strcmp(i->name.c_str(), "flagfile") == 0) { + flags.erase(i); + break; + } + } + fprintf(fp, "%s", TheseCommandlineFlagsIntoString(flags).c_str()); + + fclose(fp); + return true; +} + +bool ReadFromFlagsFile(const string& filename, const char* prog_name, + bool errors_are_fatal) { + return ReadFlagsFromString(ReadFileIntoString(filename.c_str()), + prog_name, errors_are_fatal); +} + + +// -------------------------------------------------------------------- +// BoolFromEnv() +// Int32FromEnv() +// Int64FromEnv() +// Uint64FromEnv() +// DoubleFromEnv() +// StringFromEnv() +// Reads the value from the environment and returns it. +// We use an FlagValue to make the parsing easy. +// Example usage: +// DEFINE_bool(myflag, BoolFromEnv("MYFLAG_DEFAULT", false), "whatever"); +// -------------------------------------------------------------------- + +bool BoolFromEnv(const char *v, bool dflt) { + return GetFromEnv(v, "bool", dflt); +} +int32 Int32FromEnv(const char *v, int32 dflt) { + return GetFromEnv(v, "int32", dflt); +} +int64 Int64FromEnv(const char *v, int64 dflt) { + return GetFromEnv(v, "int64", dflt); +} +uint64 Uint64FromEnv(const char *v, uint64 dflt) { + return GetFromEnv(v, "uint64", dflt); +} +double DoubleFromEnv(const char *v, double dflt) { + return GetFromEnv(v, "double", dflt); +} +const char *StringFromEnv(const char *varname, const char *dflt) { + const char* const val = getenv(varname); + return val ? val : dflt; +} + + +// -------------------------------------------------------------------- +// RegisterFlagValidator() +// RegisterFlagValidator() is the function that clients use to +// 'decorate' a flag with a validation function. Once this is +// done, every time the flag is set (including when the flag +// is parsed from argv), the validator-function is called. +// These functions return true if the validator was added +// successfully, or false if not: the flag already has a validator, +// (only one allowed per flag), the 1st arg isn't a flag, etc. +// This function is not thread-safe. +// -------------------------------------------------------------------- + +bool RegisterFlagValidator(const bool* flag, + bool (*validate_fn)(const char*, bool)) { + return AddFlagValidator(flag, reinterpret_cast<ValidateFnProto>(validate_fn)); +} +bool RegisterFlagValidator(const int32* flag, + bool (*validate_fn)(const char*, int32)) { + return AddFlagValidator(flag, reinterpret_cast<ValidateFnProto>(validate_fn)); +} +bool RegisterFlagValidator(const int64* flag, + bool (*validate_fn)(const char*, int64)) { + return AddFlagValidator(flag, reinterpret_cast<ValidateFnProto>(validate_fn)); +} +bool RegisterFlagValidator(const uint64* flag, + bool (*validate_fn)(const char*, uint64)) { + return AddFlagValidator(flag, reinterpret_cast<ValidateFnProto>(validate_fn)); +} +bool RegisterFlagValidator(const double* flag, + bool (*validate_fn)(const char*, double)) { + return AddFlagValidator(flag, reinterpret_cast<ValidateFnProto>(validate_fn)); +} +bool RegisterFlagValidator(const string* flag, + bool (*validate_fn)(const char*, const string&)) { + return AddFlagValidator(flag, reinterpret_cast<ValidateFnProto>(validate_fn)); +} + + +// -------------------------------------------------------------------- +// ParseCommandLineFlags() +// ParseCommandLineNonHelpFlags() +// HandleCommandLineHelpFlags() +// This is the main function called from main(), to actually +// parse the commandline. It modifies argc and argv as described +// at the top of gflags.h. You can also divide this +// function into two parts, if you want to do work between +// the parsing of the flags and the printing of any help output. +// -------------------------------------------------------------------- + +static uint32 ParseCommandLineFlagsInternal(int* argc, char*** argv, + bool remove_flags, bool do_report) { + SetArgv(*argc, const_cast<const char**>(*argv)); // save it for later + + FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); + CommandLineFlagParser parser(registry); + + // When we parse the commandline flags, we'll handle --flagfile, + // --tryfromenv, etc. as we see them (since flag-evaluation order + // may be important). But sometimes apps set FLAGS_tryfromenv/etc. + // manually before calling ParseCommandLineFlags. We want to evaluate + // those too, as if they were the first flags on the commandline. + registry->Lock(); + parser.ProcessFlagfileLocked(FLAGS_flagfile, SET_FLAGS_VALUE); + // Last arg here indicates whether flag-not-found is a fatal error or not + parser.ProcessFromenvLocked(FLAGS_fromenv, SET_FLAGS_VALUE, true); + parser.ProcessFromenvLocked(FLAGS_tryfromenv, SET_FLAGS_VALUE, false); + registry->Unlock(); + + // Now get the flags specified on the commandline + const int r = parser.ParseNewCommandLineFlags(argc, argv, remove_flags); + + if (do_report) + HandleCommandLineHelpFlags(); // may cause us to exit on --help, etc. + + // See if any of the unset flags fail their validation checks + parser.ValidateAllFlags(); + + if (parser.ReportErrors()) // may cause us to exit on illegal flags + commandlineflags_exitfunc(1); // almost certainly exit() + return r; +} + +uint32 ParseCommandLineFlags(int* argc, char*** argv, bool remove_flags) { + return ParseCommandLineFlagsInternal(argc, argv, remove_flags, true); +} + +uint32 ParseCommandLineNonHelpFlags(int* argc, char*** argv, + bool remove_flags) { + return ParseCommandLineFlagsInternal(argc, argv, remove_flags, false); +} + +// -------------------------------------------------------------------- +// AllowCommandLineReparsing() +// ReparseCommandLineNonHelpFlags() +// This is most useful for shared libraries. The idea is if +// a flag is defined in a shared library that is dlopen'ed +// sometime after main(), you can ParseCommandLineFlags before +// the dlopen, then ReparseCommandLineNonHelpFlags() after the +// dlopen, to get the new flags. But you have to explicitly +// Allow() it; otherwise, you get the normal default behavior +// of unrecognized flags calling a fatal error. +// TODO(csilvers): this isn't used. Just delete it? +// -------------------------------------------------------------------- + +void AllowCommandLineReparsing() { + allow_command_line_reparsing = true; +} + +uint32 ReparseCommandLineNonHelpFlags() { + // We make a copy of argc and argv to pass in + const vector<string>& argvs = GetArgvs(); + int tmp_argc = static_cast<int>(argvs.size()); + char** tmp_argv = new char* [tmp_argc + 1]; + for (int i = 0; i < tmp_argc; ++i) + tmp_argv[i] = strdup(argvs[i].c_str()); // TODO(csilvers): don't dup + + const int retval = ParseCommandLineNonHelpFlags(&tmp_argc, &tmp_argv, false); + + for (int i = 0; i < tmp_argc; ++i) + free(tmp_argv[i]); + delete[] tmp_argv; + + return retval; +} + +_END_GOOGLE_NAMESPACE_ diff --git a/dtm_release/lib/util/gflags-1.1/src/gflags/gflags.h b/dtm_release/lib/util/gflags-1.1/src/gflags/gflags.h new file mode 100644 index 0000000000000000000000000000000000000000..6bcc61c4df7360f1a7824a5aa13474b748c46218 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/src/gflags/gflags.h @@ -0,0 +1,527 @@ +// Copyright (c) 2006, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// Author: Ray Sidney +// Revamped and reorganized by Craig Silverstein +// +// This is the file that should be included by any file which declares +// or defines a command line flag or wants to parse command line flags +// or print a program usage message (which will include information about +// flags). Executive summary, in the form of an example foo.cc file: +// +// #include "foo.h" // foo.h has a line "DECLARE_int32(start);" +// +// DEFINE_int32(end, 1000, "The last record to read"); +// DECLARE_bool(verbose); // some other file has a DEFINE_bool(verbose, ...) +// +// void MyFunc() { +// if (FLAGS_verbose) printf("Records %d-%d\n", FLAGS_start, FLAGS_end); +// } +// +// Then, at the command-line: +// ./foo --noverbose --start=5 --end=100 +// +// For more details, see +// doc/gflags.html +// +// --- A note about thread-safety: +// +// We describe many functions in this routine as being thread-hostile, +// thread-compatible, or thread-safe. Here are the meanings we use: +// +// thread-safe: it is safe for multiple threads to call this routine +// (or, when referring to a class, methods of this class) +// concurrently. +// thread-hostile: it is not safe for multiple threads to call this +// routine (or methods of this class) concurrently. In gflags, +// most thread-hostile routines are intended to be called early in, +// or even before, main() -- that is, before threads are spawned. +// thread-compatible: it is safe for multiple threads to read from +// this variable (when applied to variables), or to call const +// methods of this class (when applied to classes), as long as no +// other thread is writing to the variable or calling non-const +// methods of this class. + +#ifndef GOOGLE_GFLAGS_H_ +#define GOOGLE_GFLAGS_H_ + +#include <string> +#include <vector> + +// We care a lot about number of bits things take up. Unfortunately, +// systems define their bit-specific ints in a lot of different ways. +// We use our own way, and have a typedef to get there. +// Note: these commands below may look like "#if 1" or "#if 0", but +// that's because they were constructed that way at ./configure time. +// Look at gflags.h.in to see how they're calculated (based on your config). +#if 1 +#include <stdint.h> // the normal place uint16_t is defined +#endif +#if 1 +#include <sys/types.h> // the normal place u_int16_t is defined +#endif +#if 1 +#include <inttypes.h> // a third place for uint16_t or u_int16_t +#endif + +namespace google { + +#if 1 // the C99 format +typedef int32_t int32; +typedef uint32_t uint32; +typedef int64_t int64; +typedef uint64_t uint64; +#elif 1 // the BSD format +typedef int32_t int32; +typedef u_int32_t uint32; +typedef int64_t int64; +typedef u_int64_t uint64; +#elif 0 // the windows (vc7) format +typedef __int32 int32; +typedef unsigned __int32 uint32; +typedef __int64 int64; +typedef unsigned __int64 uint64; +#else +#error Do not know how to define a 32-bit integer quantity on your system +#endif + +// -------------------------------------------------------------------- +// To actually define a flag in a file, use DEFINE_bool, +// DEFINE_string, etc. at the bottom of this file. You may also find +// it useful to register a validator with the flag. This ensures that +// when the flag is parsed from the commandline, or is later set via +// SetCommandLineOption, we call the validation function. +// +// The validation function should return true if the flag value is valid, and +// false otherwise. If the function returns false for the new setting of the +// flag, the flag will retain its current value. If it returns false for the +// default value, InitGoogle will die. +// +// This function is safe to call at global construct time (as in the +// example below). +// +// Example use: +// static bool ValidatePort(const char* flagname, int32 value) { +// if (value > 0 && value < 32768) // value is ok +// return true; +// printf("Invalid value for --%s: %d\n", flagname, (int)value); +// return false; +// } +// DEFINE_int32(port, 0, "What port to listen on"); +// static bool dummy = RegisterFlagValidator(&FLAGS_port, &ValidatePort); + +// Returns true if successfully registered, false if not (because the +// first argument doesn't point to a command-line flag, or because a +// validator is already registered for this flag). +bool RegisterFlagValidator(const bool* flag, + bool (*validate_fn)(const char*, bool)); +bool RegisterFlagValidator(const int32* flag, + bool (*validate_fn)(const char*, int32)); +bool RegisterFlagValidator(const int64* flag, + bool (*validate_fn)(const char*, int64)); +bool RegisterFlagValidator(const uint64* flag, + bool (*validate_fn)(const char*, uint64)); +bool RegisterFlagValidator(const double* flag, + bool (*validate_fn)(const char*, double)); +bool RegisterFlagValidator(const std::string* flag, + bool (*validate_fn)(const char*, const std::string&)); + + +// -------------------------------------------------------------------- +// These methods are the best way to get access to info about the +// list of commandline flags. Note that these routines are pretty slow. +// GetAllFlags: mostly-complete info about the list, sorted by file. +// ShowUsageWithFlags: pretty-prints the list to stdout (what --help does) +// ShowUsageWithFlagsRestrict: limit to filenames with restrict as a substr +// +// In addition to accessing flags, you can also access argv[0] (the program +// name) and argv (the entire commandline), which we sock away a copy of. +// These variables are static, so you should only set them once. + +struct CommandLineFlagInfo { + std::string name; // the name of the flag + std::string type; // the type of the flag: int32, etc + std::string description; // the "help text" associated with the flag + std::string current_value; // the current value, as a string + std::string default_value; // the default value, as a string + std::string filename; // 'cleaned' version of filename holding the flag + bool has_validator_fn; // true if RegisterFlagValidator called on flag + bool is_default; // true if the flag has default value +}; + +extern void GetAllFlags(std::vector<CommandLineFlagInfo>* OUTPUT); +// These two are actually defined in commandlineflags_reporting.cc. +extern void ShowUsageWithFlags(const char *argv0); // what --help does +extern void ShowUsageWithFlagsRestrict(const char *argv0, const char *restrict); + +// Create a descriptive string for a flag. +// Goes to some trouble to make pretty line breaks. +extern std::string DescribeOneFlag(const CommandLineFlagInfo& flag); + +// Thread-hostile; meant to be called before any threads are spawned. +extern void SetArgv(int argc, const char** argv); +// The following functions are thread-safe as long as SetArgv() is +// only called before any threads start. +extern const std::vector<std::string>& GetArgvs(); // all of argv as a vector +extern const char* GetArgv(); // all of argv as a string +extern const char* GetArgv0(); // only argv0 +extern uint32 GetArgvSum(); // simple checksum of argv +extern const char* ProgramInvocationName(); // argv0, or "UNKNOWN" if not set +extern const char* ProgramInvocationShortName(); // basename(argv0) +// ProgramUsage() is thread-safe as long as SetUsageMessage() is only +// called before any threads start. +extern const char* ProgramUsage(); // string set by SetUsageMessage() + + +// -------------------------------------------------------------------- +// Normally you access commandline flags by just saying "if (FLAGS_foo)" +// or whatever, and set them by calling "FLAGS_foo = bar" (or, more +// commonly, via the DEFINE_foo macro). But if you need a bit more +// control, we have programmatic ways to get/set the flags as well. +// These programmatic ways to access flags are thread-safe, but direct +// access is only thread-compatible. + +// Return true iff the flagname was found. +// OUTPUT is set to the flag's value, or unchanged if we return false. +extern bool GetCommandLineOption(const char* name, std::string* OUTPUT); + +// Return true iff the flagname was found. OUTPUT is set to the flag's +// CommandLineFlagInfo or unchanged if we return false. +extern bool GetCommandLineFlagInfo(const char* name, + CommandLineFlagInfo* OUTPUT); + +// Return the CommandLineFlagInfo of the flagname. exit() if name not found. +// Example usage, to check if a flag's value is currently the default value: +// if (GetCommandLineFlagInfoOrDie("foo").is_default) ... +extern CommandLineFlagInfo GetCommandLineFlagInfoOrDie(const char* name); + +enum FlagSettingMode { + // update the flag's value (can call this multiple times). + SET_FLAGS_VALUE, + // update the flag's value, but *only if* it has not yet been updated + // with SET_FLAGS_VALUE, SET_FLAG_IF_DEFAULT, or "FLAGS_xxx = nondef". + SET_FLAG_IF_DEFAULT, + // set the flag's default value to this. If the flag has not yet updated + // yet (via SET_FLAGS_VALUE, SET_FLAG_IF_DEFAULT, or "FLAGS_xxx = nondef") + // change the flag's current value to the new default value as well. + SET_FLAGS_DEFAULT +}; + +// Set a particular flag ("command line option"). Returns a string +// describing the new value that the option has been set to. The +// return value API is not well-specified, so basically just depend on +// it to be empty if the setting failed for some reason -- the name is +// not a valid flag name, or the value is not a valid value -- and +// non-empty else. + +// SetCommandLineOption uses set_mode == SET_FLAGS_VALUE (the common case) +extern std::string SetCommandLineOption(const char* name, const char* value); +extern std::string SetCommandLineOptionWithMode(const char* name, const char* value, + FlagSettingMode set_mode); + + +// -------------------------------------------------------------------- +// Saves the states (value, default value, whether the user has set +// the flag, registered validators, etc) of all flags, and restores +// them when the FlagSaver is destroyed. This is very useful in +// tests, say, when you want to let your tests change the flags, but +// make sure that they get reverted to the original states when your +// test is complete. +// +// Example usage: +// void TestFoo() { +// FlagSaver s1; +// FLAG_foo = false; +// FLAG_bar = "some value"; +// +// // test happens here. You can return at any time +// // without worrying about restoring the FLAG values. +// } +// +// Note: This class is marked with __attribute__((unused)) because all the +// work is done in the constructor and destructor, so in the standard +// usage example above, the compiler would complain that it's an +// unused variable. +// +// This class is thread-safe. + +class FlagSaver { + public: + FlagSaver(); + ~FlagSaver(); + + private: + class FlagSaverImpl* impl_; // we use pimpl here to keep API steady + + FlagSaver(const FlagSaver&); // no copying! + void operator=(const FlagSaver&); +} __attribute__ ((unused)); + +// -------------------------------------------------------------------- +// Some deprecated or hopefully-soon-to-be-deprecated functions. + +// This is often used for logging. TODO(csilvers): figure out a better way +extern std::string CommandlineFlagsIntoString(); +// Usually where this is used, a FlagSaver should be used instead. +extern bool ReadFlagsFromString(const std::string& flagfilecontents, + const char* prog_name, + bool errors_are_fatal); // uses SET_FLAGS_VALUE + +// These let you manually implement --flagfile functionality. +// DEPRECATED. +extern bool AppendFlagsIntoFile(const std::string& filename, const char* prog_name); +extern bool SaveCommandFlags(); // actually defined in google.cc ! +extern bool ReadFromFlagsFile(const std::string& filename, const char* prog_name, + bool errors_are_fatal); // uses SET_FLAGS_VALUE + + +// -------------------------------------------------------------------- +// Useful routines for initializing flags from the environment. +// In each case, if 'varname' does not exist in the environment +// return defval. If 'varname' does exist but is not valid +// (e.g., not a number for an int32 flag), abort with an error. +// Otherwise, return the value. NOTE: for booleans, for true use +// 't' or 'T' or 'true' or '1', for false 'f' or 'F' or 'false' or '0'. + +extern bool BoolFromEnv(const char *varname, bool defval); +extern int32 Int32FromEnv(const char *varname, int32 defval); +extern int64 Int64FromEnv(const char *varname, int64 defval); +extern uint64 Uint64FromEnv(const char *varname, uint64 defval); +extern double DoubleFromEnv(const char *varname, double defval); +extern const char *StringFromEnv(const char *varname, const char *defval); + + +// -------------------------------------------------------------------- +// The next two functions parse commandlineflags from main(): + +// Set the "usage" message for this program. For example: +// string usage("This program does nothing. Sample usage:\n"); +// usage += argv[0] + " <uselessarg1> <uselessarg2>"; +// SetUsageMessage(usage); +// Do not include commandline flags in the usage: we do that for you! +// Thread-hostile; meant to be called before any threads are spawned. +extern void SetUsageMessage(const std::string& usage); + +// Looks for flags in argv and parses them. Rearranges argv to put +// flags first, or removes them entirely if remove_flags is true. +// If a flag is defined more than once in the command line or flag +// file, the last definition is used. +// See top-of-file for more details on this function. +#ifndef SWIG // In swig, use ParseCommandLineFlagsScript() instead. +extern uint32 ParseCommandLineFlags(int *argc, char*** argv, + bool remove_flags); +#endif + + +// Calls to ParseCommandLineNonHelpFlags and then to +// HandleCommandLineHelpFlags can be used instead of a call to +// ParseCommandLineFlags during initialization, in order to allow for +// changing default values for some FLAGS (via +// e.g. SetCommandLineOptionWithMode calls) between the time of +// command line parsing and the time of dumping help information for +// the flags as a result of command line parsing. +// If a flag is defined more than once in the command line or flag +// file, the last definition is used. +extern uint32 ParseCommandLineNonHelpFlags(int *argc, char*** argv, + bool remove_flags); +// This is actually defined in commandlineflags_reporting.cc. +// This function is misnamed (it also handles --version, etc.), but +// it's too late to change that now. :-( +extern void HandleCommandLineHelpFlags(); // in commandlineflags_reporting.cc + +// Allow command line reparsing. Disables the error normally +// generated when an unknown flag is found, since it may be found in a +// later parse. Thread-hostile; meant to be called before any threads +// are spawned. +extern void AllowCommandLineReparsing(); + +// Reparse the flags that have not yet been recognized. +// Only flags registered since the last parse will be recognized. +// Any flag value must be provided as part of the argument using "=", +// not as a separate command line argument that follows the flag argument. +// Intended for handling flags from dynamically loaded libraries, +// since their flags are not registered until they are loaded. +extern uint32 ReparseCommandLineNonHelpFlags(); + + +// -------------------------------------------------------------------- +// Now come the command line flag declaration/definition macros that +// will actually be used. They're kind of hairy. A major reason +// for this is initialization: we want people to be able to access +// variables in global constructors and have that not crash, even if +// their global constructor runs before the global constructor here. +// (Obviously, we can't guarantee the flags will have the correct +// default value in that case, but at least accessing them is safe.) +// The only way to do that is have flags point to a static buffer. +// So we make one, using a union to ensure proper alignment, and +// then use placement-new to actually set up the flag with the +// correct default value. In the same vein, we have to worry about +// flag access in global destructors, so FlagRegisterer has to be +// careful never to destroy the flag-values it constructs. +// +// Note that when we define a flag variable FLAGS_<name>, we also +// preemptively define a junk variable, FLAGS_no<name>. This is to +// cause a link-time error if someone tries to define 2 flags with +// names like "logging" and "nologging". We do this because a bool +// flag FLAG can be set from the command line to true with a "-FLAG" +// argument, and to false with a "-noFLAG" argument, and so this can +// potentially avert confusion. +// +// We also put flags into their own namespace. It is purposefully +// named in an opaque way that people should have trouble typing +// directly. The idea is that DEFINE puts the flag in the weird +// namespace, and DECLARE imports the flag from there into the current +// namespace. The net result is to force people to use DECLARE to get +// access to a flag, rather than saying "extern bool FLAGS_whatever;" +// or some such instead. We want this so we can put extra +// functionality (like sanity-checking) in DECLARE if we want, and +// make sure it is picked up everywhere. +// +// We also put the type of the variable in the namespace, so that +// people can't DECLARE_int32 something that they DEFINE_bool'd +// elsewhere. + +class FlagRegisterer { + public: + FlagRegisterer(const char* name, const char* type, + const char* help, const char* filename, + void* current_storage, void* defvalue_storage); +}; + +#ifndef SWIG // In swig, ignore the main flag declarations + +// If your application #defines STRIP_FLAG_HELP to a non-zero value +// before #including this file, we remove the help message from the +// binary file. This can reduce the size of the resulting binary +// somewhat, and may also be useful for security reasons. + +extern const char kStrippedFlagHelp[]; + +#if defined(STRIP_FLAG_HELP) && STRIP_FLAG_HELP > 0 +// Need this construct to avoid the 'defined but not used' warning. +#define MAYBE_STRIPPED_HELP(txt) (false ? (txt) : kStrippedFlagHelp) +#else +#define MAYBE_STRIPPED_HELP(txt) txt +#endif + +// Each command-line flag has two variables associated with it: one +// with the current value, and one with the default value. However, +// we have a third variable, which is where value is assigned; it's a +// constant. This guarantees that FLAG_##value is initialized at +// static initialization time (e.g. before program-start) rather than +// than global construction time (which is after program-start but +// before main), at least when 'value' is a compile-time constant. We +// use a small trick for the "default value" variable, and call it +// FLAGS_no<name>. This serves the second purpose of assuring a +// compile error if someone tries to define a flag named no<name> +// which is illegal (--foo and --nofoo both affect the "foo" flag). +#define DEFINE_VARIABLE(type, shorttype, name, value, help) \ + namespace fL##shorttype { \ + static const type FLAGS_nono##name = value; \ + type FLAGS_##name = FLAGS_nono##name; \ + type FLAGS_no##name = FLAGS_nono##name; \ + static ::google::FlagRegisterer o_##name( \ + #name, #type, MAYBE_STRIPPED_HELP(help), __FILE__, \ + &FLAGS_##name, &FLAGS_no##name); \ + } \ + using fL##shorttype::FLAGS_##name + +#define DECLARE_VARIABLE(type, shorttype, name) \ + namespace fL##shorttype { \ + extern type FLAGS_##name; \ + } \ + using fL##shorttype::FLAGS_##name + +// For boolean flags, we want to do the extra check that the passed-in +// value is actually a bool, and not a string or something that can be +// coerced to a bool. These declarations (no definition needed!) will +// help us do that, and never evaluate from, which is important. +// We'll use 'sizeof(IsBool(val))' to distinguish. +namespace fLB { +template<typename From> double IsBoolFlag(const From& from); +bool IsBoolFlag(bool from); +} +extern bool FlagsTypeWarn(const char *name); + +#define DECLARE_bool(name) DECLARE_VARIABLE(bool,B, name) +// We have extra code here to make sure 'val' is actually a boolean. +#define DEFINE_bool(name,val,txt) namespace fLB { \ + const bool FLAGS_nonono##name = \ + (sizeof(::google::fLB::IsBoolFlag(val)) \ + == sizeof(double)) \ + ? ::google::FlagsTypeWarn(#name) : true; \ + } \ + DEFINE_VARIABLE(bool,B, name, val, txt) +#define DECLARE_int32(name) DECLARE_VARIABLE(::google::int32,I, name) +#define DEFINE_int32(name,val,txt) DEFINE_VARIABLE(::google::int32,I, name, val, txt) + +#define DECLARE_int64(name) DECLARE_VARIABLE(::google::int64,I64, name) +#define DEFINE_int64(name,val,txt) DEFINE_VARIABLE(::google::int64,I64, name, val, txt) + +#define DECLARE_uint64(name) DECLARE_VARIABLE(::google::uint64,U64, name) +#define DEFINE_uint64(name,val,txt) DEFINE_VARIABLE(::google::uint64,U64, name, val, txt) + +#define DECLARE_double(name) DECLARE_VARIABLE(double,D, name) +#define DEFINE_double(name,val,txt) DEFINE_VARIABLE(double,D, name, val, txt) + +// Strings are trickier, because they're not a POD, so we can't +// construct them at static-initialization time (instead they get +// constructed at global-constructor time, which is much later). To +// try to avoid crashes in that case, we use a char buffer to store +// the string, which we can static-initialize, and then placement-new +// into it later. It's not perfect, but the best we can do. +#define DECLARE_string(name) namespace fLS { extern std::string& FLAGS_##name; } \ + using fLS::FLAGS_##name + +// We need to define a var named FLAGS_no##name so people don't define +// --string and --nostring. And we need a temporary place to put val +// so we don't have to evaluate it twice. Two great needs that go +// great together! +// The weird 'using' + 'extern' inside the fLS namespace is to work around +// an unknown compiler bug/issue with the gcc 4.2.1 on SUSE 10. See +// http://code.google.com/p/google-gflags/issues/detail?id=20 +#define DEFINE_string(name, val, txt) \ + namespace fLS { \ + static union { void* align; char s[sizeof(std::string)]; } s_##name[2]; \ + const std::string* const FLAGS_no##name = new (s_##name[0].s) std::string(val); \ + static ::google::FlagRegisterer o_##name( \ + #name, "string", MAYBE_STRIPPED_HELP(txt), __FILE__, \ + s_##name[0].s, new (s_##name[1].s) std::string(*FLAGS_no##name)); \ + extern std::string& FLAGS_##name; \ + using fLS::FLAGS_##name; \ + std::string& FLAGS_##name = *(reinterpret_cast<std::string*>(s_##name[0].s)); \ + } \ + using fLS::FLAGS_##name + +#endif // SWIG + +} + +#endif // GOOGLE_GFLAGS_H_ diff --git a/dtm_release/lib/util/gflags-1.1/src/gflags/gflags.h.in b/dtm_release/lib/util/gflags-1.1/src/gflags/gflags.h.in new file mode 100644 index 0000000000000000000000000000000000000000..4bf91fead903e3994abdc0a90c7d3b099388666c --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/src/gflags/gflags.h.in @@ -0,0 +1,527 @@ +// Copyright (c) 2006, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// Author: Ray Sidney +// Revamped and reorganized by Craig Silverstein +// +// This is the file that should be included by any file which declares +// or defines a command line flag or wants to parse command line flags +// or print a program usage message (which will include information about +// flags). Executive summary, in the form of an example foo.cc file: +// +// #include "foo.h" // foo.h has a line "DECLARE_int32(start);" +// +// DEFINE_int32(end, 1000, "The last record to read"); +// DECLARE_bool(verbose); // some other file has a DEFINE_bool(verbose, ...) +// +// void MyFunc() { +// if (FLAGS_verbose) printf("Records %d-%d\n", FLAGS_start, FLAGS_end); +// } +// +// Then, at the command-line: +// ./foo --noverbose --start=5 --end=100 +// +// For more details, see +// doc/gflags.html +// +// --- A note about thread-safety: +// +// We describe many functions in this routine as being thread-hostile, +// thread-compatible, or thread-safe. Here are the meanings we use: +// +// thread-safe: it is safe for multiple threads to call this routine +// (or, when referring to a class, methods of this class) +// concurrently. +// thread-hostile: it is not safe for multiple threads to call this +// routine (or methods of this class) concurrently. In gflags, +// most thread-hostile routines are intended to be called early in, +// or even before, main() -- that is, before threads are spawned. +// thread-compatible: it is safe for multiple threads to read from +// this variable (when applied to variables), or to call const +// methods of this class (when applied to classes), as long as no +// other thread is writing to the variable or calling non-const +// methods of this class. + +#ifndef GOOGLE_GFLAGS_H_ +#define GOOGLE_GFLAGS_H_ + +#include <string> +#include <vector> + +// We care a lot about number of bits things take up. Unfortunately, +// systems define their bit-specific ints in a lot of different ways. +// We use our own way, and have a typedef to get there. +// Note: these commands below may look like "#if 1" or "#if 0", but +// that's because they were constructed that way at ./configure time. +// Look at gflags.h.in to see how they're calculated (based on your config). +#if @ac_cv_have_stdint_h@ +#include <stdint.h> // the normal place uint16_t is defined +#endif +#if @ac_cv_have_systypes_h@ +#include <sys/types.h> // the normal place u_int16_t is defined +#endif +#if @ac_cv_have_inttypes_h@ +#include <inttypes.h> // a third place for uint16_t or u_int16_t +#endif + +@ac_google_start_namespace@ + +#if @ac_cv_have_uint16_t@ // the C99 format +typedef int32_t int32; +typedef uint32_t uint32; +typedef int64_t int64; +typedef uint64_t uint64; +#elif @ac_cv_have_u_int16_t@ // the BSD format +typedef int32_t int32; +typedef u_int32_t uint32; +typedef int64_t int64; +typedef u_int64_t uint64; +#elif @ac_cv_have___int16@ // the windows (vc7) format +typedef __int32 int32; +typedef unsigned __int32 uint32; +typedef __int64 int64; +typedef unsigned __int64 uint64; +#else +#error Do not know how to define a 32-bit integer quantity on your system +#endif + +// -------------------------------------------------------------------- +// To actually define a flag in a file, use DEFINE_bool, +// DEFINE_string, etc. at the bottom of this file. You may also find +// it useful to register a validator with the flag. This ensures that +// when the flag is parsed from the commandline, or is later set via +// SetCommandLineOption, we call the validation function. +// +// The validation function should return true if the flag value is valid, and +// false otherwise. If the function returns false for the new setting of the +// flag, the flag will retain its current value. If it returns false for the +// default value, InitGoogle will die. +// +// This function is safe to call at global construct time (as in the +// example below). +// +// Example use: +// static bool ValidatePort(const char* flagname, int32 value) { +// if (value > 0 && value < 32768) // value is ok +// return true; +// printf("Invalid value for --%s: %d\n", flagname, (int)value); +// return false; +// } +// DEFINE_int32(port, 0, "What port to listen on"); +// static bool dummy = RegisterFlagValidator(&FLAGS_port, &ValidatePort); + +// Returns true if successfully registered, false if not (because the +// first argument doesn't point to a command-line flag, or because a +// validator is already registered for this flag). +bool RegisterFlagValidator(const bool* flag, + bool (*validate_fn)(const char*, bool)); +bool RegisterFlagValidator(const int32* flag, + bool (*validate_fn)(const char*, int32)); +bool RegisterFlagValidator(const int64* flag, + bool (*validate_fn)(const char*, int64)); +bool RegisterFlagValidator(const uint64* flag, + bool (*validate_fn)(const char*, uint64)); +bool RegisterFlagValidator(const double* flag, + bool (*validate_fn)(const char*, double)); +bool RegisterFlagValidator(const std::string* flag, + bool (*validate_fn)(const char*, const std::string&)); + + +// -------------------------------------------------------------------- +// These methods are the best way to get access to info about the +// list of commandline flags. Note that these routines are pretty slow. +// GetAllFlags: mostly-complete info about the list, sorted by file. +// ShowUsageWithFlags: pretty-prints the list to stdout (what --help does) +// ShowUsageWithFlagsRestrict: limit to filenames with restrict as a substr +// +// In addition to accessing flags, you can also access argv[0] (the program +// name) and argv (the entire commandline), which we sock away a copy of. +// These variables are static, so you should only set them once. + +struct CommandLineFlagInfo { + std::string name; // the name of the flag + std::string type; // the type of the flag: int32, etc + std::string description; // the "help text" associated with the flag + std::string current_value; // the current value, as a string + std::string default_value; // the default value, as a string + std::string filename; // 'cleaned' version of filename holding the flag + bool has_validator_fn; // true if RegisterFlagValidator called on flag + bool is_default; // true if the flag has default value +}; + +extern void GetAllFlags(std::vector<CommandLineFlagInfo>* OUTPUT); +// These two are actually defined in commandlineflags_reporting.cc. +extern void ShowUsageWithFlags(const char *argv0); // what --help does +extern void ShowUsageWithFlagsRestrict(const char *argv0, const char *restrict); + +// Create a descriptive string for a flag. +// Goes to some trouble to make pretty line breaks. +extern std::string DescribeOneFlag(const CommandLineFlagInfo& flag); + +// Thread-hostile; meant to be called before any threads are spawned. +extern void SetArgv(int argc, const char** argv); +// The following functions are thread-safe as long as SetArgv() is +// only called before any threads start. +extern const std::vector<std::string>& GetArgvs(); // all of argv as a vector +extern const char* GetArgv(); // all of argv as a string +extern const char* GetArgv0(); // only argv0 +extern uint32 GetArgvSum(); // simple checksum of argv +extern const char* ProgramInvocationName(); // argv0, or "UNKNOWN" if not set +extern const char* ProgramInvocationShortName(); // basename(argv0) +// ProgramUsage() is thread-safe as long as SetUsageMessage() is only +// called before any threads start. +extern const char* ProgramUsage(); // string set by SetUsageMessage() + + +// -------------------------------------------------------------------- +// Normally you access commandline flags by just saying "if (FLAGS_foo)" +// or whatever, and set them by calling "FLAGS_foo = bar" (or, more +// commonly, via the DEFINE_foo macro). But if you need a bit more +// control, we have programmatic ways to get/set the flags as well. +// These programmatic ways to access flags are thread-safe, but direct +// access is only thread-compatible. + +// Return true iff the flagname was found. +// OUTPUT is set to the flag's value, or unchanged if we return false. +extern bool GetCommandLineOption(const char* name, std::string* OUTPUT); + +// Return true iff the flagname was found. OUTPUT is set to the flag's +// CommandLineFlagInfo or unchanged if we return false. +extern bool GetCommandLineFlagInfo(const char* name, + CommandLineFlagInfo* OUTPUT); + +// Return the CommandLineFlagInfo of the flagname. exit() if name not found. +// Example usage, to check if a flag's value is currently the default value: +// if (GetCommandLineFlagInfoOrDie("foo").is_default) ... +extern CommandLineFlagInfo GetCommandLineFlagInfoOrDie(const char* name); + +enum FlagSettingMode { + // update the flag's value (can call this multiple times). + SET_FLAGS_VALUE, + // update the flag's value, but *only if* it has not yet been updated + // with SET_FLAGS_VALUE, SET_FLAG_IF_DEFAULT, or "FLAGS_xxx = nondef". + SET_FLAG_IF_DEFAULT, + // set the flag's default value to this. If the flag has not yet updated + // yet (via SET_FLAGS_VALUE, SET_FLAG_IF_DEFAULT, or "FLAGS_xxx = nondef") + // change the flag's current value to the new default value as well. + SET_FLAGS_DEFAULT +}; + +// Set a particular flag ("command line option"). Returns a string +// describing the new value that the option has been set to. The +// return value API is not well-specified, so basically just depend on +// it to be empty if the setting failed for some reason -- the name is +// not a valid flag name, or the value is not a valid value -- and +// non-empty else. + +// SetCommandLineOption uses set_mode == SET_FLAGS_VALUE (the common case) +extern std::string SetCommandLineOption(const char* name, const char* value); +extern std::string SetCommandLineOptionWithMode(const char* name, const char* value, + FlagSettingMode set_mode); + + +// -------------------------------------------------------------------- +// Saves the states (value, default value, whether the user has set +// the flag, registered validators, etc) of all flags, and restores +// them when the FlagSaver is destroyed. This is very useful in +// tests, say, when you want to let your tests change the flags, but +// make sure that they get reverted to the original states when your +// test is complete. +// +// Example usage: +// void TestFoo() { +// FlagSaver s1; +// FLAG_foo = false; +// FLAG_bar = "some value"; +// +// // test happens here. You can return at any time +// // without worrying about restoring the FLAG values. +// } +// +// Note: This class is marked with __attribute__((unused)) because all the +// work is done in the constructor and destructor, so in the standard +// usage example above, the compiler would complain that it's an +// unused variable. +// +// This class is thread-safe. + +class FlagSaver { + public: + FlagSaver(); + ~FlagSaver(); + + private: + class FlagSaverImpl* impl_; // we use pimpl here to keep API steady + + FlagSaver(const FlagSaver&); // no copying! + void operator=(const FlagSaver&); +} @ac_cv___attribute__unused@; + +// -------------------------------------------------------------------- +// Some deprecated or hopefully-soon-to-be-deprecated functions. + +// This is often used for logging. TODO(csilvers): figure out a better way +extern std::string CommandlineFlagsIntoString(); +// Usually where this is used, a FlagSaver should be used instead. +extern bool ReadFlagsFromString(const std::string& flagfilecontents, + const char* prog_name, + bool errors_are_fatal); // uses SET_FLAGS_VALUE + +// These let you manually implement --flagfile functionality. +// DEPRECATED. +extern bool AppendFlagsIntoFile(const std::string& filename, const char* prog_name); +extern bool SaveCommandFlags(); // actually defined in google.cc ! +extern bool ReadFromFlagsFile(const std::string& filename, const char* prog_name, + bool errors_are_fatal); // uses SET_FLAGS_VALUE + + +// -------------------------------------------------------------------- +// Useful routines for initializing flags from the environment. +// In each case, if 'varname' does not exist in the environment +// return defval. If 'varname' does exist but is not valid +// (e.g., not a number for an int32 flag), abort with an error. +// Otherwise, return the value. NOTE: for booleans, for true use +// 't' or 'T' or 'true' or '1', for false 'f' or 'F' or 'false' or '0'. + +extern bool BoolFromEnv(const char *varname, bool defval); +extern int32 Int32FromEnv(const char *varname, int32 defval); +extern int64 Int64FromEnv(const char *varname, int64 defval); +extern uint64 Uint64FromEnv(const char *varname, uint64 defval); +extern double DoubleFromEnv(const char *varname, double defval); +extern const char *StringFromEnv(const char *varname, const char *defval); + + +// -------------------------------------------------------------------- +// The next two functions parse commandlineflags from main(): + +// Set the "usage" message for this program. For example: +// string usage("This program does nothing. Sample usage:\n"); +// usage += argv[0] + " <uselessarg1> <uselessarg2>"; +// SetUsageMessage(usage); +// Do not include commandline flags in the usage: we do that for you! +// Thread-hostile; meant to be called before any threads are spawned. +extern void SetUsageMessage(const std::string& usage); + +// Looks for flags in argv and parses them. Rearranges argv to put +// flags first, or removes them entirely if remove_flags is true. +// If a flag is defined more than once in the command line or flag +// file, the last definition is used. +// See top-of-file for more details on this function. +#ifndef SWIG // In swig, use ParseCommandLineFlagsScript() instead. +extern uint32 ParseCommandLineFlags(int *argc, char*** argv, + bool remove_flags); +#endif + + +// Calls to ParseCommandLineNonHelpFlags and then to +// HandleCommandLineHelpFlags can be used instead of a call to +// ParseCommandLineFlags during initialization, in order to allow for +// changing default values for some FLAGS (via +// e.g. SetCommandLineOptionWithMode calls) between the time of +// command line parsing and the time of dumping help information for +// the flags as a result of command line parsing. +// If a flag is defined more than once in the command line or flag +// file, the last definition is used. +extern uint32 ParseCommandLineNonHelpFlags(int *argc, char*** argv, + bool remove_flags); +// This is actually defined in commandlineflags_reporting.cc. +// This function is misnamed (it also handles --version, etc.), but +// it's too late to change that now. :-( +extern void HandleCommandLineHelpFlags(); // in commandlineflags_reporting.cc + +// Allow command line reparsing. Disables the error normally +// generated when an unknown flag is found, since it may be found in a +// later parse. Thread-hostile; meant to be called before any threads +// are spawned. +extern void AllowCommandLineReparsing(); + +// Reparse the flags that have not yet been recognized. +// Only flags registered since the last parse will be recognized. +// Any flag value must be provided as part of the argument using "=", +// not as a separate command line argument that follows the flag argument. +// Intended for handling flags from dynamically loaded libraries, +// since their flags are not registered until they are loaded. +extern uint32 ReparseCommandLineNonHelpFlags(); + + +// -------------------------------------------------------------------- +// Now come the command line flag declaration/definition macros that +// will actually be used. They're kind of hairy. A major reason +// for this is initialization: we want people to be able to access +// variables in global constructors and have that not crash, even if +// their global constructor runs before the global constructor here. +// (Obviously, we can't guarantee the flags will have the correct +// default value in that case, but at least accessing them is safe.) +// The only way to do that is have flags point to a static buffer. +// So we make one, using a union to ensure proper alignment, and +// then use placement-new to actually set up the flag with the +// correct default value. In the same vein, we have to worry about +// flag access in global destructors, so FlagRegisterer has to be +// careful never to destroy the flag-values it constructs. +// +// Note that when we define a flag variable FLAGS_<name>, we also +// preemptively define a junk variable, FLAGS_no<name>. This is to +// cause a link-time error if someone tries to define 2 flags with +// names like "logging" and "nologging". We do this because a bool +// flag FLAG can be set from the command line to true with a "-FLAG" +// argument, and to false with a "-noFLAG" argument, and so this can +// potentially avert confusion. +// +// We also put flags into their own namespace. It is purposefully +// named in an opaque way that people should have trouble typing +// directly. The idea is that DEFINE puts the flag in the weird +// namespace, and DECLARE imports the flag from there into the current +// namespace. The net result is to force people to use DECLARE to get +// access to a flag, rather than saying "extern bool FLAGS_whatever;" +// or some such instead. We want this so we can put extra +// functionality (like sanity-checking) in DECLARE if we want, and +// make sure it is picked up everywhere. +// +// We also put the type of the variable in the namespace, so that +// people can't DECLARE_int32 something that they DEFINE_bool'd +// elsewhere. + +class FlagRegisterer { + public: + FlagRegisterer(const char* name, const char* type, + const char* help, const char* filename, + void* current_storage, void* defvalue_storage); +}; + +#ifndef SWIG // In swig, ignore the main flag declarations + +// If your application #defines STRIP_FLAG_HELP to a non-zero value +// before #including this file, we remove the help message from the +// binary file. This can reduce the size of the resulting binary +// somewhat, and may also be useful for security reasons. + +extern const char kStrippedFlagHelp[]; + +#if defined(STRIP_FLAG_HELP) && STRIP_FLAG_HELP > 0 +// Need this construct to avoid the 'defined but not used' warning. +#define MAYBE_STRIPPED_HELP(txt) (false ? (txt) : kStrippedFlagHelp) +#else +#define MAYBE_STRIPPED_HELP(txt) txt +#endif + +// Each command-line flag has two variables associated with it: one +// with the current value, and one with the default value. However, +// we have a third variable, which is where value is assigned; it's a +// constant. This guarantees that FLAG_##value is initialized at +// static initialization time (e.g. before program-start) rather than +// than global construction time (which is after program-start but +// before main), at least when 'value' is a compile-time constant. We +// use a small trick for the "default value" variable, and call it +// FLAGS_no<name>. This serves the second purpose of assuring a +// compile error if someone tries to define a flag named no<name> +// which is illegal (--foo and --nofoo both affect the "foo" flag). +#define DEFINE_VARIABLE(type, shorttype, name, value, help) \ + namespace fL##shorttype { \ + static const type FLAGS_nono##name = value; \ + type FLAGS_##name = FLAGS_nono##name; \ + type FLAGS_no##name = FLAGS_nono##name; \ + static @ac_google_namespace@::FlagRegisterer o_##name( \ + #name, #type, MAYBE_STRIPPED_HELP(help), __FILE__, \ + &FLAGS_##name, &FLAGS_no##name); \ + } \ + using fL##shorttype::FLAGS_##name + +#define DECLARE_VARIABLE(type, shorttype, name) \ + namespace fL##shorttype { \ + extern type FLAGS_##name; \ + } \ + using fL##shorttype::FLAGS_##name + +// For boolean flags, we want to do the extra check that the passed-in +// value is actually a bool, and not a string or something that can be +// coerced to a bool. These declarations (no definition needed!) will +// help us do that, and never evaluate from, which is important. +// We'll use 'sizeof(IsBool(val))' to distinguish. +namespace fLB { +template<typename From> double IsBoolFlag(const From& from); +bool IsBoolFlag(bool from); +} +extern bool FlagsTypeWarn(const char *name); + +#define DECLARE_bool(name) DECLARE_VARIABLE(bool,B, name) +// We have extra code here to make sure 'val' is actually a boolean. +#define DEFINE_bool(name,val,txt) namespace fLB { \ + const bool FLAGS_nonono##name = \ + (sizeof(@ac_google_namespace@::fLB::IsBoolFlag(val)) \ + == sizeof(double)) \ + ? @ac_google_namespace@::FlagsTypeWarn(#name) : true; \ + } \ + DEFINE_VARIABLE(bool,B, name, val, txt) +#define DECLARE_int32(name) DECLARE_VARIABLE(@ac_google_namespace@::int32,I, name) +#define DEFINE_int32(name,val,txt) DEFINE_VARIABLE(@ac_google_namespace@::int32,I, name, val, txt) + +#define DECLARE_int64(name) DECLARE_VARIABLE(@ac_google_namespace@::int64,I64, name) +#define DEFINE_int64(name,val,txt) DEFINE_VARIABLE(@ac_google_namespace@::int64,I64, name, val, txt) + +#define DECLARE_uint64(name) DECLARE_VARIABLE(@ac_google_namespace@::uint64,U64, name) +#define DEFINE_uint64(name,val,txt) DEFINE_VARIABLE(@ac_google_namespace@::uint64,U64, name, val, txt) + +#define DECLARE_double(name) DECLARE_VARIABLE(double,D, name) +#define DEFINE_double(name,val,txt) DEFINE_VARIABLE(double,D, name, val, txt) + +// Strings are trickier, because they're not a POD, so we can't +// construct them at static-initialization time (instead they get +// constructed at global-constructor time, which is much later). To +// try to avoid crashes in that case, we use a char buffer to store +// the string, which we can static-initialize, and then placement-new +// into it later. It's not perfect, but the best we can do. +#define DECLARE_string(name) namespace fLS { extern std::string& FLAGS_##name; } \ + using fLS::FLAGS_##name + +// We need to define a var named FLAGS_no##name so people don't define +// --string and --nostring. And we need a temporary place to put val +// so we don't have to evaluate it twice. Two great needs that go +// great together! +// The weird 'using' + 'extern' inside the fLS namespace is to work around +// an unknown compiler bug/issue with the gcc 4.2.1 on SUSE 10. See +// http://code.google.com/p/google-gflags/issues/detail?id=20 +#define DEFINE_string(name, val, txt) \ + namespace fLS { \ + static union { void* align; char s[sizeof(std::string)]; } s_##name[2]; \ + const std::string* const FLAGS_no##name = new (s_##name[0].s) std::string(val); \ + static @ac_google_namespace@::FlagRegisterer o_##name( \ + #name, "string", MAYBE_STRIPPED_HELP(txt), __FILE__, \ + s_##name[0].s, new (s_##name[1].s) std::string(*FLAGS_no##name)); \ + extern std::string& FLAGS_##name; \ + using fLS::FLAGS_##name; \ + std::string& FLAGS_##name = *(reinterpret_cast<std::string*>(s_##name[0].s)); \ + } \ + using fLS::FLAGS_##name + +#endif // SWIG + +@ac_google_end_namespace@ + +#endif // GOOGLE_GFLAGS_H_ diff --git a/dtm_release/lib/util/gflags-1.1/src/gflags/gflags_completions.h b/dtm_release/lib/util/gflags-1.1/src/gflags/gflags_completions.h new file mode 100644 index 0000000000000000000000000000000000000000..9d9ce7a5f7542a238270a4a78dc2e0de42126b8a --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/src/gflags/gflags_completions.h @@ -0,0 +1,121 @@ +// Copyright (c) 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --- +// Author: Dave Nicponski +// +// Implement helpful bash-style command line flag completions +// +// ** Functional API: +// HandleCommandLineCompletions() should be called early during +// program startup, but after command line flag code has been +// initialized, such as the beginning of HandleCommandLineHelpFlags(). +// It checks the value of the flag --tab_completion_word. If this +// flag is empty, nothing happens here. If it contains a string, +// however, then HandleCommandLineCompletions() will hijack the +// process, attempting to identify the intention behind this +// completion. Regardless of the outcome of this deduction, the +// process will be terminated, similar to --helpshort flag +// handling. +// +// ** Overview of Bash completions: +// Bash can be told to programatically determine completions for the +// current 'cursor word'. It does this by (in this case) invoking a +// command with some additional arguments identifying the command +// being executed, the word being completed, and the previous word +// (if any). Bash then expects a sequence of output lines to be +// printed to stdout. If these lines all contain a common prefix +// longer than the cursor word, bash will replace the cursor word +// with that common prefix, and display nothing. If there isn't such +// a common prefix, bash will display the lines in pages using 'more'. +// +// ** Strategy taken for command line completions: +// If we can deduce either the exact flag intended, or a common flag +// prefix, we'll output exactly that. Otherwise, if information +// must be displayed to the user, we'll take the opportunity to add +// some helpful information beyond just the flag name (specifically, +// we'll include the default flag value and as much of the flag's +// description as can fit on a single terminal line width, as specified +// by the flag --tab_completion_columns). Furthermore, we'll try to +// make bash order the output such that the most useful or relevent +// flags are the most likely to be shown at the top. +// +// ** Additional features: +// To assist in finding that one really useful flag, substring matching +// was implemented. Before pressing a <TAB> to get completion for the +// current word, you can append one or more '?' to the flag to do +// substring matching. Here's the semantics: +// --foo<TAB> Show me all flags with names prefixed by 'foo' +// --foo?<TAB> Show me all flags with 'foo' somewhere in the name +// --foo??<TAB> Same as prior case, but also search in module +// definition path for 'foo' +// --foo???<TAB> Same as prior case, but also search in flag +// descriptions for 'foo' +// Finally, we'll trim the output to a relatively small number of +// flags to keep bash quiet about the verbosity of output. If one +// really wanted to see all possible matches, appending a '+' to the +// search word will force the exhaustive list of matches to be printed. +// +// ** How to have bash accept completions from a binary: +// Bash requires that it be informed about each command that programmatic +// completion should be enabled for. Example addition to a .bashrc +// file would be (your path to gflags_completions.sh file may differ): + +/* +$ complete -o bashdefault -o default -o nospace -C \ + '/usr/local/bin/gflags_completions.sh --tab_completion_columns $COLUMNS' \ + time env binary_name another_binary [...] +*/ + +// This would allow the following to work: +// $ /path/to/binary_name --vmodule<TAB> +// Or: +// $ ./bin/path/another_binary --gfs_u<TAB> +// (etc) +// +// Sadly, it appears that bash gives no easy way to force this behavior for +// all commands. That's where the "time" in the above example comes in. +// If you haven't specifically added a command to the list of completion +// supported commands, you can still get completions by prefixing the +// entire command with "env". +// $ env /some/brand/new/binary --vmod<TAB> +// Assuming that "binary" is a newly compiled binary, this should still +// produce the expected completion output. + + +#ifndef GOOGLE_GFLAGS_COMPLETIONS_H_ +#define GOOGLE_GFLAGS_COMPLETIONS_H_ + +namespace google { + +void HandleCommandLineCompletions(void); + +} + +#endif // GOOGLE_GFLAGS_COMPLETIONS_H_ diff --git a/dtm_release/lib/util/gflags-1.1/src/gflags/gflags_completions.h.in b/dtm_release/lib/util/gflags-1.1/src/gflags/gflags_completions.h.in new file mode 100644 index 0000000000000000000000000000000000000000..b4ca6a8b1b414a5057c2a4002c0f5202f937bc3e --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/src/gflags/gflags_completions.h.in @@ -0,0 +1,121 @@ +// Copyright (c) 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --- +// Author: Dave Nicponski +// +// Implement helpful bash-style command line flag completions +// +// ** Functional API: +// HandleCommandLineCompletions() should be called early during +// program startup, but after command line flag code has been +// initialized, such as the beginning of HandleCommandLineHelpFlags(). +// It checks the value of the flag --tab_completion_word. If this +// flag is empty, nothing happens here. If it contains a string, +// however, then HandleCommandLineCompletions() will hijack the +// process, attempting to identify the intention behind this +// completion. Regardless of the outcome of this deduction, the +// process will be terminated, similar to --helpshort flag +// handling. +// +// ** Overview of Bash completions: +// Bash can be told to programatically determine completions for the +// current 'cursor word'. It does this by (in this case) invoking a +// command with some additional arguments identifying the command +// being executed, the word being completed, and the previous word +// (if any). Bash then expects a sequence of output lines to be +// printed to stdout. If these lines all contain a common prefix +// longer than the cursor word, bash will replace the cursor word +// with that common prefix, and display nothing. If there isn't such +// a common prefix, bash will display the lines in pages using 'more'. +// +// ** Strategy taken for command line completions: +// If we can deduce either the exact flag intended, or a common flag +// prefix, we'll output exactly that. Otherwise, if information +// must be displayed to the user, we'll take the opportunity to add +// some helpful information beyond just the flag name (specifically, +// we'll include the default flag value and as much of the flag's +// description as can fit on a single terminal line width, as specified +// by the flag --tab_completion_columns). Furthermore, we'll try to +// make bash order the output such that the most useful or relevent +// flags are the most likely to be shown at the top. +// +// ** Additional features: +// To assist in finding that one really useful flag, substring matching +// was implemented. Before pressing a <TAB> to get completion for the +// current word, you can append one or more '?' to the flag to do +// substring matching. Here's the semantics: +// --foo<TAB> Show me all flags with names prefixed by 'foo' +// --foo?<TAB> Show me all flags with 'foo' somewhere in the name +// --foo??<TAB> Same as prior case, but also search in module +// definition path for 'foo' +// --foo???<TAB> Same as prior case, but also search in flag +// descriptions for 'foo' +// Finally, we'll trim the output to a relatively small number of +// flags to keep bash quiet about the verbosity of output. If one +// really wanted to see all possible matches, appending a '+' to the +// search word will force the exhaustive list of matches to be printed. +// +// ** How to have bash accept completions from a binary: +// Bash requires that it be informed about each command that programmatic +// completion should be enabled for. Example addition to a .bashrc +// file would be (your path to gflags_completions.sh file may differ): + +/* +$ complete -o bashdefault -o default -o nospace -C \ + '/usr/local/bin/gflags_completions.sh --tab_completion_columns $COLUMNS' \ + time env binary_name another_binary [...] +*/ + +// This would allow the following to work: +// $ /path/to/binary_name --vmodule<TAB> +// Or: +// $ ./bin/path/another_binary --gfs_u<TAB> +// (etc) +// +// Sadly, it appears that bash gives no easy way to force this behavior for +// all commands. That's where the "time" in the above example comes in. +// If you haven't specifically added a command to the list of completion +// supported commands, you can still get completions by prefixing the +// entire command with "env". +// $ env /some/brand/new/binary --vmod<TAB> +// Assuming that "binary" is a newly compiled binary, this should still +// produce the expected completion output. + + +#ifndef GOOGLE_GFLAGS_COMPLETIONS_H_ +#define GOOGLE_GFLAGS_COMPLETIONS_H_ + +@ac_google_start_namespace@ + +void HandleCommandLineCompletions(void); + +@ac_google_end_namespace@ + +#endif // GOOGLE_GFLAGS_COMPLETIONS_H_ diff --git a/dtm_release/lib/util/gflags-1.1/src/gflags_completions.cc b/dtm_release/lib/util/gflags-1.1/src/gflags_completions.cc new file mode 100644 index 0000000000000000000000000000000000000000..6a4c5422e08a029481526386b052491219808377 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/src/gflags_completions.cc @@ -0,0 +1,765 @@ +// Copyright (c) 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --- +// Author: Dave Nicponski +// +// Bash-style command line flag completion for C++ binaries +// +// This module implements bash-style completions. It achieves this +// goal in the following broad chunks: +// +// 1) Take a to-be-completed word, and examine it for search hints +// 2) Identify all potentially matching flags +// 2a) If there are no matching flags, do nothing. +// 2b) If all matching flags share a common prefix longer than the +// completion word, output just that matching prefix +// 3) Categorize those flags to produce a rough ordering of relevence. +// 4) Potentially trim the set of flags returned to a smaller number +// that bash is happier with +// 5) Output the matching flags in groups ordered by relevence. +// 5a) Force bash to place most-relevent groups at the top of the list +// 5b) Trim most flag's descriptions to fit on a single terminal line + + +#include "config.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> // for strlen + +#include <set> +#include <string> +#include <utility> +#include <vector> + +#include "gflags/gflags.h" + +using std::set; +using std::string; +using std::vector; + +#ifndef PATH_SEPARATOR +#define PATH_SEPARATOR '/' +#endif + +DEFINE_string(tab_completion_word, "", + "If non-empty, HandleCommandLineCompletions() will hijack the " + "process and attempt to do bash-style command line flag " + "completion on this value."); +DEFINE_int32(tab_completion_columns, 80, + "Number of columns to use in output for tab completion"); + +_START_GOOGLE_NAMESPACE_ + +namespace { + +// Function prototypes and Type forward declarations. Code may be +// more easily understood if it is roughly ordered according to +// control flow, rather than by C's "declare before use" ordering +struct CompletionOptions; +struct NotableFlags; + +// The entry point if flag completion is to be used. +static void PrintFlagCompletionInfo(void); + + +// 1) Examine search word +static void CanonicalizeCursorWordAndSearchOptions( + const string &cursor_word, + string *canonical_search_token, + CompletionOptions *options); + +static bool RemoveTrailingChar(string *str, char c); + + +// 2) Find all matches +static void FindMatchingFlags( + const vector<CommandLineFlagInfo> &all_flags, + const CompletionOptions &options, + const string &match_token, + set<const CommandLineFlagInfo *> *all_matches, + string *longest_common_prefix); + +static bool DoesSingleFlagMatch( + const CommandLineFlagInfo &flag, + const CompletionOptions &options, + const string &match_token); + + +// 3) Categorize matches +static void CategorizeAllMatchingFlags( + const set<const CommandLineFlagInfo *> &all_matches, + const string &search_token, + const string &module, + const string &package_dir, + NotableFlags *notable_flags); + +static void TryFindModuleAndPackageDir( + const vector<CommandLineFlagInfo> all_flags, + string *module, + string *package_dir); + + +// 4) Decide which flags to use +static void FinalizeCompletionOutput( + const set<const CommandLineFlagInfo *> &matching_flags, + CompletionOptions *options, + NotableFlags *notable_flags, + vector<string> *completions); + +static void RetrieveUnusedFlags( + const set<const CommandLineFlagInfo *> &matching_flags, + const NotableFlags ¬able_flags, + set<const CommandLineFlagInfo *> *unused_flags); + + +// 5) Output matches +static void OutputSingleGroupWithLimit( + const set<const CommandLineFlagInfo *> &group, + const string &line_indentation, + const string &header, + const string &footer, + bool long_output_format, + int *remaining_line_limit, + size_t *completion_elements_added, + vector<string> *completions); + +// (helpers for #5) +static string GetShortFlagLine( + const string &line_indentation, + const CommandLineFlagInfo &info); + +static string GetLongFlagLine( + const string &line_indentation, + const CommandLineFlagInfo &info); + + +// +// Useful types + +// Try to deduce the intentions behind this completion attempt. Return the +// canonical search term in 'canonical_search_token'. Binary search options +// are returned in the various booleans, which should all have intuitive +// semantics, possibly except: +// - return_all_matching_flags: Generally, we'll trim the number of +// returned candidates to some small number, showing those that are +// most likely to be useful first. If this is set, however, the user +// really does want us to return every single flag as an option. +// - force_no_update: Any time we output lines, all of which share a +// common prefix, bash will 'helpfully' not even bother to show the +// output, instead changing the current word to be that common prefix. +// If it's clear this shouldn't happen, we'll set this boolean +struct CompletionOptions { + bool flag_name_substring_search; + bool flag_location_substring_search; + bool flag_description_substring_search; + bool return_all_matching_flags; + bool force_no_update; +}; + +// Notable flags are flags that are special or preferred for some +// reason. For example, flags that are defined in the binary's module +// are expected to be much more relevent than flags defined in some +// other random location. These sets are specified roughly in precedence +// order. Once a flag is placed in one of these 'higher' sets, it won't +// be placed in any of the 'lower' sets. +struct NotableFlags { + typedef set<const CommandLineFlagInfo *> FlagSet; + FlagSet perfect_match_flag; + FlagSet module_flags; // Found in module file + FlagSet package_flags; // Found in same directory as module file + FlagSet most_common_flags; // One of the XXX most commonly supplied flags + FlagSet subpackage_flags; // Found in subdirectories of package +}; + + +// +// Tab completion implementation - entry point +static void PrintFlagCompletionInfo(void) { + string cursor_word = FLAGS_tab_completion_word; + string canonical_token; + CompletionOptions options = { }; + CanonicalizeCursorWordAndSearchOptions( + cursor_word, + &canonical_token, + &options); + + //VLOG(1) << "Identified canonical_token: '" << canonical_token << "'"; + + vector<CommandLineFlagInfo> all_flags; + set<const CommandLineFlagInfo *> matching_flags; + GetAllFlags(&all_flags); + //VLOG(2) << "Found " << all_flags.size() << " flags overall"; + + string longest_common_prefix; + FindMatchingFlags( + all_flags, + options, + canonical_token, + &matching_flags, + &longest_common_prefix); + //VLOG(1) << "Identified " << matching_flags.size() << " matching flags"; + //VLOG(1) << "Identified " << longest_common_prefix + // << " as longest common prefix."; + if (longest_common_prefix.size() > canonical_token.size()) { + // There's actually a shared common prefix to all matching flags, + // so may as well output that and quit quickly. + //VLOG(1) << "The common prefix '" << longest_common_prefix + // << "' was longer than the token '" << canonical_token + // << "'. Returning just this prefix for completion."; + fprintf(stdout, "--%s", longest_common_prefix.c_str()); + return; + } + if (matching_flags.empty()) { + //VLOG(1) << "There were no matching flags, returning nothing."; + return; + } + + string module; + string package_dir; + TryFindModuleAndPackageDir(all_flags, &module, &package_dir); + //VLOG(1) << "Identified module: '" << module << "'"; + //VLOG(1) << "Identified package_dir: '" << package_dir << "'"; + + NotableFlags notable_flags; + CategorizeAllMatchingFlags( + matching_flags, + canonical_token, + module, + package_dir, + ¬able_flags); + //VLOG(2) << "Categorized matching flags:"; + //VLOG(2) << " perfect_match: " << notable_flags.perfect_match_flag.size(); + //VLOG(2) << " module: " << notable_flags.module_flags.size(); + //VLOG(2) << " package: " << notable_flags.package_flags.size(); + //VLOG(2) << " most common: " << notable_flags.most_common_flags.size(); + //VLOG(2) << " subpackage: " << notable_flags.subpackage_flags.size(); + + vector<string> completions; + FinalizeCompletionOutput( + matching_flags, + &options, + ¬able_flags, + &completions); + + if (options.force_no_update) + completions.push_back("~"); + + //VLOG(1) << "Finalized with " << completions.size() + // << " chosen completions"; + + for (vector<string>::const_iterator it = completions.begin(); + it != completions.end(); + ++it) { + //VLOG(9) << " Completion entry: '" << *it << "'"; + fprintf(stdout, "%s\n", it->c_str()); + } +} + + +// 1) Examine search word (and helper method) +static void CanonicalizeCursorWordAndSearchOptions( + const string &cursor_word, + string *canonical_search_token, + CompletionOptions *options) { + *canonical_search_token = cursor_word; + if (canonical_search_token->empty()) return; + + // Get rid of leading quotes and dashes in the search term + if ((*canonical_search_token)[0] == '"') + *canonical_search_token = canonical_search_token->substr(1); + while ((*canonical_search_token)[0] == '-') + *canonical_search_token = canonical_search_token->substr(1); + + options->flag_name_substring_search = false; + options->flag_location_substring_search = false; + options->flag_description_substring_search = false; + options->return_all_matching_flags = false; + options->force_no_update = false; + + // Look for all search options we can deduce now. Do this by walking + // backwards through the term, looking for up to three '?' and up to + // one '+' as suffixed characters. Consume them if found, and remove + // them from the canonical search token. + int found_question_marks = 0; + int found_plusses = 0; + while (true) { + if (found_question_marks < 3 && + RemoveTrailingChar(canonical_search_token, '?')) { + ++found_question_marks; + continue; + } + if (found_plusses < 1 && + RemoveTrailingChar(canonical_search_token, '+')) { + ++found_plusses; + continue; + } + break; + } + + switch (found_question_marks) { // all fallthroughs + case 3: options->flag_description_substring_search = true; + case 2: options->flag_location_substring_search = true; + case 1: options->flag_name_substring_search = true; + }; + + options->return_all_matching_flags = (found_plusses > 0); +} + +// Returns true if a char was removed +static bool RemoveTrailingChar(string *str, char c) { + if (str->empty()) return false; + if ((*str)[str->size() - 1] == c) { + *str = str->substr(0, str->size() - 1); + return true; + } + return false; +} + + +// 2) Find all matches (and helper methods) +static void FindMatchingFlags( + const vector<CommandLineFlagInfo> &all_flags, + const CompletionOptions &options, + const string &match_token, + set<const CommandLineFlagInfo *> *all_matches, + string *longest_common_prefix) { + all_matches->clear(); + bool first_match = true; + for (vector<CommandLineFlagInfo>::const_iterator it = all_flags.begin(); + it != all_flags.end(); + ++it) { + if (DoesSingleFlagMatch(*it, options, match_token)) { + all_matches->insert(&*it); + if (first_match) { + first_match = false; + *longest_common_prefix = it->name; + } else { + if (longest_common_prefix->empty() || it->name.empty()) { + longest_common_prefix->clear(); + continue; + } + string::size_type pos = 0; + while (pos < longest_common_prefix->size() && + pos < it->name.size() && + (*longest_common_prefix)[pos] == it->name[pos]) + ++pos; + longest_common_prefix->erase(pos); + } + } + } +} + +// Given the set of all flags, the parsed match options, and the +// canonical search token, produce the set of all candidate matching +// flags for subsequent analysis or filtering. +static bool DoesSingleFlagMatch( + const CommandLineFlagInfo &flag, + const CompletionOptions &options, + const string &match_token) { + // Is there a prefix match? + string::size_type pos = flag.name.find(match_token); + if (pos == 0) return true; + + // Is there a substring match if we want it? + if (options.flag_name_substring_search && + pos != string::npos) + return true; + + // Is there a location match if we want it? + if (options.flag_location_substring_search && + flag.filename.find(match_token) != string::npos) + return true; + + // TODO(daven): All searches should probably be case-insensitive + // (especially this one...) + if (options.flag_description_substring_search && + flag.description.find(match_token) != string::npos) + return true; + + return false; +} + +// 3) Categorize matches (and helper method) + +// Given a set of matching flags, categorize them by +// likely relevence to this specific binary +static void CategorizeAllMatchingFlags( + const set<const CommandLineFlagInfo *> &all_matches, + const string &search_token, + const string &module, // empty if we couldn't find any + const string &package_dir, // empty if we couldn't find any + NotableFlags *notable_flags) { + notable_flags->perfect_match_flag.clear(); + notable_flags->module_flags.clear(); + notable_flags->package_flags.clear(); + notable_flags->most_common_flags.clear(); + notable_flags->subpackage_flags.clear(); + + for (set<const CommandLineFlagInfo *>::const_iterator it = + all_matches.begin(); + it != all_matches.end(); + ++it) { + //VLOG(2) << "Examining match '" << (*it)->name << "'"; + //VLOG(7) << " filename: '" << (*it)->filename << "'"; + string::size_type pos = string::npos; + if (!package_dir.empty()) + pos = (*it)->filename.find(package_dir); + string::size_type slash = string::npos; + if (pos != string::npos) // candidate for package or subpackage match + slash = (*it)->filename.find( + PATH_SEPARATOR, + pos + package_dir.size() + 1); + + if ((*it)->name == search_token) { + // Exact match on some flag's name + notable_flags->perfect_match_flag.insert(*it); + //VLOG(3) << "Result: perfect match"; + } else if (!module.empty() && (*it)->filename == module) { + // Exact match on module filename + notable_flags->module_flags.insert(*it); + //VLOG(3) << "Result: module match"; + } else if (!package_dir.empty() && + pos != string::npos && slash == string::npos) { + // In the package, since there was no slash after the package portion + notable_flags->package_flags.insert(*it); + //VLOG(3) << "Result: package match"; + } else if (false) { + // In the list of the XXX most commonly supplied flags overall + // TODO(daven): Compile this list. + //VLOG(3) << "Result: most-common match"; + } else if (!package_dir.empty() && + pos != string::npos && slash != string::npos) { + // In a subdirectory of the package + notable_flags->subpackage_flags.insert(*it); + //VLOG(3) << "Result: subpackage match"; + } + + //VLOG(3) << "Result: not special match"; + } +} + +static void PushNameWithSuffix(vector<string>* suffixes, const char* suffix) { + string s("/"); + s += ProgramInvocationShortName(); + s += suffix; + suffixes->push_back(s); +} + +static void TryFindModuleAndPackageDir( + const vector<CommandLineFlagInfo> all_flags, + string *module, + string *package_dir) { + module->clear(); + package_dir->clear(); + + vector<string> suffixes; + // TODO(daven): There's some inherant ambiguity here - multiple directories + // could share the same trailing folder and file structure (and even worse, + // same file names), causing us to be unsure as to which of the two is the + // actual package for this binary. In this case, we'll arbitrarily choose. + PushNameWithSuffix(&suffixes, "."); + PushNameWithSuffix(&suffixes, "-main."); + PushNameWithSuffix(&suffixes, "_main."); + // These four are new but probably merited? + PushNameWithSuffix(&suffixes, "-test."); + PushNameWithSuffix(&suffixes, "_test."); + PushNameWithSuffix(&suffixes, "-unittest."); + PushNameWithSuffix(&suffixes, "_unittest."); + + for (vector<CommandLineFlagInfo>::const_iterator it = all_flags.begin(); + it != all_flags.end(); + ++it) { + for (vector<string>::const_iterator suffix = suffixes.begin(); + suffix != suffixes.end(); + ++suffix) { + // TODO(daven): Make sure the match is near the end of the string + if (it->filename.find(*suffix) != string::npos) { + *module = it->filename; + string::size_type sep = it->filename.rfind(PATH_SEPARATOR); + *package_dir = it->filename.substr(0, (sep == string::npos) ? 0 : sep); + return; + } + } + } +} + +// Can't specialize template type on a locally defined type. Silly C++... +struct DisplayInfoGroup { + const char* header; + const char* footer; + set<const CommandLineFlagInfo *> *group; + + int SizeInLines() const { + int size_in_lines = static_cast<int>(group->size()) + 1; + if (strlen(header) > 0) { + size_in_lines++; + } + if (strlen(footer) > 0) { + size_in_lines++; + } + return size_in_lines; + } +}; + +// 4) Finalize and trim output flag set +static void FinalizeCompletionOutput( + const set<const CommandLineFlagInfo *> &matching_flags, + CompletionOptions *options, + NotableFlags *notable_flags, + vector<string> *completions) { + + // We want to output lines in groups. Each group needs to be indented + // the same to keep its lines together. Unless otherwise required, + // only 99 lines should be output to prevent bash from harassing the + // user. + + // First, figure out which output groups we'll actually use. For each + // nonempty group, there will be ~3 lines of header & footer, plus all + // output lines themselves. + int max_desired_lines = // "999999 flags should be enough for anyone. -dave" + (options->return_all_matching_flags ? 999999 : 98); + int lines_so_far = 0; + + vector<DisplayInfoGroup> output_groups; + bool perfect_match_found = false; + if (lines_so_far < max_desired_lines && + !notable_flags->perfect_match_flag.empty()) { + perfect_match_found = true; + DisplayInfoGroup group = + { "", + "==========", + ¬able_flags->perfect_match_flag }; + lines_so_far += group.SizeInLines(); + output_groups.push_back(group); + } + if (lines_so_far < max_desired_lines && + !notable_flags->module_flags.empty()) { + DisplayInfoGroup group = { + "-* Matching module flags *-", + "===========================", + ¬able_flags->module_flags }; + lines_so_far += group.SizeInLines(); + output_groups.push_back(group); + } + if (lines_so_far < max_desired_lines && + !notable_flags->package_flags.empty()) { + DisplayInfoGroup group = { + "-* Matching package flags *-", + "============================", + ¬able_flags->package_flags }; + lines_so_far += group.SizeInLines(); + output_groups.push_back(group); + } + if (lines_so_far < max_desired_lines && + !notable_flags->most_common_flags.empty()) { + DisplayInfoGroup group = { + "-* Commonly used flags *-", + "=========================", + ¬able_flags->most_common_flags }; + lines_so_far += group.SizeInLines(); + output_groups.push_back(group); + } + if (lines_so_far < max_desired_lines && + !notable_flags->subpackage_flags.empty()) { + DisplayInfoGroup group = { + "-* Matching sub-package flags *-", + "================================", + ¬able_flags->subpackage_flags }; + lines_so_far += group.SizeInLines(); + output_groups.push_back(group); + } + + set<const CommandLineFlagInfo *> obscure_flags; // flags not notable + if (lines_so_far < max_desired_lines) { + RetrieveUnusedFlags(matching_flags, *notable_flags, &obscure_flags); + if (!obscure_flags.empty()) { + DisplayInfoGroup group = { + "-* Other flags *-", + "", + &obscure_flags }; + lines_so_far += group.SizeInLines(); + output_groups.push_back(group); + } + } + + // Second, go through each of the chosen output groups and output + // as many of those flags as we can, while remaining below our limit + int remaining_lines = max_desired_lines; + size_t completions_output = 0; + int indent = static_cast<int>(output_groups.size()) - 1; + for (vector<DisplayInfoGroup>::const_iterator it = + output_groups.begin(); + it != output_groups.end(); + ++it, --indent) { + OutputSingleGroupWithLimit( + *it->group, // group + string(indent, ' '), // line indentation + string(it->header), // header + string(it->footer), // footer + perfect_match_found, // long format + &remaining_lines, // line limit - reduces this by number printed + &completions_output, // completions (not lines) added + completions); // produced completions + perfect_match_found = false; + } + + if (completions_output != matching_flags.size()) { + options->force_no_update = false; + completions->push_back("~ (Remaining flags hidden) ~"); + } else { + options->force_no_update = true; + } +} + +static void RetrieveUnusedFlags( + const set<const CommandLineFlagInfo *> &matching_flags, + const NotableFlags ¬able_flags, + set<const CommandLineFlagInfo *> *unused_flags) { + // Remove from 'matching_flags' set all members of the sets of + // flags we've already printed (specifically, those in notable_flags) + for (set<const CommandLineFlagInfo *>::const_iterator it = + matching_flags.begin(); + it != matching_flags.end(); + ++it) { + if (notable_flags.perfect_match_flag.count(*it) || + notable_flags.module_flags.count(*it) || + notable_flags.package_flags.count(*it) || + notable_flags.most_common_flags.count(*it) || + notable_flags.subpackage_flags.count(*it)) + continue; + unused_flags->insert(*it); + } +} + +// 5) Output matches (and helper methods) + +static void OutputSingleGroupWithLimit( + const set<const CommandLineFlagInfo *> &group, + const string &line_indentation, + const string &header, + const string &footer, + bool long_output_format, + int *remaining_line_limit, + size_t *completion_elements_output, + vector<string> *completions) { + if (group.empty()) return; + if (!header.empty()) { + if (*remaining_line_limit < 2) return; + *remaining_line_limit -= 2; + completions->push_back(line_indentation + header); + completions->push_back(line_indentation + string(header.size(), '-')); + } + for (set<const CommandLineFlagInfo *>::const_iterator it = group.begin(); + it != group.end() && *remaining_line_limit > 0; + ++it) { + --*remaining_line_limit; + ++*completion_elements_output; + completions->push_back( + (long_output_format + ? GetLongFlagLine(line_indentation, **it) + : GetShortFlagLine(line_indentation, **it))); + } + if (!footer.empty()) { + if (*remaining_line_limit < 1) return; + --*remaining_line_limit; + completions->push_back(line_indentation + footer); + } +} + +static string GetShortFlagLine( + const string &line_indentation, + const CommandLineFlagInfo &info) { + string prefix = + line_indentation + "--" + info.name + " [" + + (info.type == "string" ? + ("'" + info.default_value + "'") : + info.default_value) + + "] "; + int remainder = + FLAGS_tab_completion_columns - static_cast<int>(prefix.size()); + string suffix; + if (remainder > 0) + suffix = + (static_cast<int>(info.description.size()) > remainder ? + (info.description.substr(0, remainder - 3) + "...").c_str() : + info.description.c_str()); + return prefix + suffix; +} + +static string GetLongFlagLine( + const string &line_indentation, + const CommandLineFlagInfo &info) { + + string output = DescribeOneFlag(info); + + // Replace '-' with '--', and remove trailing newline before appending + // the module definition location. + string old_flagname = "-" + info.name; + output.replace( + output.find(old_flagname), + old_flagname.size(), + "-" + old_flagname); + // Stick a newline and indentation in front of the type and default + // portions of DescribeOneFlag()s description + static const char kNewlineWithIndent[] = "\n "; + output.replace(output.find(" type:"), 1, string(kNewlineWithIndent)); + output.replace(output.find(" default:"), 1, string(kNewlineWithIndent)); + output = line_indentation + " Details for '--" + info.name + "':\n" + + output + " defined: " + info.filename; + + // Eliminate any doubled newlines that crept in. Specifically, if + // DescribeOneFlag() decided to break the line just before "type" + // or "default", we don't want to introduce an extra blank line + static const string line_of_spaces(FLAGS_tab_completion_columns, ' '); + static const char kDoubledNewlines[] = "\n \n"; + for (string::size_type newlines = output.find(kDoubledNewlines); + newlines != string::npos; + newlines = output.find(kDoubledNewlines)) + // Replace each 'doubled newline' with a single newline + output.replace(newlines, sizeof(kDoubledNewlines) - 1, string("\n")); + + for (string::size_type newline = output.find('\n'); + newline != string::npos; + newline = output.find('\n')) { + int newline_pos = static_cast<int>(newline) % FLAGS_tab_completion_columns; + int missing_spaces = FLAGS_tab_completion_columns - newline_pos; + output.replace(newline, 1, line_of_spaces, 1, missing_spaces); + } + return output; +} +} // anonymous + +void HandleCommandLineCompletions(void) { + if (FLAGS_tab_completion_word.empty()) return; + PrintFlagCompletionInfo(); + exit(0); +} + +_END_GOOGLE_NAMESPACE_ diff --git a/dtm_release/lib/util/gflags-1.1/src/gflags_completions.sh b/dtm_release/lib/util/gflags-1.1/src/gflags_completions.sh new file mode 100755 index 0000000000000000000000000000000000000000..2291b59a99ce5933c031d07eff12b0b3cb608779 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/src/gflags_completions.sh @@ -0,0 +1,119 @@ +#!/bin/bash + +# Copyright (c) 2008, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# --- +# Author: Dave Nicponski +# +# This script is invoked by bash in response to a matching compspec. When +# this happens, bash calls this script using the command shown in the -C +# block of the complete entry, but also appends 3 arguments. They are: +# - The command being used for completion +# - The word being completed +# - The word preceding the completion word. +# +# Here's an example of how you might use this script: +# $ complete -o bashdefault -o default -o nospace -C \ +# '/usr/local/bin/gflags_completions.sh --tab_completion_columns $COLUMNS' \ +# time env binary_name another_binary [...] + +# completion_word_index gets the index of the (N-1)th argument for +# this command line. completion_word gets the actual argument from +# this command line at the (N-1)th position +completion_word_index="$(($# - 1))" +completion_word="${!completion_word_index}" + +# TODO(daven): Replace this once commandlineflags_completions.cc has +# a bool parameter indicating unambiguously to hijack the process for +# completion purposes. +if [ -z "$completion_word" ]; then + # Until an empty value for the completion word stops being misunderstood + # by google3 binaries, don't actuall execute the binary or the process + # won't be hijacked! + exit 0 +fi + +# binary_index gets the index of the command being completed (which bash +# places in the (N-2)nd position. binary gets the actual command from +# this command line at that (N-2)nd position +binary_index="$(($# - 2))" +binary="${!binary_index}" + +# For completions to be universal, we may have setup the compspec to +# trigger on 'harmless pass-through' commands, like 'time' or 'env'. +# If the command being completed is one of those two, we'll need to +# identify the actual command being executed. To do this, we need +# the actual command line that the <TAB> was pressed on. Bash helpfully +# places this in the $COMP_LINE variable. +if [ "$binary" == "time" ] || [ "$binary" == "env" ]; then + # we'll assume that the first 'argument' is actually the + # binary to be run, if we think it looks like a google3 + # binary + + # TODO(daven): Decide what 'looks' like a google3 binary. =) + + # TODO(daven): This is not perfect - the 'env' command, for instance, + # is allowed to have options between the 'env' and 'the command to + # be executed'. For example, consider: + # $ env FOO="bar" bin/do_something --help<TAB> + # In this case, we'll mistake the FOO="bar" portion as the binary. + # Perhaps we should continuing consuming leading words until we + # either run out of words, or find a word that is a valid file + # marked as executable. I can't think of any reason this wouldn't + # work. + + # Break up the 'original command line' (not this script's command line, + # rather the one the <TAB> was pressed on) and find the second word. + parts=( ${COMP_LINE} ) + binary=${parts[1]} +fi + +# Build the command line to use for completion. Basically it involves +# passing through all the arguments given to this script (except the 3 +# that bash added), and appending a '--tab_completion_word "WORD"' to +# the arguments. +params="" +for ((i=1; i<=$(($# - 3)); ++i)); do + params="$params \"${!i}\""; +done +params="$params --tab_completion_word \"$completion_word\"" + +# TODO(daven): Perhaps stash the output in a temporary file somewhere +# in /tmp, and only cat it to stdout if the command returned a success +# code, to prevent false positives + +# If we think we have a reasonable command to execute, then execute it +# and hope for the best. +candidate=$(type -p "$binary") +if [ ! -z "$candidate" ]; then + eval "$candidate 2>/dev/null $params" +elif [ -f "$binary" ] && [ -x "$binary" ]; then + eval "$binary 2>/dev/null $params" +fi diff --git a/dtm_release/lib/util/gflags-1.1/src/gflags_reporting.cc b/dtm_release/lib/util/gflags-1.1/src/gflags_reporting.cc new file mode 100644 index 0000000000000000000000000000000000000000..c1dc8dffc9ae7a09acc49732acb736e5e9cc857e --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/src/gflags_reporting.cc @@ -0,0 +1,443 @@ +// Copyright (c) 2006, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// Author: Ray Sidney +// Revamped and reorganized by Craig Silverstein +// +// This file contains code for handling the 'reporting' flags. These +// are flags that, when present, cause the program to report some +// information and then exit. --help and --version are the canonical +// reporting flags, but we also have flags like --helpxml, etc. +// +// There's only one function that's meant to be called externally: +// HandleCommandLineHelpFlags(). (Well, actually, ShowUsageWithFlags(), +// ShowUsageWithFlagsRestrict(), and DescribeOneFlag() can be called +// externally too, but there's little need for it.) These are all +// declared in the main commandlineflags.h header file. +// +// HandleCommandLineHelpFlags() will check what 'reporting' flags have +// been defined, if any -- the "help" part of the function name is a +// bit misleading -- and do the relevant reporting. It should be +// called after all flag-values have been assigned, that is, after +// parsing the command-line. + +#include "config.h" +#include <stdio.h> +#include <string.h> +#include <ctype.h> +#include <assert.h> +#include <string> +#include <vector> +#include "gflags/gflags.h" +#include "gflags/gflags_completions.h" + +#ifndef PATH_SEPARATOR +#define PATH_SEPARATOR '/' +#endif + +using std::string; +using std::vector; + +// The 'reporting' flags. They all call exit(). +DEFINE_bool(help, false, + "show help on all flags [tip: all flags can have two dashes]"); +DEFINE_bool(helpfull, false, + "show help on all flags -- same as -help"); +DEFINE_bool(helpshort, false, + "show help on only the main module for this program"); +DEFINE_string(helpon, "", + "show help on the modules named by this flag value"); +DEFINE_string(helpmatch, "", + "show help on modules whose name contains the specified substr"); +DEFINE_bool(helppackage, false, + "show help on all modules in the main package"); +DEFINE_bool(helpxml, false, + "produce an xml version of help"); +DEFINE_bool(version, false, + "show version and build info and exit"); + +_START_GOOGLE_NAMESPACE_ + +// -------------------------------------------------------------------- +// DescribeOneFlag() +// DescribeOneFlagInXML() +// Routines that pretty-print info about a flag. These use +// a CommandLineFlagInfo, which is the way the commandlineflags +// API exposes static info about a flag. +// -------------------------------------------------------------------- + +static const int kLineLength = 80; + +static void AddString(const string& s, + string* final_string, int* chars_in_line) { + const int slen = static_cast<int>(s.length()); + if (*chars_in_line + 1 + slen >= kLineLength) { // < 80 chars/line + *final_string += "\n "; + *chars_in_line = 6; + } else { + *final_string += " "; + *chars_in_line += 1; + } + *final_string += s; + *chars_in_line += slen; +} + +// Create a descriptive string for a flag. +// Goes to some trouble to make pretty line breaks. +string DescribeOneFlag(const CommandLineFlagInfo& flag) { + string main_part = (string(" -") + flag.name + + " (" + flag.description + ')'); + const char* c_string = main_part.c_str(); + int chars_left = static_cast<int>(main_part.length()); + string final_string = ""; + int chars_in_line = 0; // how many chars in current line so far? + while (1) { + assert(chars_left == strlen(c_string)); // Unless there's a \0 in there? + const char* newline = strchr(c_string, '\n'); + if (newline == NULL && chars_in_line+chars_left < kLineLength) { + // The whole remainder of the string fits on this line + final_string += c_string; + chars_in_line += chars_left; + break; + } + if (newline != NULL && newline - c_string < kLineLength - chars_in_line) { + int n = static_cast<int>(newline - c_string); + final_string.append(c_string, n); + chars_left -= n + 1; + c_string += n + 1; + } else { + // Find the last whitespace on this 80-char line + int whitespace = kLineLength-chars_in_line-1; // < 80 chars/line + while ( whitespace > 0 && !isspace(c_string[whitespace]) ) { + --whitespace; + } + if (whitespace <= 0) { + // Couldn't find any whitespace to make a line break. Just dump the + // rest out! + final_string += c_string; + chars_in_line = kLineLength; // next part gets its own line for sure! + break; + } + final_string += string(c_string, whitespace); + chars_in_line += whitespace; + while (isspace(c_string[whitespace])) ++whitespace; + c_string += whitespace; + chars_left -= whitespace; + } + if (*c_string == '\0') + break; + final_string += "\n "; + chars_in_line = 6; + } + + // Append data type + AddString(string("type: ") + flag.type, &final_string, &chars_in_line); + // Append the effective default value (i.e., the value that the flag + // will have after the command line is parsed if the flag is not + // specified on the command line), which may be different from the + // stored default value. This would happen if the value of the flag + // was modified before the command line was parsed. (Unless the + // value was modified using SetCommandLineOptionWithMode() with mode + // SET_FLAGS_DEFAULT.) + // Note that we are assuming this code is being executed because a help + // request was just parsed from the command line, in which case the + // printed value is indeed the effective default, as long as no value + // for the flag was parsed from the command line before "--help". + if (strcmp(flag.type.c_str(), "string") == 0) { // add quotes for strings + AddString(string("default: \"") + flag.current_value + string("\""), + &final_string, &chars_in_line); + } else { + AddString(string("default: ") + flag.current_value, + &final_string, &chars_in_line); + } + + final_string += '\n'; + return final_string; +} + +// Simple routine to xml-escape a string: escape & and < only. +static string XMLText(const string& txt) { + string ans = txt; + for (string::size_type pos = 0; (pos = ans.find("&", pos)) != string::npos; ) + ans.replace(pos++, 1, "&"); + for (string::size_type pos = 0; (pos = ans.find("<", pos)) != string::npos; ) + ans.replace(pos++, 1, "<"); + return ans; +} + +static void AddXMLTag(string* r, const char* tag, const string& txt) { + *r += ('<'); + *r += (tag); + *r += ('>'); + *r += (XMLText(txt)); + *r += ("</"); + *r += (tag); + *r += ('>'); +} + +static string DescribeOneFlagInXML(const CommandLineFlagInfo& flag) { + // The file and flagname could have been attributes, but default + // and meaning need to avoid attribute normalization. This way it + // can be parsed by simple programs, in addition to xml parsers. + string r("<flag>"); + AddXMLTag(&r, "file", flag.filename); + AddXMLTag(&r, "name", flag.name); + AddXMLTag(&r, "meaning", flag.description); + AddXMLTag(&r, "default", flag.default_value); + AddXMLTag(&r, "current", flag.current_value); + AddXMLTag(&r, "type", flag.type); + r += "</flag>"; + return r; +} + +// -------------------------------------------------------------------- +// ShowUsageWithFlags() +// ShowUsageWithFlagsRestrict() +// ShowXMLOfFlags() +// These routines variously expose the registry's list of flag +// values. ShowUsage*() prints the flag-value information +// to stdout in a user-readable format (that's what --help uses). +// The Restrict() version limits what flags are shown. +// ShowXMLOfFlags() prints the flag-value information to stdout +// in a machine-readable format. In all cases, the flags are +// sorted: first by filename they are defined in, then by flagname. +// -------------------------------------------------------------------- + +static const char* Basename(const char* filename) { + const char* sep = strrchr(filename, PATH_SEPARATOR); + return sep ? sep + 1 : filename; +} + +static string Dirname(const string& filename) { + string::size_type sep = filename.rfind(PATH_SEPARATOR); + return filename.substr(0, (sep == string::npos) ? 0 : sep); +} + +// Test whether a filename contains at least one of the substrings. +static bool FileMatchesSubstring(const string& filename, + const vector<string>& substrings) { + for (vector<string>::const_iterator target = substrings.begin(); + target != substrings.end(); + ++target) { + if (strstr(filename.c_str(), target->c_str()) != NULL) + return true; + // If the substring starts with a '/', that means that we want + // the string to be at the beginning of a directory component. + // That should match the first directory component as well, so + // we allow '/foo' to match a filename of 'foo'. + if (!target->empty() && (*target)[0] == '/' && + strncmp(filename.c_str(), target->c_str() + 1, + strlen(target->c_str() + 1)) == 0) + return true; + } + return false; +} + +// Show help for every filename which matches any of the target substrings. +// If substrings is empty, shows help for every file. If a flag's help message +// has been stripped (e.g. by adding '#define STRIP_FLAG_HELP 1' before +// including gflags/gflags.h), then this flag will not be displayed by +// '--help' and its variants. +static void ShowUsageWithFlagsMatching(const char *argv0, + const vector<string> &substrings) { + fprintf(stdout, "%s: %s\n", Basename(argv0), ProgramUsage()); + + vector<CommandLineFlagInfo> flags; + GetAllFlags(&flags); // flags are sorted by filename, then flagname + + string last_filename; // so we know when we're at a new file + bool first_directory = true; // controls blank lines between dirs + bool found_match = false; // stays false iff no dir matches restrict + for (vector<CommandLineFlagInfo>::const_iterator flag = flags.begin(); + flag != flags.end(); + ++flag) { + if (substrings.empty() || + FileMatchesSubstring(flag->filename, substrings)) { + // If the flag has been stripped, pretend that it doesn't exist. + if (flag->description == kStrippedFlagHelp) continue; + found_match = true; // this flag passed the match! + if (flag->filename != last_filename) { // new file + if (Dirname(flag->filename) != Dirname(last_filename)) { // new dir! + if (!first_directory) + fprintf(stdout, "\n\n"); // put blank lines between directories + first_directory = false; + } + fprintf(stdout, "\n Flags from %s:\n", flag->filename.c_str()); + last_filename = flag->filename; + } + // Now print this flag + fprintf(stdout, "%s", DescribeOneFlag(*flag).c_str()); + } + } + if (!found_match && !substrings.empty()) { + fprintf(stdout, "\n No modules matched: use -help\n"); + } +} + +void ShowUsageWithFlagsRestrict(const char *argv0, const char *restrict) { + vector<string> substrings; + if (restrict != NULL && *restrict != '\0') { + substrings.push_back(restrict); + } + ShowUsageWithFlagsMatching(argv0, substrings); +} + +void ShowUsageWithFlags(const char *argv0) { + ShowUsageWithFlagsRestrict(argv0, ""); +} + +// Convert the help, program, and usage to xml. +static void ShowXMLOfFlags(const char *prog_name) { + vector<CommandLineFlagInfo> flags; + GetAllFlags(&flags); // flags are sorted: by filename, then flagname + + // XML. There is no corresponding schema yet + fprintf(stdout, "<?xml version=\"1.0\"?>\n"); + // The document + fprintf(stdout, "<AllFlags>\n"); + // the program name and usage + fprintf(stdout, "<program>%s</program>\n", + XMLText(Basename(prog_name)).c_str()); + fprintf(stdout, "<usage>%s</usage>\n", + XMLText(ProgramUsage()).c_str()); + // All the flags + for (vector<CommandLineFlagInfo>::const_iterator flag = flags.begin(); + flag != flags.end(); + ++flag) { + if (flag->description != kStrippedFlagHelp) + fprintf(stdout, "%s\n", DescribeOneFlagInXML(*flag).c_str()); + } + // The end of the document + fprintf(stdout, "</AllFlags>\n"); +} + +// -------------------------------------------------------------------- +// ShowVersion() +// Called upon --version. Prints build-related info. +// -------------------------------------------------------------------- + +static void ShowVersion() { + fprintf(stdout, "%s\n", ProgramInvocationShortName()); + // TODO: add other stuff, like a timestamp, who built it, what + // target they built, etc. + +# if !defined(NDEBUG) + fprintf(stdout, "Debug build (NDEBUG not #defined)\n"); +# endif +} + +static void AppendPrognameStrings(vector<string>* substrings, + const char* progname) { + string r("/"); + r += progname; + substrings->push_back(r + "."); + substrings->push_back(r + "-main."); + substrings->push_back(r + "_main."); +} + +// -------------------------------------------------------------------- +// HandleCommandLineHelpFlags() +// Checks all the 'reporting' commandline flags to see if any +// have been set. If so, handles them appropriately. Note +// that all of them, by definition, cause the program to exit +// if they trigger. +// -------------------------------------------------------------------- + +void HandleCommandLineHelpFlags() { + const char* progname = ProgramInvocationShortName(); + extern void (*commandlineflags_exitfunc)(int); // in gflags.cc + + HandleCommandLineCompletions(); + + vector<string> substrings; + AppendPrognameStrings(&substrings, progname); + + if (FLAGS_helpshort) { + // show only flags related to this binary: + // E.g. for fileutil.cc, want flags containing ... "/fileutil." cc + ShowUsageWithFlagsMatching(progname, substrings); + commandlineflags_exitfunc(1); // almost certainly exit() + + } else if (FLAGS_help || FLAGS_helpfull) { + // show all options + ShowUsageWithFlagsRestrict(progname, ""); // empty restrict + commandlineflags_exitfunc(1); + + } else if (!FLAGS_helpon.empty()) { + string restrict = "/" + FLAGS_helpon + "."; + ShowUsageWithFlagsRestrict(progname, restrict.c_str()); + commandlineflags_exitfunc(1); + + } else if (!FLAGS_helpmatch.empty()) { + ShowUsageWithFlagsRestrict(progname, FLAGS_helpmatch.c_str()); + commandlineflags_exitfunc(1); + + } else if (FLAGS_helppackage) { + // Shows help for all files in the same directory as main(). We + // don't want to resort to looking at dirname(progname), because + // the user can pick progname, and it may not relate to the file + // where main() resides. So instead, we search the flags for a + // filename like "/progname.cc", and take the dirname of that. + vector<CommandLineFlagInfo> flags; + GetAllFlags(&flags); + string last_package; + for (vector<CommandLineFlagInfo>::const_iterator flag = flags.begin(); + flag != flags.end(); + ++flag) { + if (!FileMatchesSubstring(flag->filename, substrings)) + continue; + const string package = Dirname(flag->filename) + "/"; + if (package != last_package) { + ShowUsageWithFlagsRestrict(progname, package.c_str()); + if (!last_package.empty()) { // means this isn't our first pkg + fprintf(stderr, "WARNING: Multiple packages contain a file=%s\n", + progname); + } + last_package = package; + } + } + if (last_package.empty()) { // never found a package to print + fprintf(stderr, "WARNING: Unable to find a package for file=%s\n", + progname); + } + commandlineflags_exitfunc(1); + + } else if (FLAGS_helpxml) { + ShowXMLOfFlags(progname); + commandlineflags_exitfunc(1); + + } else if (FLAGS_version) { + ShowVersion(); + // Unlike help, we may be asking for version in a script, so return 0 + commandlineflags_exitfunc(0); + } +} + +_END_GOOGLE_NAMESPACE_ diff --git a/dtm_release/lib/util/gflags-1.1/src/gflags_unittest-main.cc b/dtm_release/lib/util/gflags-1.1/src/gflags_unittest-main.cc new file mode 100644 index 0000000000000000000000000000000000000000..19e6a8fe788a2fe407691cd9f0cd9f80f14b7c22 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/src/gflags_unittest-main.cc @@ -0,0 +1,1511 @@ +// Copyright (c) 2006, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// Author: Marius Eriksen +// +// For now, this unit test does not cover all features of +// gflags.cc + +#include "config.h" +#include <stdio.h> +#include <stdlib.h> // for &exit +#include <string.h> +#include <unistd.h> // for unlink() +#include <sys/stat.h> // for mkdir() +#include <math.h> // for isinf() and isnan() +#include <vector> +#include <string> +#include "gflags/gflags.h" +// I don't actually use this header file, but #include it under the +// old location to make sure that the include-header-forwarding +// works. +#include "google/gflags_completions.h" +void (*unused_fn)() = &GOOGLE_NAMESPACE::HandleCommandLineCompletions; + +using std::vector; +using std::string; +using GOOGLE_NAMESPACE::int32; +using GOOGLE_NAMESPACE::FlagRegisterer; + +// Returns the number of elements in an array. +#define GET_ARRAY_SIZE(arr) (sizeof(arr)/sizeof(*(arr))) + +DECLARE_string(tryfromenv); // in gflags.cc + +DEFINE_string(test_tmpdir, "/tmp/gflags_unittest", "Dir we use for temp files"); +DEFINE_string(srcdir, GOOGLE_NAMESPACE::StringFromEnv("SRCDIR", "."), + "Source-dir root, needed to find gflags_unittest_flagfile"); + + +DEFINE_bool(test_bool, false, "tests bool-ness"); +DEFINE_int32(test_int32, -1, ""); +DEFINE_int64(test_int64, -2, ""); +DEFINE_uint64(test_uint64, 2, ""); +DEFINE_double(test_double, -1.0, ""); +DEFINE_string(test_string, "initial", ""); + +// +// The below ugliness gets some additional code coverage in the -helpxml +// and -helpmatch test cases having to do with string lengths and formatting +// +DEFINE_bool(test_bool_with_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_long_name, + false, + "extremely_extremely_extremely_extremely_extremely_extremely_extremely_extremely_long_meaning"); + +DEFINE_string(test_str1, "initial", ""); +DEFINE_string(test_str2, "initial", ""); +DEFINE_string(test_str3, "initial", ""); + +// This is used to test setting tryfromenv manually +DEFINE_string(test_tryfromenv, "initial", ""); + +// boolean flag assigned correctly with bool +DEFINE_bool(test_bool_bool, true, ""); + +// boolean flag assigned with string +DEFINE_bool(test_bool_string, "", ""); + +// boolean flag assigned with float +DEFINE_bool(test_bool_float, 1.0, ""); + +// boolean flag assigned with int +DEFINE_bool(test_bool_int, 1, ""); + +// Don't try this at home! +static int changeable_var = 12; +DEFINE_int32(changeable_var, ++changeable_var, ""); + +static int changeable_bool_var = 8008; +DEFINE_bool(changeable_bool_var, ++changeable_bool_var == 8009, ""); + +static int changeable_string_var = 0; +static string ChangeableString() { + char r[] = {'0' + ++changeable_string_var, '\0'}; + return r; +} +DEFINE_string(changeable_string_var, ChangeableString(), ""); + +// These are never used in this unittest, but can be used by +// gflags_unittest.sh when it needs to specify flags +// that are legal for gflags_unittest but don't need to +// be a particular value. +DEFINE_bool(unused_bool, true, "unused bool-ness"); +DEFINE_int32(unused_int32, -1001, ""); +DEFINE_int64(unused_int64, -2001, ""); +DEFINE_uint64(unused_uint64, 2000, ""); +DEFINE_double(unused_double, -1000.0, ""); +DEFINE_string(unused_string, "unused", ""); + +// These flags are used by gflags_unittest.sh +DEFINE_bool(changed_bool1, false, "changed"); +DEFINE_bool(changed_bool2, false, "changed"); + +static bool AlwaysFail(const char* flag, bool value) { return value == false; } +DEFINE_bool(always_fail, false, "will fail to validate when you set it"); +static const bool dummy = GOOGLE_NAMESPACE::RegisterFlagValidator(&FLAGS_always_fail, AlwaysFail); + +// This is a psuedo-flag -- we want to register a flag with a filename +// at the top level, but there is no way to do this except by faking +// the filename. +namespace fLI { + static const int32 FLAGS_nonotldflag1 = 12; + int32 FLAGS_tldflag1 = FLAGS_nonotldflag1; + int32 FLAGS_notldflag1 = FLAGS_nonotldflag1; + static FlagRegisterer o_tldflag1( + "tldflag1", "int32", + "should show up in --helpshort", "gflags_unittest.cc", + &FLAGS_tldflag1, &FLAGS_notldflag1); +} +using fLI::FLAGS_tldflag1; + +namespace fLI { + static const int32 FLAGS_nonotldflag2 = 23; + int32 FLAGS_tldflag2 = FLAGS_nonotldflag2; + int32 FLAGS_notldflag2 = FLAGS_nonotldflag2; + static FlagRegisterer o_tldflag2( + "tldflag2", "int32", + "should show up in --helpshort", "gflags_unittest.", + &FLAGS_tldflag2, &FLAGS_notldflag2); +} +using fLI::FLAGS_tldflag2; + +_START_GOOGLE_NAMESPACE_ + +// The following is some bare-bones testing infrastructure + +#define EXPECT_TRUE(cond) \ + do { \ + if (!(cond)) { \ + fprintf(stderr, "Check failed: %s\n", #cond); \ + exit(1); \ + } \ + } while (0) + +#define EXPECT_FALSE(cond) EXPECT_TRUE(!(cond)) + +#define EXPECT_OP(op, val1, val2) \ + do { \ + if (!((val1) op (val2))) { \ + fprintf(stderr, "Check failed: %s %s %s\n", #val1, #op, #val2); \ + exit(1); \ + } \ + } while (0) + +#define EXPECT_EQ(val1, val2) EXPECT_OP(==, val1, val2) +#define EXPECT_NE(val1, val2) EXPECT_OP(!=, val1, val2) +#define EXPECT_GT(val1, val2) EXPECT_OP(>, val1, val2) +#define EXPECT_LT(val1, val2) EXPECT_OP(<, val1, val2) + +// C99 declares isnan and isinf should be macros, so the #ifdef test +// should be reliable everywhere. Of course, it's not, but these +// are testing pertty marginal functionality anyway, so it's ok to +// not-run them even in situations they might, with effort, be made to work. +#ifdef isnan // Some compilers, like sun's for Solaris 10, don't define this +#define EXPECT_NAN(arg) \ + do { \ + if (!isnan(arg)) { \ + fprintf(stderr, "Check failed: isnan(%s)\n", #arg); \ + exit(1); \ + } \ + } while (0) +#else +#define EXPECT_NAN(arg) +#endif + +#ifdef isinf // Some compilers, like sun's for Solaris 10, don't define this +#define EXPECT_INF(arg) \ + do { \ + if (!isinf(arg)) { \ + fprintf(stderr, "Check failed: isinf(%s)\n", #arg); \ + exit(1); \ + } \ + } while (0) +#else +#define EXPECT_INF(arg) +#endif + +#define EXPECT_DOUBLE_EQ(val1, val2) \ + do { \ + if (((val1) < (val2) - 0.001 || (val1) > (val2) + 0.001)) { \ + fprintf(stderr, "Check failed: %s == %s\n", #val1, #val2); \ + exit(1); \ + } \ + } while (0) + +#define EXPECT_STREQ(val1, val2) \ + do { \ + if (strcmp((val1), (val2)) != 0) { \ + fprintf(stderr, "Check failed: streq(%s, %s)\n", #val1, #val2); \ + exit(1); \ + } \ + } while (0) + +static bool g_called_exit; +static void CalledExit(int) { g_called_exit = true; } + +#define EXPECT_DEATH(fn, msg) \ + do { \ + g_called_exit = false; \ + extern void (*commandlineflags_exitfunc)(int); /* in gflags.cc */ \ + commandlineflags_exitfunc = &CalledExit; \ + fn; \ + commandlineflags_exitfunc = &exit; /* set back to its default */ \ + if (!g_called_exit) { \ + fprintf(stderr, "Function didn't die (%s): %s\n", msg, #fn); \ + exit(1); \ + } \ + } while (0) + + +vector<void (*)()> g_testlist; // the tests to run + +#define TEST(a, b) \ + struct Test_##a##_##b { \ + Test_##a##_##b() { g_testlist.push_back(&Run); } \ + static void Run() { FlagSaver fs; RunTest(); } \ + static void RunTest(); \ + }; \ + static Test_##a##_##b g_test_##a##_##b; \ + void Test_##a##_##b::RunTest() + + +static int RUN_ALL_TESTS() { + vector<void (*)()>::const_iterator it; + for (it = g_testlist.begin(); it != g_testlist.end(); ++it) { + (*it)(); + } + fprintf(stderr, "Passed %d tests\n\nPASS\n", (int)g_testlist.size()); + return 0; +} + + +// Defining a variable of type CompileAssertTypesEqual<T1, T2> will cause a +// compiler error iff T1 and T2 are different types. +template <typename T1, typename T2> +struct CompileAssertTypesEqual; + +template <typename T> +struct CompileAssertTypesEqual<T, T> { +}; + + +template <typename Expected, typename Actual> +void AssertIsType(Actual& x) { + CompileAssertTypesEqual<Expected, Actual>(); +} + +// Verify all the flags are the right type. +TEST(FlagTypes, FlagTypes) { + AssertIsType<bool>(FLAGS_test_bool); + AssertIsType<int32>(FLAGS_test_int32); + AssertIsType<int64>(FLAGS_test_int64); + AssertIsType<uint64>(FLAGS_test_uint64); + AssertIsType<double>(FLAGS_test_double); + AssertIsType<string>(FLAGS_test_string); +} + +// Death tests for "help" options. +// +// The help system automatically calls exit(1) when you specify any of +// the help-related flags ("-helpmatch", "-helpxml") so we can't test +// those mainline. + +// Tests that "-helpmatch" causes the process to die. +TEST(ReadFlagsFromStringDeathTest, HelpMatch) { + EXPECT_DEATH(ReadFlagsFromString("-helpmatch=base", GetArgv0(), true), + ""); +} + + +// Tests that "-helpxml" causes the process to die. +TEST(ReadFlagsFromStringDeathTest, HelpXml) { + EXPECT_DEATH(ReadFlagsFromString("-helpxml", GetArgv0(), true), + ""); +} + + +// A subroutine needed for testing reading flags from a string. +void TestFlagString(const string& flags, + const string& expected_string, + bool expected_bool, + int32 expected_int32, + double expected_double) { + EXPECT_TRUE(ReadFlagsFromString(flags, + GetArgv0(), + // errors are fatal + true)); + + EXPECT_EQ(expected_string, FLAGS_test_string); + EXPECT_EQ(expected_bool, FLAGS_test_bool); + EXPECT_EQ(expected_int32, FLAGS_test_int32); + EXPECT_DOUBLE_EQ(expected_double, FLAGS_test_double); +} + + +// Tests reading flags from a string. +TEST(FlagFileTest, ReadFlagsFromString) { + TestFlagString( + // Flag string + "-test_string=continued\n" + "# some comments are in order\n" + "# some\n" + " # comments\n" + "#are\n" + " #trickier\n" + "# than others\n" + "-test_bool=true\n" + " -test_int32=1\n" + "-test_double=0.0\n", + // Expected values + "continued", + true, + 1, + 0.0); + + TestFlagString( + // Flag string + "# let's make sure it can update values\n" + "-test_string=initial\n" + "-test_bool=false\n" + "-test_int32=123\n" + "-test_double=123.0\n", + // Expected values + "initial", + false, + 123, + 123.0); +} + +// Tests the filename part of the flagfile +TEST(FlagFileTest, FilenamesOurfileLast) { + FLAGS_test_string = "initial"; + FLAGS_test_bool = false; + FLAGS_test_int32 = -1; + FLAGS_test_double = -1.0; + TestFlagString( + // Flag string + "-test_string=continued\n" + "# some comments are in order\n" + "# some\n" + " # comments\n" + "#are\n" + " #trickier\n" + "# than others\n" + "not_our_filename\n" + "-test_bool=true\n" + " -test_int32=1\n" + "gflags_unittest\n" + "-test_double=1000.0\n", + // Expected values + "continued", + false, + -1, + 1000.0); +} + +TEST(FlagFileTest, FilenamesOurfileFirst) { + FLAGS_test_string = "initial"; + FLAGS_test_bool = false; + FLAGS_test_int32 = -1; + FLAGS_test_double = -1.0; + TestFlagString( + // Flag string + "-test_string=continued\n" + "# some comments are in order\n" + "# some\n" + " # comments\n" + "#are\n" + " #trickier\n" + "# than others\n" + "gflags_unittest\n" + "-test_bool=true\n" + " -test_int32=1\n" + "not_our_filename\n" + "-test_double=1000.0\n", + // Expected values + "continued", + true, + 1, + -1.0); +} + +TEST(FlagFileTest, FilenamesOurfileGlob) { + FLAGS_test_string = "initial"; + FLAGS_test_bool = false; + FLAGS_test_int32 = -1; + FLAGS_test_double = -1.0; + TestFlagString( + // Flag string + "-test_string=continued\n" + "# some comments are in order\n" + "# some\n" + " # comments\n" + "#are\n" + " #trickier\n" + "# than others\n" + "*flags*\n" + "-test_bool=true\n" + " -test_int32=1\n" + "flags\n" + "-test_double=1000.0\n", + // Expected values + "continued", + true, + 1, + -1.0); +} + +TEST(FlagFileTest, FilenamesOurfileInBigList) { + FLAGS_test_string = "initial"; + FLAGS_test_bool = false; + FLAGS_test_int32 = -1; + FLAGS_test_double = -1.0; + TestFlagString( + // Flag string + "-test_string=continued\n" + "# some comments are in order\n" + "# some\n" + " # comments\n" + "#are\n" + " #trickier\n" + "# than others\n" + "*first* *flags* *third*\n" + "-test_bool=true\n" + " -test_int32=1\n" + "flags\n" + "-test_double=1000.0\n", + // Expected values + "continued", + true, + 1, + -1.0); +} + +// Tests that a failed flag-from-string read keeps flags at default values +TEST(FlagFileTest, FailReadFlagsFromString) { + FLAGS_test_int32 = 119; + string flags("# let's make sure it can update values\n" + "-test_string=non_initial\n" + "-test_bool=false\n" + "-test_int32=123\n" + "-test_double=illegal\n"); + + EXPECT_FALSE(ReadFlagsFromString(flags, + GetArgv0(), + // errors are fatal + false)); + + EXPECT_EQ(119, FLAGS_test_int32); + EXPECT_EQ("initial", FLAGS_test_string); +} + +// Tests that flags can be set to ordinary values. +TEST(SetFlagValueTest, OrdinaryValues) { + EXPECT_EQ("initial", FLAGS_test_str1); + + SetCommandLineOptionWithMode("test_str1", "second", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str1); // set; was default + + SetCommandLineOptionWithMode("test_str1", "third", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str1); // already set once + + FLAGS_test_str1 = "initial"; + SetCommandLineOptionWithMode("test_str1", "third", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("initial", FLAGS_test_str1); // still already set before + + SetCommandLineOptionWithMode("test_str1", "third", SET_FLAGS_VALUE); + EXPECT_EQ("third", FLAGS_test_str1); // changed value + + SetCommandLineOptionWithMode("test_str1", "fourth", SET_FLAGS_DEFAULT); + EXPECT_EQ("third", FLAGS_test_str1); + // value not changed (already set before) + + EXPECT_EQ("initial", FLAGS_test_str2); + + SetCommandLineOptionWithMode("test_str2", "second", SET_FLAGS_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str2); // changed (was default) + + FLAGS_test_str2 = "extra"; + EXPECT_EQ("extra", FLAGS_test_str2); + + FLAGS_test_str2 = "second"; + SetCommandLineOptionWithMode("test_str2", "third", SET_FLAGS_DEFAULT); + EXPECT_EQ("third", FLAGS_test_str2); // still changed (was equal to default) + + SetCommandLineOptionWithMode("test_str2", "fourth", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("fourth", FLAGS_test_str2); // changed (was default) + + EXPECT_EQ("initial", FLAGS_test_str3); + + SetCommandLineOptionWithMode("test_str3", "second", SET_FLAGS_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str3); // changed + + FLAGS_test_str3 = "third"; + SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAGS_DEFAULT); + EXPECT_EQ("third", FLAGS_test_str3); // not changed (was set) + + SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("third", FLAGS_test_str3); // not changed (was set) + + SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAGS_VALUE); + EXPECT_EQ("fourth", FLAGS_test_str3); // changed value +} + + +// Tests that flags can be set to exceptional values. +TEST(SetFlagValueTest, ExceptionalValues) { +#ifdef isinf // on systems without isinf, inf stuff may not work at all + EXPECT_EQ("test_double set to inf\n", + SetCommandLineOption("test_double", "inf")); + EXPECT_INF(FLAGS_test_double); + + EXPECT_EQ("test_double set to inf\n", + SetCommandLineOption("test_double", "INF")); + EXPECT_INF(FLAGS_test_double); +#endif + + // set some bad values + EXPECT_EQ("", + SetCommandLineOption("test_double", "0.1xxx")); + EXPECT_EQ("", + SetCommandLineOption("test_double", " ")); + EXPECT_EQ("", + SetCommandLineOption("test_double", "")); +#ifdef isinf + EXPECT_EQ("test_double set to -inf\n", + SetCommandLineOption("test_double", "-inf")); + EXPECT_INF(FLAGS_test_double); + EXPECT_GT(0, FLAGS_test_double); +#endif + +#ifdef isnan + EXPECT_EQ("test_double set to nan\n", + SetCommandLineOption("test_double", "NaN")); + EXPECT_NAN(FLAGS_test_double); +#endif +} + +// Tests that integer flags can be specified in many ways +TEST(SetFlagValueTest, DifferentRadices) { + EXPECT_EQ("test_int32 set to 12\n", + SetCommandLineOption("test_int32", "12")); + + EXPECT_EQ("test_int32 set to 16\n", + SetCommandLineOption("test_int32", "0x10")); + + EXPECT_EQ("test_int32 set to 34\n", + SetCommandLineOption("test_int32", "0X22")); + + // Leading 0 is *not* octal; it's still decimal + EXPECT_EQ("test_int32 set to 10\n", + SetCommandLineOption("test_int32", "010")); +} + +// Tests what happens when you try to set a flag to an illegal value +TEST(SetFlagValueTest, IllegalValues) { + FLAGS_test_bool = true; + FLAGS_test_int32 = 119; + FLAGS_test_int64 = 1191; + FLAGS_test_uint64 = 11911; + + EXPECT_EQ("", + SetCommandLineOption("test_bool", "12")); + + EXPECT_EQ("", + SetCommandLineOption("test_int32", "7000000000000")); + + // TODO(csilvers): uncomment this when we disallow negative numbers for uint64 +#if 0 + EXPECT_EQ("", + SetCommandLineOption("test_uint64", "-1")); +#endif + + EXPECT_EQ("", + SetCommandLineOption("test_int64", "not a number!")); + + // Test the empty string with each type of input + EXPECT_EQ("", SetCommandLineOption("test_bool", "")); + EXPECT_EQ("", SetCommandLineOption("test_int32", "")); + EXPECT_EQ("", SetCommandLineOption("test_int64", "")); + EXPECT_EQ("", SetCommandLineOption("test_uint64", "")); + EXPECT_EQ("", SetCommandLineOption("test_double", "")); + EXPECT_EQ("test_string set to \n", SetCommandLineOption("test_string", "")); + + EXPECT_EQ(true, FLAGS_test_bool); + EXPECT_EQ(119, FLAGS_test_int32); + EXPECT_EQ(1191, FLAGS_test_int64); + EXPECT_EQ(11911, FLAGS_test_uint64); +} + + +// Tests that we only evaluate macro args once +TEST(MacroArgs, EvaluateOnce) { + EXPECT_EQ(13, FLAGS_changeable_var); + // Make sure we don't ++ the value somehow, when evaluating the flag. + EXPECT_EQ(13, FLAGS_changeable_var); + // Make sure the macro only evaluated this var once. + EXPECT_EQ(13, changeable_var); + // Make sure the actual value and default value are the same + SetCommandLineOptionWithMode("changeable_var", "21", SET_FLAG_IF_DEFAULT); + EXPECT_EQ(21, FLAGS_changeable_var); +} + +TEST(MacroArgs, EvaluateOnceBool) { + EXPECT_EQ(true, FLAGS_changeable_bool_var); + EXPECT_EQ(true, FLAGS_changeable_bool_var); + EXPECT_EQ(8009, changeable_bool_var); + SetCommandLineOptionWithMode("changeable_bool_var", "false", + SET_FLAG_IF_DEFAULT); + EXPECT_EQ(false, FLAGS_changeable_bool_var); +} + +TEST(MacroArgs, EvaluateOnceStrings) { + EXPECT_EQ("1", FLAGS_changeable_string_var); + EXPECT_EQ("1", FLAGS_changeable_string_var); + EXPECT_EQ(1, changeable_string_var); + SetCommandLineOptionWithMode("changeable_string_var", "different", + SET_FLAG_IF_DEFAULT); + EXPECT_EQ("different", FLAGS_changeable_string_var); +} + +// Tests that the FooFromEnv does the right thing +TEST(FromEnvTest, LegalValues) { + setenv("BOOL_VAL1", "true", 1); + setenv("BOOL_VAL2", "false", 1); + setenv("BOOL_VAL3", "1", 1); + setenv("BOOL_VAL4", "F", 1); + EXPECT_EQ(true, BoolFromEnv("BOOL_VAL1", false)); + EXPECT_EQ(false, BoolFromEnv("BOOL_VAL2", true)); + EXPECT_EQ(true, BoolFromEnv("BOOL_VAL3", false)); + EXPECT_EQ(false, BoolFromEnv("BOOL_VAL4", true)); + EXPECT_EQ(true, BoolFromEnv("BOOL_VAL_UNKNOWN", true)); + EXPECT_EQ(false, BoolFromEnv("BOOL_VAL_UNKNOWN", false)); + + setenv("INT_VAL1", "1", 1); + setenv("INT_VAL2", "-1", 1); + EXPECT_EQ(1, Int32FromEnv("INT_VAL1", 10)); + EXPECT_EQ(-1, Int32FromEnv("INT_VAL2", 10)); + EXPECT_EQ(10, Int32FromEnv("INT_VAL_UNKNOWN", 10)); + + setenv("INT_VAL3", "1099511627776", 1); + EXPECT_EQ(1, Int64FromEnv("INT_VAL1", 20)); + EXPECT_EQ(-1, Int64FromEnv("INT_VAL2", 20)); + EXPECT_EQ(1099511627776LL, Int64FromEnv("INT_VAL3", 20)); + EXPECT_EQ(20, Int64FromEnv("INT_VAL_UNKNOWN", 20)); + + EXPECT_EQ(1, Uint64FromEnv("INT_VAL1", 30)); + EXPECT_EQ(1099511627776ULL, Uint64FromEnv("INT_VAL3", 30)); + EXPECT_EQ(30, Uint64FromEnv("INT_VAL_UNKNOWN", 30)); + + // I pick values here that can be easily represented exactly in floating-point + setenv("DOUBLE_VAL1", "0.0", 1); + setenv("DOUBLE_VAL2", "1.0", 1); + setenv("DOUBLE_VAL3", "-1.0", 1); + EXPECT_EQ(0.0, DoubleFromEnv("DOUBLE_VAL1", 40.0)); + EXPECT_EQ(1.0, DoubleFromEnv("DOUBLE_VAL2", 40.0)); + EXPECT_EQ(-1.0, DoubleFromEnv("DOUBLE_VAL3", 40.0)); + EXPECT_EQ(40.0, DoubleFromEnv("DOUBLE_VAL_UNKNOWN", 40.0)); + + setenv("STRING_VAL1", "", 1); + setenv("STRING_VAL2", "my happy string!", 1); + EXPECT_STREQ("", StringFromEnv("STRING_VAL1", "unknown")); + EXPECT_STREQ("my happy string!", StringFromEnv("STRING_VAL2", "unknown")); + EXPECT_STREQ("unknown", StringFromEnv("STRING_VAL_UNKNOWN", "unknown")); +} + +// Tests that the FooFromEnv dies on parse-error +TEST(FromEnvDeathTest, IllegalValues) { + setenv("BOOL_BAD1", "so true!",1 ); + setenv("BOOL_BAD2", "", 1); + EXPECT_DEATH(BoolFromEnv("BOOL_BAD1", false), "error parsing env variable"); + EXPECT_DEATH(BoolFromEnv("BOOL_BAD2", true), "error parsing env variable"); + + setenv("INT_BAD1", "one", 1); + setenv("INT_BAD2", "100000000000000000", 1); + setenv("INT_BAD3", "0xx10", 1); + setenv("INT_BAD4", "", 1); + EXPECT_DEATH(Int32FromEnv("INT_BAD1", 10), "error parsing env variable"); + EXPECT_DEATH(Int32FromEnv("INT_BAD2", 10), "error parsing env variable"); + EXPECT_DEATH(Int32FromEnv("INT_BAD3", 10), "error parsing env variable"); + EXPECT_DEATH(Int32FromEnv("INT_BAD4", 10), "error parsing env variable"); + + setenv("BIGINT_BAD1", "18446744073709551616000", 1); + EXPECT_DEATH(Int64FromEnv("INT_BAD1", 20), "error parsing env variable"); + EXPECT_DEATH(Int64FromEnv("INT_BAD3", 20), "error parsing env variable"); + EXPECT_DEATH(Int64FromEnv("INT_BAD4", 20), "error parsing env variable"); + EXPECT_DEATH(Int64FromEnv("BIGINT_BAD1", 200), "error parsing env variable"); + + setenv("BIGINT_BAD2", "-1", 1); + EXPECT_DEATH(Uint64FromEnv("INT_BAD1", 30), "error parsing env variable"); + EXPECT_DEATH(Uint64FromEnv("INT_BAD3", 30), "error parsing env variable"); + EXPECT_DEATH(Uint64FromEnv("INT_BAD4", 30), "error parsing env variable"); + EXPECT_DEATH(Uint64FromEnv("BIGINT_BAD1", 30), "error parsing env variable"); + // TODO(csilvers): uncomment this when we disallow negative numbers for uint64 +#if 0 + EXPECT_DEATH(Uint64FromEnv("BIGINT_BAD2", 30), "error parsing env variable"); +#endif + + setenv("DOUBLE_BAD1", "0.0.0", 1); + setenv("DOUBLE_BAD2", "", 1); + EXPECT_DEATH(DoubleFromEnv("DOUBLE_BAD1", 40.0), "error parsing env variable"); + EXPECT_DEATH(DoubleFromEnv("DOUBLE_BAD2", 40.0), "error parsing env variable"); +} + +// Tests that FlagSaver can save the states of string flags. +TEST(FlagSaverTest, CanSaveStringFlagStates) { + // 1. Initializes the flags. + + // State of flag test_str1: + // default value - "initial" + // current value - "initial" + // not set - true + + SetCommandLineOptionWithMode("test_str2", "second", SET_FLAGS_VALUE); + // State of flag test_str2: + // default value - "initial" + // current value - "second" + // not set - false + + SetCommandLineOptionWithMode("test_str3", "second", SET_FLAGS_DEFAULT); + // State of flag test_str3: + // default value - "second" + // current value - "second" + // not set - true + + // 2. Saves the flag states. + + { + FlagSaver fs; + + // 3. Modifies the flag states. + + SetCommandLineOptionWithMode("test_str1", "second", SET_FLAGS_VALUE); + EXPECT_EQ("second", FLAGS_test_str1); + // State of flag test_str1: + // default value - "second" + // current value - "second" + // not set - true + + SetCommandLineOptionWithMode("test_str2", "third", SET_FLAGS_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str2); + // State of flag test_str2: + // default value - "third" + // current value - "second" + // not set - false + + SetCommandLineOptionWithMode("test_str3", "third", SET_FLAGS_VALUE); + EXPECT_EQ("third", FLAGS_test_str3); + // State of flag test_str1: + // default value - "second" + // current value - "third" + // not set - false + + // 4. Restores the flag states. + } + + // 5. Verifies that the states were restored. + + // Verifies that the value of test_str1 was restored. + EXPECT_EQ("initial", FLAGS_test_str1); + // Verifies that the "not set" attribute of test_str1 was restored to true. + SetCommandLineOptionWithMode("test_str1", "second", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str1); + + // Verifies that the value of test_str2 was restored. + EXPECT_EQ("second", FLAGS_test_str2); + // Verifies that the "not set" attribute of test_str2 was restored to false. + SetCommandLineOptionWithMode("test_str2", "fourth", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str2); + + // Verifies that the value of test_str3 was restored. + EXPECT_EQ("second", FLAGS_test_str3); + // Verifies that the "not set" attribute of test_str3 was restored to true. + SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("fourth", FLAGS_test_str3); +} + + +// Tests that FlagSaver can save the values of various-typed flags. +TEST(FlagSaverTest, CanSaveVariousTypedFlagValues) { + // Initializes the flags. + FLAGS_test_bool = false; + FLAGS_test_int32 = -1; + FLAGS_test_int64 = -2; + FLAGS_test_uint64 = 3; + FLAGS_test_double = 4.0; + FLAGS_test_string = "good"; + + // Saves the flag states. + { + FlagSaver fs; + + // Modifies the flags. + FLAGS_test_bool = true; + FLAGS_test_int32 = -5; + FLAGS_test_int64 = -6; + FLAGS_test_uint64 = 7; + FLAGS_test_double = 8.0; + FLAGS_test_string = "bad"; + + // Restores the flag states. + } + + // Verifies the flag values were restored. + EXPECT_FALSE(FLAGS_test_bool); + EXPECT_EQ(-1, FLAGS_test_int32); + EXPECT_EQ(-2, FLAGS_test_int64); + EXPECT_EQ(3, FLAGS_test_uint64); + EXPECT_DOUBLE_EQ(4.0, FLAGS_test_double); + EXPECT_EQ("good", FLAGS_test_string); +} + +TEST(GetAllFlagsTest, BaseTest) { + vector<CommandLineFlagInfo> flags; + GetAllFlags(&flags); + bool found_test_bool = false; + vector<CommandLineFlagInfo>::const_iterator i; + for (i = flags.begin(); i != flags.end(); ++i) { + if (i->name == "test_bool") { + found_test_bool = true; + EXPECT_EQ(i->type, "bool"); + EXPECT_EQ(i->default_value, "false"); + break; + } + } + EXPECT_EQ(true, found_test_bool); +} + +TEST(ShowUsageWithFlagsTest, BaseTest) { + // TODO(csilvers): test this by allowing output other than to stdout. + // Not urgent since this functionality is tested via + // gflags_unittest.sh, though only through use of --help. +} + +TEST(ShowUsageWithFlagsRestrictTest, BaseTest) { + // TODO(csilvers): test this by allowing output other than to stdout. + // Not urgent since this functionality is tested via + // gflags_unittest.sh, though only through use of --helpmatch. +} + +// Note: all these argv-based tests depend on SetArgv being called +// before InitGoogle() in main(), below. +TEST(GetArgvsTest, BaseTest) { + vector<string> argvs = GetArgvs(); + EXPECT_EQ(4, argvs.size()); + EXPECT_EQ("/test/argv/for/gflags_unittest", argvs[0]); + EXPECT_EQ("argv 2", argvs[1]); + EXPECT_EQ("3rd argv", argvs[2]); + EXPECT_EQ("argv #4", argvs[3]); +} + +TEST(GetArgvTest, BaseTest) { + EXPECT_STREQ("/test/argv/for/gflags_unittest " + "argv 2 3rd argv argv #4", GetArgv()); +} + +TEST(GetArgv0Test, BaseTest) { + EXPECT_STREQ("/test/argv/for/gflags_unittest", GetArgv0()); +} + +TEST(GetArgvSumTest, BaseTest) { + // This number is just the sum of the ASCII values of all the chars + // in GetArgv(). + EXPECT_EQ(4904, GetArgvSum()); +} + +TEST(ProgramInvocationNameTest, BaseTest) { + EXPECT_STREQ("/test/argv/for/gflags_unittest", + ProgramInvocationName()); +} + +TEST(ProgramInvocationShortNameTest, BaseTest) { + EXPECT_STREQ("gflags_unittest", ProgramInvocationShortName()); +} + +TEST(ProgramUsageTest, BaseTest) { // Depends on 1st arg to InitGoogle in main() + EXPECT_STREQ("/test/argv/for/gflags_unittest: " + "<useless flag> [...]\nDoes something useless.\n", + ProgramUsage()); +} + +TEST(GetCommandLineOptionTest, NameExistsAndIsDefault) { + string value("will be changed"); + bool r = GetCommandLineOption("test_bool", &value); + EXPECT_EQ(true, r); + EXPECT_EQ("false", value); + + r = GetCommandLineOption("test_int32", &value); + EXPECT_EQ(true, r); + EXPECT_EQ("-1", value); +} + +TEST(GetCommandLineOptionTest, NameExistsAndWasAssigned) { + FLAGS_test_int32 = 400; + string value("will be changed"); + const bool r = GetCommandLineOption("test_int32", &value); + EXPECT_EQ(true, r); + EXPECT_EQ("400", value); +} + +TEST(GetCommandLineOptionTest, NameExistsAndWasSet) { + SetCommandLineOption("test_int32", "700"); + string value("will be changed"); + const bool r = GetCommandLineOption("test_int32", &value); + EXPECT_EQ(true, r); + EXPECT_EQ("700", value); +} + +TEST(GetCommandLineOptionTest, NameExistsAndWasNotSet) { + // This doesn't set the flag's value, but rather its default value. + // is_default is still true, but the 'default' value returned has changed! + SetCommandLineOptionWithMode("test_int32", "800", SET_FLAGS_DEFAULT); + string value("will be changed"); + const bool r = GetCommandLineOption("test_int32", &value); + EXPECT_EQ(true, r); + EXPECT_EQ("800", value); + EXPECT_EQ(true, GetCommandLineFlagInfoOrDie("test_int32").is_default); + +} + +TEST(GetCommandLineOptionTest, NameExistsAndWasConditionallySet) { + SetCommandLineOptionWithMode("test_int32", "900", SET_FLAG_IF_DEFAULT); + string value("will be changed"); + const bool r = GetCommandLineOption("test_int32", &value); + EXPECT_EQ(true, r); + EXPECT_EQ("900", value); +} + +TEST(GetCommandLineOptionTest, NameDoesNotExist) { + string value("will not be changed"); + const bool r = GetCommandLineOption("test_int3210", &value); + EXPECT_EQ(false, r); + EXPECT_EQ("will not be changed", value); +} + +TEST(GetCommandLineFlagInfoTest, FlagExists) { + CommandLineFlagInfo info; + bool r = GetCommandLineFlagInfo("test_int32", &info); + EXPECT_EQ(true, r); + EXPECT_EQ("test_int32", info.name); + EXPECT_EQ("int32", info.type); + EXPECT_EQ("", info.description); + EXPECT_EQ("-1", info.current_value); + EXPECT_EQ("-1", info.default_value); + EXPECT_EQ(true, info.is_default); + EXPECT_EQ(false, info.has_validator_fn); + + FLAGS_test_bool = true; + r = GetCommandLineFlagInfo("test_bool", &info); + EXPECT_EQ(true, r); + EXPECT_EQ("test_bool", info.name); + EXPECT_EQ("bool", info.type); + EXPECT_EQ("tests bool-ness", info.description); + EXPECT_EQ("true", info.current_value); + EXPECT_EQ("false", info.default_value); + EXPECT_EQ(false, info.is_default); + EXPECT_EQ(false, info.has_validator_fn); + + FLAGS_test_bool = false; + r = GetCommandLineFlagInfo("test_bool", &info); + EXPECT_EQ(true, r); + EXPECT_EQ("test_bool", info.name); + EXPECT_EQ("bool", info.type); + EXPECT_EQ("tests bool-ness", info.description); + EXPECT_EQ("false", info.current_value); + EXPECT_EQ("false", info.default_value); + EXPECT_EQ(false, info.is_default); // value is same, but flag *was* modified + EXPECT_EQ(false, info.has_validator_fn); +} + +TEST(GetCommandLineFlagInfoTest, FlagDoesNotExist) { + CommandLineFlagInfo info; + // Set to some random values that GetCommandLineFlagInfo should not change + info.name = "name"; + info.type = "type"; + info.current_value = "curr"; + info.default_value = "def"; + info.filename = "/"; + info.is_default = false; + info.has_validator_fn = true; + bool r = GetCommandLineFlagInfo("test_int3210", &info); + EXPECT_EQ(false, r); + EXPECT_EQ("name", info.name); + EXPECT_EQ("type", info.type); + EXPECT_EQ("", info.description); + EXPECT_EQ("curr", info.current_value); + EXPECT_EQ("def", info.default_value); + EXPECT_EQ("/", info.filename); + EXPECT_EQ(false, info.is_default); + EXPECT_EQ(true, info.has_validator_fn); +} + +TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndIsDefault) { + CommandLineFlagInfo info; + info = GetCommandLineFlagInfoOrDie("test_int32"); + EXPECT_EQ("test_int32", info.name); + EXPECT_EQ("int32", info.type); + EXPECT_EQ("", info.description); + EXPECT_EQ("-1", info.current_value); + EXPECT_EQ("-1", info.default_value); + EXPECT_EQ(true, info.is_default); + info = GetCommandLineFlagInfoOrDie("test_bool"); + EXPECT_EQ("test_bool", info.name); + EXPECT_EQ("bool", info.type); + EXPECT_EQ("tests bool-ness", info.description); + EXPECT_EQ("false", info.current_value); + EXPECT_EQ("false", info.default_value); + EXPECT_EQ(true, info.is_default); + EXPECT_EQ(false, info.has_validator_fn); +} + +TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndWasAssigned) { + FLAGS_test_int32 = 400; + CommandLineFlagInfo info; + info = GetCommandLineFlagInfoOrDie("test_int32"); + EXPECT_EQ("test_int32", info.name); + EXPECT_EQ("int32", info.type); + EXPECT_EQ("", info.description); + EXPECT_EQ("400", info.current_value); + EXPECT_EQ("-1", info.default_value); + EXPECT_EQ(false, info.is_default); + FLAGS_test_bool = true; + info = GetCommandLineFlagInfoOrDie("test_bool"); + EXPECT_EQ("test_bool", info.name); + EXPECT_EQ("bool", info.type); + EXPECT_EQ("tests bool-ness", info.description); + EXPECT_EQ("true", info.current_value); + EXPECT_EQ("false", info.default_value); + EXPECT_EQ(false, info.is_default); + EXPECT_EQ(false, info.has_validator_fn); +} + +TEST(GetCommandLineFlagInfoOrDieDeathTest, FlagDoesNotExist) { + EXPECT_DEATH(GetCommandLineFlagInfoOrDie("test_int3210"), + ".*: flag test_int3210 does not exist"); +} + + +// These are lightly tested because they're deprecated. Basically, +// the tests are meant to cover how existing users use these functions, +// but not necessarily how new users could use them. +TEST(DeprecatedFunctionsTest, CommandlineFlagsIntoString) { + string s = CommandlineFlagsIntoString(); + EXPECT_NE(string::npos, s.find("--test_bool=")); +} + +TEST(DeprecatedFunctionsTest, AppendFlagsIntoFile) { + FLAGS_test_int32 = 10; // just to make the test more interesting + string filename(FLAGS_test_tmpdir + "/flagfile"); + unlink(filename.c_str()); // just to be safe + const bool r = AppendFlagsIntoFile(filename, "not the real argv0"); + EXPECT_EQ(true, r); + + FILE* fp = fopen(filename.c_str(), "r"); + EXPECT_TRUE(fp != NULL); + char line[8192]; + fgets(line, sizeof(line)-1, fp); // first line should be progname + EXPECT_STREQ("not the real argv0\n", line); + + bool found_bool = false, found_int32 = false; + while (fgets(line, sizeof(line)-1, fp)) { + line[sizeof(line)-1] = '\0'; // just to be safe + if (strcmp(line, "--test_bool=false\n") == 0) + found_bool = true; + if (strcmp(line, "--test_int32=10\n") == 0) + found_int32 = true; + } + EXPECT_EQ(true, found_int32); + EXPECT_EQ(true, found_bool); + fclose(fp); +} + +TEST(DeprecatedFunctionsTest, ReadFromFlagsFile) { + FLAGS_test_int32 = -10; // just to make the test more interesting + string filename(FLAGS_test_tmpdir + "/flagfile2"); + unlink(filename.c_str()); // just to be safe + bool r = AppendFlagsIntoFile(filename, GetArgv0()); + EXPECT_EQ(true, r); + + FLAGS_test_int32 = -11; + r = ReadFromFlagsFile(filename, GetArgv0(), true); + EXPECT_EQ(true, r); + EXPECT_EQ(-10, FLAGS_test_int32); +} + +TEST(DeprecatedFunctionsTest, ReadFromFlagsFileFailure) { + FLAGS_test_int32 = -20; + string filename(FLAGS_test_tmpdir + "/flagfile3"); + FILE* fp = fopen(filename.c_str(), "w"); + EXPECT_TRUE(fp != NULL); + // Note the error in the bool assignment below... + fprintf(fp, "%s\n--test_int32=-21\n--test_bool=not_a_bool!\n", GetArgv0()); + fclose(fp); + + FLAGS_test_int32 = -22; + const bool r = ReadFromFlagsFile(filename, GetArgv0(), false); + EXPECT_EQ(false, r); + EXPECT_EQ(-22, FLAGS_test_int32); // the -21 from the flagsfile didn't take +} + +TEST(FlagsSetBeforeInitGoogleTest, TryFromEnv) { + EXPECT_EQ("pre-set", FLAGS_test_tryfromenv); +} + +// The following test case verifies that ParseCommandLineFlags() and +// ParseCommandLineNonHelpFlags() uses the last definition of a flag +// in case it's defined more than once. + +DEFINE_int32(test_flag, -1, "used for testing commandlineflags.cc"); + +// Returns the definition of the --flagfile flag to be used in the tests. +const char* GetFlagFileFlag() { + static const string flagfile_flag = string("--flagfile=") + + FLAGS_srcdir + "/src/gflags_unittest_flagfile"; + + return flagfile_flag.c_str(); +} + +// Parses and returns the --test_flag flag. +// If with_help is true, calls ParseCommandLineFlags; otherwise calls +// ParseCommandLineNonHelpFlags. +int32 ParseTestFlag(bool with_help, int argc, const char** const_argv) { + FlagSaver fs; // Restores the flags before returning. + + // Makes a copy of the input array s.t. it can be reused + // (ParseCommandLineFlags() will alter the array). + char** const argv_save = new char*[argc + 1]; + char** argv = argv_save; + memcpy(argv, const_argv, sizeof(*argv)*(argc + 1)); + + if (with_help) { + ParseCommandLineFlags(&argc, &argv, true); + } else { + ParseCommandLineNonHelpFlags(&argc, &argv, true); + } + + delete[] argv_save; + return FLAGS_test_flag; +} + +TEST(ParseCommandLineFlagsUsesLastDefinitionTest, + WhenFlagIsDefinedTwiceOnCommandLine) { + const char* argv[] = { + "my_test", + "--test_flag=1", + "--test_flag=2", + NULL, + }; + + EXPECT_EQ(2, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(2, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsUsesLastDefinitionTest, + WhenFlagIsDefinedTwiceInFlagFile) { + const char* argv[] = { + "my_test", + GetFlagFileFlag(), + NULL, + }; + + EXPECT_EQ(2, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(2, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsUsesLastDefinitionTest, + WhenFlagIsDefinedInCommandLineAndThenFlagFile) { + const char* argv[] = { + "my_test", + "--test_flag=0", + GetFlagFileFlag(), + NULL, + }; + + EXPECT_EQ(2, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(2, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsUsesLastDefinitionTest, + WhenFlagIsDefinedInFlagFileAndThenCommandLine) { + const char* argv[] = { + "my_test", + GetFlagFileFlag(), + "--test_flag=3", + NULL, + }; + + EXPECT_EQ(3, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(3, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsUsesLastDefinitionTest, + WhenFlagIsDefinedInCommandLineAndFlagFileAndThenCommandLine) { + const char* argv[] = { + "my_test", + "--test_flag=0", + GetFlagFileFlag(), + "--test_flag=3", + NULL, + }; + + EXPECT_EQ(3, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(3, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsAndDashArgs, TwoDashArgFirst) { + const char* argv[] = { + "my_test", + "--", + "--test_flag=0", + NULL, + }; + + EXPECT_EQ(-1, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(-1, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsAndDashArgs, TwoDashArgMiddle) { + const char* argv[] = { + "my_test", + "--test_flag=7", + "--", + "--test_flag=0", + NULL, + }; + + EXPECT_EQ(7, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(7, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsAndDashArgs, OneDashArg) { + const char* argv[] = { + "my_test", + "-", + "--test_flag=0", + NULL, + }; + + EXPECT_EQ(0, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(0, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsUnknownFlagDeathTest, + FlagIsCompletelyUnknown) { + const char* argv[] = { + "my_test", + "--this_flag_does_not_exist", + NULL, + }; + + EXPECT_DEATH(ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv), + "unknown command line flag.*"); + EXPECT_DEATH(ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv), + "unknown command line flag.*"); +} + +TEST(ParseCommandLineFlagsUnknownFlagDeathTest, + BoolFlagIsCompletelyUnknown) { + const char* argv[] = { + "my_test", + "--nothis_flag_does_not_exist", + NULL, + }; + + EXPECT_DEATH(ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv), + "unknown command line flag.*"); + EXPECT_DEATH(ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv), + "unknown command line flag.*"); +} + +TEST(ParseCommandLineFlagsUnknownFlagDeathTest, + FlagIsNotABool) { + const char* argv[] = { + "my_test", + "--notest_string", + NULL, + }; + + EXPECT_DEATH(ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv), + "boolean value .* specified for .* command line flag"); + EXPECT_DEATH(ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv), + "boolean value .* specified for .* command line flag"); +} + +TEST(ParseCommandLineFlagsWrongFields, + DescriptionIsInvalid) { + // These must not be automatic variables, since command line flags + // aren't unregistered and gUnit uses FlagSaver to save and restore + // command line flags' values. If these are on the stack, then when + // later tests attempt to save and restore their values, the stack + // addresses of these variables will be overwritten... Stack smash! + static bool current_storage; + static bool defvalue_storage; + FlagRegisterer fr("flag_name", "bool", 0, "filename", + ¤t_storage, &defvalue_storage); + CommandLineFlagInfo fi; + EXPECT_TRUE(GetCommandLineFlagInfo("flag_name", &fi)); + EXPECT_EQ("", fi.description); +} + +static bool ValidateTestFlagIs5(const char* flagname, int32 flagval) { + if (flagval == 5) + return true; + printf("%s isn't 5!\n", flagname); + return false; +} + +static bool ValidateTestFlagIs10(const char* flagname, int32 flagval) { + return flagval == 10; +} + + +TEST(FlagsValidator, ValidFlagViaArgv) { + const char* argv[] = { + "my_test", + "--test_flag=5", + NULL, + }; + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_EQ(5, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + // Undo the flag validator setting + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidator, ValidFlagViaSetDefault) { + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + // SetCommandLineOptionWithMode returns the empty string on error. + EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", + SET_FLAG_IF_DEFAULT)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidator, ValidFlagViaSetValue) { + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + FLAGS_test_flag = 100; // doesn't trigger the validator + // SetCommandLineOptionWithMode returns the empty string on error. + EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", + SET_FLAGS_VALUE)); + EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", + SET_FLAGS_DEFAULT)); + EXPECT_NE("", SetCommandLineOption("test_flag", "5")); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidatorDeathTest, InvalidFlagViaArgv) { + const char* argv[] = { + "my_test", + "--test_flag=50", + NULL, + }; + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_DEATH(ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv), + "ERROR: failed validation of new value '50' for flag 'test_flag'"); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidator, InvalidFlagViaSetDefault) { + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + // SetCommandLineOptionWithMode returns the empty string on error. + EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", + SET_FLAG_IF_DEFAULT)); + EXPECT_EQ(-1, FLAGS_test_flag); // the setting-to-50 should have failed + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidator, InvalidFlagViaSetValue) { + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + FLAGS_test_flag = 100; // doesn't trigger the validator + // SetCommandLineOptionWithMode returns the empty string on error. + EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", + SET_FLAGS_VALUE)); + EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", + SET_FLAGS_DEFAULT)); + EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); + EXPECT_EQ(100, FLAGS_test_flag); // the setting-to-50 should have failed + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidatorDeathTest, InvalidFlagNeverSet) { + // If a flag keeps its default value, and that default value is + // invalid, we should die at argv-parse time. + const char* argv[] = { + "my_test", + NULL, + }; + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_DEATH(ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv), + "ERROR: --test_flag must be set on the commandline"); +} + +TEST(FlagsValidator, InvalidFlagPtr) { + int32 dummy; + EXPECT_FALSE(RegisterFlagValidator(NULL, &ValidateTestFlagIs5)); + EXPECT_FALSE(RegisterFlagValidator(&dummy, &ValidateTestFlagIs5)); +} + +TEST(FlagsValidator, RegisterValidatorTwice) { + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_FALSE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); + EXPECT_FALSE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidator, CommandLineFlagInfo) { + CommandLineFlagInfo info; + info = GetCommandLineFlagInfoOrDie("test_flag"); + EXPECT_FALSE(info.has_validator_fn); + + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + info = GetCommandLineFlagInfoOrDie("test_flag"); + EXPECT_TRUE(info.has_validator_fn); + + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); + info = GetCommandLineFlagInfoOrDie("test_flag"); + EXPECT_FALSE(info.has_validator_fn); +} + +TEST(FlagsValidator, FlagSaver) { + { + FlagSaver fs; + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); // fails validation + } + EXPECT_NE("", SetCommandLineOption("test_flag", "50")); // validator is gone + + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + { + FlagSaver fs; + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); + EXPECT_NE("", SetCommandLineOption("test_flag", "50")); // no validator + } + EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); // validator is back +} + + +static int Main(int argc, char **argv) { + // We need to call SetArgv before InitGoogle, so our "test" argv will + // win out over this executable's real argv. That makes running this + // test with a real --help flag kinda annoying, unfortunately. + const char* test_argv[] = { "/test/argv/for/gflags_unittest", + "argv 2", "3rd argv", "argv #4" }; + SetArgv(GET_ARRAY_SIZE(test_argv), test_argv); + + // The first arg is the usage message, also important for testing. + string usage_message = (string(GetArgv0()) + + ": <useless flag> [...]\nDoes something useless.\n"); + + // We test setting tryfromenv manually, and making sure initgoogle still + // evaluates it. + FLAGS_tryfromenv = "test_tryfromenv"; + setenv("FLAGS_test_tryfromenv", "pre-set", 1); + + // Modify flag values from declared default value in two ways. + // The recommended way: + SetCommandLineOptionWithMode("changed_bool1", "true", SET_FLAGS_DEFAULT); + // The non-recommended way: + FLAGS_changed_bool2 = true; + + SetUsageMessage(usage_message.c_str()); + ParseCommandLineFlags(&argc, &argv, true); + + mkdir(FLAGS_test_tmpdir.c_str(), 0755); + + return RUN_ALL_TESTS(); +} + +_END_GOOGLE_NAMESPACE_ + +int main(int argc, char** argv) { + return GOOGLE_NAMESPACE::Main(argc, argv); +} diff --git a/dtm_release/lib/util/gflags-1.1/src/gflags_unittest.cc b/dtm_release/lib/util/gflags-1.1/src/gflags_unittest.cc new file mode 100644 index 0000000000000000000000000000000000000000..19e6a8fe788a2fe407691cd9f0cd9f80f14b7c22 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/src/gflags_unittest.cc @@ -0,0 +1,1511 @@ +// Copyright (c) 2006, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// Author: Marius Eriksen +// +// For now, this unit test does not cover all features of +// gflags.cc + +#include "config.h" +#include <stdio.h> +#include <stdlib.h> // for &exit +#include <string.h> +#include <unistd.h> // for unlink() +#include <sys/stat.h> // for mkdir() +#include <math.h> // for isinf() and isnan() +#include <vector> +#include <string> +#include "gflags/gflags.h" +// I don't actually use this header file, but #include it under the +// old location to make sure that the include-header-forwarding +// works. +#include "google/gflags_completions.h" +void (*unused_fn)() = &GOOGLE_NAMESPACE::HandleCommandLineCompletions; + +using std::vector; +using std::string; +using GOOGLE_NAMESPACE::int32; +using GOOGLE_NAMESPACE::FlagRegisterer; + +// Returns the number of elements in an array. +#define GET_ARRAY_SIZE(arr) (sizeof(arr)/sizeof(*(arr))) + +DECLARE_string(tryfromenv); // in gflags.cc + +DEFINE_string(test_tmpdir, "/tmp/gflags_unittest", "Dir we use for temp files"); +DEFINE_string(srcdir, GOOGLE_NAMESPACE::StringFromEnv("SRCDIR", "."), + "Source-dir root, needed to find gflags_unittest_flagfile"); + + +DEFINE_bool(test_bool, false, "tests bool-ness"); +DEFINE_int32(test_int32, -1, ""); +DEFINE_int64(test_int64, -2, ""); +DEFINE_uint64(test_uint64, 2, ""); +DEFINE_double(test_double, -1.0, ""); +DEFINE_string(test_string, "initial", ""); + +// +// The below ugliness gets some additional code coverage in the -helpxml +// and -helpmatch test cases having to do with string lengths and formatting +// +DEFINE_bool(test_bool_with_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_long_name, + false, + "extremely_extremely_extremely_extremely_extremely_extremely_extremely_extremely_long_meaning"); + +DEFINE_string(test_str1, "initial", ""); +DEFINE_string(test_str2, "initial", ""); +DEFINE_string(test_str3, "initial", ""); + +// This is used to test setting tryfromenv manually +DEFINE_string(test_tryfromenv, "initial", ""); + +// boolean flag assigned correctly with bool +DEFINE_bool(test_bool_bool, true, ""); + +// boolean flag assigned with string +DEFINE_bool(test_bool_string, "", ""); + +// boolean flag assigned with float +DEFINE_bool(test_bool_float, 1.0, ""); + +// boolean flag assigned with int +DEFINE_bool(test_bool_int, 1, ""); + +// Don't try this at home! +static int changeable_var = 12; +DEFINE_int32(changeable_var, ++changeable_var, ""); + +static int changeable_bool_var = 8008; +DEFINE_bool(changeable_bool_var, ++changeable_bool_var == 8009, ""); + +static int changeable_string_var = 0; +static string ChangeableString() { + char r[] = {'0' + ++changeable_string_var, '\0'}; + return r; +} +DEFINE_string(changeable_string_var, ChangeableString(), ""); + +// These are never used in this unittest, but can be used by +// gflags_unittest.sh when it needs to specify flags +// that are legal for gflags_unittest but don't need to +// be a particular value. +DEFINE_bool(unused_bool, true, "unused bool-ness"); +DEFINE_int32(unused_int32, -1001, ""); +DEFINE_int64(unused_int64, -2001, ""); +DEFINE_uint64(unused_uint64, 2000, ""); +DEFINE_double(unused_double, -1000.0, ""); +DEFINE_string(unused_string, "unused", ""); + +// These flags are used by gflags_unittest.sh +DEFINE_bool(changed_bool1, false, "changed"); +DEFINE_bool(changed_bool2, false, "changed"); + +static bool AlwaysFail(const char* flag, bool value) { return value == false; } +DEFINE_bool(always_fail, false, "will fail to validate when you set it"); +static const bool dummy = GOOGLE_NAMESPACE::RegisterFlagValidator(&FLAGS_always_fail, AlwaysFail); + +// This is a psuedo-flag -- we want to register a flag with a filename +// at the top level, but there is no way to do this except by faking +// the filename. +namespace fLI { + static const int32 FLAGS_nonotldflag1 = 12; + int32 FLAGS_tldflag1 = FLAGS_nonotldflag1; + int32 FLAGS_notldflag1 = FLAGS_nonotldflag1; + static FlagRegisterer o_tldflag1( + "tldflag1", "int32", + "should show up in --helpshort", "gflags_unittest.cc", + &FLAGS_tldflag1, &FLAGS_notldflag1); +} +using fLI::FLAGS_tldflag1; + +namespace fLI { + static const int32 FLAGS_nonotldflag2 = 23; + int32 FLAGS_tldflag2 = FLAGS_nonotldflag2; + int32 FLAGS_notldflag2 = FLAGS_nonotldflag2; + static FlagRegisterer o_tldflag2( + "tldflag2", "int32", + "should show up in --helpshort", "gflags_unittest.", + &FLAGS_tldflag2, &FLAGS_notldflag2); +} +using fLI::FLAGS_tldflag2; + +_START_GOOGLE_NAMESPACE_ + +// The following is some bare-bones testing infrastructure + +#define EXPECT_TRUE(cond) \ + do { \ + if (!(cond)) { \ + fprintf(stderr, "Check failed: %s\n", #cond); \ + exit(1); \ + } \ + } while (0) + +#define EXPECT_FALSE(cond) EXPECT_TRUE(!(cond)) + +#define EXPECT_OP(op, val1, val2) \ + do { \ + if (!((val1) op (val2))) { \ + fprintf(stderr, "Check failed: %s %s %s\n", #val1, #op, #val2); \ + exit(1); \ + } \ + } while (0) + +#define EXPECT_EQ(val1, val2) EXPECT_OP(==, val1, val2) +#define EXPECT_NE(val1, val2) EXPECT_OP(!=, val1, val2) +#define EXPECT_GT(val1, val2) EXPECT_OP(>, val1, val2) +#define EXPECT_LT(val1, val2) EXPECT_OP(<, val1, val2) + +// C99 declares isnan and isinf should be macros, so the #ifdef test +// should be reliable everywhere. Of course, it's not, but these +// are testing pertty marginal functionality anyway, so it's ok to +// not-run them even in situations they might, with effort, be made to work. +#ifdef isnan // Some compilers, like sun's for Solaris 10, don't define this +#define EXPECT_NAN(arg) \ + do { \ + if (!isnan(arg)) { \ + fprintf(stderr, "Check failed: isnan(%s)\n", #arg); \ + exit(1); \ + } \ + } while (0) +#else +#define EXPECT_NAN(arg) +#endif + +#ifdef isinf // Some compilers, like sun's for Solaris 10, don't define this +#define EXPECT_INF(arg) \ + do { \ + if (!isinf(arg)) { \ + fprintf(stderr, "Check failed: isinf(%s)\n", #arg); \ + exit(1); \ + } \ + } while (0) +#else +#define EXPECT_INF(arg) +#endif + +#define EXPECT_DOUBLE_EQ(val1, val2) \ + do { \ + if (((val1) < (val2) - 0.001 || (val1) > (val2) + 0.001)) { \ + fprintf(stderr, "Check failed: %s == %s\n", #val1, #val2); \ + exit(1); \ + } \ + } while (0) + +#define EXPECT_STREQ(val1, val2) \ + do { \ + if (strcmp((val1), (val2)) != 0) { \ + fprintf(stderr, "Check failed: streq(%s, %s)\n", #val1, #val2); \ + exit(1); \ + } \ + } while (0) + +static bool g_called_exit; +static void CalledExit(int) { g_called_exit = true; } + +#define EXPECT_DEATH(fn, msg) \ + do { \ + g_called_exit = false; \ + extern void (*commandlineflags_exitfunc)(int); /* in gflags.cc */ \ + commandlineflags_exitfunc = &CalledExit; \ + fn; \ + commandlineflags_exitfunc = &exit; /* set back to its default */ \ + if (!g_called_exit) { \ + fprintf(stderr, "Function didn't die (%s): %s\n", msg, #fn); \ + exit(1); \ + } \ + } while (0) + + +vector<void (*)()> g_testlist; // the tests to run + +#define TEST(a, b) \ + struct Test_##a##_##b { \ + Test_##a##_##b() { g_testlist.push_back(&Run); } \ + static void Run() { FlagSaver fs; RunTest(); } \ + static void RunTest(); \ + }; \ + static Test_##a##_##b g_test_##a##_##b; \ + void Test_##a##_##b::RunTest() + + +static int RUN_ALL_TESTS() { + vector<void (*)()>::const_iterator it; + for (it = g_testlist.begin(); it != g_testlist.end(); ++it) { + (*it)(); + } + fprintf(stderr, "Passed %d tests\n\nPASS\n", (int)g_testlist.size()); + return 0; +} + + +// Defining a variable of type CompileAssertTypesEqual<T1, T2> will cause a +// compiler error iff T1 and T2 are different types. +template <typename T1, typename T2> +struct CompileAssertTypesEqual; + +template <typename T> +struct CompileAssertTypesEqual<T, T> { +}; + + +template <typename Expected, typename Actual> +void AssertIsType(Actual& x) { + CompileAssertTypesEqual<Expected, Actual>(); +} + +// Verify all the flags are the right type. +TEST(FlagTypes, FlagTypes) { + AssertIsType<bool>(FLAGS_test_bool); + AssertIsType<int32>(FLAGS_test_int32); + AssertIsType<int64>(FLAGS_test_int64); + AssertIsType<uint64>(FLAGS_test_uint64); + AssertIsType<double>(FLAGS_test_double); + AssertIsType<string>(FLAGS_test_string); +} + +// Death tests for "help" options. +// +// The help system automatically calls exit(1) when you specify any of +// the help-related flags ("-helpmatch", "-helpxml") so we can't test +// those mainline. + +// Tests that "-helpmatch" causes the process to die. +TEST(ReadFlagsFromStringDeathTest, HelpMatch) { + EXPECT_DEATH(ReadFlagsFromString("-helpmatch=base", GetArgv0(), true), + ""); +} + + +// Tests that "-helpxml" causes the process to die. +TEST(ReadFlagsFromStringDeathTest, HelpXml) { + EXPECT_DEATH(ReadFlagsFromString("-helpxml", GetArgv0(), true), + ""); +} + + +// A subroutine needed for testing reading flags from a string. +void TestFlagString(const string& flags, + const string& expected_string, + bool expected_bool, + int32 expected_int32, + double expected_double) { + EXPECT_TRUE(ReadFlagsFromString(flags, + GetArgv0(), + // errors are fatal + true)); + + EXPECT_EQ(expected_string, FLAGS_test_string); + EXPECT_EQ(expected_bool, FLAGS_test_bool); + EXPECT_EQ(expected_int32, FLAGS_test_int32); + EXPECT_DOUBLE_EQ(expected_double, FLAGS_test_double); +} + + +// Tests reading flags from a string. +TEST(FlagFileTest, ReadFlagsFromString) { + TestFlagString( + // Flag string + "-test_string=continued\n" + "# some comments are in order\n" + "# some\n" + " # comments\n" + "#are\n" + " #trickier\n" + "# than others\n" + "-test_bool=true\n" + " -test_int32=1\n" + "-test_double=0.0\n", + // Expected values + "continued", + true, + 1, + 0.0); + + TestFlagString( + // Flag string + "# let's make sure it can update values\n" + "-test_string=initial\n" + "-test_bool=false\n" + "-test_int32=123\n" + "-test_double=123.0\n", + // Expected values + "initial", + false, + 123, + 123.0); +} + +// Tests the filename part of the flagfile +TEST(FlagFileTest, FilenamesOurfileLast) { + FLAGS_test_string = "initial"; + FLAGS_test_bool = false; + FLAGS_test_int32 = -1; + FLAGS_test_double = -1.0; + TestFlagString( + // Flag string + "-test_string=continued\n" + "# some comments are in order\n" + "# some\n" + " # comments\n" + "#are\n" + " #trickier\n" + "# than others\n" + "not_our_filename\n" + "-test_bool=true\n" + " -test_int32=1\n" + "gflags_unittest\n" + "-test_double=1000.0\n", + // Expected values + "continued", + false, + -1, + 1000.0); +} + +TEST(FlagFileTest, FilenamesOurfileFirst) { + FLAGS_test_string = "initial"; + FLAGS_test_bool = false; + FLAGS_test_int32 = -1; + FLAGS_test_double = -1.0; + TestFlagString( + // Flag string + "-test_string=continued\n" + "# some comments are in order\n" + "# some\n" + " # comments\n" + "#are\n" + " #trickier\n" + "# than others\n" + "gflags_unittest\n" + "-test_bool=true\n" + " -test_int32=1\n" + "not_our_filename\n" + "-test_double=1000.0\n", + // Expected values + "continued", + true, + 1, + -1.0); +} + +TEST(FlagFileTest, FilenamesOurfileGlob) { + FLAGS_test_string = "initial"; + FLAGS_test_bool = false; + FLAGS_test_int32 = -1; + FLAGS_test_double = -1.0; + TestFlagString( + // Flag string + "-test_string=continued\n" + "# some comments are in order\n" + "# some\n" + " # comments\n" + "#are\n" + " #trickier\n" + "# than others\n" + "*flags*\n" + "-test_bool=true\n" + " -test_int32=1\n" + "flags\n" + "-test_double=1000.0\n", + // Expected values + "continued", + true, + 1, + -1.0); +} + +TEST(FlagFileTest, FilenamesOurfileInBigList) { + FLAGS_test_string = "initial"; + FLAGS_test_bool = false; + FLAGS_test_int32 = -1; + FLAGS_test_double = -1.0; + TestFlagString( + // Flag string + "-test_string=continued\n" + "# some comments are in order\n" + "# some\n" + " # comments\n" + "#are\n" + " #trickier\n" + "# than others\n" + "*first* *flags* *third*\n" + "-test_bool=true\n" + " -test_int32=1\n" + "flags\n" + "-test_double=1000.0\n", + // Expected values + "continued", + true, + 1, + -1.0); +} + +// Tests that a failed flag-from-string read keeps flags at default values +TEST(FlagFileTest, FailReadFlagsFromString) { + FLAGS_test_int32 = 119; + string flags("# let's make sure it can update values\n" + "-test_string=non_initial\n" + "-test_bool=false\n" + "-test_int32=123\n" + "-test_double=illegal\n"); + + EXPECT_FALSE(ReadFlagsFromString(flags, + GetArgv0(), + // errors are fatal + false)); + + EXPECT_EQ(119, FLAGS_test_int32); + EXPECT_EQ("initial", FLAGS_test_string); +} + +// Tests that flags can be set to ordinary values. +TEST(SetFlagValueTest, OrdinaryValues) { + EXPECT_EQ("initial", FLAGS_test_str1); + + SetCommandLineOptionWithMode("test_str1", "second", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str1); // set; was default + + SetCommandLineOptionWithMode("test_str1", "third", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str1); // already set once + + FLAGS_test_str1 = "initial"; + SetCommandLineOptionWithMode("test_str1", "third", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("initial", FLAGS_test_str1); // still already set before + + SetCommandLineOptionWithMode("test_str1", "third", SET_FLAGS_VALUE); + EXPECT_EQ("third", FLAGS_test_str1); // changed value + + SetCommandLineOptionWithMode("test_str1", "fourth", SET_FLAGS_DEFAULT); + EXPECT_EQ("third", FLAGS_test_str1); + // value not changed (already set before) + + EXPECT_EQ("initial", FLAGS_test_str2); + + SetCommandLineOptionWithMode("test_str2", "second", SET_FLAGS_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str2); // changed (was default) + + FLAGS_test_str2 = "extra"; + EXPECT_EQ("extra", FLAGS_test_str2); + + FLAGS_test_str2 = "second"; + SetCommandLineOptionWithMode("test_str2", "third", SET_FLAGS_DEFAULT); + EXPECT_EQ("third", FLAGS_test_str2); // still changed (was equal to default) + + SetCommandLineOptionWithMode("test_str2", "fourth", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("fourth", FLAGS_test_str2); // changed (was default) + + EXPECT_EQ("initial", FLAGS_test_str3); + + SetCommandLineOptionWithMode("test_str3", "second", SET_FLAGS_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str3); // changed + + FLAGS_test_str3 = "third"; + SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAGS_DEFAULT); + EXPECT_EQ("third", FLAGS_test_str3); // not changed (was set) + + SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("third", FLAGS_test_str3); // not changed (was set) + + SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAGS_VALUE); + EXPECT_EQ("fourth", FLAGS_test_str3); // changed value +} + + +// Tests that flags can be set to exceptional values. +TEST(SetFlagValueTest, ExceptionalValues) { +#ifdef isinf // on systems without isinf, inf stuff may not work at all + EXPECT_EQ("test_double set to inf\n", + SetCommandLineOption("test_double", "inf")); + EXPECT_INF(FLAGS_test_double); + + EXPECT_EQ("test_double set to inf\n", + SetCommandLineOption("test_double", "INF")); + EXPECT_INF(FLAGS_test_double); +#endif + + // set some bad values + EXPECT_EQ("", + SetCommandLineOption("test_double", "0.1xxx")); + EXPECT_EQ("", + SetCommandLineOption("test_double", " ")); + EXPECT_EQ("", + SetCommandLineOption("test_double", "")); +#ifdef isinf + EXPECT_EQ("test_double set to -inf\n", + SetCommandLineOption("test_double", "-inf")); + EXPECT_INF(FLAGS_test_double); + EXPECT_GT(0, FLAGS_test_double); +#endif + +#ifdef isnan + EXPECT_EQ("test_double set to nan\n", + SetCommandLineOption("test_double", "NaN")); + EXPECT_NAN(FLAGS_test_double); +#endif +} + +// Tests that integer flags can be specified in many ways +TEST(SetFlagValueTest, DifferentRadices) { + EXPECT_EQ("test_int32 set to 12\n", + SetCommandLineOption("test_int32", "12")); + + EXPECT_EQ("test_int32 set to 16\n", + SetCommandLineOption("test_int32", "0x10")); + + EXPECT_EQ("test_int32 set to 34\n", + SetCommandLineOption("test_int32", "0X22")); + + // Leading 0 is *not* octal; it's still decimal + EXPECT_EQ("test_int32 set to 10\n", + SetCommandLineOption("test_int32", "010")); +} + +// Tests what happens when you try to set a flag to an illegal value +TEST(SetFlagValueTest, IllegalValues) { + FLAGS_test_bool = true; + FLAGS_test_int32 = 119; + FLAGS_test_int64 = 1191; + FLAGS_test_uint64 = 11911; + + EXPECT_EQ("", + SetCommandLineOption("test_bool", "12")); + + EXPECT_EQ("", + SetCommandLineOption("test_int32", "7000000000000")); + + // TODO(csilvers): uncomment this when we disallow negative numbers for uint64 +#if 0 + EXPECT_EQ("", + SetCommandLineOption("test_uint64", "-1")); +#endif + + EXPECT_EQ("", + SetCommandLineOption("test_int64", "not a number!")); + + // Test the empty string with each type of input + EXPECT_EQ("", SetCommandLineOption("test_bool", "")); + EXPECT_EQ("", SetCommandLineOption("test_int32", "")); + EXPECT_EQ("", SetCommandLineOption("test_int64", "")); + EXPECT_EQ("", SetCommandLineOption("test_uint64", "")); + EXPECT_EQ("", SetCommandLineOption("test_double", "")); + EXPECT_EQ("test_string set to \n", SetCommandLineOption("test_string", "")); + + EXPECT_EQ(true, FLAGS_test_bool); + EXPECT_EQ(119, FLAGS_test_int32); + EXPECT_EQ(1191, FLAGS_test_int64); + EXPECT_EQ(11911, FLAGS_test_uint64); +} + + +// Tests that we only evaluate macro args once +TEST(MacroArgs, EvaluateOnce) { + EXPECT_EQ(13, FLAGS_changeable_var); + // Make sure we don't ++ the value somehow, when evaluating the flag. + EXPECT_EQ(13, FLAGS_changeable_var); + // Make sure the macro only evaluated this var once. + EXPECT_EQ(13, changeable_var); + // Make sure the actual value and default value are the same + SetCommandLineOptionWithMode("changeable_var", "21", SET_FLAG_IF_DEFAULT); + EXPECT_EQ(21, FLAGS_changeable_var); +} + +TEST(MacroArgs, EvaluateOnceBool) { + EXPECT_EQ(true, FLAGS_changeable_bool_var); + EXPECT_EQ(true, FLAGS_changeable_bool_var); + EXPECT_EQ(8009, changeable_bool_var); + SetCommandLineOptionWithMode("changeable_bool_var", "false", + SET_FLAG_IF_DEFAULT); + EXPECT_EQ(false, FLAGS_changeable_bool_var); +} + +TEST(MacroArgs, EvaluateOnceStrings) { + EXPECT_EQ("1", FLAGS_changeable_string_var); + EXPECT_EQ("1", FLAGS_changeable_string_var); + EXPECT_EQ(1, changeable_string_var); + SetCommandLineOptionWithMode("changeable_string_var", "different", + SET_FLAG_IF_DEFAULT); + EXPECT_EQ("different", FLAGS_changeable_string_var); +} + +// Tests that the FooFromEnv does the right thing +TEST(FromEnvTest, LegalValues) { + setenv("BOOL_VAL1", "true", 1); + setenv("BOOL_VAL2", "false", 1); + setenv("BOOL_VAL3", "1", 1); + setenv("BOOL_VAL4", "F", 1); + EXPECT_EQ(true, BoolFromEnv("BOOL_VAL1", false)); + EXPECT_EQ(false, BoolFromEnv("BOOL_VAL2", true)); + EXPECT_EQ(true, BoolFromEnv("BOOL_VAL3", false)); + EXPECT_EQ(false, BoolFromEnv("BOOL_VAL4", true)); + EXPECT_EQ(true, BoolFromEnv("BOOL_VAL_UNKNOWN", true)); + EXPECT_EQ(false, BoolFromEnv("BOOL_VAL_UNKNOWN", false)); + + setenv("INT_VAL1", "1", 1); + setenv("INT_VAL2", "-1", 1); + EXPECT_EQ(1, Int32FromEnv("INT_VAL1", 10)); + EXPECT_EQ(-1, Int32FromEnv("INT_VAL2", 10)); + EXPECT_EQ(10, Int32FromEnv("INT_VAL_UNKNOWN", 10)); + + setenv("INT_VAL3", "1099511627776", 1); + EXPECT_EQ(1, Int64FromEnv("INT_VAL1", 20)); + EXPECT_EQ(-1, Int64FromEnv("INT_VAL2", 20)); + EXPECT_EQ(1099511627776LL, Int64FromEnv("INT_VAL3", 20)); + EXPECT_EQ(20, Int64FromEnv("INT_VAL_UNKNOWN", 20)); + + EXPECT_EQ(1, Uint64FromEnv("INT_VAL1", 30)); + EXPECT_EQ(1099511627776ULL, Uint64FromEnv("INT_VAL3", 30)); + EXPECT_EQ(30, Uint64FromEnv("INT_VAL_UNKNOWN", 30)); + + // I pick values here that can be easily represented exactly in floating-point + setenv("DOUBLE_VAL1", "0.0", 1); + setenv("DOUBLE_VAL2", "1.0", 1); + setenv("DOUBLE_VAL3", "-1.0", 1); + EXPECT_EQ(0.0, DoubleFromEnv("DOUBLE_VAL1", 40.0)); + EXPECT_EQ(1.0, DoubleFromEnv("DOUBLE_VAL2", 40.0)); + EXPECT_EQ(-1.0, DoubleFromEnv("DOUBLE_VAL3", 40.0)); + EXPECT_EQ(40.0, DoubleFromEnv("DOUBLE_VAL_UNKNOWN", 40.0)); + + setenv("STRING_VAL1", "", 1); + setenv("STRING_VAL2", "my happy string!", 1); + EXPECT_STREQ("", StringFromEnv("STRING_VAL1", "unknown")); + EXPECT_STREQ("my happy string!", StringFromEnv("STRING_VAL2", "unknown")); + EXPECT_STREQ("unknown", StringFromEnv("STRING_VAL_UNKNOWN", "unknown")); +} + +// Tests that the FooFromEnv dies on parse-error +TEST(FromEnvDeathTest, IllegalValues) { + setenv("BOOL_BAD1", "so true!",1 ); + setenv("BOOL_BAD2", "", 1); + EXPECT_DEATH(BoolFromEnv("BOOL_BAD1", false), "error parsing env variable"); + EXPECT_DEATH(BoolFromEnv("BOOL_BAD2", true), "error parsing env variable"); + + setenv("INT_BAD1", "one", 1); + setenv("INT_BAD2", "100000000000000000", 1); + setenv("INT_BAD3", "0xx10", 1); + setenv("INT_BAD4", "", 1); + EXPECT_DEATH(Int32FromEnv("INT_BAD1", 10), "error parsing env variable"); + EXPECT_DEATH(Int32FromEnv("INT_BAD2", 10), "error parsing env variable"); + EXPECT_DEATH(Int32FromEnv("INT_BAD3", 10), "error parsing env variable"); + EXPECT_DEATH(Int32FromEnv("INT_BAD4", 10), "error parsing env variable"); + + setenv("BIGINT_BAD1", "18446744073709551616000", 1); + EXPECT_DEATH(Int64FromEnv("INT_BAD1", 20), "error parsing env variable"); + EXPECT_DEATH(Int64FromEnv("INT_BAD3", 20), "error parsing env variable"); + EXPECT_DEATH(Int64FromEnv("INT_BAD4", 20), "error parsing env variable"); + EXPECT_DEATH(Int64FromEnv("BIGINT_BAD1", 200), "error parsing env variable"); + + setenv("BIGINT_BAD2", "-1", 1); + EXPECT_DEATH(Uint64FromEnv("INT_BAD1", 30), "error parsing env variable"); + EXPECT_DEATH(Uint64FromEnv("INT_BAD3", 30), "error parsing env variable"); + EXPECT_DEATH(Uint64FromEnv("INT_BAD4", 30), "error parsing env variable"); + EXPECT_DEATH(Uint64FromEnv("BIGINT_BAD1", 30), "error parsing env variable"); + // TODO(csilvers): uncomment this when we disallow negative numbers for uint64 +#if 0 + EXPECT_DEATH(Uint64FromEnv("BIGINT_BAD2", 30), "error parsing env variable"); +#endif + + setenv("DOUBLE_BAD1", "0.0.0", 1); + setenv("DOUBLE_BAD2", "", 1); + EXPECT_DEATH(DoubleFromEnv("DOUBLE_BAD1", 40.0), "error parsing env variable"); + EXPECT_DEATH(DoubleFromEnv("DOUBLE_BAD2", 40.0), "error parsing env variable"); +} + +// Tests that FlagSaver can save the states of string flags. +TEST(FlagSaverTest, CanSaveStringFlagStates) { + // 1. Initializes the flags. + + // State of flag test_str1: + // default value - "initial" + // current value - "initial" + // not set - true + + SetCommandLineOptionWithMode("test_str2", "second", SET_FLAGS_VALUE); + // State of flag test_str2: + // default value - "initial" + // current value - "second" + // not set - false + + SetCommandLineOptionWithMode("test_str3", "second", SET_FLAGS_DEFAULT); + // State of flag test_str3: + // default value - "second" + // current value - "second" + // not set - true + + // 2. Saves the flag states. + + { + FlagSaver fs; + + // 3. Modifies the flag states. + + SetCommandLineOptionWithMode("test_str1", "second", SET_FLAGS_VALUE); + EXPECT_EQ("second", FLAGS_test_str1); + // State of flag test_str1: + // default value - "second" + // current value - "second" + // not set - true + + SetCommandLineOptionWithMode("test_str2", "third", SET_FLAGS_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str2); + // State of flag test_str2: + // default value - "third" + // current value - "second" + // not set - false + + SetCommandLineOptionWithMode("test_str3", "third", SET_FLAGS_VALUE); + EXPECT_EQ("third", FLAGS_test_str3); + // State of flag test_str1: + // default value - "second" + // current value - "third" + // not set - false + + // 4. Restores the flag states. + } + + // 5. Verifies that the states were restored. + + // Verifies that the value of test_str1 was restored. + EXPECT_EQ("initial", FLAGS_test_str1); + // Verifies that the "not set" attribute of test_str1 was restored to true. + SetCommandLineOptionWithMode("test_str1", "second", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str1); + + // Verifies that the value of test_str2 was restored. + EXPECT_EQ("second", FLAGS_test_str2); + // Verifies that the "not set" attribute of test_str2 was restored to false. + SetCommandLineOptionWithMode("test_str2", "fourth", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str2); + + // Verifies that the value of test_str3 was restored. + EXPECT_EQ("second", FLAGS_test_str3); + // Verifies that the "not set" attribute of test_str3 was restored to true. + SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("fourth", FLAGS_test_str3); +} + + +// Tests that FlagSaver can save the values of various-typed flags. +TEST(FlagSaverTest, CanSaveVariousTypedFlagValues) { + // Initializes the flags. + FLAGS_test_bool = false; + FLAGS_test_int32 = -1; + FLAGS_test_int64 = -2; + FLAGS_test_uint64 = 3; + FLAGS_test_double = 4.0; + FLAGS_test_string = "good"; + + // Saves the flag states. + { + FlagSaver fs; + + // Modifies the flags. + FLAGS_test_bool = true; + FLAGS_test_int32 = -5; + FLAGS_test_int64 = -6; + FLAGS_test_uint64 = 7; + FLAGS_test_double = 8.0; + FLAGS_test_string = "bad"; + + // Restores the flag states. + } + + // Verifies the flag values were restored. + EXPECT_FALSE(FLAGS_test_bool); + EXPECT_EQ(-1, FLAGS_test_int32); + EXPECT_EQ(-2, FLAGS_test_int64); + EXPECT_EQ(3, FLAGS_test_uint64); + EXPECT_DOUBLE_EQ(4.0, FLAGS_test_double); + EXPECT_EQ("good", FLAGS_test_string); +} + +TEST(GetAllFlagsTest, BaseTest) { + vector<CommandLineFlagInfo> flags; + GetAllFlags(&flags); + bool found_test_bool = false; + vector<CommandLineFlagInfo>::const_iterator i; + for (i = flags.begin(); i != flags.end(); ++i) { + if (i->name == "test_bool") { + found_test_bool = true; + EXPECT_EQ(i->type, "bool"); + EXPECT_EQ(i->default_value, "false"); + break; + } + } + EXPECT_EQ(true, found_test_bool); +} + +TEST(ShowUsageWithFlagsTest, BaseTest) { + // TODO(csilvers): test this by allowing output other than to stdout. + // Not urgent since this functionality is tested via + // gflags_unittest.sh, though only through use of --help. +} + +TEST(ShowUsageWithFlagsRestrictTest, BaseTest) { + // TODO(csilvers): test this by allowing output other than to stdout. + // Not urgent since this functionality is tested via + // gflags_unittest.sh, though only through use of --helpmatch. +} + +// Note: all these argv-based tests depend on SetArgv being called +// before InitGoogle() in main(), below. +TEST(GetArgvsTest, BaseTest) { + vector<string> argvs = GetArgvs(); + EXPECT_EQ(4, argvs.size()); + EXPECT_EQ("/test/argv/for/gflags_unittest", argvs[0]); + EXPECT_EQ("argv 2", argvs[1]); + EXPECT_EQ("3rd argv", argvs[2]); + EXPECT_EQ("argv #4", argvs[3]); +} + +TEST(GetArgvTest, BaseTest) { + EXPECT_STREQ("/test/argv/for/gflags_unittest " + "argv 2 3rd argv argv #4", GetArgv()); +} + +TEST(GetArgv0Test, BaseTest) { + EXPECT_STREQ("/test/argv/for/gflags_unittest", GetArgv0()); +} + +TEST(GetArgvSumTest, BaseTest) { + // This number is just the sum of the ASCII values of all the chars + // in GetArgv(). + EXPECT_EQ(4904, GetArgvSum()); +} + +TEST(ProgramInvocationNameTest, BaseTest) { + EXPECT_STREQ("/test/argv/for/gflags_unittest", + ProgramInvocationName()); +} + +TEST(ProgramInvocationShortNameTest, BaseTest) { + EXPECT_STREQ("gflags_unittest", ProgramInvocationShortName()); +} + +TEST(ProgramUsageTest, BaseTest) { // Depends on 1st arg to InitGoogle in main() + EXPECT_STREQ("/test/argv/for/gflags_unittest: " + "<useless flag> [...]\nDoes something useless.\n", + ProgramUsage()); +} + +TEST(GetCommandLineOptionTest, NameExistsAndIsDefault) { + string value("will be changed"); + bool r = GetCommandLineOption("test_bool", &value); + EXPECT_EQ(true, r); + EXPECT_EQ("false", value); + + r = GetCommandLineOption("test_int32", &value); + EXPECT_EQ(true, r); + EXPECT_EQ("-1", value); +} + +TEST(GetCommandLineOptionTest, NameExistsAndWasAssigned) { + FLAGS_test_int32 = 400; + string value("will be changed"); + const bool r = GetCommandLineOption("test_int32", &value); + EXPECT_EQ(true, r); + EXPECT_EQ("400", value); +} + +TEST(GetCommandLineOptionTest, NameExistsAndWasSet) { + SetCommandLineOption("test_int32", "700"); + string value("will be changed"); + const bool r = GetCommandLineOption("test_int32", &value); + EXPECT_EQ(true, r); + EXPECT_EQ("700", value); +} + +TEST(GetCommandLineOptionTest, NameExistsAndWasNotSet) { + // This doesn't set the flag's value, but rather its default value. + // is_default is still true, but the 'default' value returned has changed! + SetCommandLineOptionWithMode("test_int32", "800", SET_FLAGS_DEFAULT); + string value("will be changed"); + const bool r = GetCommandLineOption("test_int32", &value); + EXPECT_EQ(true, r); + EXPECT_EQ("800", value); + EXPECT_EQ(true, GetCommandLineFlagInfoOrDie("test_int32").is_default); + +} + +TEST(GetCommandLineOptionTest, NameExistsAndWasConditionallySet) { + SetCommandLineOptionWithMode("test_int32", "900", SET_FLAG_IF_DEFAULT); + string value("will be changed"); + const bool r = GetCommandLineOption("test_int32", &value); + EXPECT_EQ(true, r); + EXPECT_EQ("900", value); +} + +TEST(GetCommandLineOptionTest, NameDoesNotExist) { + string value("will not be changed"); + const bool r = GetCommandLineOption("test_int3210", &value); + EXPECT_EQ(false, r); + EXPECT_EQ("will not be changed", value); +} + +TEST(GetCommandLineFlagInfoTest, FlagExists) { + CommandLineFlagInfo info; + bool r = GetCommandLineFlagInfo("test_int32", &info); + EXPECT_EQ(true, r); + EXPECT_EQ("test_int32", info.name); + EXPECT_EQ("int32", info.type); + EXPECT_EQ("", info.description); + EXPECT_EQ("-1", info.current_value); + EXPECT_EQ("-1", info.default_value); + EXPECT_EQ(true, info.is_default); + EXPECT_EQ(false, info.has_validator_fn); + + FLAGS_test_bool = true; + r = GetCommandLineFlagInfo("test_bool", &info); + EXPECT_EQ(true, r); + EXPECT_EQ("test_bool", info.name); + EXPECT_EQ("bool", info.type); + EXPECT_EQ("tests bool-ness", info.description); + EXPECT_EQ("true", info.current_value); + EXPECT_EQ("false", info.default_value); + EXPECT_EQ(false, info.is_default); + EXPECT_EQ(false, info.has_validator_fn); + + FLAGS_test_bool = false; + r = GetCommandLineFlagInfo("test_bool", &info); + EXPECT_EQ(true, r); + EXPECT_EQ("test_bool", info.name); + EXPECT_EQ("bool", info.type); + EXPECT_EQ("tests bool-ness", info.description); + EXPECT_EQ("false", info.current_value); + EXPECT_EQ("false", info.default_value); + EXPECT_EQ(false, info.is_default); // value is same, but flag *was* modified + EXPECT_EQ(false, info.has_validator_fn); +} + +TEST(GetCommandLineFlagInfoTest, FlagDoesNotExist) { + CommandLineFlagInfo info; + // Set to some random values that GetCommandLineFlagInfo should not change + info.name = "name"; + info.type = "type"; + info.current_value = "curr"; + info.default_value = "def"; + info.filename = "/"; + info.is_default = false; + info.has_validator_fn = true; + bool r = GetCommandLineFlagInfo("test_int3210", &info); + EXPECT_EQ(false, r); + EXPECT_EQ("name", info.name); + EXPECT_EQ("type", info.type); + EXPECT_EQ("", info.description); + EXPECT_EQ("curr", info.current_value); + EXPECT_EQ("def", info.default_value); + EXPECT_EQ("/", info.filename); + EXPECT_EQ(false, info.is_default); + EXPECT_EQ(true, info.has_validator_fn); +} + +TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndIsDefault) { + CommandLineFlagInfo info; + info = GetCommandLineFlagInfoOrDie("test_int32"); + EXPECT_EQ("test_int32", info.name); + EXPECT_EQ("int32", info.type); + EXPECT_EQ("", info.description); + EXPECT_EQ("-1", info.current_value); + EXPECT_EQ("-1", info.default_value); + EXPECT_EQ(true, info.is_default); + info = GetCommandLineFlagInfoOrDie("test_bool"); + EXPECT_EQ("test_bool", info.name); + EXPECT_EQ("bool", info.type); + EXPECT_EQ("tests bool-ness", info.description); + EXPECT_EQ("false", info.current_value); + EXPECT_EQ("false", info.default_value); + EXPECT_EQ(true, info.is_default); + EXPECT_EQ(false, info.has_validator_fn); +} + +TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndWasAssigned) { + FLAGS_test_int32 = 400; + CommandLineFlagInfo info; + info = GetCommandLineFlagInfoOrDie("test_int32"); + EXPECT_EQ("test_int32", info.name); + EXPECT_EQ("int32", info.type); + EXPECT_EQ("", info.description); + EXPECT_EQ("400", info.current_value); + EXPECT_EQ("-1", info.default_value); + EXPECT_EQ(false, info.is_default); + FLAGS_test_bool = true; + info = GetCommandLineFlagInfoOrDie("test_bool"); + EXPECT_EQ("test_bool", info.name); + EXPECT_EQ("bool", info.type); + EXPECT_EQ("tests bool-ness", info.description); + EXPECT_EQ("true", info.current_value); + EXPECT_EQ("false", info.default_value); + EXPECT_EQ(false, info.is_default); + EXPECT_EQ(false, info.has_validator_fn); +} + +TEST(GetCommandLineFlagInfoOrDieDeathTest, FlagDoesNotExist) { + EXPECT_DEATH(GetCommandLineFlagInfoOrDie("test_int3210"), + ".*: flag test_int3210 does not exist"); +} + + +// These are lightly tested because they're deprecated. Basically, +// the tests are meant to cover how existing users use these functions, +// but not necessarily how new users could use them. +TEST(DeprecatedFunctionsTest, CommandlineFlagsIntoString) { + string s = CommandlineFlagsIntoString(); + EXPECT_NE(string::npos, s.find("--test_bool=")); +} + +TEST(DeprecatedFunctionsTest, AppendFlagsIntoFile) { + FLAGS_test_int32 = 10; // just to make the test more interesting + string filename(FLAGS_test_tmpdir + "/flagfile"); + unlink(filename.c_str()); // just to be safe + const bool r = AppendFlagsIntoFile(filename, "not the real argv0"); + EXPECT_EQ(true, r); + + FILE* fp = fopen(filename.c_str(), "r"); + EXPECT_TRUE(fp != NULL); + char line[8192]; + fgets(line, sizeof(line)-1, fp); // first line should be progname + EXPECT_STREQ("not the real argv0\n", line); + + bool found_bool = false, found_int32 = false; + while (fgets(line, sizeof(line)-1, fp)) { + line[sizeof(line)-1] = '\0'; // just to be safe + if (strcmp(line, "--test_bool=false\n") == 0) + found_bool = true; + if (strcmp(line, "--test_int32=10\n") == 0) + found_int32 = true; + } + EXPECT_EQ(true, found_int32); + EXPECT_EQ(true, found_bool); + fclose(fp); +} + +TEST(DeprecatedFunctionsTest, ReadFromFlagsFile) { + FLAGS_test_int32 = -10; // just to make the test more interesting + string filename(FLAGS_test_tmpdir + "/flagfile2"); + unlink(filename.c_str()); // just to be safe + bool r = AppendFlagsIntoFile(filename, GetArgv0()); + EXPECT_EQ(true, r); + + FLAGS_test_int32 = -11; + r = ReadFromFlagsFile(filename, GetArgv0(), true); + EXPECT_EQ(true, r); + EXPECT_EQ(-10, FLAGS_test_int32); +} + +TEST(DeprecatedFunctionsTest, ReadFromFlagsFileFailure) { + FLAGS_test_int32 = -20; + string filename(FLAGS_test_tmpdir + "/flagfile3"); + FILE* fp = fopen(filename.c_str(), "w"); + EXPECT_TRUE(fp != NULL); + // Note the error in the bool assignment below... + fprintf(fp, "%s\n--test_int32=-21\n--test_bool=not_a_bool!\n", GetArgv0()); + fclose(fp); + + FLAGS_test_int32 = -22; + const bool r = ReadFromFlagsFile(filename, GetArgv0(), false); + EXPECT_EQ(false, r); + EXPECT_EQ(-22, FLAGS_test_int32); // the -21 from the flagsfile didn't take +} + +TEST(FlagsSetBeforeInitGoogleTest, TryFromEnv) { + EXPECT_EQ("pre-set", FLAGS_test_tryfromenv); +} + +// The following test case verifies that ParseCommandLineFlags() and +// ParseCommandLineNonHelpFlags() uses the last definition of a flag +// in case it's defined more than once. + +DEFINE_int32(test_flag, -1, "used for testing commandlineflags.cc"); + +// Returns the definition of the --flagfile flag to be used in the tests. +const char* GetFlagFileFlag() { + static const string flagfile_flag = string("--flagfile=") + + FLAGS_srcdir + "/src/gflags_unittest_flagfile"; + + return flagfile_flag.c_str(); +} + +// Parses and returns the --test_flag flag. +// If with_help is true, calls ParseCommandLineFlags; otherwise calls +// ParseCommandLineNonHelpFlags. +int32 ParseTestFlag(bool with_help, int argc, const char** const_argv) { + FlagSaver fs; // Restores the flags before returning. + + // Makes a copy of the input array s.t. it can be reused + // (ParseCommandLineFlags() will alter the array). + char** const argv_save = new char*[argc + 1]; + char** argv = argv_save; + memcpy(argv, const_argv, sizeof(*argv)*(argc + 1)); + + if (with_help) { + ParseCommandLineFlags(&argc, &argv, true); + } else { + ParseCommandLineNonHelpFlags(&argc, &argv, true); + } + + delete[] argv_save; + return FLAGS_test_flag; +} + +TEST(ParseCommandLineFlagsUsesLastDefinitionTest, + WhenFlagIsDefinedTwiceOnCommandLine) { + const char* argv[] = { + "my_test", + "--test_flag=1", + "--test_flag=2", + NULL, + }; + + EXPECT_EQ(2, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(2, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsUsesLastDefinitionTest, + WhenFlagIsDefinedTwiceInFlagFile) { + const char* argv[] = { + "my_test", + GetFlagFileFlag(), + NULL, + }; + + EXPECT_EQ(2, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(2, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsUsesLastDefinitionTest, + WhenFlagIsDefinedInCommandLineAndThenFlagFile) { + const char* argv[] = { + "my_test", + "--test_flag=0", + GetFlagFileFlag(), + NULL, + }; + + EXPECT_EQ(2, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(2, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsUsesLastDefinitionTest, + WhenFlagIsDefinedInFlagFileAndThenCommandLine) { + const char* argv[] = { + "my_test", + GetFlagFileFlag(), + "--test_flag=3", + NULL, + }; + + EXPECT_EQ(3, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(3, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsUsesLastDefinitionTest, + WhenFlagIsDefinedInCommandLineAndFlagFileAndThenCommandLine) { + const char* argv[] = { + "my_test", + "--test_flag=0", + GetFlagFileFlag(), + "--test_flag=3", + NULL, + }; + + EXPECT_EQ(3, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(3, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsAndDashArgs, TwoDashArgFirst) { + const char* argv[] = { + "my_test", + "--", + "--test_flag=0", + NULL, + }; + + EXPECT_EQ(-1, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(-1, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsAndDashArgs, TwoDashArgMiddle) { + const char* argv[] = { + "my_test", + "--test_flag=7", + "--", + "--test_flag=0", + NULL, + }; + + EXPECT_EQ(7, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(7, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsAndDashArgs, OneDashArg) { + const char* argv[] = { + "my_test", + "-", + "--test_flag=0", + NULL, + }; + + EXPECT_EQ(0, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(0, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsUnknownFlagDeathTest, + FlagIsCompletelyUnknown) { + const char* argv[] = { + "my_test", + "--this_flag_does_not_exist", + NULL, + }; + + EXPECT_DEATH(ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv), + "unknown command line flag.*"); + EXPECT_DEATH(ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv), + "unknown command line flag.*"); +} + +TEST(ParseCommandLineFlagsUnknownFlagDeathTest, + BoolFlagIsCompletelyUnknown) { + const char* argv[] = { + "my_test", + "--nothis_flag_does_not_exist", + NULL, + }; + + EXPECT_DEATH(ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv), + "unknown command line flag.*"); + EXPECT_DEATH(ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv), + "unknown command line flag.*"); +} + +TEST(ParseCommandLineFlagsUnknownFlagDeathTest, + FlagIsNotABool) { + const char* argv[] = { + "my_test", + "--notest_string", + NULL, + }; + + EXPECT_DEATH(ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv), + "boolean value .* specified for .* command line flag"); + EXPECT_DEATH(ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv), + "boolean value .* specified for .* command line flag"); +} + +TEST(ParseCommandLineFlagsWrongFields, + DescriptionIsInvalid) { + // These must not be automatic variables, since command line flags + // aren't unregistered and gUnit uses FlagSaver to save and restore + // command line flags' values. If these are on the stack, then when + // later tests attempt to save and restore their values, the stack + // addresses of these variables will be overwritten... Stack smash! + static bool current_storage; + static bool defvalue_storage; + FlagRegisterer fr("flag_name", "bool", 0, "filename", + ¤t_storage, &defvalue_storage); + CommandLineFlagInfo fi; + EXPECT_TRUE(GetCommandLineFlagInfo("flag_name", &fi)); + EXPECT_EQ("", fi.description); +} + +static bool ValidateTestFlagIs5(const char* flagname, int32 flagval) { + if (flagval == 5) + return true; + printf("%s isn't 5!\n", flagname); + return false; +} + +static bool ValidateTestFlagIs10(const char* flagname, int32 flagval) { + return flagval == 10; +} + + +TEST(FlagsValidator, ValidFlagViaArgv) { + const char* argv[] = { + "my_test", + "--test_flag=5", + NULL, + }; + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_EQ(5, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + // Undo the flag validator setting + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidator, ValidFlagViaSetDefault) { + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + // SetCommandLineOptionWithMode returns the empty string on error. + EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", + SET_FLAG_IF_DEFAULT)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidator, ValidFlagViaSetValue) { + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + FLAGS_test_flag = 100; // doesn't trigger the validator + // SetCommandLineOptionWithMode returns the empty string on error. + EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", + SET_FLAGS_VALUE)); + EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", + SET_FLAGS_DEFAULT)); + EXPECT_NE("", SetCommandLineOption("test_flag", "5")); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidatorDeathTest, InvalidFlagViaArgv) { + const char* argv[] = { + "my_test", + "--test_flag=50", + NULL, + }; + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_DEATH(ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv), + "ERROR: failed validation of new value '50' for flag 'test_flag'"); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidator, InvalidFlagViaSetDefault) { + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + // SetCommandLineOptionWithMode returns the empty string on error. + EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", + SET_FLAG_IF_DEFAULT)); + EXPECT_EQ(-1, FLAGS_test_flag); // the setting-to-50 should have failed + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidator, InvalidFlagViaSetValue) { + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + FLAGS_test_flag = 100; // doesn't trigger the validator + // SetCommandLineOptionWithMode returns the empty string on error. + EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", + SET_FLAGS_VALUE)); + EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", + SET_FLAGS_DEFAULT)); + EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); + EXPECT_EQ(100, FLAGS_test_flag); // the setting-to-50 should have failed + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidatorDeathTest, InvalidFlagNeverSet) { + // If a flag keeps its default value, and that default value is + // invalid, we should die at argv-parse time. + const char* argv[] = { + "my_test", + NULL, + }; + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_DEATH(ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv), + "ERROR: --test_flag must be set on the commandline"); +} + +TEST(FlagsValidator, InvalidFlagPtr) { + int32 dummy; + EXPECT_FALSE(RegisterFlagValidator(NULL, &ValidateTestFlagIs5)); + EXPECT_FALSE(RegisterFlagValidator(&dummy, &ValidateTestFlagIs5)); +} + +TEST(FlagsValidator, RegisterValidatorTwice) { + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_FALSE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); + EXPECT_FALSE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidator, CommandLineFlagInfo) { + CommandLineFlagInfo info; + info = GetCommandLineFlagInfoOrDie("test_flag"); + EXPECT_FALSE(info.has_validator_fn); + + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + info = GetCommandLineFlagInfoOrDie("test_flag"); + EXPECT_TRUE(info.has_validator_fn); + + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); + info = GetCommandLineFlagInfoOrDie("test_flag"); + EXPECT_FALSE(info.has_validator_fn); +} + +TEST(FlagsValidator, FlagSaver) { + { + FlagSaver fs; + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); // fails validation + } + EXPECT_NE("", SetCommandLineOption("test_flag", "50")); // validator is gone + + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + { + FlagSaver fs; + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); + EXPECT_NE("", SetCommandLineOption("test_flag", "50")); // no validator + } + EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); // validator is back +} + + +static int Main(int argc, char **argv) { + // We need to call SetArgv before InitGoogle, so our "test" argv will + // win out over this executable's real argv. That makes running this + // test with a real --help flag kinda annoying, unfortunately. + const char* test_argv[] = { "/test/argv/for/gflags_unittest", + "argv 2", "3rd argv", "argv #4" }; + SetArgv(GET_ARRAY_SIZE(test_argv), test_argv); + + // The first arg is the usage message, also important for testing. + string usage_message = (string(GetArgv0()) + + ": <useless flag> [...]\nDoes something useless.\n"); + + // We test setting tryfromenv manually, and making sure initgoogle still + // evaluates it. + FLAGS_tryfromenv = "test_tryfromenv"; + setenv("FLAGS_test_tryfromenv", "pre-set", 1); + + // Modify flag values from declared default value in two ways. + // The recommended way: + SetCommandLineOptionWithMode("changed_bool1", "true", SET_FLAGS_DEFAULT); + // The non-recommended way: + FLAGS_changed_bool2 = true; + + SetUsageMessage(usage_message.c_str()); + ParseCommandLineFlags(&argc, &argv, true); + + mkdir(FLAGS_test_tmpdir.c_str(), 0755); + + return RUN_ALL_TESTS(); +} + +_END_GOOGLE_NAMESPACE_ + +int main(int argc, char** argv) { + return GOOGLE_NAMESPACE::Main(argc, argv); +} diff --git a/dtm_release/lib/util/gflags-1.1/src/gflags_unittest.sh b/dtm_release/lib/util/gflags-1.1/src/gflags_unittest.sh new file mode 100755 index 0000000000000000000000000000000000000000..f57e5f849568b3cb31bbd03d158f414e0627ccce --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/src/gflags_unittest.sh @@ -0,0 +1,230 @@ +#!/bin/sh + +# Copyright (c) 2006, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# --- +# Author: Craig Silverstein +# +# Just tries to run gflags_unittest with various flags defined in +# gflags.cc, and make sure they give the appropriate exit +# status and appropriate error message. + +if [ -z "$1" ] +then + echo "USAGE: $0 <unittest exe> [top_srcdir] [tmpdir]" + exit 1 +fi + +EXE="$1" +SRCDIR="${2:-./}" +TMPDIR="${3:-/tmp/gflags}" + +# Executables built with the main source file suffixed with "-main" and "_main". +EXE2="${EXE}2" # eg, gflags_unittest2 +EXE3="${EXE}3" # eg, gflags_unittest3 + +# $1: executable +# $2: line-number $3: expected return code. $4: substring of expected output. +# $5: a substring you *don't* expect to find in the output. $6+ flags +ExpectExe() { + local executable="$1" + shift + local line_number="$1" + shift + local expected_rc="$1" + shift + local expected_output="$1" + shift + local unexpected_output="$1" + shift + + # We always add --srcdir=$SRCDIR because it's needed for correctness + "$executable" --srcdir="$SRCDIR" "$@" > "$TMPDIR/test.$line_number" 2>&1 + local actual_rc=$? + if [ $actual_rc != $expected_rc ]; then + echo "Test on line $line_number failed:" \ + "expected rc $expected_rc, got $actual_rc" + exit 1; + fi + if [ -n "$expected_output" ] && + ! fgrep -e "$expected_output" "$TMPDIR/test.$line_number" >/dev/null; then + echo "Test on line $line_number failed:" \ + "did not find expected substring '$expected_output'" + exit 1; + fi + if [ -n "$unexpected_output" ] && + fgrep -e "$unexpected_output" "$TMPDIR/test.$line_number" >/dev/null; then + echo "Test line $line_number failed:" \ + "found unexpected substring '$unexpected_output'" + exit 1; + fi +} + +# $1: line-number $2: expected return code. $3: substring of expected output. +# $4: a substring you *don't* expect to find in the output. $5+ flags +Expect() { + ExpectExe "$EXE" "$@" +} + +rm -rf "$TMPDIR" +mkdir "$TMPDIR" || exit 2 + +# Create a few flagfiles we can use later +echo "--version" > "$TMPDIR/flagfile.1" +echo "--foo=bar" > "$TMPDIR/flagfile.2" +echo "--nounused_bool" >> "$TMPDIR/flagfile.2" +echo "--flagfile=$TMPDIR/flagfile.2" > "$TMPDIR/flagfile.3" + +# Set a few environment variables (useful for --tryfromenv) +export FLAGS_undefok=foo,bar +export FLAGS_weirdo= +export FLAGS_version=true +export FLAGS_help=false + +# First, just make sure the unittest works as-is +Expect $LINENO 0 "PASS" "" + +# --help should show all flags, including flags from gflags_reporting.cc +Expect $LINENO 1 "/gflags_reporting.cc" "" --help + +# Make sure --help reflects flag changes made before flag-parsing +Expect $LINENO 1 \ + "-changed_bool1 (changed) type: bool default: true" "" --help +Expect $LINENO 1 \ + "-changed_bool2 (changed) type: bool default: true" "" --help + +# --nohelp and --help=false should be as if we didn't say anything +Expect $LINENO 0 "PASS" "" --nohelp +Expect $LINENO 0 "PASS" "" --help=false + +# --helpfull is the same as help +Expect $LINENO 1 "/gflags_reporting.cc" "" -helpfull + +# --helpshort should show only flags from the unittest itself +Expect $LINENO 1 "/gflags_unittest.cc" "/gflags_reporting.cc" --helpshort + +# --helpshort should show the tldflag we created in the unittest dir +Expect $LINENO 1 "tldflag1" "/google.cc" --helpshort +Expect $LINENO 1 "tldflag2" "/google.cc" --helpshort + +# --helpshort should work if the main source file is suffixed with [_-]main +ExpectExe "$EXE2" $LINENO 1 "/gflags_unittest-main.cc" "/gflags_reporting.cc" \ + --helpshort +ExpectExe "$EXE3" $LINENO 1 "/gflags_unittest_main.cc" "/gflags_reporting.cc" \ + --helpshort + +# --helpon needs an argument +Expect $LINENO 1 \ + "'--helpon' is missing its argument; flag description: show help on" \ + "" --helpon + +# --helpon argument indicates what file we'll show args from +Expect $LINENO 1 "/gflags.cc" "/gflags_unittest.cc" --helpon=gflags + +# another way of specifying the argument +Expect $LINENO 1 "/gflags.cc" "/gflags_unittest.cc" --helpon gflags + +# test another argument +Expect $LINENO 1 "/gflags_unittest.cc" "/gflags.cc" \ + --helpon gflags_unittest + +# helpmatch is like helpon but takes substrings +Expect $LINENO 1 "/gflags_reporting.cc" "/gflags_unittest.cc" \ + -helpmatch reporting +Expect $LINENO 1 "/gflags_unittest.cc" "/gflags.cc" \ + -helpmatch=unittest + +# if no flags are found with helpmatch or helpon, suggest --help +Expect $LINENO 1 "No modules matched" "/gflags_unittest.cc" \ + -helpmatch=nosuchsubstring +Expect $LINENO 1 "No modules matched" "/gflags_unittest.cc" \ + -helpon=nosuchmodule + +# helppackage shows all the flags in the same dir as this unittest +# --help should show all flags, including flags from google.cc +Expect $LINENO 1 "/gflags_reporting.cc" "" --helppackage + +# xml! +Expect $LINENO 1 "/gflags_unittest.cc</file>" \ + "/gflags_unittest.cc:" --helpxml + +# just print the version info and exit +Expect $LINENO 0 "gflags_unittest" "gflags_unittest.cc" --version + +# --undefok is a fun flag... +Expect $LINENO 1 "unknown command line flag 'foo'" "" --undefok= --foo --unused_bool +Expect $LINENO 0 "PASS" "" --undefok=foo --foo --unused_bool +# If you say foo is ok to be undefined, we'll accept --nofoo as well +Expect $LINENO 0 "PASS" "" --undefok=foo --nofoo --unused_bool +# It's ok if the foo is in the middle +Expect $LINENO 0 "PASS" "" --undefok=fee,fi,foo,fum --foo --unused_bool +# But the spelling has to be just right... +Expect $LINENO 1 "unknown command line flag 'foo'" "" --undefok=fo --foo --unused_bool +Expect $LINENO 1 "unknown command line flag 'foo'" "" --undefok=foot --foo --unused_bool + +# See if we can successfully load our flags from the flagfile +Expect $LINENO 0 "gflags_unittest" "gflags_unittest.cc" \ + --flagfile="$TMPDIR/flagfile.1" +Expect $LINENO 0 "PASS" "" --flagfile="$TMPDIR/flagfile.2" +Expect $LINENO 0 "PASS" "" --flagfile="$TMPDIR/flagfile.3" + +# Also try to load flags from the environment +Expect $LINENO 0 "gflags_unittest" "gflags_unittest.cc" --fromenv=version +Expect $LINENO 0 "gflags_unittest" "gflags_unittest.cc" --tryfromenv=version +Expect $LINENO 0 "PASS" "" --fromenv=help +Expect $LINENO 0 "PASS" "" --tryfromenv=help +Expect $LINENO 1 "helpfull not found in environment" "" --fromenv=helpfull +Expect $LINENO 0 "PASS" "" --tryfromenv=helpfull +Expect $LINENO 0 "PASS" "" --tryfromenv=undefok --foo +Expect $LINENO 1 "unknown command line flag" "" --tryfromenv=weirdo +Expect $LINENO 0 "gflags_unittest" "gflags_unittest.cc" \ + --tryfromenv=test_bool,version,unused_bool +Expect $LINENO 1 "not found in environment" "" --fromenv=test_bool +Expect $LINENO 1 "unknown command line flag" "" --fromenv=test_bool,ok +# Here, the --version overrides the fromenv +Expect $LINENO 0 "gflags_unittest" "gflags_unittest.cc" \ + --fromenv=test_bool,version,ok + +# Make sure -- by itself stops argv processing +Expect $LINENO 0 "PASS" "" -- --help + +# Make sure boolean flags gives warning when type of default value is not bool +Expect $LINENO 0 "Flag test_bool_string is of type bool, but its default value is not a boolean." "" +Expect $LINENO 0 "Flag test_bool_float is of type bool, but its default value is not a boolean." "" +Expect $LINENO 0 "Flag test_bool_int is of type bool, but its default value is not a boolean." "" + +# Make sure that boolean flags don't give warning when default value is bool +Expect $LINENO 0 "" "Flag test_bool_bool is of type bool, but its default value is not a boolean." + +# And we should die if the flag value doesn't pas the validator +Expect $LINENO 1 "ERROR: failed validation of new value 'true' for flag 'always_fail'" "" --always_fail + +echo "PASS" +exit 0 diff --git a/dtm_release/lib/util/gflags-1.1/src/gflags_unittest_flagfile b/dtm_release/lib/util/gflags-1.1/src/gflags_unittest_flagfile new file mode 100644 index 0000000000000000000000000000000000000000..f4fa0c4d5c5e8759bd76f059a31fffa06bafc8e8 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/src/gflags_unittest_flagfile @@ -0,0 +1,2 @@ +--test_flag=1 +--test_flag=2 diff --git a/dtm_release/lib/util/gflags-1.1/src/gflags_unittest_main.cc b/dtm_release/lib/util/gflags-1.1/src/gflags_unittest_main.cc new file mode 100644 index 0000000000000000000000000000000000000000..19e6a8fe788a2fe407691cd9f0cd9f80f14b7c22 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/src/gflags_unittest_main.cc @@ -0,0 +1,1511 @@ +// Copyright (c) 2006, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- +// Author: Marius Eriksen +// +// For now, this unit test does not cover all features of +// gflags.cc + +#include "config.h" +#include <stdio.h> +#include <stdlib.h> // for &exit +#include <string.h> +#include <unistd.h> // for unlink() +#include <sys/stat.h> // for mkdir() +#include <math.h> // for isinf() and isnan() +#include <vector> +#include <string> +#include "gflags/gflags.h" +// I don't actually use this header file, but #include it under the +// old location to make sure that the include-header-forwarding +// works. +#include "google/gflags_completions.h" +void (*unused_fn)() = &GOOGLE_NAMESPACE::HandleCommandLineCompletions; + +using std::vector; +using std::string; +using GOOGLE_NAMESPACE::int32; +using GOOGLE_NAMESPACE::FlagRegisterer; + +// Returns the number of elements in an array. +#define GET_ARRAY_SIZE(arr) (sizeof(arr)/sizeof(*(arr))) + +DECLARE_string(tryfromenv); // in gflags.cc + +DEFINE_string(test_tmpdir, "/tmp/gflags_unittest", "Dir we use for temp files"); +DEFINE_string(srcdir, GOOGLE_NAMESPACE::StringFromEnv("SRCDIR", "."), + "Source-dir root, needed to find gflags_unittest_flagfile"); + + +DEFINE_bool(test_bool, false, "tests bool-ness"); +DEFINE_int32(test_int32, -1, ""); +DEFINE_int64(test_int64, -2, ""); +DEFINE_uint64(test_uint64, 2, ""); +DEFINE_double(test_double, -1.0, ""); +DEFINE_string(test_string, "initial", ""); + +// +// The below ugliness gets some additional code coverage in the -helpxml +// and -helpmatch test cases having to do with string lengths and formatting +// +DEFINE_bool(test_bool_with_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_long_name, + false, + "extremely_extremely_extremely_extremely_extremely_extremely_extremely_extremely_long_meaning"); + +DEFINE_string(test_str1, "initial", ""); +DEFINE_string(test_str2, "initial", ""); +DEFINE_string(test_str3, "initial", ""); + +// This is used to test setting tryfromenv manually +DEFINE_string(test_tryfromenv, "initial", ""); + +// boolean flag assigned correctly with bool +DEFINE_bool(test_bool_bool, true, ""); + +// boolean flag assigned with string +DEFINE_bool(test_bool_string, "", ""); + +// boolean flag assigned with float +DEFINE_bool(test_bool_float, 1.0, ""); + +// boolean flag assigned with int +DEFINE_bool(test_bool_int, 1, ""); + +// Don't try this at home! +static int changeable_var = 12; +DEFINE_int32(changeable_var, ++changeable_var, ""); + +static int changeable_bool_var = 8008; +DEFINE_bool(changeable_bool_var, ++changeable_bool_var == 8009, ""); + +static int changeable_string_var = 0; +static string ChangeableString() { + char r[] = {'0' + ++changeable_string_var, '\0'}; + return r; +} +DEFINE_string(changeable_string_var, ChangeableString(), ""); + +// These are never used in this unittest, but can be used by +// gflags_unittest.sh when it needs to specify flags +// that are legal for gflags_unittest but don't need to +// be a particular value. +DEFINE_bool(unused_bool, true, "unused bool-ness"); +DEFINE_int32(unused_int32, -1001, ""); +DEFINE_int64(unused_int64, -2001, ""); +DEFINE_uint64(unused_uint64, 2000, ""); +DEFINE_double(unused_double, -1000.0, ""); +DEFINE_string(unused_string, "unused", ""); + +// These flags are used by gflags_unittest.sh +DEFINE_bool(changed_bool1, false, "changed"); +DEFINE_bool(changed_bool2, false, "changed"); + +static bool AlwaysFail(const char* flag, bool value) { return value == false; } +DEFINE_bool(always_fail, false, "will fail to validate when you set it"); +static const bool dummy = GOOGLE_NAMESPACE::RegisterFlagValidator(&FLAGS_always_fail, AlwaysFail); + +// This is a psuedo-flag -- we want to register a flag with a filename +// at the top level, but there is no way to do this except by faking +// the filename. +namespace fLI { + static const int32 FLAGS_nonotldflag1 = 12; + int32 FLAGS_tldflag1 = FLAGS_nonotldflag1; + int32 FLAGS_notldflag1 = FLAGS_nonotldflag1; + static FlagRegisterer o_tldflag1( + "tldflag1", "int32", + "should show up in --helpshort", "gflags_unittest.cc", + &FLAGS_tldflag1, &FLAGS_notldflag1); +} +using fLI::FLAGS_tldflag1; + +namespace fLI { + static const int32 FLAGS_nonotldflag2 = 23; + int32 FLAGS_tldflag2 = FLAGS_nonotldflag2; + int32 FLAGS_notldflag2 = FLAGS_nonotldflag2; + static FlagRegisterer o_tldflag2( + "tldflag2", "int32", + "should show up in --helpshort", "gflags_unittest.", + &FLAGS_tldflag2, &FLAGS_notldflag2); +} +using fLI::FLAGS_tldflag2; + +_START_GOOGLE_NAMESPACE_ + +// The following is some bare-bones testing infrastructure + +#define EXPECT_TRUE(cond) \ + do { \ + if (!(cond)) { \ + fprintf(stderr, "Check failed: %s\n", #cond); \ + exit(1); \ + } \ + } while (0) + +#define EXPECT_FALSE(cond) EXPECT_TRUE(!(cond)) + +#define EXPECT_OP(op, val1, val2) \ + do { \ + if (!((val1) op (val2))) { \ + fprintf(stderr, "Check failed: %s %s %s\n", #val1, #op, #val2); \ + exit(1); \ + } \ + } while (0) + +#define EXPECT_EQ(val1, val2) EXPECT_OP(==, val1, val2) +#define EXPECT_NE(val1, val2) EXPECT_OP(!=, val1, val2) +#define EXPECT_GT(val1, val2) EXPECT_OP(>, val1, val2) +#define EXPECT_LT(val1, val2) EXPECT_OP(<, val1, val2) + +// C99 declares isnan and isinf should be macros, so the #ifdef test +// should be reliable everywhere. Of course, it's not, but these +// are testing pertty marginal functionality anyway, so it's ok to +// not-run them even in situations they might, with effort, be made to work. +#ifdef isnan // Some compilers, like sun's for Solaris 10, don't define this +#define EXPECT_NAN(arg) \ + do { \ + if (!isnan(arg)) { \ + fprintf(stderr, "Check failed: isnan(%s)\n", #arg); \ + exit(1); \ + } \ + } while (0) +#else +#define EXPECT_NAN(arg) +#endif + +#ifdef isinf // Some compilers, like sun's for Solaris 10, don't define this +#define EXPECT_INF(arg) \ + do { \ + if (!isinf(arg)) { \ + fprintf(stderr, "Check failed: isinf(%s)\n", #arg); \ + exit(1); \ + } \ + } while (0) +#else +#define EXPECT_INF(arg) +#endif + +#define EXPECT_DOUBLE_EQ(val1, val2) \ + do { \ + if (((val1) < (val2) - 0.001 || (val1) > (val2) + 0.001)) { \ + fprintf(stderr, "Check failed: %s == %s\n", #val1, #val2); \ + exit(1); \ + } \ + } while (0) + +#define EXPECT_STREQ(val1, val2) \ + do { \ + if (strcmp((val1), (val2)) != 0) { \ + fprintf(stderr, "Check failed: streq(%s, %s)\n", #val1, #val2); \ + exit(1); \ + } \ + } while (0) + +static bool g_called_exit; +static void CalledExit(int) { g_called_exit = true; } + +#define EXPECT_DEATH(fn, msg) \ + do { \ + g_called_exit = false; \ + extern void (*commandlineflags_exitfunc)(int); /* in gflags.cc */ \ + commandlineflags_exitfunc = &CalledExit; \ + fn; \ + commandlineflags_exitfunc = &exit; /* set back to its default */ \ + if (!g_called_exit) { \ + fprintf(stderr, "Function didn't die (%s): %s\n", msg, #fn); \ + exit(1); \ + } \ + } while (0) + + +vector<void (*)()> g_testlist; // the tests to run + +#define TEST(a, b) \ + struct Test_##a##_##b { \ + Test_##a##_##b() { g_testlist.push_back(&Run); } \ + static void Run() { FlagSaver fs; RunTest(); } \ + static void RunTest(); \ + }; \ + static Test_##a##_##b g_test_##a##_##b; \ + void Test_##a##_##b::RunTest() + + +static int RUN_ALL_TESTS() { + vector<void (*)()>::const_iterator it; + for (it = g_testlist.begin(); it != g_testlist.end(); ++it) { + (*it)(); + } + fprintf(stderr, "Passed %d tests\n\nPASS\n", (int)g_testlist.size()); + return 0; +} + + +// Defining a variable of type CompileAssertTypesEqual<T1, T2> will cause a +// compiler error iff T1 and T2 are different types. +template <typename T1, typename T2> +struct CompileAssertTypesEqual; + +template <typename T> +struct CompileAssertTypesEqual<T, T> { +}; + + +template <typename Expected, typename Actual> +void AssertIsType(Actual& x) { + CompileAssertTypesEqual<Expected, Actual>(); +} + +// Verify all the flags are the right type. +TEST(FlagTypes, FlagTypes) { + AssertIsType<bool>(FLAGS_test_bool); + AssertIsType<int32>(FLAGS_test_int32); + AssertIsType<int64>(FLAGS_test_int64); + AssertIsType<uint64>(FLAGS_test_uint64); + AssertIsType<double>(FLAGS_test_double); + AssertIsType<string>(FLAGS_test_string); +} + +// Death tests for "help" options. +// +// The help system automatically calls exit(1) when you specify any of +// the help-related flags ("-helpmatch", "-helpxml") so we can't test +// those mainline. + +// Tests that "-helpmatch" causes the process to die. +TEST(ReadFlagsFromStringDeathTest, HelpMatch) { + EXPECT_DEATH(ReadFlagsFromString("-helpmatch=base", GetArgv0(), true), + ""); +} + + +// Tests that "-helpxml" causes the process to die. +TEST(ReadFlagsFromStringDeathTest, HelpXml) { + EXPECT_DEATH(ReadFlagsFromString("-helpxml", GetArgv0(), true), + ""); +} + + +// A subroutine needed for testing reading flags from a string. +void TestFlagString(const string& flags, + const string& expected_string, + bool expected_bool, + int32 expected_int32, + double expected_double) { + EXPECT_TRUE(ReadFlagsFromString(flags, + GetArgv0(), + // errors are fatal + true)); + + EXPECT_EQ(expected_string, FLAGS_test_string); + EXPECT_EQ(expected_bool, FLAGS_test_bool); + EXPECT_EQ(expected_int32, FLAGS_test_int32); + EXPECT_DOUBLE_EQ(expected_double, FLAGS_test_double); +} + + +// Tests reading flags from a string. +TEST(FlagFileTest, ReadFlagsFromString) { + TestFlagString( + // Flag string + "-test_string=continued\n" + "# some comments are in order\n" + "# some\n" + " # comments\n" + "#are\n" + " #trickier\n" + "# than others\n" + "-test_bool=true\n" + " -test_int32=1\n" + "-test_double=0.0\n", + // Expected values + "continued", + true, + 1, + 0.0); + + TestFlagString( + // Flag string + "# let's make sure it can update values\n" + "-test_string=initial\n" + "-test_bool=false\n" + "-test_int32=123\n" + "-test_double=123.0\n", + // Expected values + "initial", + false, + 123, + 123.0); +} + +// Tests the filename part of the flagfile +TEST(FlagFileTest, FilenamesOurfileLast) { + FLAGS_test_string = "initial"; + FLAGS_test_bool = false; + FLAGS_test_int32 = -1; + FLAGS_test_double = -1.0; + TestFlagString( + // Flag string + "-test_string=continued\n" + "# some comments are in order\n" + "# some\n" + " # comments\n" + "#are\n" + " #trickier\n" + "# than others\n" + "not_our_filename\n" + "-test_bool=true\n" + " -test_int32=1\n" + "gflags_unittest\n" + "-test_double=1000.0\n", + // Expected values + "continued", + false, + -1, + 1000.0); +} + +TEST(FlagFileTest, FilenamesOurfileFirst) { + FLAGS_test_string = "initial"; + FLAGS_test_bool = false; + FLAGS_test_int32 = -1; + FLAGS_test_double = -1.0; + TestFlagString( + // Flag string + "-test_string=continued\n" + "# some comments are in order\n" + "# some\n" + " # comments\n" + "#are\n" + " #trickier\n" + "# than others\n" + "gflags_unittest\n" + "-test_bool=true\n" + " -test_int32=1\n" + "not_our_filename\n" + "-test_double=1000.0\n", + // Expected values + "continued", + true, + 1, + -1.0); +} + +TEST(FlagFileTest, FilenamesOurfileGlob) { + FLAGS_test_string = "initial"; + FLAGS_test_bool = false; + FLAGS_test_int32 = -1; + FLAGS_test_double = -1.0; + TestFlagString( + // Flag string + "-test_string=continued\n" + "# some comments are in order\n" + "# some\n" + " # comments\n" + "#are\n" + " #trickier\n" + "# than others\n" + "*flags*\n" + "-test_bool=true\n" + " -test_int32=1\n" + "flags\n" + "-test_double=1000.0\n", + // Expected values + "continued", + true, + 1, + -1.0); +} + +TEST(FlagFileTest, FilenamesOurfileInBigList) { + FLAGS_test_string = "initial"; + FLAGS_test_bool = false; + FLAGS_test_int32 = -1; + FLAGS_test_double = -1.0; + TestFlagString( + // Flag string + "-test_string=continued\n" + "# some comments are in order\n" + "# some\n" + " # comments\n" + "#are\n" + " #trickier\n" + "# than others\n" + "*first* *flags* *third*\n" + "-test_bool=true\n" + " -test_int32=1\n" + "flags\n" + "-test_double=1000.0\n", + // Expected values + "continued", + true, + 1, + -1.0); +} + +// Tests that a failed flag-from-string read keeps flags at default values +TEST(FlagFileTest, FailReadFlagsFromString) { + FLAGS_test_int32 = 119; + string flags("# let's make sure it can update values\n" + "-test_string=non_initial\n" + "-test_bool=false\n" + "-test_int32=123\n" + "-test_double=illegal\n"); + + EXPECT_FALSE(ReadFlagsFromString(flags, + GetArgv0(), + // errors are fatal + false)); + + EXPECT_EQ(119, FLAGS_test_int32); + EXPECT_EQ("initial", FLAGS_test_string); +} + +// Tests that flags can be set to ordinary values. +TEST(SetFlagValueTest, OrdinaryValues) { + EXPECT_EQ("initial", FLAGS_test_str1); + + SetCommandLineOptionWithMode("test_str1", "second", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str1); // set; was default + + SetCommandLineOptionWithMode("test_str1", "third", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str1); // already set once + + FLAGS_test_str1 = "initial"; + SetCommandLineOptionWithMode("test_str1", "third", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("initial", FLAGS_test_str1); // still already set before + + SetCommandLineOptionWithMode("test_str1", "third", SET_FLAGS_VALUE); + EXPECT_EQ("third", FLAGS_test_str1); // changed value + + SetCommandLineOptionWithMode("test_str1", "fourth", SET_FLAGS_DEFAULT); + EXPECT_EQ("third", FLAGS_test_str1); + // value not changed (already set before) + + EXPECT_EQ("initial", FLAGS_test_str2); + + SetCommandLineOptionWithMode("test_str2", "second", SET_FLAGS_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str2); // changed (was default) + + FLAGS_test_str2 = "extra"; + EXPECT_EQ("extra", FLAGS_test_str2); + + FLAGS_test_str2 = "second"; + SetCommandLineOptionWithMode("test_str2", "third", SET_FLAGS_DEFAULT); + EXPECT_EQ("third", FLAGS_test_str2); // still changed (was equal to default) + + SetCommandLineOptionWithMode("test_str2", "fourth", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("fourth", FLAGS_test_str2); // changed (was default) + + EXPECT_EQ("initial", FLAGS_test_str3); + + SetCommandLineOptionWithMode("test_str3", "second", SET_FLAGS_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str3); // changed + + FLAGS_test_str3 = "third"; + SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAGS_DEFAULT); + EXPECT_EQ("third", FLAGS_test_str3); // not changed (was set) + + SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("third", FLAGS_test_str3); // not changed (was set) + + SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAGS_VALUE); + EXPECT_EQ("fourth", FLAGS_test_str3); // changed value +} + + +// Tests that flags can be set to exceptional values. +TEST(SetFlagValueTest, ExceptionalValues) { +#ifdef isinf // on systems without isinf, inf stuff may not work at all + EXPECT_EQ("test_double set to inf\n", + SetCommandLineOption("test_double", "inf")); + EXPECT_INF(FLAGS_test_double); + + EXPECT_EQ("test_double set to inf\n", + SetCommandLineOption("test_double", "INF")); + EXPECT_INF(FLAGS_test_double); +#endif + + // set some bad values + EXPECT_EQ("", + SetCommandLineOption("test_double", "0.1xxx")); + EXPECT_EQ("", + SetCommandLineOption("test_double", " ")); + EXPECT_EQ("", + SetCommandLineOption("test_double", "")); +#ifdef isinf + EXPECT_EQ("test_double set to -inf\n", + SetCommandLineOption("test_double", "-inf")); + EXPECT_INF(FLAGS_test_double); + EXPECT_GT(0, FLAGS_test_double); +#endif + +#ifdef isnan + EXPECT_EQ("test_double set to nan\n", + SetCommandLineOption("test_double", "NaN")); + EXPECT_NAN(FLAGS_test_double); +#endif +} + +// Tests that integer flags can be specified in many ways +TEST(SetFlagValueTest, DifferentRadices) { + EXPECT_EQ("test_int32 set to 12\n", + SetCommandLineOption("test_int32", "12")); + + EXPECT_EQ("test_int32 set to 16\n", + SetCommandLineOption("test_int32", "0x10")); + + EXPECT_EQ("test_int32 set to 34\n", + SetCommandLineOption("test_int32", "0X22")); + + // Leading 0 is *not* octal; it's still decimal + EXPECT_EQ("test_int32 set to 10\n", + SetCommandLineOption("test_int32", "010")); +} + +// Tests what happens when you try to set a flag to an illegal value +TEST(SetFlagValueTest, IllegalValues) { + FLAGS_test_bool = true; + FLAGS_test_int32 = 119; + FLAGS_test_int64 = 1191; + FLAGS_test_uint64 = 11911; + + EXPECT_EQ("", + SetCommandLineOption("test_bool", "12")); + + EXPECT_EQ("", + SetCommandLineOption("test_int32", "7000000000000")); + + // TODO(csilvers): uncomment this when we disallow negative numbers for uint64 +#if 0 + EXPECT_EQ("", + SetCommandLineOption("test_uint64", "-1")); +#endif + + EXPECT_EQ("", + SetCommandLineOption("test_int64", "not a number!")); + + // Test the empty string with each type of input + EXPECT_EQ("", SetCommandLineOption("test_bool", "")); + EXPECT_EQ("", SetCommandLineOption("test_int32", "")); + EXPECT_EQ("", SetCommandLineOption("test_int64", "")); + EXPECT_EQ("", SetCommandLineOption("test_uint64", "")); + EXPECT_EQ("", SetCommandLineOption("test_double", "")); + EXPECT_EQ("test_string set to \n", SetCommandLineOption("test_string", "")); + + EXPECT_EQ(true, FLAGS_test_bool); + EXPECT_EQ(119, FLAGS_test_int32); + EXPECT_EQ(1191, FLAGS_test_int64); + EXPECT_EQ(11911, FLAGS_test_uint64); +} + + +// Tests that we only evaluate macro args once +TEST(MacroArgs, EvaluateOnce) { + EXPECT_EQ(13, FLAGS_changeable_var); + // Make sure we don't ++ the value somehow, when evaluating the flag. + EXPECT_EQ(13, FLAGS_changeable_var); + // Make sure the macro only evaluated this var once. + EXPECT_EQ(13, changeable_var); + // Make sure the actual value and default value are the same + SetCommandLineOptionWithMode("changeable_var", "21", SET_FLAG_IF_DEFAULT); + EXPECT_EQ(21, FLAGS_changeable_var); +} + +TEST(MacroArgs, EvaluateOnceBool) { + EXPECT_EQ(true, FLAGS_changeable_bool_var); + EXPECT_EQ(true, FLAGS_changeable_bool_var); + EXPECT_EQ(8009, changeable_bool_var); + SetCommandLineOptionWithMode("changeable_bool_var", "false", + SET_FLAG_IF_DEFAULT); + EXPECT_EQ(false, FLAGS_changeable_bool_var); +} + +TEST(MacroArgs, EvaluateOnceStrings) { + EXPECT_EQ("1", FLAGS_changeable_string_var); + EXPECT_EQ("1", FLAGS_changeable_string_var); + EXPECT_EQ(1, changeable_string_var); + SetCommandLineOptionWithMode("changeable_string_var", "different", + SET_FLAG_IF_DEFAULT); + EXPECT_EQ("different", FLAGS_changeable_string_var); +} + +// Tests that the FooFromEnv does the right thing +TEST(FromEnvTest, LegalValues) { + setenv("BOOL_VAL1", "true", 1); + setenv("BOOL_VAL2", "false", 1); + setenv("BOOL_VAL3", "1", 1); + setenv("BOOL_VAL4", "F", 1); + EXPECT_EQ(true, BoolFromEnv("BOOL_VAL1", false)); + EXPECT_EQ(false, BoolFromEnv("BOOL_VAL2", true)); + EXPECT_EQ(true, BoolFromEnv("BOOL_VAL3", false)); + EXPECT_EQ(false, BoolFromEnv("BOOL_VAL4", true)); + EXPECT_EQ(true, BoolFromEnv("BOOL_VAL_UNKNOWN", true)); + EXPECT_EQ(false, BoolFromEnv("BOOL_VAL_UNKNOWN", false)); + + setenv("INT_VAL1", "1", 1); + setenv("INT_VAL2", "-1", 1); + EXPECT_EQ(1, Int32FromEnv("INT_VAL1", 10)); + EXPECT_EQ(-1, Int32FromEnv("INT_VAL2", 10)); + EXPECT_EQ(10, Int32FromEnv("INT_VAL_UNKNOWN", 10)); + + setenv("INT_VAL3", "1099511627776", 1); + EXPECT_EQ(1, Int64FromEnv("INT_VAL1", 20)); + EXPECT_EQ(-1, Int64FromEnv("INT_VAL2", 20)); + EXPECT_EQ(1099511627776LL, Int64FromEnv("INT_VAL3", 20)); + EXPECT_EQ(20, Int64FromEnv("INT_VAL_UNKNOWN", 20)); + + EXPECT_EQ(1, Uint64FromEnv("INT_VAL1", 30)); + EXPECT_EQ(1099511627776ULL, Uint64FromEnv("INT_VAL3", 30)); + EXPECT_EQ(30, Uint64FromEnv("INT_VAL_UNKNOWN", 30)); + + // I pick values here that can be easily represented exactly in floating-point + setenv("DOUBLE_VAL1", "0.0", 1); + setenv("DOUBLE_VAL2", "1.0", 1); + setenv("DOUBLE_VAL3", "-1.0", 1); + EXPECT_EQ(0.0, DoubleFromEnv("DOUBLE_VAL1", 40.0)); + EXPECT_EQ(1.0, DoubleFromEnv("DOUBLE_VAL2", 40.0)); + EXPECT_EQ(-1.0, DoubleFromEnv("DOUBLE_VAL3", 40.0)); + EXPECT_EQ(40.0, DoubleFromEnv("DOUBLE_VAL_UNKNOWN", 40.0)); + + setenv("STRING_VAL1", "", 1); + setenv("STRING_VAL2", "my happy string!", 1); + EXPECT_STREQ("", StringFromEnv("STRING_VAL1", "unknown")); + EXPECT_STREQ("my happy string!", StringFromEnv("STRING_VAL2", "unknown")); + EXPECT_STREQ("unknown", StringFromEnv("STRING_VAL_UNKNOWN", "unknown")); +} + +// Tests that the FooFromEnv dies on parse-error +TEST(FromEnvDeathTest, IllegalValues) { + setenv("BOOL_BAD1", "so true!",1 ); + setenv("BOOL_BAD2", "", 1); + EXPECT_DEATH(BoolFromEnv("BOOL_BAD1", false), "error parsing env variable"); + EXPECT_DEATH(BoolFromEnv("BOOL_BAD2", true), "error parsing env variable"); + + setenv("INT_BAD1", "one", 1); + setenv("INT_BAD2", "100000000000000000", 1); + setenv("INT_BAD3", "0xx10", 1); + setenv("INT_BAD4", "", 1); + EXPECT_DEATH(Int32FromEnv("INT_BAD1", 10), "error parsing env variable"); + EXPECT_DEATH(Int32FromEnv("INT_BAD2", 10), "error parsing env variable"); + EXPECT_DEATH(Int32FromEnv("INT_BAD3", 10), "error parsing env variable"); + EXPECT_DEATH(Int32FromEnv("INT_BAD4", 10), "error parsing env variable"); + + setenv("BIGINT_BAD1", "18446744073709551616000", 1); + EXPECT_DEATH(Int64FromEnv("INT_BAD1", 20), "error parsing env variable"); + EXPECT_DEATH(Int64FromEnv("INT_BAD3", 20), "error parsing env variable"); + EXPECT_DEATH(Int64FromEnv("INT_BAD4", 20), "error parsing env variable"); + EXPECT_DEATH(Int64FromEnv("BIGINT_BAD1", 200), "error parsing env variable"); + + setenv("BIGINT_BAD2", "-1", 1); + EXPECT_DEATH(Uint64FromEnv("INT_BAD1", 30), "error parsing env variable"); + EXPECT_DEATH(Uint64FromEnv("INT_BAD3", 30), "error parsing env variable"); + EXPECT_DEATH(Uint64FromEnv("INT_BAD4", 30), "error parsing env variable"); + EXPECT_DEATH(Uint64FromEnv("BIGINT_BAD1", 30), "error parsing env variable"); + // TODO(csilvers): uncomment this when we disallow negative numbers for uint64 +#if 0 + EXPECT_DEATH(Uint64FromEnv("BIGINT_BAD2", 30), "error parsing env variable"); +#endif + + setenv("DOUBLE_BAD1", "0.0.0", 1); + setenv("DOUBLE_BAD2", "", 1); + EXPECT_DEATH(DoubleFromEnv("DOUBLE_BAD1", 40.0), "error parsing env variable"); + EXPECT_DEATH(DoubleFromEnv("DOUBLE_BAD2", 40.0), "error parsing env variable"); +} + +// Tests that FlagSaver can save the states of string flags. +TEST(FlagSaverTest, CanSaveStringFlagStates) { + // 1. Initializes the flags. + + // State of flag test_str1: + // default value - "initial" + // current value - "initial" + // not set - true + + SetCommandLineOptionWithMode("test_str2", "second", SET_FLAGS_VALUE); + // State of flag test_str2: + // default value - "initial" + // current value - "second" + // not set - false + + SetCommandLineOptionWithMode("test_str3", "second", SET_FLAGS_DEFAULT); + // State of flag test_str3: + // default value - "second" + // current value - "second" + // not set - true + + // 2. Saves the flag states. + + { + FlagSaver fs; + + // 3. Modifies the flag states. + + SetCommandLineOptionWithMode("test_str1", "second", SET_FLAGS_VALUE); + EXPECT_EQ("second", FLAGS_test_str1); + // State of flag test_str1: + // default value - "second" + // current value - "second" + // not set - true + + SetCommandLineOptionWithMode("test_str2", "third", SET_FLAGS_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str2); + // State of flag test_str2: + // default value - "third" + // current value - "second" + // not set - false + + SetCommandLineOptionWithMode("test_str3", "third", SET_FLAGS_VALUE); + EXPECT_EQ("third", FLAGS_test_str3); + // State of flag test_str1: + // default value - "second" + // current value - "third" + // not set - false + + // 4. Restores the flag states. + } + + // 5. Verifies that the states were restored. + + // Verifies that the value of test_str1 was restored. + EXPECT_EQ("initial", FLAGS_test_str1); + // Verifies that the "not set" attribute of test_str1 was restored to true. + SetCommandLineOptionWithMode("test_str1", "second", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str1); + + // Verifies that the value of test_str2 was restored. + EXPECT_EQ("second", FLAGS_test_str2); + // Verifies that the "not set" attribute of test_str2 was restored to false. + SetCommandLineOptionWithMode("test_str2", "fourth", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("second", FLAGS_test_str2); + + // Verifies that the value of test_str3 was restored. + EXPECT_EQ("second", FLAGS_test_str3); + // Verifies that the "not set" attribute of test_str3 was restored to true. + SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAG_IF_DEFAULT); + EXPECT_EQ("fourth", FLAGS_test_str3); +} + + +// Tests that FlagSaver can save the values of various-typed flags. +TEST(FlagSaverTest, CanSaveVariousTypedFlagValues) { + // Initializes the flags. + FLAGS_test_bool = false; + FLAGS_test_int32 = -1; + FLAGS_test_int64 = -2; + FLAGS_test_uint64 = 3; + FLAGS_test_double = 4.0; + FLAGS_test_string = "good"; + + // Saves the flag states. + { + FlagSaver fs; + + // Modifies the flags. + FLAGS_test_bool = true; + FLAGS_test_int32 = -5; + FLAGS_test_int64 = -6; + FLAGS_test_uint64 = 7; + FLAGS_test_double = 8.0; + FLAGS_test_string = "bad"; + + // Restores the flag states. + } + + // Verifies the flag values were restored. + EXPECT_FALSE(FLAGS_test_bool); + EXPECT_EQ(-1, FLAGS_test_int32); + EXPECT_EQ(-2, FLAGS_test_int64); + EXPECT_EQ(3, FLAGS_test_uint64); + EXPECT_DOUBLE_EQ(4.0, FLAGS_test_double); + EXPECT_EQ("good", FLAGS_test_string); +} + +TEST(GetAllFlagsTest, BaseTest) { + vector<CommandLineFlagInfo> flags; + GetAllFlags(&flags); + bool found_test_bool = false; + vector<CommandLineFlagInfo>::const_iterator i; + for (i = flags.begin(); i != flags.end(); ++i) { + if (i->name == "test_bool") { + found_test_bool = true; + EXPECT_EQ(i->type, "bool"); + EXPECT_EQ(i->default_value, "false"); + break; + } + } + EXPECT_EQ(true, found_test_bool); +} + +TEST(ShowUsageWithFlagsTest, BaseTest) { + // TODO(csilvers): test this by allowing output other than to stdout. + // Not urgent since this functionality is tested via + // gflags_unittest.sh, though only through use of --help. +} + +TEST(ShowUsageWithFlagsRestrictTest, BaseTest) { + // TODO(csilvers): test this by allowing output other than to stdout. + // Not urgent since this functionality is tested via + // gflags_unittest.sh, though only through use of --helpmatch. +} + +// Note: all these argv-based tests depend on SetArgv being called +// before InitGoogle() in main(), below. +TEST(GetArgvsTest, BaseTest) { + vector<string> argvs = GetArgvs(); + EXPECT_EQ(4, argvs.size()); + EXPECT_EQ("/test/argv/for/gflags_unittest", argvs[0]); + EXPECT_EQ("argv 2", argvs[1]); + EXPECT_EQ("3rd argv", argvs[2]); + EXPECT_EQ("argv #4", argvs[3]); +} + +TEST(GetArgvTest, BaseTest) { + EXPECT_STREQ("/test/argv/for/gflags_unittest " + "argv 2 3rd argv argv #4", GetArgv()); +} + +TEST(GetArgv0Test, BaseTest) { + EXPECT_STREQ("/test/argv/for/gflags_unittest", GetArgv0()); +} + +TEST(GetArgvSumTest, BaseTest) { + // This number is just the sum of the ASCII values of all the chars + // in GetArgv(). + EXPECT_EQ(4904, GetArgvSum()); +} + +TEST(ProgramInvocationNameTest, BaseTest) { + EXPECT_STREQ("/test/argv/for/gflags_unittest", + ProgramInvocationName()); +} + +TEST(ProgramInvocationShortNameTest, BaseTest) { + EXPECT_STREQ("gflags_unittest", ProgramInvocationShortName()); +} + +TEST(ProgramUsageTest, BaseTest) { // Depends on 1st arg to InitGoogle in main() + EXPECT_STREQ("/test/argv/for/gflags_unittest: " + "<useless flag> [...]\nDoes something useless.\n", + ProgramUsage()); +} + +TEST(GetCommandLineOptionTest, NameExistsAndIsDefault) { + string value("will be changed"); + bool r = GetCommandLineOption("test_bool", &value); + EXPECT_EQ(true, r); + EXPECT_EQ("false", value); + + r = GetCommandLineOption("test_int32", &value); + EXPECT_EQ(true, r); + EXPECT_EQ("-1", value); +} + +TEST(GetCommandLineOptionTest, NameExistsAndWasAssigned) { + FLAGS_test_int32 = 400; + string value("will be changed"); + const bool r = GetCommandLineOption("test_int32", &value); + EXPECT_EQ(true, r); + EXPECT_EQ("400", value); +} + +TEST(GetCommandLineOptionTest, NameExistsAndWasSet) { + SetCommandLineOption("test_int32", "700"); + string value("will be changed"); + const bool r = GetCommandLineOption("test_int32", &value); + EXPECT_EQ(true, r); + EXPECT_EQ("700", value); +} + +TEST(GetCommandLineOptionTest, NameExistsAndWasNotSet) { + // This doesn't set the flag's value, but rather its default value. + // is_default is still true, but the 'default' value returned has changed! + SetCommandLineOptionWithMode("test_int32", "800", SET_FLAGS_DEFAULT); + string value("will be changed"); + const bool r = GetCommandLineOption("test_int32", &value); + EXPECT_EQ(true, r); + EXPECT_EQ("800", value); + EXPECT_EQ(true, GetCommandLineFlagInfoOrDie("test_int32").is_default); + +} + +TEST(GetCommandLineOptionTest, NameExistsAndWasConditionallySet) { + SetCommandLineOptionWithMode("test_int32", "900", SET_FLAG_IF_DEFAULT); + string value("will be changed"); + const bool r = GetCommandLineOption("test_int32", &value); + EXPECT_EQ(true, r); + EXPECT_EQ("900", value); +} + +TEST(GetCommandLineOptionTest, NameDoesNotExist) { + string value("will not be changed"); + const bool r = GetCommandLineOption("test_int3210", &value); + EXPECT_EQ(false, r); + EXPECT_EQ("will not be changed", value); +} + +TEST(GetCommandLineFlagInfoTest, FlagExists) { + CommandLineFlagInfo info; + bool r = GetCommandLineFlagInfo("test_int32", &info); + EXPECT_EQ(true, r); + EXPECT_EQ("test_int32", info.name); + EXPECT_EQ("int32", info.type); + EXPECT_EQ("", info.description); + EXPECT_EQ("-1", info.current_value); + EXPECT_EQ("-1", info.default_value); + EXPECT_EQ(true, info.is_default); + EXPECT_EQ(false, info.has_validator_fn); + + FLAGS_test_bool = true; + r = GetCommandLineFlagInfo("test_bool", &info); + EXPECT_EQ(true, r); + EXPECT_EQ("test_bool", info.name); + EXPECT_EQ("bool", info.type); + EXPECT_EQ("tests bool-ness", info.description); + EXPECT_EQ("true", info.current_value); + EXPECT_EQ("false", info.default_value); + EXPECT_EQ(false, info.is_default); + EXPECT_EQ(false, info.has_validator_fn); + + FLAGS_test_bool = false; + r = GetCommandLineFlagInfo("test_bool", &info); + EXPECT_EQ(true, r); + EXPECT_EQ("test_bool", info.name); + EXPECT_EQ("bool", info.type); + EXPECT_EQ("tests bool-ness", info.description); + EXPECT_EQ("false", info.current_value); + EXPECT_EQ("false", info.default_value); + EXPECT_EQ(false, info.is_default); // value is same, but flag *was* modified + EXPECT_EQ(false, info.has_validator_fn); +} + +TEST(GetCommandLineFlagInfoTest, FlagDoesNotExist) { + CommandLineFlagInfo info; + // Set to some random values that GetCommandLineFlagInfo should not change + info.name = "name"; + info.type = "type"; + info.current_value = "curr"; + info.default_value = "def"; + info.filename = "/"; + info.is_default = false; + info.has_validator_fn = true; + bool r = GetCommandLineFlagInfo("test_int3210", &info); + EXPECT_EQ(false, r); + EXPECT_EQ("name", info.name); + EXPECT_EQ("type", info.type); + EXPECT_EQ("", info.description); + EXPECT_EQ("curr", info.current_value); + EXPECT_EQ("def", info.default_value); + EXPECT_EQ("/", info.filename); + EXPECT_EQ(false, info.is_default); + EXPECT_EQ(true, info.has_validator_fn); +} + +TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndIsDefault) { + CommandLineFlagInfo info; + info = GetCommandLineFlagInfoOrDie("test_int32"); + EXPECT_EQ("test_int32", info.name); + EXPECT_EQ("int32", info.type); + EXPECT_EQ("", info.description); + EXPECT_EQ("-1", info.current_value); + EXPECT_EQ("-1", info.default_value); + EXPECT_EQ(true, info.is_default); + info = GetCommandLineFlagInfoOrDie("test_bool"); + EXPECT_EQ("test_bool", info.name); + EXPECT_EQ("bool", info.type); + EXPECT_EQ("tests bool-ness", info.description); + EXPECT_EQ("false", info.current_value); + EXPECT_EQ("false", info.default_value); + EXPECT_EQ(true, info.is_default); + EXPECT_EQ(false, info.has_validator_fn); +} + +TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndWasAssigned) { + FLAGS_test_int32 = 400; + CommandLineFlagInfo info; + info = GetCommandLineFlagInfoOrDie("test_int32"); + EXPECT_EQ("test_int32", info.name); + EXPECT_EQ("int32", info.type); + EXPECT_EQ("", info.description); + EXPECT_EQ("400", info.current_value); + EXPECT_EQ("-1", info.default_value); + EXPECT_EQ(false, info.is_default); + FLAGS_test_bool = true; + info = GetCommandLineFlagInfoOrDie("test_bool"); + EXPECT_EQ("test_bool", info.name); + EXPECT_EQ("bool", info.type); + EXPECT_EQ("tests bool-ness", info.description); + EXPECT_EQ("true", info.current_value); + EXPECT_EQ("false", info.default_value); + EXPECT_EQ(false, info.is_default); + EXPECT_EQ(false, info.has_validator_fn); +} + +TEST(GetCommandLineFlagInfoOrDieDeathTest, FlagDoesNotExist) { + EXPECT_DEATH(GetCommandLineFlagInfoOrDie("test_int3210"), + ".*: flag test_int3210 does not exist"); +} + + +// These are lightly tested because they're deprecated. Basically, +// the tests are meant to cover how existing users use these functions, +// but not necessarily how new users could use them. +TEST(DeprecatedFunctionsTest, CommandlineFlagsIntoString) { + string s = CommandlineFlagsIntoString(); + EXPECT_NE(string::npos, s.find("--test_bool=")); +} + +TEST(DeprecatedFunctionsTest, AppendFlagsIntoFile) { + FLAGS_test_int32 = 10; // just to make the test more interesting + string filename(FLAGS_test_tmpdir + "/flagfile"); + unlink(filename.c_str()); // just to be safe + const bool r = AppendFlagsIntoFile(filename, "not the real argv0"); + EXPECT_EQ(true, r); + + FILE* fp = fopen(filename.c_str(), "r"); + EXPECT_TRUE(fp != NULL); + char line[8192]; + fgets(line, sizeof(line)-1, fp); // first line should be progname + EXPECT_STREQ("not the real argv0\n", line); + + bool found_bool = false, found_int32 = false; + while (fgets(line, sizeof(line)-1, fp)) { + line[sizeof(line)-1] = '\0'; // just to be safe + if (strcmp(line, "--test_bool=false\n") == 0) + found_bool = true; + if (strcmp(line, "--test_int32=10\n") == 0) + found_int32 = true; + } + EXPECT_EQ(true, found_int32); + EXPECT_EQ(true, found_bool); + fclose(fp); +} + +TEST(DeprecatedFunctionsTest, ReadFromFlagsFile) { + FLAGS_test_int32 = -10; // just to make the test more interesting + string filename(FLAGS_test_tmpdir + "/flagfile2"); + unlink(filename.c_str()); // just to be safe + bool r = AppendFlagsIntoFile(filename, GetArgv0()); + EXPECT_EQ(true, r); + + FLAGS_test_int32 = -11; + r = ReadFromFlagsFile(filename, GetArgv0(), true); + EXPECT_EQ(true, r); + EXPECT_EQ(-10, FLAGS_test_int32); +} + +TEST(DeprecatedFunctionsTest, ReadFromFlagsFileFailure) { + FLAGS_test_int32 = -20; + string filename(FLAGS_test_tmpdir + "/flagfile3"); + FILE* fp = fopen(filename.c_str(), "w"); + EXPECT_TRUE(fp != NULL); + // Note the error in the bool assignment below... + fprintf(fp, "%s\n--test_int32=-21\n--test_bool=not_a_bool!\n", GetArgv0()); + fclose(fp); + + FLAGS_test_int32 = -22; + const bool r = ReadFromFlagsFile(filename, GetArgv0(), false); + EXPECT_EQ(false, r); + EXPECT_EQ(-22, FLAGS_test_int32); // the -21 from the flagsfile didn't take +} + +TEST(FlagsSetBeforeInitGoogleTest, TryFromEnv) { + EXPECT_EQ("pre-set", FLAGS_test_tryfromenv); +} + +// The following test case verifies that ParseCommandLineFlags() and +// ParseCommandLineNonHelpFlags() uses the last definition of a flag +// in case it's defined more than once. + +DEFINE_int32(test_flag, -1, "used for testing commandlineflags.cc"); + +// Returns the definition of the --flagfile flag to be used in the tests. +const char* GetFlagFileFlag() { + static const string flagfile_flag = string("--flagfile=") + + FLAGS_srcdir + "/src/gflags_unittest_flagfile"; + + return flagfile_flag.c_str(); +} + +// Parses and returns the --test_flag flag. +// If with_help is true, calls ParseCommandLineFlags; otherwise calls +// ParseCommandLineNonHelpFlags. +int32 ParseTestFlag(bool with_help, int argc, const char** const_argv) { + FlagSaver fs; // Restores the flags before returning. + + // Makes a copy of the input array s.t. it can be reused + // (ParseCommandLineFlags() will alter the array). + char** const argv_save = new char*[argc + 1]; + char** argv = argv_save; + memcpy(argv, const_argv, sizeof(*argv)*(argc + 1)); + + if (with_help) { + ParseCommandLineFlags(&argc, &argv, true); + } else { + ParseCommandLineNonHelpFlags(&argc, &argv, true); + } + + delete[] argv_save; + return FLAGS_test_flag; +} + +TEST(ParseCommandLineFlagsUsesLastDefinitionTest, + WhenFlagIsDefinedTwiceOnCommandLine) { + const char* argv[] = { + "my_test", + "--test_flag=1", + "--test_flag=2", + NULL, + }; + + EXPECT_EQ(2, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(2, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsUsesLastDefinitionTest, + WhenFlagIsDefinedTwiceInFlagFile) { + const char* argv[] = { + "my_test", + GetFlagFileFlag(), + NULL, + }; + + EXPECT_EQ(2, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(2, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsUsesLastDefinitionTest, + WhenFlagIsDefinedInCommandLineAndThenFlagFile) { + const char* argv[] = { + "my_test", + "--test_flag=0", + GetFlagFileFlag(), + NULL, + }; + + EXPECT_EQ(2, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(2, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsUsesLastDefinitionTest, + WhenFlagIsDefinedInFlagFileAndThenCommandLine) { + const char* argv[] = { + "my_test", + GetFlagFileFlag(), + "--test_flag=3", + NULL, + }; + + EXPECT_EQ(3, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(3, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsUsesLastDefinitionTest, + WhenFlagIsDefinedInCommandLineAndFlagFileAndThenCommandLine) { + const char* argv[] = { + "my_test", + "--test_flag=0", + GetFlagFileFlag(), + "--test_flag=3", + NULL, + }; + + EXPECT_EQ(3, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(3, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsAndDashArgs, TwoDashArgFirst) { + const char* argv[] = { + "my_test", + "--", + "--test_flag=0", + NULL, + }; + + EXPECT_EQ(-1, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(-1, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsAndDashArgs, TwoDashArgMiddle) { + const char* argv[] = { + "my_test", + "--test_flag=7", + "--", + "--test_flag=0", + NULL, + }; + + EXPECT_EQ(7, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(7, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsAndDashArgs, OneDashArg) { + const char* argv[] = { + "my_test", + "-", + "--test_flag=0", + NULL, + }; + + EXPECT_EQ(0, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + EXPECT_EQ(0, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv)); +} + +TEST(ParseCommandLineFlagsUnknownFlagDeathTest, + FlagIsCompletelyUnknown) { + const char* argv[] = { + "my_test", + "--this_flag_does_not_exist", + NULL, + }; + + EXPECT_DEATH(ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv), + "unknown command line flag.*"); + EXPECT_DEATH(ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv), + "unknown command line flag.*"); +} + +TEST(ParseCommandLineFlagsUnknownFlagDeathTest, + BoolFlagIsCompletelyUnknown) { + const char* argv[] = { + "my_test", + "--nothis_flag_does_not_exist", + NULL, + }; + + EXPECT_DEATH(ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv), + "unknown command line flag.*"); + EXPECT_DEATH(ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv), + "unknown command line flag.*"); +} + +TEST(ParseCommandLineFlagsUnknownFlagDeathTest, + FlagIsNotABool) { + const char* argv[] = { + "my_test", + "--notest_string", + NULL, + }; + + EXPECT_DEATH(ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv), + "boolean value .* specified for .* command line flag"); + EXPECT_DEATH(ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv), + "boolean value .* specified for .* command line flag"); +} + +TEST(ParseCommandLineFlagsWrongFields, + DescriptionIsInvalid) { + // These must not be automatic variables, since command line flags + // aren't unregistered and gUnit uses FlagSaver to save and restore + // command line flags' values. If these are on the stack, then when + // later tests attempt to save and restore their values, the stack + // addresses of these variables will be overwritten... Stack smash! + static bool current_storage; + static bool defvalue_storage; + FlagRegisterer fr("flag_name", "bool", 0, "filename", + ¤t_storage, &defvalue_storage); + CommandLineFlagInfo fi; + EXPECT_TRUE(GetCommandLineFlagInfo("flag_name", &fi)); + EXPECT_EQ("", fi.description); +} + +static bool ValidateTestFlagIs5(const char* flagname, int32 flagval) { + if (flagval == 5) + return true; + printf("%s isn't 5!\n", flagname); + return false; +} + +static bool ValidateTestFlagIs10(const char* flagname, int32 flagval) { + return flagval == 10; +} + + +TEST(FlagsValidator, ValidFlagViaArgv) { + const char* argv[] = { + "my_test", + "--test_flag=5", + NULL, + }; + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_EQ(5, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv)); + // Undo the flag validator setting + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidator, ValidFlagViaSetDefault) { + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + // SetCommandLineOptionWithMode returns the empty string on error. + EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", + SET_FLAG_IF_DEFAULT)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidator, ValidFlagViaSetValue) { + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + FLAGS_test_flag = 100; // doesn't trigger the validator + // SetCommandLineOptionWithMode returns the empty string on error. + EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", + SET_FLAGS_VALUE)); + EXPECT_NE("", SetCommandLineOptionWithMode("test_flag", "5", + SET_FLAGS_DEFAULT)); + EXPECT_NE("", SetCommandLineOption("test_flag", "5")); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidatorDeathTest, InvalidFlagViaArgv) { + const char* argv[] = { + "my_test", + "--test_flag=50", + NULL, + }; + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_DEATH(ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv), + "ERROR: failed validation of new value '50' for flag 'test_flag'"); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidator, InvalidFlagViaSetDefault) { + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + // SetCommandLineOptionWithMode returns the empty string on error. + EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", + SET_FLAG_IF_DEFAULT)); + EXPECT_EQ(-1, FLAGS_test_flag); // the setting-to-50 should have failed + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidator, InvalidFlagViaSetValue) { + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + FLAGS_test_flag = 100; // doesn't trigger the validator + // SetCommandLineOptionWithMode returns the empty string on error. + EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", + SET_FLAGS_VALUE)); + EXPECT_EQ("", SetCommandLineOptionWithMode("test_flag", "50", + SET_FLAGS_DEFAULT)); + EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); + EXPECT_EQ(100, FLAGS_test_flag); // the setting-to-50 should have failed + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidatorDeathTest, InvalidFlagNeverSet) { + // If a flag keeps its default value, and that default value is + // invalid, we should die at argv-parse time. + const char* argv[] = { + "my_test", + NULL, + }; + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_DEATH(ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv), + "ERROR: --test_flag must be set on the commandline"); +} + +TEST(FlagsValidator, InvalidFlagPtr) { + int32 dummy; + EXPECT_FALSE(RegisterFlagValidator(NULL, &ValidateTestFlagIs5)); + EXPECT_FALSE(RegisterFlagValidator(&dummy, &ValidateTestFlagIs5)); +} + +TEST(FlagsValidator, RegisterValidatorTwice) { + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_FALSE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); + EXPECT_FALSE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs10)); + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); +} + +TEST(FlagsValidator, CommandLineFlagInfo) { + CommandLineFlagInfo info; + info = GetCommandLineFlagInfoOrDie("test_flag"); + EXPECT_FALSE(info.has_validator_fn); + + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + info = GetCommandLineFlagInfoOrDie("test_flag"); + EXPECT_TRUE(info.has_validator_fn); + + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); + info = GetCommandLineFlagInfoOrDie("test_flag"); + EXPECT_FALSE(info.has_validator_fn); +} + +TEST(FlagsValidator, FlagSaver) { + { + FlagSaver fs; + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); // fails validation + } + EXPECT_NE("", SetCommandLineOption("test_flag", "50")); // validator is gone + + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, &ValidateTestFlagIs5)); + { + FlagSaver fs; + EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL)); + EXPECT_NE("", SetCommandLineOption("test_flag", "50")); // no validator + } + EXPECT_EQ("", SetCommandLineOption("test_flag", "50")); // validator is back +} + + +static int Main(int argc, char **argv) { + // We need to call SetArgv before InitGoogle, so our "test" argv will + // win out over this executable's real argv. That makes running this + // test with a real --help flag kinda annoying, unfortunately. + const char* test_argv[] = { "/test/argv/for/gflags_unittest", + "argv 2", "3rd argv", "argv #4" }; + SetArgv(GET_ARRAY_SIZE(test_argv), test_argv); + + // The first arg is the usage message, also important for testing. + string usage_message = (string(GetArgv0()) + + ": <useless flag> [...]\nDoes something useless.\n"); + + // We test setting tryfromenv manually, and making sure initgoogle still + // evaluates it. + FLAGS_tryfromenv = "test_tryfromenv"; + setenv("FLAGS_test_tryfromenv", "pre-set", 1); + + // Modify flag values from declared default value in two ways. + // The recommended way: + SetCommandLineOptionWithMode("changed_bool1", "true", SET_FLAGS_DEFAULT); + // The non-recommended way: + FLAGS_changed_bool2 = true; + + SetUsageMessage(usage_message.c_str()); + ParseCommandLineFlags(&argc, &argv, true); + + mkdir(FLAGS_test_tmpdir.c_str(), 0755); + + return RUN_ALL_TESTS(); +} + +_END_GOOGLE_NAMESPACE_ + +int main(int argc, char** argv) { + return GOOGLE_NAMESPACE::Main(argc, argv); +} diff --git a/dtm_release/lib/util/gflags-1.1/src/google/gflags.h b/dtm_release/lib/util/gflags-1.1/src/google/gflags.h new file mode 100644 index 0000000000000000000000000000000000000000..c1adcb824bb0603f2f2cdb49fef15b965d6bf108 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/src/google/gflags.h @@ -0,0 +1,34 @@ +// Copyright (c) 2006, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Header files have moved from the google directory to the gflags +// directory. This forwarding file is provided only for backwards +// compatibility. Use gflags/gflags.h in all new code. + +#include <gflags/gflags.h> diff --git a/dtm_release/lib/util/gflags-1.1/src/google/gflags_completions.h b/dtm_release/lib/util/gflags-1.1/src/google/gflags_completions.h new file mode 100644 index 0000000000000000000000000000000000000000..614ef098ac3b6f64c388cc95b55b91d5a87a89d5 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/src/google/gflags_completions.h @@ -0,0 +1,34 @@ +// Copyright (c) 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Header files have moved from the google directory to the gflags +// directory. This forwarding file is provided only for backwards +// compatibility. Use gflags/gflags_completions.h in all new code. + +#include <gflags/gflags_completions.h> diff --git a/dtm_release/lib/util/gflags-1.1/src/mutex.h b/dtm_release/lib/util/gflags-1.1/src/mutex.h new file mode 100644 index 0000000000000000000000000000000000000000..eda1f4e1ce01fd32051098f205649e5bd55216d6 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/src/mutex.h @@ -0,0 +1,303 @@ +// Copyright (c) 2007, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --- +// Author: Craig Silverstein. +// +// A simple mutex wrapper, supporting locks and read-write locks. +// You should assume the locks are *not* re-entrant. +// +// To use: you should define the following macros in your configure.ac: +// ACX_PTHREAD +// AC_RWLOCK +// The latter is defined in ../autoconf. +// +// This class is meant to be internal-only, so it's defined in the +// global namespace. If you want to expose it, you'll want to move +// it to the Google namespace. +// +// NOTE: by default, we have #ifdef'ed out the TryLock() method. +// This is for two reasons: +// 1) TryLock() under Windows is a bit annoying (it requires a +// #define to be defined very early). +// 2) TryLock() is broken for NO_THREADS mode, at least in NDEBUG +// mode. +// If you need TryLock(), and either these two caveats are not a +// problem for you, or you're willing to work around them, then +// feel free to #define GMUTEX_TRYLOCK, or to remove the #ifdefs +// in the code below. +// +// CYGWIN NOTE: Cygwin support for rwlock seems to be buggy: +// http://www.cygwin.com/ml/cygwin/2008-12/msg00017.html +// Because of that, we might as well use windows locks for +// cygwin. They seem to be more reliable than the cygwin pthreads layer. +// +// TRICKY IMPLEMENTATION NOTE: +// This class is designed to be safe to use during +// dynamic-initialization -- that is, by global constructors that are +// run before main() starts. The issue in this case is that +// dynamic-initialization happens in an unpredictable order, and it +// could be that someone else's dynamic initializer could call a +// function that tries to acquire this mutex -- but that all happens +// before this mutex's constructor has run. (This can happen even if +// the mutex and the function that uses the mutex are in the same .cc +// file.) Basically, because Mutex does non-trivial work in its +// constructor, it's not, in the naive implementation, safe to use +// before dynamic initialization has run on it. +// +// The solution used here is to pair the actual mutex primitive with a +// bool that is set to true when the mutex is dynamically initialized. +// (Before that it's false.) Then we modify all mutex routines to +// look at the bool, and not try to lock/unlock until the bool makes +// it to true (which happens after the Mutex constructor has run.) +// +// This works because before main() starts -- particularly, during +// dynamic initialization -- there are no threads, so a) it's ok that +// the mutex operations are a no-op, since we don't need locking then +// anyway; and b) we can be quite confident our bool won't change +// state between a call to Lock() and a call to Unlock() (that would +// require a global constructor in one translation unit to call Lock() +// and another global constructor in another translation unit to call +// Unlock() later, which is pretty perverse). +// +// That said, it's tricky, and can conceivably fail; it's safest to +// avoid trying to acquire a mutex in a global constructor, if you +// can. One way it can fail is that a really smart compiler might +// initialize the bool to true at static-initialization time (too +// early) rather than at dynamic-initialization time. To discourage +// that, we set is_safe_ to true in code (not the constructor +// colon-initializer) and set it to true via a function that always +// evaluates to true, but that the compiler can't know always +// evaluates to true. This should be good enough. + +#ifndef GOOGLE_MUTEX_H_ +#define GOOGLE_MUTEX_H_ + +#include "config.h" // to figure out pthreads support + +#if defined(NO_THREADS) + typedef int MutexType; // to keep a lock-count +#elif defined(_WIN32) || defined(__CYGWIN32__) || defined(__CYGWIN64__) +# define WIN32_LEAN_AND_MEAN // We only need minimal includes +# ifdef GMUTEX_TRYLOCK + // We need Windows NT or later for TryEnterCriticalSection(). If you + // don't need that functionality, you can remove these _WIN32_WINNT + // lines, and change TryLock() to assert(0) or something. +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0400 +# endif +# endif +# include <windows.h> + typedef CRITICAL_SECTION MutexType; +#elif defined(HAVE_PTHREAD) && defined(HAVE_RWLOCK) + // Needed for pthread_rwlock_*. If it causes problems, you could take it + // out, but then you'd have to unset HAVE_RWLOCK (at least on linux -- it + // *does* cause problems for FreeBSD, or MacOSX, but isn't needed + // for locking there.) +# ifdef __linux__ +# define _XOPEN_SOURCE 500 // may be needed to get the rwlock calls +# endif +# include <pthread.h> + typedef pthread_rwlock_t MutexType; +#elif defined(HAVE_PTHREAD) +# include <pthread.h> + typedef pthread_mutex_t MutexType; +#else +# error Need to implement mutex.h for your architecture, or #define NO_THREADS +#endif + +class Mutex { + public: + // Create a Mutex that is not held by anybody. This constructor is + // typically used for Mutexes allocated on the heap or the stack. + // See below for a recommendation for constructing global Mutex + // objects. + inline Mutex(); + + // Destructor + inline ~Mutex(); + + inline void Lock(); // Block if needed until free then acquire exclusively + inline void Unlock(); // Release a lock acquired via Lock() +#ifdef GMUTEX_TRYLOCK + inline bool TryLock(); // If free, Lock() and return true, else return false +#endif + // Note that on systems that don't support read-write locks, these may + // be implemented as synonyms to Lock() and Unlock(). So you can use + // these for efficiency, but don't use them anyplace where being able + // to do shared reads is necessary to avoid deadlock. + inline void ReaderLock(); // Block until free or shared then acquire a share + inline void ReaderUnlock(); // Release a read share of this Mutex + inline void WriterLock() { Lock(); } // Acquire an exclusive lock + inline void WriterUnlock() { Unlock(); } // Release a lock from WriterLock() + + private: + MutexType mutex_; + // We want to make sure that the compiler sets is_safe_ to true only + // when we tell it to, and never makes assumptions is_safe_ is + // always true. volatile is the most reliable way to do that. + volatile bool is_safe_; + + inline void SetIsSafe() { is_safe_ = true; } + + // Catch the error of writing Mutex when intending MutexLock. + Mutex(Mutex* /*ignored*/) {} + // Disallow "evil" constructors + Mutex(const Mutex&); + void operator=(const Mutex&); +}; + +// Now the implementation of Mutex for various systems +#if defined(NO_THREADS) + +// When we don't have threads, we can be either reading or writing, +// but not both. We can have lots of readers at once (in no-threads +// mode, that's most likely to happen in recursive function calls), +// but only one writer. We represent this by having mutex_ be -1 when +// writing and a number > 0 when reading (and 0 when no lock is held). +// +// In debug mode, we assert these invariants, while in non-debug mode +// we do nothing, for efficiency. That's why everything is in an +// assert. +#include <assert.h> + +Mutex::Mutex() : mutex_(0) { } +Mutex::~Mutex() { assert(mutex_ == 0); } +void Mutex::Lock() { assert(--mutex_ == -1); } +void Mutex::Unlock() { assert(mutex_++ == -1); } +#ifdef GMUTEX_TRYLOCK +bool Mutex::TryLock() { if (mutex_) return false; Lock(); return true; } +#endif +void Mutex::ReaderLock() { assert(++mutex_ > 0); } +void Mutex::ReaderUnlock() { assert(mutex_-- > 0); } + +#elif defined(_WIN32) || defined(__CYGWIN32__) || defined(__CYGWIN64__) + +Mutex::Mutex() { InitializeCriticalSection(&mutex_); SetIsSafe(); } +Mutex::~Mutex() { DeleteCriticalSection(&mutex_); } +void Mutex::Lock() { if (is_safe_) EnterCriticalSection(&mutex_); } +void Mutex::Unlock() { if (is_safe_) LeaveCriticalSection(&mutex_); } +#ifdef GMUTEX_TRYLOCK +bool Mutex::TryLock() { return is_safe_ ? + TryEnterCriticalSection(&mutex_) != 0 : true; } +#endif +void Mutex::ReaderLock() { Lock(); } // we don't have read-write locks +void Mutex::ReaderUnlock() { Unlock(); } + +#elif defined(HAVE_PTHREAD) && defined(HAVE_RWLOCK) + +#include <stdlib.h> // for abort() +#define SAFE_PTHREAD(fncall) do { /* run fncall if is_safe_ is true */ \ + if (is_safe_ && fncall(&mutex_) != 0) abort(); \ +} while (0) + +Mutex::Mutex() { + SetIsSafe(); + if (is_safe_ && pthread_rwlock_init(&mutex_, NULL) != 0) abort(); +} +Mutex::~Mutex() { SAFE_PTHREAD(pthread_rwlock_destroy); } +void Mutex::Lock() { SAFE_PTHREAD(pthread_rwlock_wrlock); } +void Mutex::Unlock() { SAFE_PTHREAD(pthread_rwlock_unlock); } +#ifdef GMUTEX_TRYLOCK +bool Mutex::TryLock() { return is_safe_ ? + pthread_rwlock_trywrlock(&mutex_) == 0 : + true; } +#endif +void Mutex::ReaderLock() { SAFE_PTHREAD(pthread_rwlock_rdlock); } +void Mutex::ReaderUnlock() { SAFE_PTHREAD(pthread_rwlock_unlock); } +#undef SAFE_PTHREAD + +#elif defined(HAVE_PTHREAD) + +#include <stdlib.h> // for abort() +#define SAFE_PTHREAD(fncall) do { /* run fncall if is_safe_ is true */ \ + if (is_safe_ && fncall(&mutex_) != 0) abort(); \ +} while (0) + +Mutex::Mutex() { + SetIsSafe(); + if (is_safe_ && pthread_mutex_init(&mutex_, NULL) != 0) abort(); +} +Mutex::~Mutex() { SAFE_PTHREAD(pthread_mutex_destroy); } +void Mutex::Lock() { SAFE_PTHREAD(pthread_mutex_lock); } +void Mutex::Unlock() { SAFE_PTHREAD(pthread_mutex_unlock); } +#ifdef GMUTEX_TRYLOCK +bool Mutex::TryLock() { return is_safe_ ? + pthread_mutex_trylock(&mutex_) == 0 : true; } +#endif +void Mutex::ReaderLock() { Lock(); } +void Mutex::ReaderUnlock() { Unlock(); } +#undef SAFE_PTHREAD + +#endif + +// -------------------------------------------------------------------------- +// Some helper classes + +// MutexLock(mu) acquires mu when constructed and releases it when destroyed. +class MutexLock { + public: + explicit MutexLock(Mutex *mu) : mu_(mu) { mu_->Lock(); } + ~MutexLock() { mu_->Unlock(); } + private: + Mutex * const mu_; + // Disallow "evil" constructors + MutexLock(const MutexLock&); + void operator=(const MutexLock&); +}; + +// ReaderMutexLock and WriterMutexLock do the same, for rwlocks +class ReaderMutexLock { + public: + explicit ReaderMutexLock(Mutex *mu) : mu_(mu) { mu_->ReaderLock(); } + ~ReaderMutexLock() { mu_->ReaderUnlock(); } + private: + Mutex * const mu_; + // Disallow "evil" constructors + ReaderMutexLock(const ReaderMutexLock&); + void operator=(const ReaderMutexLock&); +}; + +class WriterMutexLock { + public: + explicit WriterMutexLock(Mutex *mu) : mu_(mu) { mu_->WriterLock(); } + ~WriterMutexLock() { mu_->WriterUnlock(); } + private: + Mutex * const mu_; + // Disallow "evil" constructors + WriterMutexLock(const WriterMutexLock&); + void operator=(const WriterMutexLock&); +}; + +// Catch bug where variable name is omitted, e.g. MutexLock (&mu); +#define MutexLock(x) COMPILE_ASSERT(0, mutex_lock_decl_missing_var_name) +#define ReaderMutexLock(x) COMPILE_ASSERT(0, rmutex_lock_decl_missing_var_name) +#define WriterMutexLock(x) COMPILE_ASSERT(0, wmutex_lock_decl_missing_var_name) + +#endif /* #define GOOGLE_MUTEX_H__ */ diff --git a/dtm_release/lib/util/gflags-1.1/src/stamp-h1 b/dtm_release/lib/util/gflags-1.1/src/stamp-h1 new file mode 100644 index 0000000000000000000000000000000000000000..57ea58e405b37b3e2f964c89cc2f42aea6073003 --- /dev/null +++ b/dtm_release/lib/util/gflags-1.1/src/stamp-h1 @@ -0,0 +1 @@ +timestamp for src/config.h diff --git a/dtm_release/local/include/gsl/gsl_blas.h b/dtm_release/local/include/gsl/gsl_blas.h new file mode 100644 index 0000000000000000000000000000000000000000..7c427149686228805155c45a52559486a1c9fae7 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_blas.h @@ -0,0 +1,602 @@ +/* blas/gsl_blas.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* + * Author: G. Jungman + */ +#ifndef __GSL_BLAS_H__ +#define __GSL_BLAS_H__ + +#include <gsl/gsl_vector.h> +#include <gsl/gsl_matrix.h> + +#include <gsl/gsl_blas_types.h> + + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* ======================================================================== + * Level 1 + * ======================================================================== + */ + +int gsl_blas_sdsdot (float alpha, + const gsl_vector_float * X, + const gsl_vector_float * Y, + float * result + ); + +int gsl_blas_dsdot (const gsl_vector_float * X, + const gsl_vector_float * Y, + double * result + ); + +int gsl_blas_sdot (const gsl_vector_float * X, + const gsl_vector_float * Y, + float * result + ); + +int gsl_blas_ddot (const gsl_vector * X, + const gsl_vector * Y, + double * result + ); + + +int gsl_blas_cdotu (const gsl_vector_complex_float * X, + const gsl_vector_complex_float * Y, + gsl_complex_float * dotu); + +int gsl_blas_cdotc (const gsl_vector_complex_float * X, + const gsl_vector_complex_float * Y, + gsl_complex_float * dotc); + +int gsl_blas_zdotu (const gsl_vector_complex * X, + const gsl_vector_complex * Y, + gsl_complex * dotu); + +int gsl_blas_zdotc (const gsl_vector_complex * X, + const gsl_vector_complex * Y, + gsl_complex * dotc); + + +float gsl_blas_snrm2 (const gsl_vector_float * X); +float gsl_blas_sasum (const gsl_vector_float * X); +double gsl_blas_dnrm2 (const gsl_vector * X); +double gsl_blas_dasum (const gsl_vector * X); +float gsl_blas_scnrm2 (const gsl_vector_complex_float * X); +float gsl_blas_scasum (const gsl_vector_complex_float * X); +double gsl_blas_dznrm2 (const gsl_vector_complex * X); +double gsl_blas_dzasum (const gsl_vector_complex * X); + + +CBLAS_INDEX_t gsl_blas_isamax (const gsl_vector_float * X); +CBLAS_INDEX_t gsl_blas_idamax (const gsl_vector * X); +CBLAS_INDEX_t gsl_blas_icamax (const gsl_vector_complex_float * X); +CBLAS_INDEX_t gsl_blas_izamax (const gsl_vector_complex * X); + + +int gsl_blas_sswap (gsl_vector_float * X, + gsl_vector_float * Y); + +int gsl_blas_scopy (const gsl_vector_float * X, + gsl_vector_float * Y); + +int gsl_blas_saxpy (float alpha, + const gsl_vector_float * X, + gsl_vector_float * Y); + +int gsl_blas_dswap (gsl_vector * X, + gsl_vector * Y); + +int gsl_blas_dcopy (const gsl_vector * X, + gsl_vector * Y); + +int gsl_blas_daxpy (double alpha, + const gsl_vector * X, + gsl_vector * Y); + +int gsl_blas_cswap (gsl_vector_complex_float * X, + gsl_vector_complex_float * Y); + +int gsl_blas_ccopy (const gsl_vector_complex_float * X, + gsl_vector_complex_float * Y); + +int gsl_blas_caxpy (const gsl_complex_float alpha, + const gsl_vector_complex_float * X, + gsl_vector_complex_float * Y); + +int gsl_blas_zswap (gsl_vector_complex * X, + gsl_vector_complex * Y); + +int gsl_blas_zcopy (const gsl_vector_complex * X, + gsl_vector_complex * Y); + +int gsl_blas_zaxpy (const gsl_complex alpha, + const gsl_vector_complex * X, + gsl_vector_complex * Y); + + +int gsl_blas_srotg (float a[], float b[], float c[], float s[]); + +int gsl_blas_srotmg (float d1[], float d2[], float b1[], float b2, float P[]); + +int gsl_blas_srot (gsl_vector_float * X, + gsl_vector_float * Y, + float c, float s); + +int gsl_blas_srotm (gsl_vector_float * X, + gsl_vector_float * Y, + const float P[]); + +int gsl_blas_drotg (double a[], double b[], double c[], double s[]); + +int gsl_blas_drotmg (double d1[], double d2[], double b1[], + double b2, double P[]); + +int gsl_blas_drot (gsl_vector * X, + gsl_vector * Y, + const double c, const double s); + +int gsl_blas_drotm (gsl_vector * X, + gsl_vector * Y, + const double P[]); + + +void gsl_blas_sscal (float alpha, gsl_vector_float * X); +void gsl_blas_dscal (double alpha, gsl_vector * X); +void gsl_blas_cscal (const gsl_complex_float alpha, gsl_vector_complex_float * X); +void gsl_blas_zscal (const gsl_complex alpha, gsl_vector_complex * X); +void gsl_blas_csscal (float alpha, gsl_vector_complex_float * X); +void gsl_blas_zdscal (double alpha, gsl_vector_complex * X); + + +/* =========================================================================== + * Level 2 + * =========================================================================== + */ + +/* + * Routines with standard 4 prefixes (S, D, C, Z) + */ +int gsl_blas_sgemv (CBLAS_TRANSPOSE_t TransA, + float alpha, + const gsl_matrix_float * A, + const gsl_vector_float * X, + float beta, + gsl_vector_float * Y); + +int gsl_blas_strmv (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, + const gsl_matrix_float * A, + gsl_vector_float * X); + +int gsl_blas_strsv (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, + const gsl_matrix_float * A, + gsl_vector_float * X); + +int gsl_blas_dgemv (CBLAS_TRANSPOSE_t TransA, + double alpha, + const gsl_matrix * A, + const gsl_vector * X, + double beta, + gsl_vector * Y); + +int gsl_blas_dtrmv (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, + const gsl_matrix * A, + gsl_vector * X); + +int gsl_blas_dtrsv (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, + const gsl_matrix * A, + gsl_vector * X); + +int gsl_blas_cgemv (CBLAS_TRANSPOSE_t TransA, + const gsl_complex_float alpha, + const gsl_matrix_complex_float * A, + const gsl_vector_complex_float * X, + const gsl_complex_float beta, + gsl_vector_complex_float * Y); + +int gsl_blas_ctrmv (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, + const gsl_matrix_complex_float * A, + gsl_vector_complex_float * X); + +int gsl_blas_ctrsv (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, + const gsl_matrix_complex_float * A, + gsl_vector_complex_float * X); + +int gsl_blas_zgemv (CBLAS_TRANSPOSE_t TransA, + const gsl_complex alpha, + const gsl_matrix_complex * A, + const gsl_vector_complex * X, + const gsl_complex beta, + gsl_vector_complex * Y); + +int gsl_blas_ztrmv (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, + const gsl_matrix_complex * A, + gsl_vector_complex * X); + +int gsl_blas_ztrsv (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, + const gsl_matrix_complex * A, + gsl_vector_complex *X); + +/* + * Routines with S and D prefixes only + */ +int gsl_blas_ssymv (CBLAS_UPLO_t Uplo, + float alpha, + const gsl_matrix_float * A, + const gsl_vector_float * X, + float beta, + gsl_vector_float * Y); + +int gsl_blas_sger (float alpha, + const gsl_vector_float * X, + const gsl_vector_float * Y, + gsl_matrix_float * A); + +int gsl_blas_ssyr (CBLAS_UPLO_t Uplo, + float alpha, + const gsl_vector_float * X, + gsl_matrix_float * A); + +int gsl_blas_ssyr2 (CBLAS_UPLO_t Uplo, + float alpha, + const gsl_vector_float * X, + const gsl_vector_float * Y, + gsl_matrix_float * A); + +int gsl_blas_dsymv (CBLAS_UPLO_t Uplo, + double alpha, + const gsl_matrix * A, + const gsl_vector * X, + double beta, + gsl_vector * Y); +int gsl_blas_dger (double alpha, + const gsl_vector * X, + const gsl_vector * Y, + gsl_matrix * A); + +int gsl_blas_dsyr (CBLAS_UPLO_t Uplo, + double alpha, + const gsl_vector * X, + gsl_matrix * A); + +int gsl_blas_dsyr2 (CBLAS_UPLO_t Uplo, + double alpha, + const gsl_vector * X, + const gsl_vector * Y, + gsl_matrix * A); + +/* + * Routines with C and Z prefixes only + */ + +int gsl_blas_chemv (CBLAS_UPLO_t Uplo, + const gsl_complex_float alpha, + const gsl_matrix_complex_float * A, + const gsl_vector_complex_float * X, + const gsl_complex_float beta, + gsl_vector_complex_float * Y); + +int gsl_blas_cgeru (const gsl_complex_float alpha, + const gsl_vector_complex_float * X, + const gsl_vector_complex_float * Y, + gsl_matrix_complex_float * A); + +int gsl_blas_cgerc (const gsl_complex_float alpha, + const gsl_vector_complex_float * X, + const gsl_vector_complex_float * Y, + gsl_matrix_complex_float * A); + +int gsl_blas_cher (CBLAS_UPLO_t Uplo, + float alpha, + const gsl_vector_complex_float * X, + gsl_matrix_complex_float * A); + +int gsl_blas_cher2 (CBLAS_UPLO_t Uplo, + const gsl_complex_float alpha, + const gsl_vector_complex_float * X, + const gsl_vector_complex_float * Y, + gsl_matrix_complex_float * A); + +int gsl_blas_zhemv (CBLAS_UPLO_t Uplo, + const gsl_complex alpha, + const gsl_matrix_complex * A, + const gsl_vector_complex * X, + const gsl_complex beta, + gsl_vector_complex * Y); + +int gsl_blas_zgeru (const gsl_complex alpha, + const gsl_vector_complex * X, + const gsl_vector_complex * Y, + gsl_matrix_complex * A); + +int gsl_blas_zgerc (const gsl_complex alpha, + const gsl_vector_complex * X, + const gsl_vector_complex * Y, + gsl_matrix_complex * A); + +int gsl_blas_zher (CBLAS_UPLO_t Uplo, + double alpha, + const gsl_vector_complex * X, + gsl_matrix_complex * A); + +int gsl_blas_zher2 (CBLAS_UPLO_t Uplo, + const gsl_complex alpha, + const gsl_vector_complex * X, + const gsl_vector_complex * Y, + gsl_matrix_complex * A); + +/* + * =========================================================================== + * Prototypes for level 3 BLAS + * =========================================================================== + */ + +/* + * Routines with standard 4 prefixes (S, D, C, Z) + */ +int gsl_blas_sgemm (CBLAS_TRANSPOSE_t TransA, + CBLAS_TRANSPOSE_t TransB, + float alpha, + const gsl_matrix_float * A, + const gsl_matrix_float * B, + float beta, + gsl_matrix_float * C); + +int gsl_blas_ssymm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, + float alpha, + const gsl_matrix_float * A, + const gsl_matrix_float * B, + float beta, + gsl_matrix_float * C); + +int gsl_blas_ssyrk (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, + float alpha, + const gsl_matrix_float * A, + float beta, + gsl_matrix_float * C); + +int gsl_blas_ssyr2k (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, + float alpha, + const gsl_matrix_float * A, + const gsl_matrix_float * B, + float beta, + gsl_matrix_float * C); + +int gsl_blas_strmm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, + CBLAS_DIAG_t Diag, + float alpha, + const gsl_matrix_float * A, + gsl_matrix_float * B); + +int gsl_blas_strsm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, + CBLAS_DIAG_t Diag, + float alpha, + const gsl_matrix_float * A, + gsl_matrix_float * B); + +int gsl_blas_dgemm (CBLAS_TRANSPOSE_t TransA, + CBLAS_TRANSPOSE_t TransB, + double alpha, + const gsl_matrix * A, + const gsl_matrix * B, + double beta, + gsl_matrix * C); + +int gsl_blas_dsymm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, + double alpha, + const gsl_matrix * A, + const gsl_matrix * B, + double beta, + gsl_matrix * C); + +int gsl_blas_dsyrk (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t Trans, + double alpha, + const gsl_matrix * A, + double beta, + gsl_matrix * C); + +int gsl_blas_dsyr2k (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t Trans, + double alpha, + const gsl_matrix * A, + const gsl_matrix * B, + double beta, + gsl_matrix * C); + +int gsl_blas_dtrmm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, + CBLAS_DIAG_t Diag, + double alpha, + const gsl_matrix * A, + gsl_matrix * B); + +int gsl_blas_dtrsm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, + CBLAS_DIAG_t Diag, + double alpha, + const gsl_matrix * A, + gsl_matrix * B); + +int gsl_blas_cgemm (CBLAS_TRANSPOSE_t TransA, + CBLAS_TRANSPOSE_t TransB, + const gsl_complex_float alpha, + const gsl_matrix_complex_float * A, + const gsl_matrix_complex_float * B, + const gsl_complex_float beta, + gsl_matrix_complex_float * C); + +int gsl_blas_csymm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, + const gsl_complex_float alpha, + const gsl_matrix_complex_float * A, + const gsl_matrix_complex_float * B, + const gsl_complex_float beta, + gsl_matrix_complex_float * C); + +int gsl_blas_csyrk (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t Trans, + const gsl_complex_float alpha, + const gsl_matrix_complex_float * A, + const gsl_complex_float beta, + gsl_matrix_complex_float * C); + +int gsl_blas_csyr2k (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t Trans, + const gsl_complex_float alpha, + const gsl_matrix_complex_float * A, + const gsl_matrix_complex_float * B, + const gsl_complex_float beta, + gsl_matrix_complex_float * C); + +int gsl_blas_ctrmm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, + CBLAS_DIAG_t Diag, + const gsl_complex_float alpha, + const gsl_matrix_complex_float * A, + gsl_matrix_complex_float * B); + +int gsl_blas_ctrsm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, + CBLAS_DIAG_t Diag, + const gsl_complex_float alpha, + const gsl_matrix_complex_float * A, + gsl_matrix_complex_float * B); + +int gsl_blas_zgemm (CBLAS_TRANSPOSE_t TransA, + CBLAS_TRANSPOSE_t TransB, + const gsl_complex alpha, + const gsl_matrix_complex * A, + const gsl_matrix_complex * B, + const gsl_complex beta, + gsl_matrix_complex * C); + +int gsl_blas_zsymm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, + const gsl_complex alpha, + const gsl_matrix_complex * A, + const gsl_matrix_complex * B, + const gsl_complex beta, + gsl_matrix_complex * C); + +int gsl_blas_zsyrk (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t Trans, + const gsl_complex alpha, + const gsl_matrix_complex * A, + const gsl_complex beta, + gsl_matrix_complex * C); + +int gsl_blas_zsyr2k (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t Trans, + const gsl_complex alpha, + const gsl_matrix_complex * A, + const gsl_matrix_complex * B, + const gsl_complex beta, + gsl_matrix_complex *C); + +int gsl_blas_ztrmm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, + CBLAS_DIAG_t Diag, + const gsl_complex alpha, + const gsl_matrix_complex * A, + gsl_matrix_complex * B); + +int gsl_blas_ztrsm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, + CBLAS_DIAG_t Diag, + const gsl_complex alpha, + const gsl_matrix_complex * A, + gsl_matrix_complex * B); + +/* + * Routines with prefixes C and Z only + */ +int gsl_blas_chemm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, + const gsl_complex_float alpha, + const gsl_matrix_complex_float * A, + const gsl_matrix_complex_float * B, + const gsl_complex_float beta, + gsl_matrix_complex_float * C); + +int gsl_blas_cherk (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t Trans, + float alpha, + const gsl_matrix_complex_float * A, + float beta, + gsl_matrix_complex_float * C); + +int gsl_blas_cher2k (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t Trans, + const gsl_complex_float alpha, + const gsl_matrix_complex_float * A, + const gsl_matrix_complex_float * B, + float beta, + gsl_matrix_complex_float * C); + +int gsl_blas_zhemm (CBLAS_SIDE_t Side, + CBLAS_UPLO_t Uplo, + const gsl_complex alpha, + const gsl_matrix_complex * A, + const gsl_matrix_complex * B, + const gsl_complex beta, + gsl_matrix_complex * C); + +int gsl_blas_zherk (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t Trans, + double alpha, + const gsl_matrix_complex * A, + double beta, + gsl_matrix_complex * C); + +int gsl_blas_zher2k (CBLAS_UPLO_t Uplo, + CBLAS_TRANSPOSE_t Trans, + const gsl_complex alpha, + const gsl_matrix_complex * A, + const gsl_matrix_complex * B, + double beta, + gsl_matrix_complex * C); + + +__END_DECLS + +#endif /* __GSL_BLAS_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_blas_types.h b/dtm_release/local/include/gsl/gsl_blas_types.h new file mode 100644 index 0000000000000000000000000000000000000000..923edb310e4a62de3abdc9531f78fbe272536bae --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_blas_types.h @@ -0,0 +1,54 @@ +/* blas/gsl_blas_types.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* + * Author: G. Jungman + */ +/* Based on draft BLAST C interface specification [Jul 7 1998] + */ +#ifndef __GSL_BLAS_TYPES_H__ +#define __GSL_BLAS_TYPES_H__ + +#include <gsl/gsl_cblas.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef CBLAS_INDEX CBLAS_INDEX_t; +typedef enum CBLAS_ORDER CBLAS_ORDER_t; +typedef enum CBLAS_TRANSPOSE CBLAS_TRANSPOSE_t; +typedef enum CBLAS_UPLO CBLAS_UPLO_t; +typedef enum CBLAS_DIAG CBLAS_DIAG_t; +typedef enum CBLAS_SIDE CBLAS_SIDE_t; + +/* typedef gsl_complex COMPLEX; */ + +__END_DECLS + + +#endif /* __GSL_BLAS_TYPES_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_block.h b/dtm_release/local/include/gsl/gsl_block.h new file mode 100644 index 0000000000000000000000000000000000000000..f1f9ef87e2a9e1f7e06ee67e787599341752a0ab --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_block.h @@ -0,0 +1,24 @@ +#ifndef __GSL_BLOCK_H__ +#define __GSL_BLOCK_H__ + +#include <gsl/gsl_block_complex_long_double.h> +#include <gsl/gsl_block_complex_double.h> +#include <gsl/gsl_block_complex_float.h> + +#include <gsl/gsl_block_long_double.h> +#include <gsl/gsl_block_double.h> +#include <gsl/gsl_block_float.h> + +#include <gsl/gsl_block_ulong.h> +#include <gsl/gsl_block_long.h> + +#include <gsl/gsl_block_uint.h> +#include <gsl/gsl_block_int.h> + +#include <gsl/gsl_block_ushort.h> +#include <gsl/gsl_block_short.h> + +#include <gsl/gsl_block_uchar.h> +#include <gsl/gsl_block_char.h> + +#endif /* __GSL_BLOCK_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_block_char.h b/dtm_release/local/include/gsl/gsl_block_char.h new file mode 100644 index 0000000000000000000000000000000000000000..70bf969fe3ffd8be092085cd4e33365cd7b1987b --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_block_char.h @@ -0,0 +1,65 @@ +/* block/gsl_block_char.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_CHAR_H__ +#define __GSL_BLOCK_CHAR_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_char_struct +{ + size_t size; + char *data; +}; + +typedef struct gsl_block_char_struct gsl_block_char; + +gsl_block_char *gsl_block_char_alloc (const size_t n); +gsl_block_char *gsl_block_char_calloc (const size_t n); +void gsl_block_char_free (gsl_block_char * b); + +int gsl_block_char_fread (FILE * stream, gsl_block_char * b); +int gsl_block_char_fwrite (FILE * stream, const gsl_block_char * b); +int gsl_block_char_fscanf (FILE * stream, gsl_block_char * b); +int gsl_block_char_fprintf (FILE * stream, const gsl_block_char * b, const char *format); + +int gsl_block_char_raw_fread (FILE * stream, char * b, const size_t n, const size_t stride); +int gsl_block_char_raw_fwrite (FILE * stream, const char * b, const size_t n, const size_t stride); +int gsl_block_char_raw_fscanf (FILE * stream, char * b, const size_t n, const size_t stride); +int gsl_block_char_raw_fprintf (FILE * stream, const char * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_char_size (const gsl_block_char * b); +char * gsl_block_char_data (const gsl_block_char * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_CHAR_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_block_complex_double.h b/dtm_release/local/include/gsl/gsl_block_complex_double.h new file mode 100644 index 0000000000000000000000000000000000000000..bcf66c08aac088095af4895ca4703fd7dd998705 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_block_complex_double.h @@ -0,0 +1,65 @@ +/* block/gsl_block_complex_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_COMPLEX_DOUBLE_H__ +#define __GSL_BLOCK_COMPLEX_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_complex_struct +{ + size_t size; + double *data; +}; + +typedef struct gsl_block_complex_struct gsl_block_complex; + +gsl_block_complex *gsl_block_complex_alloc (const size_t n); +gsl_block_complex *gsl_block_complex_calloc (const size_t n); +void gsl_block_complex_free (gsl_block_complex * b); + +int gsl_block_complex_fread (FILE * stream, gsl_block_complex * b); +int gsl_block_complex_fwrite (FILE * stream, const gsl_block_complex * b); +int gsl_block_complex_fscanf (FILE * stream, gsl_block_complex * b); +int gsl_block_complex_fprintf (FILE * stream, const gsl_block_complex * b, const char *format); + +int gsl_block_complex_raw_fread (FILE * stream, double * b, const size_t n, const size_t stride); +int gsl_block_complex_raw_fwrite (FILE * stream, const double * b, const size_t n, const size_t stride); +int gsl_block_complex_raw_fscanf (FILE * stream, double * b, const size_t n, const size_t stride); +int gsl_block_complex_raw_fprintf (FILE * stream, const double * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_complex_size (const gsl_block_complex * b); +double * gsl_block_complex_data (const gsl_block_complex * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_COMPLEX_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_block_complex_float.h b/dtm_release/local/include/gsl/gsl_block_complex_float.h new file mode 100644 index 0000000000000000000000000000000000000000..03595dc9f176417935ced4d9457f91c9a28c2130 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_block_complex_float.h @@ -0,0 +1,65 @@ +/* block/gsl_block_complex_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_COMPLEX_FLOAT_H__ +#define __GSL_BLOCK_COMPLEX_FLOAT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_complex_float_struct +{ + size_t size; + float *data; +}; + +typedef struct gsl_block_complex_float_struct gsl_block_complex_float; + +gsl_block_complex_float *gsl_block_complex_float_alloc (const size_t n); +gsl_block_complex_float *gsl_block_complex_float_calloc (const size_t n); +void gsl_block_complex_float_free (gsl_block_complex_float * b); + +int gsl_block_complex_float_fread (FILE * stream, gsl_block_complex_float * b); +int gsl_block_complex_float_fwrite (FILE * stream, const gsl_block_complex_float * b); +int gsl_block_complex_float_fscanf (FILE * stream, gsl_block_complex_float * b); +int gsl_block_complex_float_fprintf (FILE * stream, const gsl_block_complex_float * b, const char *format); + +int gsl_block_complex_float_raw_fread (FILE * stream, float * b, const size_t n, const size_t stride); +int gsl_block_complex_float_raw_fwrite (FILE * stream, const float * b, const size_t n, const size_t stride); +int gsl_block_complex_float_raw_fscanf (FILE * stream, float * b, const size_t n, const size_t stride); +int gsl_block_complex_float_raw_fprintf (FILE * stream, const float * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_complex_float_size (const gsl_block_complex_float * b); +float * gsl_block_complex_float_data (const gsl_block_complex_float * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_COMPLEX_FLOAT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_block_complex_long_double.h b/dtm_release/local/include/gsl/gsl_block_complex_long_double.h new file mode 100644 index 0000000000000000000000000000000000000000..eb0c60515db5866c000a1503918211c77f5c5b4b --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_block_complex_long_double.h @@ -0,0 +1,65 @@ +/* block/gsl_block_complex_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_COMPLEX_LONG_DOUBLE_H__ +#define __GSL_BLOCK_COMPLEX_LONG_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_complex_long_double_struct +{ + size_t size; + long double *data; +}; + +typedef struct gsl_block_complex_long_double_struct gsl_block_complex_long_double; + +gsl_block_complex_long_double *gsl_block_complex_long_double_alloc (const size_t n); +gsl_block_complex_long_double *gsl_block_complex_long_double_calloc (const size_t n); +void gsl_block_complex_long_double_free (gsl_block_complex_long_double * b); + +int gsl_block_complex_long_double_fread (FILE * stream, gsl_block_complex_long_double * b); +int gsl_block_complex_long_double_fwrite (FILE * stream, const gsl_block_complex_long_double * b); +int gsl_block_complex_long_double_fscanf (FILE * stream, gsl_block_complex_long_double * b); +int gsl_block_complex_long_double_fprintf (FILE * stream, const gsl_block_complex_long_double * b, const char *format); + +int gsl_block_complex_long_double_raw_fread (FILE * stream, long double * b, const size_t n, const size_t stride); +int gsl_block_complex_long_double_raw_fwrite (FILE * stream, const long double * b, const size_t n, const size_t stride); +int gsl_block_complex_long_double_raw_fscanf (FILE * stream, long double * b, const size_t n, const size_t stride); +int gsl_block_complex_long_double_raw_fprintf (FILE * stream, const long double * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_complex_long_double_size (const gsl_block_complex_long_double * b); +long double * gsl_block_complex_long_double_data (const gsl_block_complex_long_double * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_COMPLEX_LONG_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_block_double.h b/dtm_release/local/include/gsl/gsl_block_double.h new file mode 100644 index 0000000000000000000000000000000000000000..3a95f4d56e0637e9435785918a726c7c7865e127 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_block_double.h @@ -0,0 +1,65 @@ +/* block/gsl_block_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_DOUBLE_H__ +#define __GSL_BLOCK_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_struct +{ + size_t size; + double *data; +}; + +typedef struct gsl_block_struct gsl_block; + +gsl_block *gsl_block_alloc (const size_t n); +gsl_block *gsl_block_calloc (const size_t n); +void gsl_block_free (gsl_block * b); + +int gsl_block_fread (FILE * stream, gsl_block * b); +int gsl_block_fwrite (FILE * stream, const gsl_block * b); +int gsl_block_fscanf (FILE * stream, gsl_block * b); +int gsl_block_fprintf (FILE * stream, const gsl_block * b, const char *format); + +int gsl_block_raw_fread (FILE * stream, double * b, const size_t n, const size_t stride); +int gsl_block_raw_fwrite (FILE * stream, const double * b, const size_t n, const size_t stride); +int gsl_block_raw_fscanf (FILE * stream, double * b, const size_t n, const size_t stride); +int gsl_block_raw_fprintf (FILE * stream, const double * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_size (const gsl_block * b); +double * gsl_block_data (const gsl_block * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_block_float.h b/dtm_release/local/include/gsl/gsl_block_float.h new file mode 100644 index 0000000000000000000000000000000000000000..f1c3fb35f1d36532db3a9af6ca6972807c722df6 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_block_float.h @@ -0,0 +1,65 @@ +/* block/gsl_block_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_FLOAT_H__ +#define __GSL_BLOCK_FLOAT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_float_struct +{ + size_t size; + float *data; +}; + +typedef struct gsl_block_float_struct gsl_block_float; + +gsl_block_float *gsl_block_float_alloc (const size_t n); +gsl_block_float *gsl_block_float_calloc (const size_t n); +void gsl_block_float_free (gsl_block_float * b); + +int gsl_block_float_fread (FILE * stream, gsl_block_float * b); +int gsl_block_float_fwrite (FILE * stream, const gsl_block_float * b); +int gsl_block_float_fscanf (FILE * stream, gsl_block_float * b); +int gsl_block_float_fprintf (FILE * stream, const gsl_block_float * b, const char *format); + +int gsl_block_float_raw_fread (FILE * stream, float * b, const size_t n, const size_t stride); +int gsl_block_float_raw_fwrite (FILE * stream, const float * b, const size_t n, const size_t stride); +int gsl_block_float_raw_fscanf (FILE * stream, float * b, const size_t n, const size_t stride); +int gsl_block_float_raw_fprintf (FILE * stream, const float * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_float_size (const gsl_block_float * b); +float * gsl_block_float_data (const gsl_block_float * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_FLOAT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_block_int.h b/dtm_release/local/include/gsl/gsl_block_int.h new file mode 100644 index 0000000000000000000000000000000000000000..2213f4701e8a45ee1953de27da41d5ce7d62b1dd --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_block_int.h @@ -0,0 +1,65 @@ +/* block/gsl_block_int.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_INT_H__ +#define __GSL_BLOCK_INT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_int_struct +{ + size_t size; + int *data; +}; + +typedef struct gsl_block_int_struct gsl_block_int; + +gsl_block_int *gsl_block_int_alloc (const size_t n); +gsl_block_int *gsl_block_int_calloc (const size_t n); +void gsl_block_int_free (gsl_block_int * b); + +int gsl_block_int_fread (FILE * stream, gsl_block_int * b); +int gsl_block_int_fwrite (FILE * stream, const gsl_block_int * b); +int gsl_block_int_fscanf (FILE * stream, gsl_block_int * b); +int gsl_block_int_fprintf (FILE * stream, const gsl_block_int * b, const char *format); + +int gsl_block_int_raw_fread (FILE * stream, int * b, const size_t n, const size_t stride); +int gsl_block_int_raw_fwrite (FILE * stream, const int * b, const size_t n, const size_t stride); +int gsl_block_int_raw_fscanf (FILE * stream, int * b, const size_t n, const size_t stride); +int gsl_block_int_raw_fprintf (FILE * stream, const int * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_int_size (const gsl_block_int * b); +int * gsl_block_int_data (const gsl_block_int * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_INT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_block_long.h b/dtm_release/local/include/gsl/gsl_block_long.h new file mode 100644 index 0000000000000000000000000000000000000000..0c30aa5e4e4f7976e1024828a571aff17f828d04 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_block_long.h @@ -0,0 +1,65 @@ +/* block/gsl_block_long.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_LONG_H__ +#define __GSL_BLOCK_LONG_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_long_struct +{ + size_t size; + long *data; +}; + +typedef struct gsl_block_long_struct gsl_block_long; + +gsl_block_long *gsl_block_long_alloc (const size_t n); +gsl_block_long *gsl_block_long_calloc (const size_t n); +void gsl_block_long_free (gsl_block_long * b); + +int gsl_block_long_fread (FILE * stream, gsl_block_long * b); +int gsl_block_long_fwrite (FILE * stream, const gsl_block_long * b); +int gsl_block_long_fscanf (FILE * stream, gsl_block_long * b); +int gsl_block_long_fprintf (FILE * stream, const gsl_block_long * b, const char *format); + +int gsl_block_long_raw_fread (FILE * stream, long * b, const size_t n, const size_t stride); +int gsl_block_long_raw_fwrite (FILE * stream, const long * b, const size_t n, const size_t stride); +int gsl_block_long_raw_fscanf (FILE * stream, long * b, const size_t n, const size_t stride); +int gsl_block_long_raw_fprintf (FILE * stream, const long * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_long_size (const gsl_block_long * b); +long * gsl_block_long_data (const gsl_block_long * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_LONG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_block_long_double.h b/dtm_release/local/include/gsl/gsl_block_long_double.h new file mode 100644 index 0000000000000000000000000000000000000000..639cd815054fb023c75d937265488908dc97d729 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_block_long_double.h @@ -0,0 +1,65 @@ +/* block/gsl_block_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_LONG_DOUBLE_H__ +#define __GSL_BLOCK_LONG_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_long_double_struct +{ + size_t size; + long double *data; +}; + +typedef struct gsl_block_long_double_struct gsl_block_long_double; + +gsl_block_long_double *gsl_block_long_double_alloc (const size_t n); +gsl_block_long_double *gsl_block_long_double_calloc (const size_t n); +void gsl_block_long_double_free (gsl_block_long_double * b); + +int gsl_block_long_double_fread (FILE * stream, gsl_block_long_double * b); +int gsl_block_long_double_fwrite (FILE * stream, const gsl_block_long_double * b); +int gsl_block_long_double_fscanf (FILE * stream, gsl_block_long_double * b); +int gsl_block_long_double_fprintf (FILE * stream, const gsl_block_long_double * b, const char *format); + +int gsl_block_long_double_raw_fread (FILE * stream, long double * b, const size_t n, const size_t stride); +int gsl_block_long_double_raw_fwrite (FILE * stream, const long double * b, const size_t n, const size_t stride); +int gsl_block_long_double_raw_fscanf (FILE * stream, long double * b, const size_t n, const size_t stride); +int gsl_block_long_double_raw_fprintf (FILE * stream, const long double * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_long_double_size (const gsl_block_long_double * b); +long double * gsl_block_long_double_data (const gsl_block_long_double * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_LONG_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_block_short.h b/dtm_release/local/include/gsl/gsl_block_short.h new file mode 100644 index 0000000000000000000000000000000000000000..97447755c90f50039355e0083611ca1177f4c1b9 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_block_short.h @@ -0,0 +1,65 @@ +/* block/gsl_block_short.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_SHORT_H__ +#define __GSL_BLOCK_SHORT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_short_struct +{ + size_t size; + short *data; +}; + +typedef struct gsl_block_short_struct gsl_block_short; + +gsl_block_short *gsl_block_short_alloc (const size_t n); +gsl_block_short *gsl_block_short_calloc (const size_t n); +void gsl_block_short_free (gsl_block_short * b); + +int gsl_block_short_fread (FILE * stream, gsl_block_short * b); +int gsl_block_short_fwrite (FILE * stream, const gsl_block_short * b); +int gsl_block_short_fscanf (FILE * stream, gsl_block_short * b); +int gsl_block_short_fprintf (FILE * stream, const gsl_block_short * b, const char *format); + +int gsl_block_short_raw_fread (FILE * stream, short * b, const size_t n, const size_t stride); +int gsl_block_short_raw_fwrite (FILE * stream, const short * b, const size_t n, const size_t stride); +int gsl_block_short_raw_fscanf (FILE * stream, short * b, const size_t n, const size_t stride); +int gsl_block_short_raw_fprintf (FILE * stream, const short * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_short_size (const gsl_block_short * b); +short * gsl_block_short_data (const gsl_block_short * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_SHORT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_block_uchar.h b/dtm_release/local/include/gsl/gsl_block_uchar.h new file mode 100644 index 0000000000000000000000000000000000000000..58cf789dc02c40f92cafc5b91430b606d604b5d9 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_block_uchar.h @@ -0,0 +1,65 @@ +/* block/gsl_block_uchar.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_UCHAR_H__ +#define __GSL_BLOCK_UCHAR_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_uchar_struct +{ + size_t size; + unsigned char *data; +}; + +typedef struct gsl_block_uchar_struct gsl_block_uchar; + +gsl_block_uchar *gsl_block_uchar_alloc (const size_t n); +gsl_block_uchar *gsl_block_uchar_calloc (const size_t n); +void gsl_block_uchar_free (gsl_block_uchar * b); + +int gsl_block_uchar_fread (FILE * stream, gsl_block_uchar * b); +int gsl_block_uchar_fwrite (FILE * stream, const gsl_block_uchar * b); +int gsl_block_uchar_fscanf (FILE * stream, gsl_block_uchar * b); +int gsl_block_uchar_fprintf (FILE * stream, const gsl_block_uchar * b, const char *format); + +int gsl_block_uchar_raw_fread (FILE * stream, unsigned char * b, const size_t n, const size_t stride); +int gsl_block_uchar_raw_fwrite (FILE * stream, const unsigned char * b, const size_t n, const size_t stride); +int gsl_block_uchar_raw_fscanf (FILE * stream, unsigned char * b, const size_t n, const size_t stride); +int gsl_block_uchar_raw_fprintf (FILE * stream, const unsigned char * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_uchar_size (const gsl_block_uchar * b); +unsigned char * gsl_block_uchar_data (const gsl_block_uchar * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_UCHAR_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_block_uint.h b/dtm_release/local/include/gsl/gsl_block_uint.h new file mode 100644 index 0000000000000000000000000000000000000000..52cf2cbecd8854150e6389b0c1ea5f6f629e36e7 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_block_uint.h @@ -0,0 +1,65 @@ +/* block/gsl_block_uint.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_UINT_H__ +#define __GSL_BLOCK_UINT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_uint_struct +{ + size_t size; + unsigned int *data; +}; + +typedef struct gsl_block_uint_struct gsl_block_uint; + +gsl_block_uint *gsl_block_uint_alloc (const size_t n); +gsl_block_uint *gsl_block_uint_calloc (const size_t n); +void gsl_block_uint_free (gsl_block_uint * b); + +int gsl_block_uint_fread (FILE * stream, gsl_block_uint * b); +int gsl_block_uint_fwrite (FILE * stream, const gsl_block_uint * b); +int gsl_block_uint_fscanf (FILE * stream, gsl_block_uint * b); +int gsl_block_uint_fprintf (FILE * stream, const gsl_block_uint * b, const char *format); + +int gsl_block_uint_raw_fread (FILE * stream, unsigned int * b, const size_t n, const size_t stride); +int gsl_block_uint_raw_fwrite (FILE * stream, const unsigned int * b, const size_t n, const size_t stride); +int gsl_block_uint_raw_fscanf (FILE * stream, unsigned int * b, const size_t n, const size_t stride); +int gsl_block_uint_raw_fprintf (FILE * stream, const unsigned int * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_uint_size (const gsl_block_uint * b); +unsigned int * gsl_block_uint_data (const gsl_block_uint * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_UINT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_block_ulong.h b/dtm_release/local/include/gsl/gsl_block_ulong.h new file mode 100644 index 0000000000000000000000000000000000000000..863ff47599ec0d16fb416460e5504dae852cdd5d --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_block_ulong.h @@ -0,0 +1,65 @@ +/* block/gsl_block_ulong.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_ULONG_H__ +#define __GSL_BLOCK_ULONG_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_ulong_struct +{ + size_t size; + unsigned long *data; +}; + +typedef struct gsl_block_ulong_struct gsl_block_ulong; + +gsl_block_ulong *gsl_block_ulong_alloc (const size_t n); +gsl_block_ulong *gsl_block_ulong_calloc (const size_t n); +void gsl_block_ulong_free (gsl_block_ulong * b); + +int gsl_block_ulong_fread (FILE * stream, gsl_block_ulong * b); +int gsl_block_ulong_fwrite (FILE * stream, const gsl_block_ulong * b); +int gsl_block_ulong_fscanf (FILE * stream, gsl_block_ulong * b); +int gsl_block_ulong_fprintf (FILE * stream, const gsl_block_ulong * b, const char *format); + +int gsl_block_ulong_raw_fread (FILE * stream, unsigned long * b, const size_t n, const size_t stride); +int gsl_block_ulong_raw_fwrite (FILE * stream, const unsigned long * b, const size_t n, const size_t stride); +int gsl_block_ulong_raw_fscanf (FILE * stream, unsigned long * b, const size_t n, const size_t stride); +int gsl_block_ulong_raw_fprintf (FILE * stream, const unsigned long * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_ulong_size (const gsl_block_ulong * b); +unsigned long * gsl_block_ulong_data (const gsl_block_ulong * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_ULONG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_block_ushort.h b/dtm_release/local/include/gsl/gsl_block_ushort.h new file mode 100644 index 0000000000000000000000000000000000000000..24ad7dbff815cc3c6d90d4b13fd198dd3d02b8ab --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_block_ushort.h @@ -0,0 +1,65 @@ +/* block/gsl_block_ushort.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BLOCK_USHORT_H__ +#define __GSL_BLOCK_USHORT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_block_ushort_struct +{ + size_t size; + unsigned short *data; +}; + +typedef struct gsl_block_ushort_struct gsl_block_ushort; + +gsl_block_ushort *gsl_block_ushort_alloc (const size_t n); +gsl_block_ushort *gsl_block_ushort_calloc (const size_t n); +void gsl_block_ushort_free (gsl_block_ushort * b); + +int gsl_block_ushort_fread (FILE * stream, gsl_block_ushort * b); +int gsl_block_ushort_fwrite (FILE * stream, const gsl_block_ushort * b); +int gsl_block_ushort_fscanf (FILE * stream, gsl_block_ushort * b); +int gsl_block_ushort_fprintf (FILE * stream, const gsl_block_ushort * b, const char *format); + +int gsl_block_ushort_raw_fread (FILE * stream, unsigned short * b, const size_t n, const size_t stride); +int gsl_block_ushort_raw_fwrite (FILE * stream, const unsigned short * b, const size_t n, const size_t stride); +int gsl_block_ushort_raw_fscanf (FILE * stream, unsigned short * b, const size_t n, const size_t stride); +int gsl_block_ushort_raw_fprintf (FILE * stream, const unsigned short * b, const size_t n, const size_t stride, const char *format); + +size_t gsl_block_ushort_size (const gsl_block_ushort * b); +unsigned short * gsl_block_ushort_data (const gsl_block_ushort * b); + +__END_DECLS + +#endif /* __GSL_BLOCK_USHORT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_bspline.h b/dtm_release/local/include/gsl/gsl_bspline.h new file mode 100644 index 0000000000000000000000000000000000000000..0a1b24834607cf72c4b39cf49fb67712920b5d0b --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_bspline.h @@ -0,0 +1,75 @@ +/* bspline/gsl_bspline.h + * + * Copyright (C) 2006 Patrick Alken + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_BSPLINE_H__ +#define __GSL_BSPLINE_H__ + +#include <stdlib.h> +#include <gsl/gsl_math.h> +#include <gsl/gsl_vector.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t k; /* spline order */ + size_t km1; /* k - 1 (polynomial order) */ + size_t l; /* number of polynomial pieces on interval */ + size_t nbreak; /* number of breakpoints (l + 1) */ + size_t n; /* number of bspline basis functions (l + k - 1) */ + + gsl_vector *knots; /* knots vector */ + gsl_vector *deltal; /* left delta */ + gsl_vector *deltar; /* right delta */ + gsl_vector *B; /* temporary spline results */ +} gsl_bspline_workspace; + +gsl_bspline_workspace * +gsl_bspline_alloc(const size_t k, const size_t nbreak); + +void gsl_bspline_free(gsl_bspline_workspace *w); + +size_t gsl_bspline_ncoeffs (gsl_bspline_workspace * w); +size_t gsl_bspline_order (gsl_bspline_workspace * w); +size_t gsl_bspline_nbreak (gsl_bspline_workspace * w); +double gsl_bspline_breakpoint (size_t i, gsl_bspline_workspace * w); + +int +gsl_bspline_knots(const gsl_vector *breakpts, gsl_bspline_workspace *w); + +int gsl_bspline_knots_uniform(const double a, const double b, + gsl_bspline_workspace *w); + +int +gsl_bspline_eval(const double x, gsl_vector *B, + gsl_bspline_workspace *w); + +__END_DECLS + +#endif /* __GSL_BSPLINE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_cblas.h b/dtm_release/local/include/gsl/gsl_cblas.h new file mode 100644 index 0000000000000000000000000000000000000000..e90e3b0376f03f384608e91f1afecda69b710c39 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_cblas.h @@ -0,0 +1,606 @@ +/* blas/gsl_cblas.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* This is a copy of the CBLAS standard header. + * We carry this around so we do not have to + * break our model for flexible BLAS functionality. + */ + +#ifndef __GSL_CBLAS_H__ +#define __GSL_CBLAS_H__ +#include <stddef.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS } +#else +#define __BEGIN_DECLS /* empty */ +#define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* + * Enumerated and derived types + */ +#define CBLAS_INDEX size_t /* this may vary between platforms */ + +enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102}; +enum CBLAS_TRANSPOSE {CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113}; +enum CBLAS_UPLO {CblasUpper=121, CblasLower=122}; +enum CBLAS_DIAG {CblasNonUnit=131, CblasUnit=132}; +enum CBLAS_SIDE {CblasLeft=141, CblasRight=142}; + +/* + * =========================================================================== + * Prototypes for level 1 BLAS functions (complex are recast as routines) + * =========================================================================== + */ +float cblas_sdsdot(const int N, const float alpha, const float *X, + const int incX, const float *Y, const int incY); +double cblas_dsdot(const int N, const float *X, const int incX, const float *Y, + const int incY); +float cblas_sdot(const int N, const float *X, const int incX, + const float *Y, const int incY); +double cblas_ddot(const int N, const double *X, const int incX, + const double *Y, const int incY); + +/* + * Functions having prefixes Z and C only + */ +void cblas_cdotu_sub(const int N, const void *X, const int incX, + const void *Y, const int incY, void *dotu); +void cblas_cdotc_sub(const int N, const void *X, const int incX, + const void *Y, const int incY, void *dotc); + +void cblas_zdotu_sub(const int N, const void *X, const int incX, + const void *Y, const int incY, void *dotu); +void cblas_zdotc_sub(const int N, const void *X, const int incX, + const void *Y, const int incY, void *dotc); + + +/* + * Functions having prefixes S D SC DZ + */ +float cblas_snrm2(const int N, const float *X, const int incX); +float cblas_sasum(const int N, const float *X, const int incX); + +double cblas_dnrm2(const int N, const double *X, const int incX); +double cblas_dasum(const int N, const double *X, const int incX); + +float cblas_scnrm2(const int N, const void *X, const int incX); +float cblas_scasum(const int N, const void *X, const int incX); + +double cblas_dznrm2(const int N, const void *X, const int incX); +double cblas_dzasum(const int N, const void *X, const int incX); + + +/* + * Functions having standard 4 prefixes (S D C Z) + */ +CBLAS_INDEX cblas_isamax(const int N, const float *X, const int incX); +CBLAS_INDEX cblas_idamax(const int N, const double *X, const int incX); +CBLAS_INDEX cblas_icamax(const int N, const void *X, const int incX); +CBLAS_INDEX cblas_izamax(const int N, const void *X, const int incX); + +/* + * =========================================================================== + * Prototypes for level 1 BLAS routines + * =========================================================================== + */ + +/* + * Routines with standard 4 prefixes (s, d, c, z) + */ +void cblas_sswap(const int N, float *X, const int incX, + float *Y, const int incY); +void cblas_scopy(const int N, const float *X, const int incX, + float *Y, const int incY); +void cblas_saxpy(const int N, const float alpha, const float *X, + const int incX, float *Y, const int incY); + +void cblas_dswap(const int N, double *X, const int incX, + double *Y, const int incY); +void cblas_dcopy(const int N, const double *X, const int incX, + double *Y, const int incY); +void cblas_daxpy(const int N, const double alpha, const double *X, + const int incX, double *Y, const int incY); + +void cblas_cswap(const int N, void *X, const int incX, + void *Y, const int incY); +void cblas_ccopy(const int N, const void *X, const int incX, + void *Y, const int incY); +void cblas_caxpy(const int N, const void *alpha, const void *X, + const int incX, void *Y, const int incY); + +void cblas_zswap(const int N, void *X, const int incX, + void *Y, const int incY); +void cblas_zcopy(const int N, const void *X, const int incX, + void *Y, const int incY); +void cblas_zaxpy(const int N, const void *alpha, const void *X, + const int incX, void *Y, const int incY); + + +/* + * Routines with S and D prefix only + */ +void cblas_srotg(float *a, float *b, float *c, float *s); +void cblas_srotmg(float *d1, float *d2, float *b1, const float b2, float *P); +void cblas_srot(const int N, float *X, const int incX, + float *Y, const int incY, const float c, const float s); +void cblas_srotm(const int N, float *X, const int incX, + float *Y, const int incY, const float *P); + +void cblas_drotg(double *a, double *b, double *c, double *s); +void cblas_drotmg(double *d1, double *d2, double *b1, const double b2, double *P); +void cblas_drot(const int N, double *X, const int incX, + double *Y, const int incY, const double c, const double s); +void cblas_drotm(const int N, double *X, const int incX, + double *Y, const int incY, const double *P); + + +/* + * Routines with S D C Z CS and ZD prefixes + */ +void cblas_sscal(const int N, const float alpha, float *X, const int incX); +void cblas_dscal(const int N, const double alpha, double *X, const int incX); +void cblas_cscal(const int N, const void *alpha, void *X, const int incX); +void cblas_zscal(const int N, const void *alpha, void *X, const int incX); +void cblas_csscal(const int N, const float alpha, void *X, const int incX); +void cblas_zdscal(const int N, const double alpha, void *X, const int incX); + +/* + * =========================================================================== + * Prototypes for level 2 BLAS + * =========================================================================== + */ + +/* + * Routines with standard 4 prefixes (S, D, C, Z) + */ +void cblas_sgemv(const enum CBLAS_ORDER order, + const enum CBLAS_TRANSPOSE TransA, const int M, const int N, + const float alpha, const float *A, const int lda, + const float *X, const int incX, const float beta, + float *Y, const int incY); +void cblas_sgbmv(const enum CBLAS_ORDER order, + const enum CBLAS_TRANSPOSE TransA, const int M, const int N, + const int KL, const int KU, const float alpha, + const float *A, const int lda, const float *X, + const int incX, const float beta, float *Y, const int incY); +void cblas_strmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const float *A, const int lda, + float *X, const int incX); +void cblas_stbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const int K, const float *A, const int lda, + float *X, const int incX); +void cblas_stpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const float *Ap, float *X, const int incX); +void cblas_strsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const float *A, const int lda, float *X, + const int incX); +void cblas_stbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const int K, const float *A, const int lda, + float *X, const int incX); +void cblas_stpsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const float *Ap, float *X, const int incX); + +void cblas_dgemv(const enum CBLAS_ORDER order, + const enum CBLAS_TRANSPOSE TransA, const int M, const int N, + const double alpha, const double *A, const int lda, + const double *X, const int incX, const double beta, + double *Y, const int incY); +void cblas_dgbmv(const enum CBLAS_ORDER order, + const enum CBLAS_TRANSPOSE TransA, const int M, const int N, + const int KL, const int KU, const double alpha, + const double *A, const int lda, const double *X, + const int incX, const double beta, double *Y, const int incY); +void cblas_dtrmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const double *A, const int lda, + double *X, const int incX); +void cblas_dtbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const int K, const double *A, const int lda, + double *X, const int incX); +void cblas_dtpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const double *Ap, double *X, const int incX); +void cblas_dtrsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const double *A, const int lda, double *X, + const int incX); +void cblas_dtbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const int K, const double *A, const int lda, + double *X, const int incX); +void cblas_dtpsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const double *Ap, double *X, const int incX); + +void cblas_cgemv(const enum CBLAS_ORDER order, + const enum CBLAS_TRANSPOSE TransA, const int M, const int N, + const void *alpha, const void *A, const int lda, + const void *X, const int incX, const void *beta, + void *Y, const int incY); +void cblas_cgbmv(const enum CBLAS_ORDER order, + const enum CBLAS_TRANSPOSE TransA, const int M, const int N, + const int KL, const int KU, const void *alpha, + const void *A, const int lda, const void *X, + const int incX, const void *beta, void *Y, const int incY); +void cblas_ctrmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const void *A, const int lda, + void *X, const int incX); +void cblas_ctbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const int K, const void *A, const int lda, + void *X, const int incX); +void cblas_ctpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const void *Ap, void *X, const int incX); +void cblas_ctrsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const void *A, const int lda, void *X, + const int incX); +void cblas_ctbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const int K, const void *A, const int lda, + void *X, const int incX); +void cblas_ctpsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const void *Ap, void *X, const int incX); + +void cblas_zgemv(const enum CBLAS_ORDER order, + const enum CBLAS_TRANSPOSE TransA, const int M, const int N, + const void *alpha, const void *A, const int lda, + const void *X, const int incX, const void *beta, + void *Y, const int incY); +void cblas_zgbmv(const enum CBLAS_ORDER order, + const enum CBLAS_TRANSPOSE TransA, const int M, const int N, + const int KL, const int KU, const void *alpha, + const void *A, const int lda, const void *X, + const int incX, const void *beta, void *Y, const int incY); +void cblas_ztrmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const void *A, const int lda, + void *X, const int incX); +void cblas_ztbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const int K, const void *A, const int lda, + void *X, const int incX); +void cblas_ztpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const void *Ap, void *X, const int incX); +void cblas_ztrsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const void *A, const int lda, void *X, + const int incX); +void cblas_ztbsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const int K, const void *A, const int lda, + void *X, const int incX); +void cblas_ztpsv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag, + const int N, const void *Ap, void *X, const int incX); + + +/* + * Routines with S and D prefixes only + */ +void cblas_ssymv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const float alpha, const float *A, + const int lda, const float *X, const int incX, + const float beta, float *Y, const int incY); +void cblas_ssbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const int K, const float alpha, const float *A, + const int lda, const float *X, const int incX, + const float beta, float *Y, const int incY); +void cblas_sspmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const float alpha, const float *Ap, + const float *X, const int incX, + const float beta, float *Y, const int incY); +void cblas_sger(const enum CBLAS_ORDER order, const int M, const int N, + const float alpha, const float *X, const int incX, + const float *Y, const int incY, float *A, const int lda); +void cblas_ssyr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const float alpha, const float *X, + const int incX, float *A, const int lda); +void cblas_sspr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const float alpha, const float *X, + const int incX, float *Ap); +void cblas_ssyr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const float alpha, const float *X, + const int incX, const float *Y, const int incY, float *A, + const int lda); +void cblas_sspr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const float alpha, const float *X, + const int incX, const float *Y, const int incY, float *A); + +void cblas_dsymv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const double alpha, const double *A, + const int lda, const double *X, const int incX, + const double beta, double *Y, const int incY); +void cblas_dsbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const int K, const double alpha, const double *A, + const int lda, const double *X, const int incX, + const double beta, double *Y, const int incY); +void cblas_dspmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const double alpha, const double *Ap, + const double *X, const int incX, + const double beta, double *Y, const int incY); +void cblas_dger(const enum CBLAS_ORDER order, const int M, const int N, + const double alpha, const double *X, const int incX, + const double *Y, const int incY, double *A, const int lda); +void cblas_dsyr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const double alpha, const double *X, + const int incX, double *A, const int lda); +void cblas_dspr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const double alpha, const double *X, + const int incX, double *Ap); +void cblas_dsyr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const double alpha, const double *X, + const int incX, const double *Y, const int incY, double *A, + const int lda); +void cblas_dspr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const double alpha, const double *X, + const int incX, const double *Y, const int incY, double *A); + + +/* + * Routines with C and Z prefixes only + */ +void cblas_chemv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const void *alpha, const void *A, + const int lda, const void *X, const int incX, + const void *beta, void *Y, const int incY); +void cblas_chbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const int K, const void *alpha, const void *A, + const int lda, const void *X, const int incX, + const void *beta, void *Y, const int incY); +void cblas_chpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const void *alpha, const void *Ap, + const void *X, const int incX, + const void *beta, void *Y, const int incY); +void cblas_cgeru(const enum CBLAS_ORDER order, const int M, const int N, + const void *alpha, const void *X, const int incX, + const void *Y, const int incY, void *A, const int lda); +void cblas_cgerc(const enum CBLAS_ORDER order, const int M, const int N, + const void *alpha, const void *X, const int incX, + const void *Y, const int incY, void *A, const int lda); +void cblas_cher(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const float alpha, const void *X, const int incX, + void *A, const int lda); +void cblas_chpr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const float alpha, const void *X, + const int incX, void *A); +void cblas_cher2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, + const void *alpha, const void *X, const int incX, + const void *Y, const int incY, void *A, const int lda); +void cblas_chpr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, + const void *alpha, const void *X, const int incX, + const void *Y, const int incY, void *Ap); + +void cblas_zhemv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const void *alpha, const void *A, + const int lda, const void *X, const int incX, + const void *beta, void *Y, const int incY); +void cblas_zhbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const int K, const void *alpha, const void *A, + const int lda, const void *X, const int incX, + const void *beta, void *Y, const int incY); +void cblas_zhpmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const void *alpha, const void *Ap, + const void *X, const int incX, + const void *beta, void *Y, const int incY); +void cblas_zgeru(const enum CBLAS_ORDER order, const int M, const int N, + const void *alpha, const void *X, const int incX, + const void *Y, const int incY, void *A, const int lda); +void cblas_zgerc(const enum CBLAS_ORDER order, const int M, const int N, + const void *alpha, const void *X, const int incX, + const void *Y, const int incY, void *A, const int lda); +void cblas_zher(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const double alpha, const void *X, const int incX, + void *A, const int lda); +void cblas_zhpr(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, + const int N, const double alpha, const void *X, + const int incX, void *A); +void cblas_zher2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, + const void *alpha, const void *X, const int incX, + const void *Y, const int incY, void *A, const int lda); +void cblas_zhpr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, + const void *alpha, const void *X, const int incX, + const void *Y, const int incY, void *Ap); + +/* + * =========================================================================== + * Prototypes for level 3 BLAS + * =========================================================================== + */ + +/* + * Routines with standard 4 prefixes (S, D, C, Z) + */ +void cblas_sgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_TRANSPOSE TransB, const int M, const int N, + const int K, const float alpha, const float *A, + const int lda, const float *B, const int ldb, + const float beta, float *C, const int ldc); +void cblas_ssymm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const int M, const int N, + const float alpha, const float *A, const int lda, + const float *B, const int ldb, const float beta, + float *C, const int ldc); +void cblas_ssyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const float alpha, const float *A, const int lda, + const float beta, float *C, const int ldc); +void cblas_ssyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const float alpha, const float *A, const int lda, + const float *B, const int ldb, const float beta, + float *C, const int ldc); +void cblas_strmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_DIAG Diag, const int M, const int N, + const float alpha, const float *A, const int lda, + float *B, const int ldb); +void cblas_strsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_DIAG Diag, const int M, const int N, + const float alpha, const float *A, const int lda, + float *B, const int ldb); + +void cblas_dgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_TRANSPOSE TransB, const int M, const int N, + const int K, const double alpha, const double *A, + const int lda, const double *B, const int ldb, + const double beta, double *C, const int ldc); +void cblas_dsymm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const int M, const int N, + const double alpha, const double *A, const int lda, + const double *B, const int ldb, const double beta, + double *C, const int ldc); +void cblas_dsyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const double alpha, const double *A, const int lda, + const double beta, double *C, const int ldc); +void cblas_dsyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const double alpha, const double *A, const int lda, + const double *B, const int ldb, const double beta, + double *C, const int ldc); +void cblas_dtrmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_DIAG Diag, const int M, const int N, + const double alpha, const double *A, const int lda, + double *B, const int ldb); +void cblas_dtrsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_DIAG Diag, const int M, const int N, + const double alpha, const double *A, const int lda, + double *B, const int ldb); + +void cblas_cgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_TRANSPOSE TransB, const int M, const int N, + const int K, const void *alpha, const void *A, + const int lda, const void *B, const int ldb, + const void *beta, void *C, const int ldc); +void cblas_csymm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const int M, const int N, + const void *alpha, const void *A, const int lda, + const void *B, const int ldb, const void *beta, + void *C, const int ldc); +void cblas_csyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const void *alpha, const void *A, const int lda, + const void *beta, void *C, const int ldc); +void cblas_csyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const void *alpha, const void *A, const int lda, + const void *B, const int ldb, const void *beta, + void *C, const int ldc); +void cblas_ctrmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_DIAG Diag, const int M, const int N, + const void *alpha, const void *A, const int lda, + void *B, const int ldb); +void cblas_ctrsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_DIAG Diag, const int M, const int N, + const void *alpha, const void *A, const int lda, + void *B, const int ldb); + +void cblas_zgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_TRANSPOSE TransB, const int M, const int N, + const int K, const void *alpha, const void *A, + const int lda, const void *B, const int ldb, + const void *beta, void *C, const int ldc); +void cblas_zsymm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const int M, const int N, + const void *alpha, const void *A, const int lda, + const void *B, const int ldb, const void *beta, + void *C, const int ldc); +void cblas_zsyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const void *alpha, const void *A, const int lda, + const void *beta, void *C, const int ldc); +void cblas_zsyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const void *alpha, const void *A, const int lda, + const void *B, const int ldb, const void *beta, + void *C, const int ldc); +void cblas_ztrmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_DIAG Diag, const int M, const int N, + const void *alpha, const void *A, const int lda, + void *B, const int ldb); +void cblas_ztrsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_DIAG Diag, const int M, const int N, + const void *alpha, const void *A, const int lda, + void *B, const int ldb); + + +/* + * Routines with prefixes C and Z only + */ +void cblas_chemm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const int M, const int N, + const void *alpha, const void *A, const int lda, + const void *B, const int ldb, const void *beta, + void *C, const int ldc); +void cblas_cherk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const float alpha, const void *A, const int lda, + const float beta, void *C, const int ldc); +void cblas_cher2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const void *alpha, const void *A, const int lda, + const void *B, const int ldb, const float beta, + void *C, const int ldc); + +void cblas_zhemm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, + const enum CBLAS_UPLO Uplo, const int M, const int N, + const void *alpha, const void *A, const int lda, + const void *B, const int ldb, const void *beta, + void *C, const int ldc); +void cblas_zherk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const double alpha, const void *A, const int lda, + const double beta, void *C, const int ldc); +void cblas_zher2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, + const enum CBLAS_TRANSPOSE Trans, const int N, const int K, + const void *alpha, const void *A, const int lda, + const void *B, const int ldb, const double beta, + void *C, const int ldc); + +void cblas_xerbla(int p, const char *rout, const char *form, ...); + +__END_DECLS + +#endif /* __GSL_CBLAS_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_cdf.h b/dtm_release/local/include/gsl/gsl_cdf.h new file mode 100644 index 0000000000000000000000000000000000000000..1a4e39b8c55f214a6871a252ba4debe710aa143e --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_cdf.h @@ -0,0 +1,170 @@ +/* cdf/gsl_cdf.h + * + * Copyright (C) 2002 Jason H. Stover. + * + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Author: J. Stover */ + +#ifndef __GSL_CDF_H__ +#define __GSL_CDF_H__ + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_cdf_ugaussian_P (const double x); +double gsl_cdf_ugaussian_Q (const double x); + +double gsl_cdf_ugaussian_Pinv (const double P); +double gsl_cdf_ugaussian_Qinv (const double Q); + +double gsl_cdf_gaussian_P (const double x, const double sigma); +double gsl_cdf_gaussian_Q (const double x, const double sigma); + +double gsl_cdf_gaussian_Pinv (const double P, const double sigma); +double gsl_cdf_gaussian_Qinv (const double Q, const double sigma); + +double gsl_cdf_gamma_P (const double x, const double a, const double b); +double gsl_cdf_gamma_Q (const double x, const double a, const double b); + +double gsl_cdf_gamma_Pinv (const double P, const double a, const double b); +double gsl_cdf_gamma_Qinv (const double Q, const double a, const double b); + +double gsl_cdf_cauchy_P (const double x, const double a); +double gsl_cdf_cauchy_Q (const double x, const double a); + +double gsl_cdf_cauchy_Pinv (const double P, const double a); +double gsl_cdf_cauchy_Qinv (const double Q, const double a); + +double gsl_cdf_laplace_P (const double x, const double a); +double gsl_cdf_laplace_Q (const double x, const double a); + +double gsl_cdf_laplace_Pinv (const double P, const double a); +double gsl_cdf_laplace_Qinv (const double Q, const double a); + +double gsl_cdf_rayleigh_P (const double x, const double sigma); +double gsl_cdf_rayleigh_Q (const double x, const double sigma); + +double gsl_cdf_rayleigh_Pinv (const double P, const double sigma); +double gsl_cdf_rayleigh_Qinv (const double Q, const double sigma); + +double gsl_cdf_chisq_P (const double x, const double nu); +double gsl_cdf_chisq_Q (const double x, const double nu); + +double gsl_cdf_chisq_Pinv (const double P, const double nu); +double gsl_cdf_chisq_Qinv (const double Q, const double nu); + +double gsl_cdf_exponential_P (const double x, const double mu); +double gsl_cdf_exponential_Q (const double x, const double mu); + +double gsl_cdf_exponential_Pinv (const double P, const double mu); +double gsl_cdf_exponential_Qinv (const double Q, const double mu); + +double gsl_cdf_exppow_P (const double x, const double a, const double b); +double gsl_cdf_exppow_Q (const double x, const double a, const double b); + +double gsl_cdf_tdist_P (const double x, const double nu); +double gsl_cdf_tdist_Q (const double x, const double nu); + +double gsl_cdf_tdist_Pinv (const double P, const double nu); +double gsl_cdf_tdist_Qinv (const double Q, const double nu); + +double gsl_cdf_fdist_P (const double x, const double nu1, const double nu2); +double gsl_cdf_fdist_Q (const double x, const double nu1, const double nu2); + +double gsl_cdf_fdist_Pinv (const double P, const double nu1, const double nu2); +double gsl_cdf_fdist_Qinv (const double Q, const double nu1, const double nu2); + +double gsl_cdf_beta_P (const double x, const double a, const double b); +double gsl_cdf_beta_Q (const double x, const double a, const double b); + +double gsl_cdf_beta_Pinv (const double P, const double a, const double b); +double gsl_cdf_beta_Qinv (const double Q, const double a, const double b); + +double gsl_cdf_flat_P (const double x, const double a, const double b); +double gsl_cdf_flat_Q (const double x, const double a, const double b); + +double gsl_cdf_flat_Pinv (const double P, const double a, const double b); +double gsl_cdf_flat_Qinv (const double Q, const double a, const double b); + +double gsl_cdf_lognormal_P (const double x, const double zeta, const double sigma); +double gsl_cdf_lognormal_Q (const double x, const double zeta, const double sigma); + +double gsl_cdf_lognormal_Pinv (const double P, const double zeta, const double sigma); +double gsl_cdf_lognormal_Qinv (const double Q, const double zeta, const double sigma); + +double gsl_cdf_gumbel1_P (const double x, const double a, const double b); +double gsl_cdf_gumbel1_Q (const double x, const double a, const double b); + +double gsl_cdf_gumbel1_Pinv (const double P, const double a, const double b); +double gsl_cdf_gumbel1_Qinv (const double Q, const double a, const double b); + +double gsl_cdf_gumbel2_P (const double x, const double a, const double b); +double gsl_cdf_gumbel2_Q (const double x, const double a, const double b); + +double gsl_cdf_gumbel2_Pinv (const double P, const double a, const double b); +double gsl_cdf_gumbel2_Qinv (const double Q, const double a, const double b); + +double gsl_cdf_weibull_P (const double x, const double a, const double b); +double gsl_cdf_weibull_Q (const double x, const double a, const double b); + +double gsl_cdf_weibull_Pinv (const double P, const double a, const double b); +double gsl_cdf_weibull_Qinv (const double Q, const double a, const double b); + +double gsl_cdf_pareto_P (const double x, const double a, const double b); +double gsl_cdf_pareto_Q (const double x, const double a, const double b); + +double gsl_cdf_pareto_Pinv (const double P, const double a, const double b); +double gsl_cdf_pareto_Qinv (const double Q, const double a, const double b); + +double gsl_cdf_logistic_P (const double x, const double a); +double gsl_cdf_logistic_Q (const double x, const double a); + +double gsl_cdf_logistic_Pinv (const double P, const double a); +double gsl_cdf_logistic_Qinv (const double Q, const double a); + +double gsl_cdf_binomial_P (const unsigned int k, const double p, const unsigned int n); +double gsl_cdf_binomial_Q (const unsigned int k, const double p, const unsigned int n); + +double gsl_cdf_poisson_P (const unsigned int k, const double mu); +double gsl_cdf_poisson_Q (const unsigned int k, const double mu); + +double gsl_cdf_geometric_P (const unsigned int k, const double p); +double gsl_cdf_geometric_Q (const unsigned int k, const double p); + +double gsl_cdf_negative_binomial_P (const unsigned int k, const double p, const double n); +double gsl_cdf_negative_binomial_Q (const unsigned int k, const double p, const double n); + +double gsl_cdf_pascal_P (const unsigned int k, const double p, const unsigned int n); +double gsl_cdf_pascal_Q (const unsigned int k, const double p, const unsigned int n); + +double gsl_cdf_hypergeometric_P (const unsigned int k, const unsigned int n1, + const unsigned int n2, const unsigned int t); +double gsl_cdf_hypergeometric_Q (const unsigned int k, const unsigned int n1, + const unsigned int n2, const unsigned int t); + +__END_DECLS + +#endif /* __GSL_CDF_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_chebyshev.h b/dtm_release/local/include/gsl/gsl_chebyshev.h new file mode 100644 index 0000000000000000000000000000000000000000..19370963d373e93393317c7f4eb07b00825d2857 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_chebyshev.h @@ -0,0 +1,129 @@ +/* cheb/gsl_chebyshev.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_CHEBYSHEV_H__ +#define __GSL_CHEBYSHEV_H__ + +#include <gsl/gsl_math.h> +#include <gsl/gsl_mode.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* data for a Chebyshev series over a given interval */ + +struct gsl_cheb_series_struct { + + double * c; /* coefficients */ + size_t order; /* order of expansion */ + double a; /* lower interval point */ + double b; /* upper interval point */ + + /* The following exists (mostly) for the benefit + * of the implementation. It is an effective single + * precision order, for use in single precision + * evaluation. Users can use it if they like, but + * only they know how to calculate it, since it is + * specific to the approximated function. By default, + * order_sp = order. + * It is used explicitly only by the gsl_cheb_eval_mode + * functions, which are not meant for casual use. + */ + size_t order_sp; + + /* Additional elements not used by specfunc */ + + double * f; /* function evaluated at chebyschev points */ +}; +typedef struct gsl_cheb_series_struct gsl_cheb_series; + + +/* Calculate a Chebyshev series of specified order over + * a specified interval, for a given function. + * Return 0 on failure. + */ +gsl_cheb_series * gsl_cheb_alloc(const size_t order); + +/* Free a Chebyshev series previously calculated with gsl_cheb_alloc(). + */ +void gsl_cheb_free(gsl_cheb_series * cs); + +/* Calculate a Chebyshev series using the storage provided. + * Uses the interval (a,b) and the order with which it + * was initially created. + * + */ +int gsl_cheb_init(gsl_cheb_series * cs, const gsl_function * func, + const double a, const double b); + + +/* Evaluate a Chebyshev series at a given point. + * No errors can occur for a struct obtained from gsl_cheb_new(). + */ +double gsl_cheb_eval(const gsl_cheb_series * cs, const double x); +int gsl_cheb_eval_err(const gsl_cheb_series * cs, const double x, + double * result, double * abserr); + + +/* Evaluate a Chebyshev series at a given point, to (at most) the given order. + * No errors can occur for a struct obtained from gsl_cheb_new(). + */ +double gsl_cheb_eval_n(const gsl_cheb_series * cs, const size_t order, + const double x); +int gsl_cheb_eval_n_err(const gsl_cheb_series * cs, const size_t order, + const double x, double * result, double * abserr); + + +/* Evaluate a Chebyshev series at a given point, using the default + * order for double precision mode(s) and the single precision + * order for other modes. + * No errors can occur for a struct obtained from gsl_cheb_new(). + */ +double gsl_cheb_eval_mode(const gsl_cheb_series * cs, const double x, gsl_mode_t mode); +int gsl_cheb_eval_mode_e(const gsl_cheb_series * cs, const double x, gsl_mode_t mode, double * result, double * abserr); + + + +/* Compute the derivative of a Chebyshev series. + */ +int gsl_cheb_calc_deriv(gsl_cheb_series * deriv, const gsl_cheb_series * cs); + +/* Compute the integral of a Chebyshev series. The + * integral is fixed by the condition that it equals zero at + * the left end-point, ie it is precisely + * Integrate[cs(t; a,b), {t, a, x}] + */ +int gsl_cheb_calc_integ(gsl_cheb_series * integ, const gsl_cheb_series * cs); + + + + +__END_DECLS + +#endif /* __GSL_CHEBYSHEV_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_check_range.h b/dtm_release/local/include/gsl/gsl_check_range.h new file mode 100644 index 0000000000000000000000000000000000000000..d110b6b8937c1b46abfe9a954cfc185e9e838df4 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_check_range.h @@ -0,0 +1,57 @@ +/* vector/gsl_check_range.h + * + * Copyright (C) 2003, 2004, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_CHECK_RANGE_H__ +#define __GSL_CHECK_RANGE_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +GSL_VAR int gsl_check_range; + +/* Turn range checking on by default, unless the user defines + GSL_RANGE_CHECK_OFF, or defines GSL_RANGE_CHECK to 0 explicitly */ + +#ifdef GSL_RANGE_CHECK_OFF +# ifndef GSL_RANGE_CHECK +# define GSL_RANGE_CHECK 0 +# else +# error "cannot set both GSL_RANGE_CHECK and GSL_RANGE_CHECK_OFF" +# endif +#else +# ifndef GSL_RANGE_CHECK +# define GSL_RANGE_CHECK 1 +# endif +#endif + +__END_DECLS + +#endif /* __GSL_CHECK_RANGE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_combination.h b/dtm_release/local/include/gsl/gsl_combination.h new file mode 100644 index 0000000000000000000000000000000000000000..ff8edb88f209ecb80fd80d55ec9fc773a6c09537 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_combination.h @@ -0,0 +1,91 @@ +/* combination/gsl_combination.h + * based on permutation/gsl_permutation.h by Brian Gough + * + * Copyright (C) 2001 Szymon Jaroszewicz + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_COMBINATION_H__ +#define __GSL_COMBINATION_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_check_range.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_combination_struct +{ + size_t n; + size_t k; + size_t *data; +}; + +typedef struct gsl_combination_struct gsl_combination; + +gsl_combination *gsl_combination_alloc (const size_t n, const size_t k); +gsl_combination *gsl_combination_calloc (const size_t n, const size_t k); +void gsl_combination_init_first (gsl_combination * c); +void gsl_combination_init_last (gsl_combination * c); +void gsl_combination_free (gsl_combination * c); +int gsl_combination_memcpy (gsl_combination * dest, const gsl_combination * src); + +int gsl_combination_fread (FILE * stream, gsl_combination * c); +int gsl_combination_fwrite (FILE * stream, const gsl_combination * c); +int gsl_combination_fscanf (FILE * stream, gsl_combination * c); +int gsl_combination_fprintf (FILE * stream, const gsl_combination * c, const char *format); + +size_t gsl_combination_n (const gsl_combination * c); +size_t gsl_combination_k (const gsl_combination * c); +size_t * gsl_combination_data (const gsl_combination * c); + +size_t gsl_combination_get (const gsl_combination * c, const size_t i); + +int gsl_combination_valid (gsl_combination * c); +int gsl_combination_next (gsl_combination * c); +int gsl_combination_prev (gsl_combination * c); + +#ifdef HAVE_INLINE + +extern inline +size_t +gsl_combination_get (const gsl_combination * c, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= c->k) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return c->data[i]; +} + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_COMBINATION_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_complex.h b/dtm_release/local/include/gsl/gsl_complex.h new file mode 100644 index 0000000000000000000000000000000000000000..e77b770627b7722f2f908a073b23cb5b3333cf37 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_complex.h @@ -0,0 +1,103 @@ +/* complex/gsl_complex.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_COMPLEX_H__ +#define __GSL_COMPLEX_H__ + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* two consecutive built-in types as a complex number */ +typedef double * gsl_complex_packed ; +typedef float * gsl_complex_packed_float ; +typedef long double * gsl_complex_packed_long_double ; + +typedef const double * gsl_const_complex_packed ; +typedef const float * gsl_const_complex_packed_float ; +typedef const long double * gsl_const_complex_packed_long_double ; + + +/* 2N consecutive built-in types as N complex numbers */ +typedef double * gsl_complex_packed_array ; +typedef float * gsl_complex_packed_array_float ; +typedef long double * gsl_complex_packed_array_long_double ; + +typedef const double * gsl_const_complex_packed_array ; +typedef const float * gsl_const_complex_packed_array_float ; +typedef const long double * gsl_const_complex_packed_array_long_double ; + + +/* Yes... this seems weird. Trust us. The point is just that + sometimes you want to make it obvious that something is + an output value. The fact that it lacks a 'const' may not + be enough of a clue for people in some contexts. + */ +typedef double * gsl_complex_packed_ptr ; +typedef float * gsl_complex_packed_float_ptr ; +typedef long double * gsl_complex_packed_long_double_ptr ; + +typedef const double * gsl_const_complex_packed_ptr ; +typedef const float * gsl_const_complex_packed_float_ptr ; +typedef const long double * gsl_const_complex_packed_long_double_ptr ; + + +typedef struct + { + long double dat[2]; + } +gsl_complex_long_double; + +typedef struct + { + double dat[2]; + } +gsl_complex; + +typedef struct + { + float dat[2]; + } +gsl_complex_float; + +#define GSL_REAL(z) ((z).dat[0]) +#define GSL_IMAG(z) ((z).dat[1]) +#define GSL_COMPLEX_P(zp) ((zp)->dat) +#define GSL_COMPLEX_P_REAL(zp) ((zp)->dat[0]) +#define GSL_COMPLEX_P_IMAG(zp) ((zp)->dat[1]) +#define GSL_COMPLEX_EQ(z1,z2) (((z1).dat[0] == (z2).dat[0]) && ((z1).dat[1] == (z2).dat[1])) + +#define GSL_SET_COMPLEX(zp,x,y) do {(zp)->dat[0]=(x); (zp)->dat[1]=(y);} while(0) +#define GSL_SET_REAL(zp,x) do {(zp)->dat[0]=(x);} while(0) +#define GSL_SET_IMAG(zp,y) do {(zp)->dat[1]=(y);} while(0) + +#define GSL_SET_COMPLEX_PACKED(zp,n,x,y) do {*((zp)+2*(n))=(x); *((zp)+(2*(n)+1))=(y);} while(0) + +__END_DECLS + +#endif /* __GSL_COMPLEX_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_complex_math.h b/dtm_release/local/include/gsl/gsl_complex_math.h new file mode 100644 index 0000000000000000000000000000000000000000..bf44b5fc06424d284c650fade211c37c30794f9f --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_complex_math.h @@ -0,0 +1,140 @@ +/* complex/gsl_complex_math.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Jorma Olavi T�htinen, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_COMPLEX_MATH_H__ +#define __GSL_COMPLEX_MATH_H__ +#include <gsl/gsl_complex.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS } +#else +#define __BEGIN_DECLS /* empty */ +#define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Complex numbers */ + +gsl_complex gsl_complex_rect (double x, double y); /* r= real+i*imag */ +gsl_complex gsl_complex_polar (double r, double theta); /* r= r e^(i theta) */ + +#ifdef HAVE_INLINE +extern inline gsl_complex +gsl_complex_rect (double x, double y) +{ /* return z = x + i y */ + gsl_complex z; + GSL_SET_COMPLEX (&z, x, y); + return z; +} +#endif + +#define GSL_COMPLEX_ONE (gsl_complex_rect(1.0,0.0)) +#define GSL_COMPLEX_ZERO (gsl_complex_rect(0.0,0.0)) +#define GSL_COMPLEX_NEGONE (gsl_complex_rect(-1.0,0.0)) + +/* Properties of complex numbers */ + +double gsl_complex_arg (gsl_complex z); /* return arg(z), -pi< arg(z) <=+pi */ +double gsl_complex_abs (gsl_complex z); /* return |z| */ +double gsl_complex_abs2 (gsl_complex z); /* return |z|^2 */ +double gsl_complex_logabs (gsl_complex z); /* return log|z| */ + +/* Complex arithmetic operators */ + +gsl_complex gsl_complex_add (gsl_complex a, gsl_complex b); /* r=a+b */ +gsl_complex gsl_complex_sub (gsl_complex a, gsl_complex b); /* r=a-b */ +gsl_complex gsl_complex_mul (gsl_complex a, gsl_complex b); /* r=a*b */ +gsl_complex gsl_complex_div (gsl_complex a, gsl_complex b); /* r=a/b */ + +gsl_complex gsl_complex_add_real (gsl_complex a, double x); /* r=a+x */ +gsl_complex gsl_complex_sub_real (gsl_complex a, double x); /* r=a-x */ +gsl_complex gsl_complex_mul_real (gsl_complex a, double x); /* r=a*x */ +gsl_complex gsl_complex_div_real (gsl_complex a, double x); /* r=a/x */ + +gsl_complex gsl_complex_add_imag (gsl_complex a, double y); /* r=a+iy */ +gsl_complex gsl_complex_sub_imag (gsl_complex a, double y); /* r=a-iy */ +gsl_complex gsl_complex_mul_imag (gsl_complex a, double y); /* r=a*iy */ +gsl_complex gsl_complex_div_imag (gsl_complex a, double y); /* r=a/iy */ + +gsl_complex gsl_complex_conjugate (gsl_complex z); /* r=conj(z) */ +gsl_complex gsl_complex_inverse (gsl_complex a); /* r=1/a */ +gsl_complex gsl_complex_negative (gsl_complex a); /* r=-a */ + +/* Elementary Complex Functions */ + +gsl_complex gsl_complex_sqrt (gsl_complex z); /* r=sqrt(z) */ +gsl_complex gsl_complex_sqrt_real (double x); /* r=sqrt(x) (x<0 ok) */ + +gsl_complex gsl_complex_pow (gsl_complex a, gsl_complex b); /* r=a^b */ +gsl_complex gsl_complex_pow_real (gsl_complex a, double b); /* r=a^b */ + +gsl_complex gsl_complex_exp (gsl_complex a); /* r=exp(a) */ +gsl_complex gsl_complex_log (gsl_complex a); /* r=log(a) (base e) */ +gsl_complex gsl_complex_log10 (gsl_complex a); /* r=log10(a) (base 10) */ +gsl_complex gsl_complex_log_b (gsl_complex a, gsl_complex b); /* r=log_b(a) (base=b) */ + +/* Complex Trigonometric Functions */ + +gsl_complex gsl_complex_sin (gsl_complex a); /* r=sin(a) */ +gsl_complex gsl_complex_cos (gsl_complex a); /* r=cos(a) */ +gsl_complex gsl_complex_sec (gsl_complex a); /* r=sec(a) */ +gsl_complex gsl_complex_csc (gsl_complex a); /* r=csc(a) */ +gsl_complex gsl_complex_tan (gsl_complex a); /* r=tan(a) */ +gsl_complex gsl_complex_cot (gsl_complex a); /* r=cot(a) */ + +/* Inverse Complex Trigonometric Functions */ + +gsl_complex gsl_complex_arcsin (gsl_complex a); /* r=arcsin(a) */ +gsl_complex gsl_complex_arcsin_real (double a); /* r=arcsin(a) */ +gsl_complex gsl_complex_arccos (gsl_complex a); /* r=arccos(a) */ +gsl_complex gsl_complex_arccos_real (double a); /* r=arccos(a) */ +gsl_complex gsl_complex_arcsec (gsl_complex a); /* r=arcsec(a) */ +gsl_complex gsl_complex_arcsec_real (double a); /* r=arcsec(a) */ +gsl_complex gsl_complex_arccsc (gsl_complex a); /* r=arccsc(a) */ +gsl_complex gsl_complex_arccsc_real (double a); /* r=arccsc(a) */ +gsl_complex gsl_complex_arctan (gsl_complex a); /* r=arctan(a) */ +gsl_complex gsl_complex_arccot (gsl_complex a); /* r=arccot(a) */ + +/* Complex Hyperbolic Functions */ + +gsl_complex gsl_complex_sinh (gsl_complex a); /* r=sinh(a) */ +gsl_complex gsl_complex_cosh (gsl_complex a); /* r=coshh(a) */ +gsl_complex gsl_complex_sech (gsl_complex a); /* r=sech(a) */ +gsl_complex gsl_complex_csch (gsl_complex a); /* r=csch(a) */ +gsl_complex gsl_complex_tanh (gsl_complex a); /* r=tanh(a) */ +gsl_complex gsl_complex_coth (gsl_complex a); /* r=coth(a) */ + +/* Inverse Complex Hyperbolic Functions */ + +gsl_complex gsl_complex_arcsinh (gsl_complex a); /* r=arcsinh(a) */ +gsl_complex gsl_complex_arccosh (gsl_complex a); /* r=arccosh(a) */ +gsl_complex gsl_complex_arccosh_real (double a); /* r=arccosh(a) */ +gsl_complex gsl_complex_arcsech (gsl_complex a); /* r=arcsech(a) */ +gsl_complex gsl_complex_arccsch (gsl_complex a); /* r=arccsch(a) */ +gsl_complex gsl_complex_arctanh (gsl_complex a); /* r=arctanh(a) */ +gsl_complex gsl_complex_arctanh_real (double a); /* r=arctanh(a) */ +gsl_complex gsl_complex_arccoth (gsl_complex a); /* r=arccoth(a) */ + +__END_DECLS + +#endif /* __GSL_COMPLEX_MATH_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_const.h b/dtm_release/local/include/gsl/gsl_const.h new file mode 100644 index 0000000000000000000000000000000000000000..5d749dc5ec7d7f305bdbc570f330b70cbcb6d068 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_const.h @@ -0,0 +1,31 @@ +/* const/gsl_const.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_CONST__ +#define __GSL_CONST__ + +#include <gsl/gsl_const_num.h> + +#include <gsl/gsl_const_cgs.h> +#include <gsl/gsl_const_mks.h> + +#include <gsl/gsl_const_cgsm.h> +#include <gsl/gsl_const_mksa.h> + +#endif /* __GSL_CONST__ */ diff --git a/dtm_release/local/include/gsl/gsl_const_cgs.h b/dtm_release/local/include/gsl/gsl_const_cgs.h new file mode 100644 index 0000000000000000000000000000000000000000..b10553151840b30510f21fe7fda15ed8ca6bebd9 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_const_cgs.h @@ -0,0 +1,123 @@ +/* const/gsl_const_cgs.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + * 2006 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_CONST_CGS__ +#define __GSL_CONST_CGS__ + +#define GSL_CONST_CGS_SPEED_OF_LIGHT (2.99792458e10) /* cm / s */ +#define GSL_CONST_CGS_GRAVITATIONAL_CONSTANT (6.673e-8) /* cm^3 / g s^2 */ +#define GSL_CONST_CGS_PLANCKS_CONSTANT_H (6.62606876e-27) /* g cm^2 / s */ +#define GSL_CONST_CGS_PLANCKS_CONSTANT_HBAR (1.05457159642e-27) /* g cm^2 / s */ +#define GSL_CONST_CGS_ASTRONOMICAL_UNIT (1.49597870691e13) /* cm */ +#define GSL_CONST_CGS_LIGHT_YEAR (9.46053620707e17) /* cm */ +#define GSL_CONST_CGS_PARSEC (3.08567758135e18) /* cm */ +#define GSL_CONST_CGS_GRAV_ACCEL (9.80665e2) /* cm / s^2 */ +#define GSL_CONST_CGS_ELECTRON_VOLT (1.602176462e-12) /* g cm^2 / s^2 */ +#define GSL_CONST_CGS_MASS_ELECTRON (9.10938188e-28) /* g */ +#define GSL_CONST_CGS_MASS_MUON (1.88353109e-25) /* g */ +#define GSL_CONST_CGS_MASS_PROTON (1.67262158e-24) /* g */ +#define GSL_CONST_CGS_MASS_NEUTRON (1.67492716e-24) /* g */ +#define GSL_CONST_CGS_RYDBERG (2.17987190389e-11) /* g cm^2 / s^2 */ +#define GSL_CONST_CGS_BOLTZMANN (1.3806503e-16) /* g cm^2 / K s^2 */ +#define GSL_CONST_CGS_BOHR_MAGNETON (9.27400899e-20) /* A cm^2 */ +#define GSL_CONST_CGS_NUCLEAR_MAGNETON (5.05078317e-23) /* A cm^2 */ +#define GSL_CONST_CGS_ELECTRON_MAGNETIC_MOMENT (9.28476362e-20) /* A cm^2 */ +#define GSL_CONST_CGS_PROTON_MAGNETIC_MOMENT (1.410606633e-22) /* A cm^2 */ +#define GSL_CONST_CGS_MOLAR_GAS (8.314472e7) /* g cm^2 / K mol s^2 */ +#define GSL_CONST_CGS_STANDARD_GAS_VOLUME (2.2710981e4) /* cm^3 / mol */ +#define GSL_CONST_CGS_MINUTE (6e1) /* s */ +#define GSL_CONST_CGS_HOUR (3.6e3) /* s */ +#define GSL_CONST_CGS_DAY (8.64e4) /* s */ +#define GSL_CONST_CGS_WEEK (6.048e5) /* s */ +#define GSL_CONST_CGS_INCH (2.54e0) /* cm */ +#define GSL_CONST_CGS_FOOT (3.048e1) /* cm */ +#define GSL_CONST_CGS_YARD (9.144e1) /* cm */ +#define GSL_CONST_CGS_MILE (1.609344e5) /* cm */ +#define GSL_CONST_CGS_NAUTICAL_MILE (1.852e5) /* cm */ +#define GSL_CONST_CGS_FATHOM (1.8288e2) /* cm */ +#define GSL_CONST_CGS_MIL (2.54e-3) /* cm */ +#define GSL_CONST_CGS_POINT (3.52777777778e-2) /* cm */ +#define GSL_CONST_CGS_TEXPOINT (3.51459803515e-2) /* cm */ +#define GSL_CONST_CGS_MICRON (1e-4) /* cm */ +#define GSL_CONST_CGS_ANGSTROM (1e-8) /* cm */ +#define GSL_CONST_CGS_HECTARE (1e8) /* cm^2 */ +#define GSL_CONST_CGS_ACRE (4.04685642241e7) /* cm^2 */ +#define GSL_CONST_CGS_BARN (1e-24) /* cm^2 */ +#define GSL_CONST_CGS_LITER (1e3) /* cm^3 */ +#define GSL_CONST_CGS_US_GALLON (3.78541178402e3) /* cm^3 */ +#define GSL_CONST_CGS_QUART (9.46352946004e2) /* cm^3 */ +#define GSL_CONST_CGS_PINT (4.73176473002e2) /* cm^3 */ +#define GSL_CONST_CGS_CUP (2.36588236501e2) /* cm^3 */ +#define GSL_CONST_CGS_FLUID_OUNCE (2.95735295626e1) /* cm^3 */ +#define GSL_CONST_CGS_TABLESPOON (1.47867647813e1) /* cm^3 */ +#define GSL_CONST_CGS_TEASPOON (4.92892159375e0) /* cm^3 */ +#define GSL_CONST_CGS_CANADIAN_GALLON (4.54609e3) /* cm^3 */ +#define GSL_CONST_CGS_UK_GALLON (4.546092e3) /* cm^3 */ +#define GSL_CONST_CGS_MILES_PER_HOUR (4.4704e1) /* cm / s */ +#define GSL_CONST_CGS_KILOMETERS_PER_HOUR (2.77777777778e1) /* cm / s */ +#define GSL_CONST_CGS_KNOT (5.14444444444e1) /* cm / s */ +#define GSL_CONST_CGS_POUND_MASS (4.5359237e2) /* g */ +#define GSL_CONST_CGS_OUNCE_MASS (2.8349523125e1) /* g */ +#define GSL_CONST_CGS_TON (9.0718474e5) /* g */ +#define GSL_CONST_CGS_METRIC_TON (1e6) /* g */ +#define GSL_CONST_CGS_UK_TON (1.0160469088e6) /* g */ +#define GSL_CONST_CGS_TROY_OUNCE (3.1103475e1) /* g */ +#define GSL_CONST_CGS_CARAT (2e-1) /* g */ +#define GSL_CONST_CGS_UNIFIED_ATOMIC_MASS (1.66053873e-24) /* g */ +#define GSL_CONST_CGS_GRAM_FORCE (9.80665e2) /* cm g / s^2 */ +#define GSL_CONST_CGS_POUND_FORCE (4.44822161526e5) /* cm g / s^2 */ +#define GSL_CONST_CGS_KILOPOUND_FORCE (4.44822161526e8) /* cm g / s^2 */ +#define GSL_CONST_CGS_POUNDAL (1.38255e4) /* cm g / s^2 */ +#define GSL_CONST_CGS_CALORIE (4.1868e7) /* g cm^2 / s^2 */ +#define GSL_CONST_CGS_BTU (1.05505585262e10) /* g cm^2 / s^2 */ +#define GSL_CONST_CGS_THERM (1.05506e15) /* g cm^2 / s^2 */ +#define GSL_CONST_CGS_HORSEPOWER (7.457e9) /* g cm^2 / s^3 */ +#define GSL_CONST_CGS_BAR (1e6) /* g / cm s^2 */ +#define GSL_CONST_CGS_STD_ATMOSPHERE (1.01325e6) /* g / cm s^2 */ +#define GSL_CONST_CGS_TORR (1.33322368421e3) /* g / cm s^2 */ +#define GSL_CONST_CGS_METER_OF_MERCURY (1.33322368421e6) /* g / cm s^2 */ +#define GSL_CONST_CGS_INCH_OF_MERCURY (3.38638815789e4) /* g / cm s^2 */ +#define GSL_CONST_CGS_INCH_OF_WATER (2.490889e3) /* g / cm s^2 */ +#define GSL_CONST_CGS_PSI (6.89475729317e4) /* g / cm s^2 */ +#define GSL_CONST_CGS_POISE (1e0) /* g / cm s */ +#define GSL_CONST_CGS_STOKES (1e0) /* cm^2 / s */ +#define GSL_CONST_CGS_FARADAY (9.6485341472e4) /* A s / mol */ +#define GSL_CONST_CGS_ELECTRON_CHARGE (1.602176462e-19) /* A s */ +#define GSL_CONST_CGS_GAUSS (1e-1) /* g / A s^2 */ +#define GSL_CONST_CGS_STILB (1e0) /* cd / cm^2 */ +#define GSL_CONST_CGS_LUMEN (1e0) /* cd sr */ +#define GSL_CONST_CGS_LUX (1e-4) /* cd sr / cm^2 */ +#define GSL_CONST_CGS_PHOT (1e0) /* cd sr / cm^2 */ +#define GSL_CONST_CGS_FOOTCANDLE (1.076e-3) /* cd sr / cm^2 */ +#define GSL_CONST_CGS_LAMBERT (1e0) /* cd sr / cm^2 */ +#define GSL_CONST_CGS_FOOTLAMBERT (1.07639104e-3) /* cd sr / cm^2 */ +#define GSL_CONST_CGS_CURIE (3.7e10) /* 1 / s */ +#define GSL_CONST_CGS_ROENTGEN (2.58e-7) /* A s / g */ +#define GSL_CONST_CGS_RAD (1e2) /* cm^2 / s^2 */ +#define GSL_CONST_CGS_SOLAR_MASS (1.98892e33) /* g */ +#define GSL_CONST_CGS_BOHR_RADIUS (5.291772083e-9) /* cm */ +#define GSL_CONST_CGS_NEWTON (1e5) /* cm g / s^2 */ +#define GSL_CONST_CGS_DYNE (1e0) /* cm g / s^2 */ +#define GSL_CONST_CGS_JOULE (1e7) /* g cm^2 / s^2 */ +#define GSL_CONST_CGS_ERG (1e0) /* g cm^2 / s^2 */ +#define GSL_CONST_CGS_STEFAN_BOLTZMANN_CONSTANT (5.67039934436e-5) /* g / K^4 s^3 */ +#define GSL_CONST_CGS_THOMSON_CROSS_SECTION (6.65245853542e-25) /* cm^2 */ + +#endif /* __GSL_CONST_CGS__ */ diff --git a/dtm_release/local/include/gsl/gsl_const_cgsm.h b/dtm_release/local/include/gsl/gsl_const_cgsm.h new file mode 100644 index 0000000000000000000000000000000000000000..17492687b53f65933557c3fb107619cefde461d0 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_const_cgsm.h @@ -0,0 +1,123 @@ +/* const/gsl_const_cgsm.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + * 2006 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_CONST_CGSM__ +#define __GSL_CONST_CGSM__ + +#define GSL_CONST_CGSM_SPEED_OF_LIGHT (2.99792458e10) /* cm / s */ +#define GSL_CONST_CGSM_GRAVITATIONAL_CONSTANT (6.673e-8) /* cm^3 / g s^2 */ +#define GSL_CONST_CGSM_PLANCKS_CONSTANT_H (6.62606876e-27) /* g cm^2 / s */ +#define GSL_CONST_CGSM_PLANCKS_CONSTANT_HBAR (1.05457159642e-27) /* g cm^2 / s */ +#define GSL_CONST_CGSM_ASTRONOMICAL_UNIT (1.49597870691e13) /* cm */ +#define GSL_CONST_CGSM_LIGHT_YEAR (9.46053620707e17) /* cm */ +#define GSL_CONST_CGSM_PARSEC (3.08567758135e18) /* cm */ +#define GSL_CONST_CGSM_GRAV_ACCEL (9.80665e2) /* cm / s^2 */ +#define GSL_CONST_CGSM_ELECTRON_VOLT (1.602176462e-12) /* g cm^2 / s^2 */ +#define GSL_CONST_CGSM_MASS_ELECTRON (9.10938188e-28) /* g */ +#define GSL_CONST_CGSM_MASS_MUON (1.88353109e-25) /* g */ +#define GSL_CONST_CGSM_MASS_PROTON (1.67262158e-24) /* g */ +#define GSL_CONST_CGSM_MASS_NEUTRON (1.67492716e-24) /* g */ +#define GSL_CONST_CGSM_RYDBERG (2.17987190389e-11) /* g cm^2 / s^2 */ +#define GSL_CONST_CGSM_BOLTZMANN (1.3806503e-16) /* g cm^2 / K s^2 */ +#define GSL_CONST_CGSM_BOHR_MAGNETON (9.27400899e-21) /* abamp cm^2 */ +#define GSL_CONST_CGSM_NUCLEAR_MAGNETON (5.05078317e-24) /* abamp cm^2 */ +#define GSL_CONST_CGSM_ELECTRON_MAGNETIC_MOMENT (9.28476362e-21) /* abamp cm^2 */ +#define GSL_CONST_CGSM_PROTON_MAGNETIC_MOMENT (1.410606633e-23) /* abamp cm^2 */ +#define GSL_CONST_CGSM_MOLAR_GAS (8.314472e7) /* g cm^2 / K mol s^2 */ +#define GSL_CONST_CGSM_STANDARD_GAS_VOLUME (2.2710981e4) /* cm^3 / mol */ +#define GSL_CONST_CGSM_MINUTE (6e1) /* s */ +#define GSL_CONST_CGSM_HOUR (3.6e3) /* s */ +#define GSL_CONST_CGSM_DAY (8.64e4) /* s */ +#define GSL_CONST_CGSM_WEEK (6.048e5) /* s */ +#define GSL_CONST_CGSM_INCH (2.54e0) /* cm */ +#define GSL_CONST_CGSM_FOOT (3.048e1) /* cm */ +#define GSL_CONST_CGSM_YARD (9.144e1) /* cm */ +#define GSL_CONST_CGSM_MILE (1.609344e5) /* cm */ +#define GSL_CONST_CGSM_NAUTICAL_MILE (1.852e5) /* cm */ +#define GSL_CONST_CGSM_FATHOM (1.8288e2) /* cm */ +#define GSL_CONST_CGSM_MIL (2.54e-3) /* cm */ +#define GSL_CONST_CGSM_POINT (3.52777777778e-2) /* cm */ +#define GSL_CONST_CGSM_TEXPOINT (3.51459803515e-2) /* cm */ +#define GSL_CONST_CGSM_MICRON (1e-4) /* cm */ +#define GSL_CONST_CGSM_ANGSTROM (1e-8) /* cm */ +#define GSL_CONST_CGSM_HECTARE (1e8) /* cm^2 */ +#define GSL_CONST_CGSM_ACRE (4.04685642241e7) /* cm^2 */ +#define GSL_CONST_CGSM_BARN (1e-24) /* cm^2 */ +#define GSL_CONST_CGSM_LITER (1e3) /* cm^3 */ +#define GSL_CONST_CGSM_US_GALLON (3.78541178402e3) /* cm^3 */ +#define GSL_CONST_CGSM_QUART (9.46352946004e2) /* cm^3 */ +#define GSL_CONST_CGSM_PINT (4.73176473002e2) /* cm^3 */ +#define GSL_CONST_CGSM_CUP (2.36588236501e2) /* cm^3 */ +#define GSL_CONST_CGSM_FLUID_OUNCE (2.95735295626e1) /* cm^3 */ +#define GSL_CONST_CGSM_TABLESPOON (1.47867647813e1) /* cm^3 */ +#define GSL_CONST_CGSM_TEASPOON (4.92892159375e0) /* cm^3 */ +#define GSL_CONST_CGSM_CANADIAN_GALLON (4.54609e3) /* cm^3 */ +#define GSL_CONST_CGSM_UK_GALLON (4.546092e3) /* cm^3 */ +#define GSL_CONST_CGSM_MILES_PER_HOUR (4.4704e1) /* cm / s */ +#define GSL_CONST_CGSM_KILOMETERS_PER_HOUR (2.77777777778e1) /* cm / s */ +#define GSL_CONST_CGSM_KNOT (5.14444444444e1) /* cm / s */ +#define GSL_CONST_CGSM_POUND_MASS (4.5359237e2) /* g */ +#define GSL_CONST_CGSM_OUNCE_MASS (2.8349523125e1) /* g */ +#define GSL_CONST_CGSM_TON (9.0718474e5) /* g */ +#define GSL_CONST_CGSM_METRIC_TON (1e6) /* g */ +#define GSL_CONST_CGSM_UK_TON (1.0160469088e6) /* g */ +#define GSL_CONST_CGSM_TROY_OUNCE (3.1103475e1) /* g */ +#define GSL_CONST_CGSM_CARAT (2e-1) /* g */ +#define GSL_CONST_CGSM_UNIFIED_ATOMIC_MASS (1.66053873e-24) /* g */ +#define GSL_CONST_CGSM_GRAM_FORCE (9.80665e2) /* cm g / s^2 */ +#define GSL_CONST_CGSM_POUND_FORCE (4.44822161526e5) /* cm g / s^2 */ +#define GSL_CONST_CGSM_KILOPOUND_FORCE (4.44822161526e8) /* cm g / s^2 */ +#define GSL_CONST_CGSM_POUNDAL (1.38255e4) /* cm g / s^2 */ +#define GSL_CONST_CGSM_CALORIE (4.1868e7) /* g cm^2 / s^2 */ +#define GSL_CONST_CGSM_BTU (1.05505585262e10) /* g cm^2 / s^2 */ +#define GSL_CONST_CGSM_THERM (1.05506e15) /* g cm^2 / s^2 */ +#define GSL_CONST_CGSM_HORSEPOWER (7.457e9) /* g cm^2 / s^3 */ +#define GSL_CONST_CGSM_BAR (1e6) /* g / cm s^2 */ +#define GSL_CONST_CGSM_STD_ATMOSPHERE (1.01325e6) /* g / cm s^2 */ +#define GSL_CONST_CGSM_TORR (1.33322368421e3) /* g / cm s^2 */ +#define GSL_CONST_CGSM_METER_OF_MERCURY (1.33322368421e6) /* g / cm s^2 */ +#define GSL_CONST_CGSM_INCH_OF_MERCURY (3.38638815789e4) /* g / cm s^2 */ +#define GSL_CONST_CGSM_INCH_OF_WATER (2.490889e3) /* g / cm s^2 */ +#define GSL_CONST_CGSM_PSI (6.89475729317e4) /* g / cm s^2 */ +#define GSL_CONST_CGSM_POISE (1e0) /* g / cm s */ +#define GSL_CONST_CGSM_STOKES (1e0) /* cm^2 / s */ +#define GSL_CONST_CGSM_FARADAY (9.6485341472e3) /* abamp s / mol */ +#define GSL_CONST_CGSM_ELECTRON_CHARGE (1.602176462e-20) /* abamp s */ +#define GSL_CONST_CGSM_GAUSS (1e0) /* g / abamp s^2 */ +#define GSL_CONST_CGSM_STILB (1e0) /* cd / cm^2 */ +#define GSL_CONST_CGSM_LUMEN (1e0) /* cd sr */ +#define GSL_CONST_CGSM_LUX (1e-4) /* cd sr / cm^2 */ +#define GSL_CONST_CGSM_PHOT (1e0) /* cd sr / cm^2 */ +#define GSL_CONST_CGSM_FOOTCANDLE (1.076e-3) /* cd sr / cm^2 */ +#define GSL_CONST_CGSM_LAMBERT (1e0) /* cd sr / cm^2 */ +#define GSL_CONST_CGSM_FOOTLAMBERT (1.07639104e-3) /* cd sr / cm^2 */ +#define GSL_CONST_CGSM_CURIE (3.7e10) /* 1 / s */ +#define GSL_CONST_CGSM_ROENTGEN (2.58e-8) /* abamp s / g */ +#define GSL_CONST_CGSM_RAD (1e2) /* cm^2 / s^2 */ +#define GSL_CONST_CGSM_SOLAR_MASS (1.98892e33) /* g */ +#define GSL_CONST_CGSM_BOHR_RADIUS (5.291772083e-9) /* cm */ +#define GSL_CONST_CGSM_NEWTON (1e5) /* cm g / s^2 */ +#define GSL_CONST_CGSM_DYNE (1e0) /* cm g / s^2 */ +#define GSL_CONST_CGSM_JOULE (1e7) /* g cm^2 / s^2 */ +#define GSL_CONST_CGSM_ERG (1e0) /* g cm^2 / s^2 */ +#define GSL_CONST_CGSM_STEFAN_BOLTZMANN_CONSTANT (5.67039934436e-5) /* g / K^4 s^3 */ +#define GSL_CONST_CGSM_THOMSON_CROSS_SECTION (6.65245853542e-25) /* cm^2 */ + +#endif /* __GSL_CONST_CGSM__ */ diff --git a/dtm_release/local/include/gsl/gsl_const_mks.h b/dtm_release/local/include/gsl/gsl_const_mks.h new file mode 100644 index 0000000000000000000000000000000000000000..5103ffedd40a010cbab29d3fe63bcc84df937426 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_const_mks.h @@ -0,0 +1,126 @@ +/* const/gsl_const_mks.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + * 2006 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_CONST_MKS__ +#define __GSL_CONST_MKS__ + +#define GSL_CONST_MKS_SPEED_OF_LIGHT (2.99792458e8) /* m / s */ +#define GSL_CONST_MKS_GRAVITATIONAL_CONSTANT (6.673e-11) /* m^3 / kg s^2 */ +#define GSL_CONST_MKS_PLANCKS_CONSTANT_H (6.62606876e-34) /* kg m^2 / s */ +#define GSL_CONST_MKS_PLANCKS_CONSTANT_HBAR (1.05457159642e-34) /* kg m^2 / s */ +#define GSL_CONST_MKS_ASTRONOMICAL_UNIT (1.49597870691e11) /* m */ +#define GSL_CONST_MKS_LIGHT_YEAR (9.46053620707e15) /* m */ +#define GSL_CONST_MKS_PARSEC (3.08567758135e16) /* m */ +#define GSL_CONST_MKS_GRAV_ACCEL (9.80665e0) /* m / s^2 */ +#define GSL_CONST_MKS_ELECTRON_VOLT (1.602176462e-19) /* kg m^2 / s^2 */ +#define GSL_CONST_MKS_MASS_ELECTRON (9.10938188e-31) /* kg */ +#define GSL_CONST_MKS_MASS_MUON (1.88353109e-28) /* kg */ +#define GSL_CONST_MKS_MASS_PROTON (1.67262158e-27) /* kg */ +#define GSL_CONST_MKS_MASS_NEUTRON (1.67492716e-27) /* kg */ +#define GSL_CONST_MKS_RYDBERG (2.17987190389e-18) /* kg m^2 / s^2 */ +#define GSL_CONST_MKS_BOLTZMANN (1.3806503e-23) /* kg m^2 / K s^2 */ +#define GSL_CONST_MKS_BOHR_MAGNETON (9.27400899e-24) /* A m^2 */ +#define GSL_CONST_MKS_NUCLEAR_MAGNETON (5.05078317e-27) /* A m^2 */ +#define GSL_CONST_MKS_ELECTRON_MAGNETIC_MOMENT (9.28476362e-24) /* A m^2 */ +#define GSL_CONST_MKS_PROTON_MAGNETIC_MOMENT (1.410606633e-26) /* A m^2 */ +#define GSL_CONST_MKS_MOLAR_GAS (8.314472e0) /* kg m^2 / K mol s^2 */ +#define GSL_CONST_MKS_STANDARD_GAS_VOLUME (2.2710981e-2) /* m^3 / mol */ +#define GSL_CONST_MKS_MINUTE (6e1) /* s */ +#define GSL_CONST_MKS_HOUR (3.6e3) /* s */ +#define GSL_CONST_MKS_DAY (8.64e4) /* s */ +#define GSL_CONST_MKS_WEEK (6.048e5) /* s */ +#define GSL_CONST_MKS_INCH (2.54e-2) /* m */ +#define GSL_CONST_MKS_FOOT (3.048e-1) /* m */ +#define GSL_CONST_MKS_YARD (9.144e-1) /* m */ +#define GSL_CONST_MKS_MILE (1.609344e3) /* m */ +#define GSL_CONST_MKS_NAUTICAL_MILE (1.852e3) /* m */ +#define GSL_CONST_MKS_FATHOM (1.8288e0) /* m */ +#define GSL_CONST_MKS_MIL (2.54e-5) /* m */ +#define GSL_CONST_MKS_POINT (3.52777777778e-4) /* m */ +#define GSL_CONST_MKS_TEXPOINT (3.51459803515e-4) /* m */ +#define GSL_CONST_MKS_MICRON (1e-6) /* m */ +#define GSL_CONST_MKS_ANGSTROM (1e-10) /* m */ +#define GSL_CONST_MKS_HECTARE (1e4) /* m^2 */ +#define GSL_CONST_MKS_ACRE (4.04685642241e3) /* m^2 */ +#define GSL_CONST_MKS_BARN (1e-28) /* m^2 */ +#define GSL_CONST_MKS_LITER (1e-3) /* m^3 */ +#define GSL_CONST_MKS_US_GALLON (3.78541178402e-3) /* m^3 */ +#define GSL_CONST_MKS_QUART (9.46352946004e-4) /* m^3 */ +#define GSL_CONST_MKS_PINT (4.73176473002e-4) /* m^3 */ +#define GSL_CONST_MKS_CUP (2.36588236501e-4) /* m^3 */ +#define GSL_CONST_MKS_FLUID_OUNCE (2.95735295626e-5) /* m^3 */ +#define GSL_CONST_MKS_TABLESPOON (1.47867647813e-5) /* m^3 */ +#define GSL_CONST_MKS_TEASPOON (4.92892159375e-6) /* m^3 */ +#define GSL_CONST_MKS_CANADIAN_GALLON (4.54609e-3) /* m^3 */ +#define GSL_CONST_MKS_UK_GALLON (4.546092e-3) /* m^3 */ +#define GSL_CONST_MKS_MILES_PER_HOUR (4.4704e-1) /* m / s */ +#define GSL_CONST_MKS_KILOMETERS_PER_HOUR (2.77777777778e-1) /* m / s */ +#define GSL_CONST_MKS_KNOT (5.14444444444e-1) /* m / s */ +#define GSL_CONST_MKS_POUND_MASS (4.5359237e-1) /* kg */ +#define GSL_CONST_MKS_OUNCE_MASS (2.8349523125e-2) /* kg */ +#define GSL_CONST_MKS_TON (9.0718474e2) /* kg */ +#define GSL_CONST_MKS_METRIC_TON (1e3) /* kg */ +#define GSL_CONST_MKS_UK_TON (1.0160469088e3) /* kg */ +#define GSL_CONST_MKS_TROY_OUNCE (3.1103475e-2) /* kg */ +#define GSL_CONST_MKS_CARAT (2e-4) /* kg */ +#define GSL_CONST_MKS_UNIFIED_ATOMIC_MASS (1.66053873e-27) /* kg */ +#define GSL_CONST_MKS_GRAM_FORCE (9.80665e-3) /* kg m / s^2 */ +#define GSL_CONST_MKS_POUND_FORCE (4.44822161526e0) /* kg m / s^2 */ +#define GSL_CONST_MKS_KILOPOUND_FORCE (4.44822161526e3) /* kg m / s^2 */ +#define GSL_CONST_MKS_POUNDAL (1.38255e-1) /* kg m / s^2 */ +#define GSL_CONST_MKS_CALORIE (4.1868e0) /* kg m^2 / s^2 */ +#define GSL_CONST_MKS_BTU (1.05505585262e3) /* kg m^2 / s^2 */ +#define GSL_CONST_MKS_THERM (1.05506e8) /* kg m^2 / s^2 */ +#define GSL_CONST_MKS_HORSEPOWER (7.457e2) /* kg m^2 / s^3 */ +#define GSL_CONST_MKS_BAR (1e5) /* kg / m s^2 */ +#define GSL_CONST_MKS_STD_ATMOSPHERE (1.01325e5) /* kg / m s^2 */ +#define GSL_CONST_MKS_TORR (1.33322368421e2) /* kg / m s^2 */ +#define GSL_CONST_MKS_METER_OF_MERCURY (1.33322368421e5) /* kg / m s^2 */ +#define GSL_CONST_MKS_INCH_OF_MERCURY (3.38638815789e3) /* kg / m s^2 */ +#define GSL_CONST_MKS_INCH_OF_WATER (2.490889e2) /* kg / m s^2 */ +#define GSL_CONST_MKS_PSI (6.89475729317e3) /* kg / m s^2 */ +#define GSL_CONST_MKS_POISE (1e-1) /* kg m^-1 s^-1 */ +#define GSL_CONST_MKS_STOKES (1e-4) /* m^2 / s */ +#define GSL_CONST_MKS_FARADAY (9.6485341472e4) /* A s / mol */ +#define GSL_CONST_MKS_ELECTRON_CHARGE (1.602176462e-19) /* A s */ +#define GSL_CONST_MKS_GAUSS (1e-4) /* kg / A s^2 */ +#define GSL_CONST_MKS_STILB (1e4) /* cd / m^2 */ +#define GSL_CONST_MKS_LUMEN (1e0) /* cd sr */ +#define GSL_CONST_MKS_LUX (1e0) /* cd sr / m^2 */ +#define GSL_CONST_MKS_PHOT (1e4) /* cd sr / m^2 */ +#define GSL_CONST_MKS_FOOTCANDLE (1.076e1) /* cd sr / m^2 */ +#define GSL_CONST_MKS_LAMBERT (1e4) /* cd sr / m^2 */ +#define GSL_CONST_MKS_FOOTLAMBERT (1.07639104e1) /* cd sr / m^2 */ +#define GSL_CONST_MKS_CURIE (3.7e10) /* 1 / s */ +#define GSL_CONST_MKS_ROENTGEN (2.58e-4) /* A s / kg */ +#define GSL_CONST_MKS_RAD (1e-2) /* m^2 / s^2 */ +#define GSL_CONST_MKS_SOLAR_MASS (1.98892e30) /* kg */ +#define GSL_CONST_MKS_BOHR_RADIUS (5.291772083e-11) /* m */ +#define GSL_CONST_MKS_NEWTON (1e0) /* kg m / s^2 */ +#define GSL_CONST_MKS_DYNE (1e-5) /* kg m / s^2 */ +#define GSL_CONST_MKS_JOULE (1e0) /* kg m^2 / s^2 */ +#define GSL_CONST_MKS_ERG (1e-7) /* kg m^2 / s^2 */ +#define GSL_CONST_MKS_STEFAN_BOLTZMANN_CONSTANT (5.67039934436e-8) /* kg / K^4 s^3 */ +#define GSL_CONST_MKS_THOMSON_CROSS_SECTION (6.65245853542e-29) /* m^2 */ +#define GSL_CONST_MKS_VACUUM_PERMITTIVITY (8.854187817e-12) /* A^2 s^4 / kg m^3 */ +#define GSL_CONST_MKS_VACUUM_PERMEABILITY (1.25663706144e-6) /* kg m / A^2 s^2 */ +#define GSL_CONST_MKS_DEBYE (3.33564095198e-30) /* A s^2 / m^2 */ + +#endif /* __GSL_CONST_MKS__ */ diff --git a/dtm_release/local/include/gsl/gsl_const_mksa.h b/dtm_release/local/include/gsl/gsl_const_mksa.h new file mode 100644 index 0000000000000000000000000000000000000000..21cc2672302122214d2039796ddb8bee6884539b --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_const_mksa.h @@ -0,0 +1,126 @@ +/* const/gsl_const_mksa.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + * 2006 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_CONST_MKSA__ +#define __GSL_CONST_MKSA__ + +#define GSL_CONST_MKSA_SPEED_OF_LIGHT (2.99792458e8) /* m / s */ +#define GSL_CONST_MKSA_GRAVITATIONAL_CONSTANT (6.673e-11) /* m^3 / kg s^2 */ +#define GSL_CONST_MKSA_PLANCKS_CONSTANT_H (6.62606876e-34) /* kg m^2 / s */ +#define GSL_CONST_MKSA_PLANCKS_CONSTANT_HBAR (1.05457159642e-34) /* kg m^2 / s */ +#define GSL_CONST_MKSA_ASTRONOMICAL_UNIT (1.49597870691e11) /* m */ +#define GSL_CONST_MKSA_LIGHT_YEAR (9.46053620707e15) /* m */ +#define GSL_CONST_MKSA_PARSEC (3.08567758135e16) /* m */ +#define GSL_CONST_MKSA_GRAV_ACCEL (9.80665e0) /* m / s^2 */ +#define GSL_CONST_MKSA_ELECTRON_VOLT (1.602176462e-19) /* kg m^2 / s^2 */ +#define GSL_CONST_MKSA_MASS_ELECTRON (9.10938188e-31) /* kg */ +#define GSL_CONST_MKSA_MASS_MUON (1.88353109e-28) /* kg */ +#define GSL_CONST_MKSA_MASS_PROTON (1.67262158e-27) /* kg */ +#define GSL_CONST_MKSA_MASS_NEUTRON (1.67492716e-27) /* kg */ +#define GSL_CONST_MKSA_RYDBERG (2.17987190389e-18) /* kg m^2 / s^2 */ +#define GSL_CONST_MKSA_BOLTZMANN (1.3806503e-23) /* kg m^2 / K s^2 */ +#define GSL_CONST_MKSA_BOHR_MAGNETON (9.27400899e-24) /* A m^2 */ +#define GSL_CONST_MKSA_NUCLEAR_MAGNETON (5.05078317e-27) /* A m^2 */ +#define GSL_CONST_MKSA_ELECTRON_MAGNETIC_MOMENT (9.28476362e-24) /* A m^2 */ +#define GSL_CONST_MKSA_PROTON_MAGNETIC_MOMENT (1.410606633e-26) /* A m^2 */ +#define GSL_CONST_MKSA_MOLAR_GAS (8.314472e0) /* kg m^2 / K mol s^2 */ +#define GSL_CONST_MKSA_STANDARD_GAS_VOLUME (2.2710981e-2) /* m^3 / mol */ +#define GSL_CONST_MKSA_MINUTE (6e1) /* s */ +#define GSL_CONST_MKSA_HOUR (3.6e3) /* s */ +#define GSL_CONST_MKSA_DAY (8.64e4) /* s */ +#define GSL_CONST_MKSA_WEEK (6.048e5) /* s */ +#define GSL_CONST_MKSA_INCH (2.54e-2) /* m */ +#define GSL_CONST_MKSA_FOOT (3.048e-1) /* m */ +#define GSL_CONST_MKSA_YARD (9.144e-1) /* m */ +#define GSL_CONST_MKSA_MILE (1.609344e3) /* m */ +#define GSL_CONST_MKSA_NAUTICAL_MILE (1.852e3) /* m */ +#define GSL_CONST_MKSA_FATHOM (1.8288e0) /* m */ +#define GSL_CONST_MKSA_MIL (2.54e-5) /* m */ +#define GSL_CONST_MKSA_POINT (3.52777777778e-4) /* m */ +#define GSL_CONST_MKSA_TEXPOINT (3.51459803515e-4) /* m */ +#define GSL_CONST_MKSA_MICRON (1e-6) /* m */ +#define GSL_CONST_MKSA_ANGSTROM (1e-10) /* m */ +#define GSL_CONST_MKSA_HECTARE (1e4) /* m^2 */ +#define GSL_CONST_MKSA_ACRE (4.04685642241e3) /* m^2 */ +#define GSL_CONST_MKSA_BARN (1e-28) /* m^2 */ +#define GSL_CONST_MKSA_LITER (1e-3) /* m^3 */ +#define GSL_CONST_MKSA_US_GALLON (3.78541178402e-3) /* m^3 */ +#define GSL_CONST_MKSA_QUART (9.46352946004e-4) /* m^3 */ +#define GSL_CONST_MKSA_PINT (4.73176473002e-4) /* m^3 */ +#define GSL_CONST_MKSA_CUP (2.36588236501e-4) /* m^3 */ +#define GSL_CONST_MKSA_FLUID_OUNCE (2.95735295626e-5) /* m^3 */ +#define GSL_CONST_MKSA_TABLESPOON (1.47867647813e-5) /* m^3 */ +#define GSL_CONST_MKSA_TEASPOON (4.92892159375e-6) /* m^3 */ +#define GSL_CONST_MKSA_CANADIAN_GALLON (4.54609e-3) /* m^3 */ +#define GSL_CONST_MKSA_UK_GALLON (4.546092e-3) /* m^3 */ +#define GSL_CONST_MKSA_MILES_PER_HOUR (4.4704e-1) /* m / s */ +#define GSL_CONST_MKSA_KILOMETERS_PER_HOUR (2.77777777778e-1) /* m / s */ +#define GSL_CONST_MKSA_KNOT (5.14444444444e-1) /* m / s */ +#define GSL_CONST_MKSA_POUND_MASS (4.5359237e-1) /* kg */ +#define GSL_CONST_MKSA_OUNCE_MASS (2.8349523125e-2) /* kg */ +#define GSL_CONST_MKSA_TON (9.0718474e2) /* kg */ +#define GSL_CONST_MKSA_METRIC_TON (1e3) /* kg */ +#define GSL_CONST_MKSA_UK_TON (1.0160469088e3) /* kg */ +#define GSL_CONST_MKSA_TROY_OUNCE (3.1103475e-2) /* kg */ +#define GSL_CONST_MKSA_CARAT (2e-4) /* kg */ +#define GSL_CONST_MKSA_UNIFIED_ATOMIC_MASS (1.66053873e-27) /* kg */ +#define GSL_CONST_MKSA_GRAM_FORCE (9.80665e-3) /* kg m / s^2 */ +#define GSL_CONST_MKSA_POUND_FORCE (4.44822161526e0) /* kg m / s^2 */ +#define GSL_CONST_MKSA_KILOPOUND_FORCE (4.44822161526e3) /* kg m / s^2 */ +#define GSL_CONST_MKSA_POUNDAL (1.38255e-1) /* kg m / s^2 */ +#define GSL_CONST_MKSA_CALORIE (4.1868e0) /* kg m^2 / s^2 */ +#define GSL_CONST_MKSA_BTU (1.05505585262e3) /* kg m^2 / s^2 */ +#define GSL_CONST_MKSA_THERM (1.05506e8) /* kg m^2 / s^2 */ +#define GSL_CONST_MKSA_HORSEPOWER (7.457e2) /* kg m^2 / s^3 */ +#define GSL_CONST_MKSA_BAR (1e5) /* kg / m s^2 */ +#define GSL_CONST_MKSA_STD_ATMOSPHERE (1.01325e5) /* kg / m s^2 */ +#define GSL_CONST_MKSA_TORR (1.33322368421e2) /* kg / m s^2 */ +#define GSL_CONST_MKSA_METER_OF_MERCURY (1.33322368421e5) /* kg / m s^2 */ +#define GSL_CONST_MKSA_INCH_OF_MERCURY (3.38638815789e3) /* kg / m s^2 */ +#define GSL_CONST_MKSA_INCH_OF_WATER (2.490889e2) /* kg / m s^2 */ +#define GSL_CONST_MKSA_PSI (6.89475729317e3) /* kg / m s^2 */ +#define GSL_CONST_MKSA_POISE (1e-1) /* kg m^-1 s^-1 */ +#define GSL_CONST_MKSA_STOKES (1e-4) /* m^2 / s */ +#define GSL_CONST_MKSA_FARADAY (9.6485341472e4) /* A s / mol */ +#define GSL_CONST_MKSA_ELECTRON_CHARGE (1.602176462e-19) /* A s */ +#define GSL_CONST_MKSA_GAUSS (1e-4) /* kg / A s^2 */ +#define GSL_CONST_MKSA_STILB (1e4) /* cd / m^2 */ +#define GSL_CONST_MKSA_LUMEN (1e0) /* cd sr */ +#define GSL_CONST_MKSA_LUX (1e0) /* cd sr / m^2 */ +#define GSL_CONST_MKSA_PHOT (1e4) /* cd sr / m^2 */ +#define GSL_CONST_MKSA_FOOTCANDLE (1.076e1) /* cd sr / m^2 */ +#define GSL_CONST_MKSA_LAMBERT (1e4) /* cd sr / m^2 */ +#define GSL_CONST_MKSA_FOOTLAMBERT (1.07639104e1) /* cd sr / m^2 */ +#define GSL_CONST_MKSA_CURIE (3.7e10) /* 1 / s */ +#define GSL_CONST_MKSA_ROENTGEN (2.58e-4) /* A s / kg */ +#define GSL_CONST_MKSA_RAD (1e-2) /* m^2 / s^2 */ +#define GSL_CONST_MKSA_SOLAR_MASS (1.98892e30) /* kg */ +#define GSL_CONST_MKSA_BOHR_RADIUS (5.291772083e-11) /* m */ +#define GSL_CONST_MKSA_NEWTON (1e0) /* kg m / s^2 */ +#define GSL_CONST_MKSA_DYNE (1e-5) /* kg m / s^2 */ +#define GSL_CONST_MKSA_JOULE (1e0) /* kg m^2 / s^2 */ +#define GSL_CONST_MKSA_ERG (1e-7) /* kg m^2 / s^2 */ +#define GSL_CONST_MKSA_STEFAN_BOLTZMANN_CONSTANT (5.67039934436e-8) /* kg / K^4 s^3 */ +#define GSL_CONST_MKSA_THOMSON_CROSS_SECTION (6.65245853542e-29) /* m^2 */ +#define GSL_CONST_MKSA_VACUUM_PERMITTIVITY (8.854187817e-12) /* A^2 s^4 / kg m^3 */ +#define GSL_CONST_MKSA_VACUUM_PERMEABILITY (1.25663706144e-6) /* kg m / A^2 s^2 */ +#define GSL_CONST_MKSA_DEBYE (3.33564095198e-30) /* A s^2 / m^2 */ + +#endif /* __GSL_CONST_MKSA__ */ diff --git a/dtm_release/local/include/gsl/gsl_const_num.h b/dtm_release/local/include/gsl/gsl_const_num.h new file mode 100644 index 0000000000000000000000000000000000000000..1d9cf70691d446fe68a918ae7a90c31ee7333a4c --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_const_num.h @@ -0,0 +1,43 @@ +/* const/gsl_const_num.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + * 2006 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_CONST_NUM__ +#define __GSL_CONST_NUM__ + +#define GSL_CONST_NUM_FINE_STRUCTURE (7.297352533e-3) /* 1 */ +#define GSL_CONST_NUM_AVOGADRO (6.02214199e23) /* 1 / mol */ +#define GSL_CONST_NUM_YOTTA (1e24) /* 1 */ +#define GSL_CONST_NUM_ZETTA (1e21) /* 1 */ +#define GSL_CONST_NUM_EXA (1e18) /* 1 */ +#define GSL_CONST_NUM_PETA (1e15) /* 1 */ +#define GSL_CONST_NUM_TERA (1e12) /* 1 */ +#define GSL_CONST_NUM_GIGA (1e9) /* 1 */ +#define GSL_CONST_NUM_MEGA (1e6) /* 1 */ +#define GSL_CONST_NUM_KILO (1e3) /* 1 */ +#define GSL_CONST_NUM_MILLI (1e-3) /* 1 */ +#define GSL_CONST_NUM_MICRO (1e-6) /* 1 */ +#define GSL_CONST_NUM_NANO (1e-9) /* 1 */ +#define GSL_CONST_NUM_PICO (1e-12) /* 1 */ +#define GSL_CONST_NUM_FEMTO (1e-15) /* 1 */ +#define GSL_CONST_NUM_ATTO (1e-18) /* 1 */ +#define GSL_CONST_NUM_ZEPTO (1e-21) /* 1 */ +#define GSL_CONST_NUM_YOCTO (1e-24) /* 1 */ + +#endif /* __GSL_CONST_NUM__ */ diff --git a/dtm_release/local/include/gsl/gsl_deriv.h b/dtm_release/local/include/gsl/gsl_deriv.h new file mode 100644 index 0000000000000000000000000000000000000000..7f4694fe75bf74bad4f96ca03f2bbc2bffb8d385 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_deriv.h @@ -0,0 +1,50 @@ +/* deriv/gsl_deriv.h + * + * Copyright (C) 2000 David Morrison + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_DERIV_H__ +#define __GSL_DERIV_H__ +#include <gsl/gsl_math.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_deriv_central (const gsl_function *f, + double x, double h, + double *result, double *abserr); + +int gsl_deriv_backward (const gsl_function *f, + double x, double h, + double *result, double *abserr); + +int gsl_deriv_forward (const gsl_function *f, + double x, double h, + double *result, double *abserr); + +__END_DECLS + +#endif /* __GSL_DERIV_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_dft_complex.h b/dtm_release/local/include/gsl/gsl_dft_complex.h new file mode 100644 index 0000000000000000000000000000000000000000..cb4d08804d1ca2baa161a294a53ba82d2502dd7a --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_dft_complex.h @@ -0,0 +1,55 @@ +/* fft/gsl_dft_complex.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_DFT_COMPLEX_H__ +#define __GSL_DFT_COMPLEX_H__ + +#include <stddef.h> + +#include <gsl/gsl_math.h> +#include <gsl/gsl_complex.h> +#include <gsl/gsl_fft.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_dft_complex_forward (const double data[], const size_t stride, const size_t n, + double result[]); + +int gsl_dft_complex_backward (const double data[], const size_t stride, const size_t n, + double result[]); + +int gsl_dft_complex_inverse (const double data[], const size_t stride, const size_t n, + double result[]); + +int gsl_dft_complex_transform (const double data[], const size_t stride, const size_t n, + double result[], const gsl_fft_direction sign); + +__END_DECLS + +#endif /* __GSL_DFT_COMPLEX_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_dft_complex_float.h b/dtm_release/local/include/gsl/gsl_dft_complex_float.h new file mode 100644 index 0000000000000000000000000000000000000000..c511ac09f63eea9a082158db0120903b46f4443a --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_dft_complex_float.h @@ -0,0 +1,55 @@ +/* fft/gsl_dft_complex_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_DFT_COMPLEX_FLOAT_H__ +#define __GSL_DFT_COMPLEX_FLOAT_H__ + +#include <stddef.h> + +#include <gsl/gsl_math.h> +#include <gsl/gsl_complex.h> +#include <gsl/gsl_fft.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_dft_complex_float_forward (const float data[], const size_t stride, const size_t n, + float result[]); + +int gsl_dft_complex_float_backward (const float data[], const size_t stride, const size_t n, + float result[]); + +int gsl_dft_complex_float_inverse (const float data[], const size_t stride, const size_t n, + float result[]); + +int gsl_dft_complex_float_transform (const float data[], const size_t stride, const size_t n, + float result[], const gsl_fft_direction sign); + +__END_DECLS + +#endif /* __GSL_DFT_COMPLEX_FLOAT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_dht.h b/dtm_release/local/include/gsl/gsl_dht.h new file mode 100644 index 0000000000000000000000000000000000000000..bfc4b2fffa9f9a9b4e4f395295665db71a94c439 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_dht.h @@ -0,0 +1,87 @@ +/* dht/gsl_dht.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman + */ +#ifndef __GSL_DHT_H__ +#define __GSL_DHT_H__ + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +struct gsl_dht_struct { + size_t size; /* size of the sample arrays to be transformed */ + double nu; /* Bessel function order */ + double xmax; /* the upper limit to the x-sampling domain */ + double kmax; /* the upper limit to the k-sampling domain */ + double * j; /* array of computed J_nu zeros, j_{nu,s} = j[s] */ + double * Jjj; /* transform numerator, J_nu(j_i j_m / j_N) */ + double * J2; /* transform denominator, J_{nu+1}^2(j_m) */ +}; +typedef struct gsl_dht_struct gsl_dht; + + +/* Create a new transform object for a given size + * sampling array on the domain [0, xmax]. + */ +gsl_dht * gsl_dht_alloc(size_t size); +gsl_dht * gsl_dht_new(size_t size, double nu, double xmax); + +/* Recalculate a transform object for given values of nu, xmax. + * You cannot change the size of the object since the internal + * allocation is reused. + */ +int gsl_dht_init(gsl_dht * t, double nu, double xmax); + +/* The n'th computed x sample point for a given transform. + * 0 <= n <= size-1 + */ +double gsl_dht_x_sample(const gsl_dht * t, int n); + + +/* The n'th computed k sample point for a given transform. + * 0 <= n <= size-1 + */ +double gsl_dht_k_sample(const gsl_dht * t, int n); + + +/* Free a transform object. + */ +void gsl_dht_free(gsl_dht * t); + + +/* Perform a transform on a sampled array. + * f_in[0] ... f_in[size-1] and similarly for f_out[] + */ +int gsl_dht_apply(const gsl_dht * t, double * f_in, double * f_out); + + +__END_DECLS + +#endif /* __GSL_DHT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_diff.h b/dtm_release/local/include/gsl/gsl_diff.h new file mode 100644 index 0000000000000000000000000000000000000000..14a0560104999394372f9f5ab12a08872f8ea62f --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_diff.h @@ -0,0 +1,50 @@ +/* diff/gsl_diff.h + * + * Copyright (C) 2000 David Morrison + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_DIFF_H__ +#define __GSL_DIFF_H__ +#include <gsl/gsl_math.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_diff_central (const gsl_function *f, + double x, + double *result, double *abserr); + +int gsl_diff_backward (const gsl_function *f, + double x, + double *result, double *abserr); + +int gsl_diff_forward (const gsl_function *f, + double x, + double *result, double *abserr); + +__END_DECLS + +#endif /* __GSL_DIFF_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_eigen.h b/dtm_release/local/include/gsl/gsl_eigen.h new file mode 100644 index 0000000000000000000000000000000000000000..37119be3db5ed11bd50b9971b475494553b7d6ba --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_eigen.h @@ -0,0 +1,345 @@ +/* eigen/gsl_eigen.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2006, 2007 Gerard Jungman, Brian Gough, Patrick Alken + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_EIGEN_H__ +#define __GSL_EIGEN_H__ + +#include <gsl/gsl_vector.h> +#include <gsl/gsl_matrix.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct { + size_t size; + double * d; + double * sd; +} gsl_eigen_symm_workspace; + +gsl_eigen_symm_workspace * gsl_eigen_symm_alloc (const size_t n); +void gsl_eigen_symm_free (gsl_eigen_symm_workspace * w); +int gsl_eigen_symm (gsl_matrix * A, gsl_vector * eval, gsl_eigen_symm_workspace * w); + +typedef struct { + size_t size; + double * d; + double * sd; + double * gc; + double * gs; +} gsl_eigen_symmv_workspace; + +gsl_eigen_symmv_workspace * gsl_eigen_symmv_alloc (const size_t n); +void gsl_eigen_symmv_free (gsl_eigen_symmv_workspace * w); +int gsl_eigen_symmv (gsl_matrix * A, gsl_vector * eval, gsl_matrix * evec, gsl_eigen_symmv_workspace * w); + +typedef struct { + size_t size; + double * d; + double * sd; + double * tau; +} gsl_eigen_herm_workspace; + +gsl_eigen_herm_workspace * gsl_eigen_herm_alloc (const size_t n); +void gsl_eigen_herm_free (gsl_eigen_herm_workspace * w); +int gsl_eigen_herm (gsl_matrix_complex * A, gsl_vector * eval, + gsl_eigen_herm_workspace * w); + +typedef struct { + size_t size; + double * d; + double * sd; + double * tau; + double * gc; + double * gs; +} gsl_eigen_hermv_workspace; + +gsl_eigen_hermv_workspace * gsl_eigen_hermv_alloc (const size_t n); +void gsl_eigen_hermv_free (gsl_eigen_hermv_workspace * w); +int gsl_eigen_hermv (gsl_matrix_complex * A, gsl_vector * eval, + gsl_matrix_complex * evec, + gsl_eigen_hermv_workspace * w); + +typedef struct { + size_t size; /* matrix size */ + size_t max_iterations; /* max iterations since last eigenvalue found */ + size_t n_iter; /* number of iterations since last eigenvalue found */ + size_t n_evals; /* number of eigenvalues found so far */ + + int compute_t; /* compute Schur form T = Z^t A Z */ + + gsl_matrix *H; /* pointer to Hessenberg matrix */ + gsl_matrix *Z; /* pointer to Schur vector matrix */ +} gsl_eigen_francis_workspace; + +gsl_eigen_francis_workspace * gsl_eigen_francis_alloc (void); +void gsl_eigen_francis_free (gsl_eigen_francis_workspace * w); +void gsl_eigen_francis_T (const int compute_t, + gsl_eigen_francis_workspace * w); +int gsl_eigen_francis (gsl_matrix * H, gsl_vector_complex * eval, + gsl_eigen_francis_workspace * w); +int gsl_eigen_francis_Z (gsl_matrix * H, gsl_vector_complex * eval, + gsl_matrix * Z, + gsl_eigen_francis_workspace * w); + +typedef struct { + size_t size; /* size of matrices */ + gsl_vector *diag; /* diagonal matrix elements from balancing */ + gsl_vector *tau; /* Householder coefficients */ + gsl_matrix *Z; /* pointer to Z matrix */ + int do_balance; /* perform balancing transformation? */ + size_t n_evals; /* number of eigenvalues found */ + + gsl_eigen_francis_workspace *francis_workspace_p; +} gsl_eigen_nonsymm_workspace; + +gsl_eigen_nonsymm_workspace * gsl_eigen_nonsymm_alloc (const size_t n); +void gsl_eigen_nonsymm_free (gsl_eigen_nonsymm_workspace * w); +void gsl_eigen_nonsymm_params (const int compute_t, const int balance, + gsl_eigen_nonsymm_workspace *w); +int gsl_eigen_nonsymm (gsl_matrix * A, gsl_vector_complex * eval, + gsl_eigen_nonsymm_workspace * w); +int gsl_eigen_nonsymm_Z (gsl_matrix * A, gsl_vector_complex * eval, + gsl_matrix * Z, gsl_eigen_nonsymm_workspace * w); + +typedef struct { + size_t size; /* size of matrices */ + gsl_vector *work; /* scratch workspace */ + gsl_vector *work2; /* scratch workspace */ + gsl_vector *work3; /* scratch workspace */ + + gsl_matrix *Z; /* pointer to Schur vectors */ + + gsl_eigen_nonsymm_workspace *nonsymm_workspace_p; +} gsl_eigen_nonsymmv_workspace; + +gsl_eigen_nonsymmv_workspace * gsl_eigen_nonsymmv_alloc (const size_t n); +void gsl_eigen_nonsymmv_free (gsl_eigen_nonsymmv_workspace * w); +int gsl_eigen_nonsymmv (gsl_matrix * A, gsl_vector_complex * eval, + gsl_matrix_complex * evec, + gsl_eigen_nonsymmv_workspace * w); +int gsl_eigen_nonsymmv_Z (gsl_matrix * A, gsl_vector_complex * eval, + gsl_matrix_complex * evec, gsl_matrix * Z, + gsl_eigen_nonsymmv_workspace * w); + +typedef struct { + size_t size; /* size of matrices */ + gsl_eigen_symm_workspace *symm_workspace_p; +} gsl_eigen_gensymm_workspace; + +gsl_eigen_gensymm_workspace * gsl_eigen_gensymm_alloc (const size_t n); +void gsl_eigen_gensymm_free (gsl_eigen_gensymm_workspace * w); +int gsl_eigen_gensymm (gsl_matrix * A, gsl_matrix * B, + gsl_vector * eval, gsl_eigen_gensymm_workspace * w); +int gsl_eigen_gensymm_standardize (gsl_matrix * A, const gsl_matrix * B); + +typedef struct { + size_t size; /* size of matrices */ + gsl_eigen_symmv_workspace *symmv_workspace_p; +} gsl_eigen_gensymmv_workspace; + +gsl_eigen_gensymmv_workspace * gsl_eigen_gensymmv_alloc (const size_t n); +void gsl_eigen_gensymmv_free (gsl_eigen_gensymmv_workspace * w); +int gsl_eigen_gensymmv (gsl_matrix * A, gsl_matrix * B, + gsl_vector * eval, gsl_matrix * evec, + gsl_eigen_gensymmv_workspace * w); + +typedef struct { + size_t size; /* size of matrices */ + gsl_eigen_herm_workspace *herm_workspace_p; +} gsl_eigen_genherm_workspace; + +gsl_eigen_genherm_workspace * gsl_eigen_genherm_alloc (const size_t n); +void gsl_eigen_genherm_free (gsl_eigen_genherm_workspace * w); +int gsl_eigen_genherm (gsl_matrix_complex * A, gsl_matrix_complex * B, + gsl_vector * eval, gsl_eigen_genherm_workspace * w); +int gsl_eigen_genherm_standardize (gsl_matrix_complex * A, + const gsl_matrix_complex * B); + +typedef struct { + size_t size; /* size of matrices */ + gsl_eigen_hermv_workspace *hermv_workspace_p; +} gsl_eigen_genhermv_workspace; + +gsl_eigen_genhermv_workspace * gsl_eigen_genhermv_alloc (const size_t n); +void gsl_eigen_genhermv_free (gsl_eigen_genhermv_workspace * w); +int gsl_eigen_genhermv (gsl_matrix_complex * A, gsl_matrix_complex * B, + gsl_vector * eval, gsl_matrix_complex * evec, + gsl_eigen_genhermv_workspace * w); + +typedef struct { + size_t size; /* size of matrices */ + gsl_vector *work; /* scratch workspace */ + + size_t n_evals; /* number of eigenvalues found */ + size_t max_iterations; /* maximum QZ iterations allowed */ + size_t n_iter; /* number of iterations since last eigenvalue found */ + double eshift; /* exceptional shift counter */ + + int needtop; /* need to compute top index? */ + + double atol; /* tolerance for splitting A matrix */ + double btol; /* tolerance for splitting B matrix */ + + double ascale; /* scaling factor for shifts */ + double bscale; /* scaling factor for shifts */ + + gsl_matrix *H; /* pointer to hessenberg matrix */ + gsl_matrix *R; /* pointer to upper triangular matrix */ + + int compute_s; /* compute generalized Schur form S */ + int compute_t; /* compute generalized Schur form T */ + + gsl_matrix *Q; /* pointer to left Schur vectors */ + gsl_matrix *Z; /* pointer to right Schur vectors */ +} gsl_eigen_gen_workspace; + +gsl_eigen_gen_workspace * gsl_eigen_gen_alloc (const size_t n); +void gsl_eigen_gen_free (gsl_eigen_gen_workspace * w); +void gsl_eigen_gen_params (const int compute_s, const int compute_t, + const int balance, gsl_eigen_gen_workspace * w); +int gsl_eigen_gen (gsl_matrix * A, gsl_matrix * B, + gsl_vector_complex * alpha, gsl_vector * beta, + gsl_eigen_gen_workspace * w); +int gsl_eigen_gen_QZ (gsl_matrix * A, gsl_matrix * B, + gsl_vector_complex * alpha, gsl_vector * beta, + gsl_matrix * Q, gsl_matrix * Z, + gsl_eigen_gen_workspace * w); + +typedef struct { + size_t size; /* size of matrices */ + + gsl_vector *work1; /* 1-norm of columns of A */ + gsl_vector *work2; /* 1-norm of columns of B */ + gsl_vector *work3; /* real part of eigenvector */ + gsl_vector *work4; /* imag part of eigenvector */ + gsl_vector *work5; /* real part of back-transformed eigenvector */ + gsl_vector *work6; /* imag part of back-transformed eigenvector */ + + gsl_matrix *Q; /* pointer to left Schur vectors */ + gsl_matrix *Z; /* pointer to right Schur vectors */ + + gsl_eigen_gen_workspace *gen_workspace_p; +} gsl_eigen_genv_workspace; + +gsl_eigen_genv_workspace * gsl_eigen_genv_alloc (const size_t n); +void gsl_eigen_genv_free (gsl_eigen_genv_workspace * w); +int gsl_eigen_genv (gsl_matrix * A, gsl_matrix * B, + gsl_vector_complex * alpha, gsl_vector * beta, + gsl_matrix_complex * evec, + gsl_eigen_genv_workspace * w); +int gsl_eigen_genv_QZ (gsl_matrix * A, gsl_matrix * B, + gsl_vector_complex * alpha, gsl_vector * beta, + gsl_matrix_complex * evec, + gsl_matrix * Q, gsl_matrix * Z, + gsl_eigen_genv_workspace * w); + + + +typedef enum { + GSL_EIGEN_SORT_VAL_ASC, + GSL_EIGEN_SORT_VAL_DESC, + GSL_EIGEN_SORT_ABS_ASC, + GSL_EIGEN_SORT_ABS_DESC +} +gsl_eigen_sort_t; + +/* Sort eigensystem results based on eigenvalues. + * Sorts in order of increasing value or increasing + * absolute value. + * + * exceptions: GSL_EBADLEN + */ + +int gsl_eigen_symmv_sort(gsl_vector * eval, gsl_matrix * evec, + gsl_eigen_sort_t sort_type); + +int gsl_eigen_hermv_sort(gsl_vector * eval, gsl_matrix_complex * evec, + gsl_eigen_sort_t sort_type); + +int gsl_eigen_nonsymmv_sort(gsl_vector_complex * eval, + gsl_matrix_complex * evec, + gsl_eigen_sort_t sort_type); + +int gsl_eigen_gensymmv_sort (gsl_vector * eval, gsl_matrix * evec, + gsl_eigen_sort_t sort_type); + +int gsl_eigen_genhermv_sort (gsl_vector * eval, gsl_matrix_complex * evec, + gsl_eigen_sort_t sort_type); + +int gsl_eigen_genv_sort (gsl_vector_complex * alpha, gsl_vector * beta, + gsl_matrix_complex * evec, + gsl_eigen_sort_t sort_type); + +/* Prototypes for the schur module */ + +int gsl_schur_gen_eigvals(const gsl_matrix *A, const gsl_matrix *B, + double *wr1, double *wr2, double *wi, + double *scale1, double *scale2); + +int gsl_schur_solve_equation(double ca, const gsl_matrix *A, double z, + double d1, double d2, const gsl_vector *b, + gsl_vector *x, double *s, double *xnorm, + double smin); + +int gsl_schur_solve_equation_z(double ca, const gsl_matrix *A, + gsl_complex *z, double d1, double d2, + const gsl_vector_complex *b, + gsl_vector_complex *x, double *s, + double *xnorm, double smin); + + +/* The following functions are obsolete: */ + +/* Eigensolve by Jacobi Method + * + * The data in the matrix input is destroyed. + * + * exceptions: + */ +int +gsl_eigen_jacobi(gsl_matrix * matrix, + gsl_vector * eval, + gsl_matrix * evec, + unsigned int max_rot, + unsigned int * nrot); + + +/* Invert by Jacobi Method + * + * exceptions: + */ +int +gsl_eigen_invert_jacobi(const gsl_matrix * matrix, + gsl_matrix * ainv, + unsigned int max_rot); + + + +__END_DECLS + +#endif /* __GSL_EIGEN_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_errno.h b/dtm_release/local/include/gsl/gsl_errno.h new file mode 100644 index 0000000000000000000000000000000000000000..b8e99b4335e9999ceaf6813884ac7788737f54fb --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_errno.h @@ -0,0 +1,154 @@ +/* err/gsl_errno.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_ERRNO_H__ +#define __GSL_ERRNO_H__ + +#include <stdio.h> +#include <errno.h> +#include <gsl/gsl_types.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +enum { + GSL_SUCCESS = 0, + GSL_FAILURE = -1, + GSL_CONTINUE = -2, /* iteration has not converged */ + GSL_EDOM = 1, /* input domain error, e.g sqrt(-1) */ + GSL_ERANGE = 2, /* output range error, e.g. exp(1e100) */ + GSL_EFAULT = 3, /* invalid pointer */ + GSL_EINVAL = 4, /* invalid argument supplied by user */ + GSL_EFAILED = 5, /* generic failure */ + GSL_EFACTOR = 6, /* factorization failed */ + GSL_ESANITY = 7, /* sanity check failed - shouldn't happen */ + GSL_ENOMEM = 8, /* malloc failed */ + GSL_EBADFUNC = 9, /* problem with user-supplied function */ + GSL_ERUNAWAY = 10, /* iterative process is out of control */ + GSL_EMAXITER = 11, /* exceeded max number of iterations */ + GSL_EZERODIV = 12, /* tried to divide by zero */ + GSL_EBADTOL = 13, /* user specified an invalid tolerance */ + GSL_ETOL = 14, /* failed to reach the specified tolerance */ + GSL_EUNDRFLW = 15, /* underflow */ + GSL_EOVRFLW = 16, /* overflow */ + GSL_ELOSS = 17, /* loss of accuracy */ + GSL_EROUND = 18, /* failed because of roundoff error */ + GSL_EBADLEN = 19, /* matrix, vector lengths are not conformant */ + GSL_ENOTSQR = 20, /* matrix not square */ + GSL_ESING = 21, /* apparent singularity detected */ + GSL_EDIVERGE = 22, /* integral or series is divergent */ + GSL_EUNSUP = 23, /* requested feature is not supported by the hardware */ + GSL_EUNIMPL = 24, /* requested feature not (yet) implemented */ + GSL_ECACHE = 25, /* cache limit exceeded */ + GSL_ETABLE = 26, /* table limit exceeded */ + GSL_ENOPROG = 27, /* iteration is not making progress towards solution */ + GSL_ENOPROGJ = 28, /* jacobian evaluations are not improving the solution */ + GSL_ETOLF = 29, /* cannot reach the specified tolerance in F */ + GSL_ETOLX = 30, /* cannot reach the specified tolerance in X */ + GSL_ETOLG = 31, /* cannot reach the specified tolerance in gradient */ + GSL_EOF = 32 /* end of file */ +} ; + +void gsl_error (const char * reason, const char * file, int line, + int gsl_errno); + +void gsl_stream_printf (const char *label, const char *file, + int line, const char *reason); + +const char * gsl_strerror (const int gsl_errno); + +typedef void gsl_error_handler_t (const char * reason, const char * file, + int line, int gsl_errno); + +typedef void gsl_stream_handler_t (const char * label, const char * file, + int line, const char * reason); + +gsl_error_handler_t * +gsl_set_error_handler (gsl_error_handler_t * new_handler); + +gsl_error_handler_t * +gsl_set_error_handler_off (void); + +gsl_stream_handler_t * +gsl_set_stream_handler (gsl_stream_handler_t * new_handler); + +FILE * gsl_set_stream (FILE * new_stream); + +/* GSL_ERROR: call the error handler, and return the error code */ + +#define GSL_ERROR(reason, gsl_errno) \ + do { \ + gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \ + return gsl_errno ; \ + } while (0) + +/* GSL_ERROR_VAL: call the error handler, and return the given value */ + +#define GSL_ERROR_VAL(reason, gsl_errno, value) \ + do { \ + gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \ + return value ; \ + } while (0) + +/* GSL_ERROR_VOID: call the error handler, and then return + (for void functions which still need to generate an error) */ + +#define GSL_ERROR_VOID(reason, gsl_errno) \ + do { \ + gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \ + return ; \ + } while (0) + +/* GSL_ERROR_NULL suitable for out-of-memory conditions */ + +#define GSL_ERROR_NULL(reason, gsl_errno) GSL_ERROR_VAL(reason, gsl_errno, 0) + +/* Sometimes you have several status results returned from + * function calls and you want to combine them in some sensible + * way. You cannot produce a "total" status condition, but you can + * pick one from a set of conditions based on an implied hierarchy. + * + * In other words: + * you have: status_a, status_b, ... + * you want: status = (status_a if it is bad, or status_b if it is bad,...) + * + * In this example you consider status_a to be more important and + * it is checked first, followed by the others in the order specified. + * + * Here are some dumb macros to do this. + */ +#define GSL_ERROR_SELECT_2(a,b) ((a) != GSL_SUCCESS ? (a) : ((b) != GSL_SUCCESS ? (b) : GSL_SUCCESS)) +#define GSL_ERROR_SELECT_3(a,b,c) ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_2(b,c)) +#define GSL_ERROR_SELECT_4(a,b,c,d) ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_3(b,c,d)) +#define GSL_ERROR_SELECT_5(a,b,c,d,e) ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_4(b,c,d,e)) + +#define GSL_STATUS_UPDATE(sp, s) do { if ((s) != GSL_SUCCESS) *(sp) = (s);} while(0) + +__END_DECLS + +#endif /* __GSL_ERRNO_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_fft.h b/dtm_release/local/include/gsl/gsl_fft.h new file mode 100644 index 0000000000000000000000000000000000000000..3578870169332b4224c9993de4169de09f9515ec --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_fft.h @@ -0,0 +1,60 @@ +/* fft/gsl_fft.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_FFT_H__ +#define __GSL_FFT_H__ + +#include <gsl/gsl_complex.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +#ifndef GSL_DISABLE_DEPRECATED +typedef enum + { + forward = -1, backward = +1, + gsl_fft_forward = -1, gsl_fft_backward = +1 + } +gsl_fft_direction; +#else +typedef enum + { + gsl_fft_forward = -1, gsl_fft_backward = +1 + } +gsl_fft_direction; +#endif + +/* this gives the sign in the formula + + h(f) = \sum x(t) exp(+/- 2 pi i f t) + + where - is the forward transform direction and + the inverse direction */ + +__END_DECLS + +#endif /* __GSL_FFT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_fft_complex.h b/dtm_release/local/include/gsl/gsl_fft_complex.h new file mode 100644 index 0000000000000000000000000000000000000000..c13f7ea504f068dfa03066fd09da0dc0b0f16967 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_fft_complex.h @@ -0,0 +1,136 @@ +/* fft/gsl_fft_complex.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_FFT_COMPLEX_H__ +#define __GSL_FFT_COMPLEX_H__ + +#include <stddef.h> + +#include <gsl/gsl_math.h> +#include <gsl/gsl_complex.h> +#include <gsl/gsl_fft.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Power of 2 routines */ + + +int gsl_fft_complex_radix2_forward (gsl_complex_packed_array data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_radix2_backward (gsl_complex_packed_array data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_radix2_inverse (gsl_complex_packed_array data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_radix2_transform (gsl_complex_packed_array data, + const size_t stride, + const size_t n, + const gsl_fft_direction sign); + +int gsl_fft_complex_radix2_dif_forward (gsl_complex_packed_array data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_radix2_dif_backward (gsl_complex_packed_array data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_radix2_dif_inverse (gsl_complex_packed_array data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_radix2_dif_transform (gsl_complex_packed_array data, + const size_t stride, + const size_t n, + const gsl_fft_direction sign); + +/* Mixed Radix general-N routines */ + +typedef struct + { + size_t n; + size_t nf; + size_t factor[64]; + gsl_complex *twiddle[64]; + gsl_complex *trig; + } +gsl_fft_complex_wavetable; + +typedef struct +{ + size_t n; + double *scratch; +} +gsl_fft_complex_workspace; + + +gsl_fft_complex_wavetable *gsl_fft_complex_wavetable_alloc (size_t n); + +void gsl_fft_complex_wavetable_free (gsl_fft_complex_wavetable * wavetable); + +gsl_fft_complex_workspace *gsl_fft_complex_workspace_alloc (size_t n); + +void gsl_fft_complex_workspace_free (gsl_fft_complex_workspace * workspace); + +int gsl_fft_complex_memcpy (gsl_fft_complex_wavetable * dest, + gsl_fft_complex_wavetable * src); + + +int gsl_fft_complex_forward (gsl_complex_packed_array data, + const size_t stride, + const size_t n, + const gsl_fft_complex_wavetable * wavetable, + gsl_fft_complex_workspace * work); + +int gsl_fft_complex_backward (gsl_complex_packed_array data, + const size_t stride, + const size_t n, + const gsl_fft_complex_wavetable * wavetable, + gsl_fft_complex_workspace * work); + +int gsl_fft_complex_inverse (gsl_complex_packed_array data, + const size_t stride, + const size_t n, + const gsl_fft_complex_wavetable * wavetable, + gsl_fft_complex_workspace * work); + +int gsl_fft_complex_transform (gsl_complex_packed_array data, + const size_t stride, const size_t n, + const gsl_fft_complex_wavetable * wavetable, + gsl_fft_complex_workspace * work, + const gsl_fft_direction sign); + +__END_DECLS + +#endif /* __GSL_FFT_COMPLEX_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_fft_complex_float.h b/dtm_release/local/include/gsl/gsl_fft_complex_float.h new file mode 100644 index 0000000000000000000000000000000000000000..d3ff395f976eb924d1363748f0de1d7180191bf3 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_fft_complex_float.h @@ -0,0 +1,139 @@ +/* fft/gsl_fft_complex_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_FFT_COMPLEX_FLOAT_H__ +#define __GSL_FFT_COMPLEX_FLOAT_H__ + +#include <stddef.h> + +#include <gsl/gsl_math.h> +#include <gsl/gsl_complex.h> +#include <gsl/gsl_fft.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Power of 2 routines */ + + +int gsl_fft_complex_float_radix2_forward (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_float_radix2_backward (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_float_radix2_inverse (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_float_radix2_transform (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n, + const gsl_fft_direction sign); + +int gsl_fft_complex_float_radix2_dif_forward (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_float_radix2_dif_backward (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_float_radix2_dif_inverse (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n); + +int gsl_fft_complex_float_radix2_dif_transform (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n, + const gsl_fft_direction sign); + +/* Mixed Radix general-N routines */ + +typedef struct + { + size_t n; + size_t nf; + size_t factor[64]; + gsl_complex_float *twiddle[64]; + gsl_complex_float *trig; + } +gsl_fft_complex_wavetable_float; + +typedef struct +{ + size_t n; + float *scratch; +} +gsl_fft_complex_workspace_float; + + +gsl_fft_complex_wavetable_float *gsl_fft_complex_wavetable_float_alloc (size_t n); + +void gsl_fft_complex_wavetable_float_free (gsl_fft_complex_wavetable_float * wavetable); + +gsl_fft_complex_workspace_float *gsl_fft_complex_workspace_float_alloc (size_t n); + +void gsl_fft_complex_workspace_float_free (gsl_fft_complex_workspace_float * workspace); + + +int gsl_fft_complex_float_memcpy (gsl_fft_complex_wavetable_float * dest, + gsl_fft_complex_wavetable_float * src); + + +int gsl_fft_complex_float_forward (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n, + const gsl_fft_complex_wavetable_float * wavetable, + gsl_fft_complex_workspace_float * work); + +int gsl_fft_complex_float_backward (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n, + const gsl_fft_complex_wavetable_float * wavetable, + gsl_fft_complex_workspace_float * work); + +int gsl_fft_complex_float_inverse (gsl_complex_packed_array_float data, + const size_t stride, + const size_t n, + const gsl_fft_complex_wavetable_float * wavetable, + gsl_fft_complex_workspace_float * work); + +int gsl_fft_complex_float_transform (gsl_complex_packed_array_float data, + const size_t stride, const size_t n, + const gsl_fft_complex_wavetable_float * wavetable, + gsl_fft_complex_workspace_float * work, + const gsl_fft_direction sign); + +__END_DECLS + +#endif /* __GSL_FFT_COMPLEX_FLOAT_H__ */ + + diff --git a/dtm_release/local/include/gsl/gsl_fft_halfcomplex.h b/dtm_release/local/include/gsl/gsl_fft_halfcomplex.h new file mode 100644 index 0000000000000000000000000000000000000000..6751e4762d3bf1f229d8e62a4fa657cc60cac01f --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_fft_halfcomplex.h @@ -0,0 +1,86 @@ +/* fft/gsl_fft_halfcomplex.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_FFT_HALFCOMPLEX_H__ +#define __GSL_FFT_HALFCOMPLEX_H__ + +#include <stddef.h> + +#include <gsl/gsl_math.h> +#include <gsl/gsl_complex.h> +#include <gsl/gsl_fft.h> +#include <gsl/gsl_fft_real.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_fft_halfcomplex_radix2_backward (double data[], const size_t stride, const size_t n); +int gsl_fft_halfcomplex_radix2_inverse (double data[], const size_t stride, const size_t n); +int gsl_fft_halfcomplex_radix2_transform (double data[], const size_t stride, const size_t n); + +typedef struct + { + size_t n; + size_t nf; + size_t factor[64]; + gsl_complex *twiddle[64]; + gsl_complex *trig; + } +gsl_fft_halfcomplex_wavetable; + +gsl_fft_halfcomplex_wavetable * gsl_fft_halfcomplex_wavetable_alloc (size_t n); + +void +gsl_fft_halfcomplex_wavetable_free (gsl_fft_halfcomplex_wavetable * wavetable); + + +int gsl_fft_halfcomplex_backward (double data[], const size_t stride, const size_t n, + const gsl_fft_halfcomplex_wavetable * wavetable, + gsl_fft_real_workspace * work); + +int gsl_fft_halfcomplex_inverse (double data[], const size_t stride, const size_t n, + const gsl_fft_halfcomplex_wavetable * wavetable, + gsl_fft_real_workspace * work); + +int gsl_fft_halfcomplex_transform (double data[], const size_t stride, const size_t n, + const gsl_fft_halfcomplex_wavetable * wavetable, + gsl_fft_real_workspace * work); + +int +gsl_fft_halfcomplex_unpack (const double halfcomplex_coefficient[], + double complex_coefficient[], + const size_t stride, const size_t n); + +int +gsl_fft_halfcomplex_radix2_unpack (const double halfcomplex_coefficient[], + double complex_coefficient[], + const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_FFT_HALFCOMPLEX_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_fft_halfcomplex_float.h b/dtm_release/local/include/gsl/gsl_fft_halfcomplex_float.h new file mode 100644 index 0000000000000000000000000000000000000000..e31836753346d5af7d94043490f7607a4bfeb72f --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_fft_halfcomplex_float.h @@ -0,0 +1,86 @@ +/* fft/gsl_fft_halfcomplex_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_FFT_HALFCOMPLEX_FLOAT_H__ +#define __GSL_FFT_HALFCOMPLEX_FLOAT_H__ + +#include <stddef.h> + +#include <gsl/gsl_math.h> +#include <gsl/gsl_complex.h> +#include <gsl/gsl_fft.h> +#include <gsl/gsl_fft_real_float.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_fft_halfcomplex_float_radix2_backward (float data[], const size_t stride, const size_t n); +int gsl_fft_halfcomplex_float_radix2_inverse (float data[], const size_t stride, const size_t n); +int gsl_fft_halfcomplex_float_radix2_transform (float data[], const size_t stride, const size_t n); + +typedef struct + { + size_t n; + size_t nf; + size_t factor[64]; + gsl_complex_float *twiddle[64]; + gsl_complex_float *trig; + } +gsl_fft_halfcomplex_wavetable_float; + + +gsl_fft_halfcomplex_wavetable_float * gsl_fft_halfcomplex_wavetable_float_alloc (size_t n); + +void +gsl_fft_halfcomplex_wavetable_float_free (gsl_fft_halfcomplex_wavetable_float * wavetable); + +int gsl_fft_halfcomplex_float_backward (float data[], const size_t stride, const size_t n, + const gsl_fft_halfcomplex_wavetable_float * wavetable, + gsl_fft_real_workspace_float * work); + +int gsl_fft_halfcomplex_float_inverse (float data[], const size_t stride, const size_t n, + const gsl_fft_halfcomplex_wavetable_float * wavetable, + gsl_fft_real_workspace_float * work); + +int gsl_fft_halfcomplex_float_transform (float data[], const size_t stride, const size_t n, + const gsl_fft_halfcomplex_wavetable_float * wavetable, + gsl_fft_real_workspace_float * work); + +int +gsl_fft_halfcomplex_float_unpack (const float halfcomplex_coefficient[], + float complex_coefficient[], + const size_t stride, const size_t n); + +int +gsl_fft_halfcomplex_float_radix2_unpack (const float halfcomplex_coefficient[], + float complex_coefficient[], + const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_FFT_HALFCOMPLEX_FLOAT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_fft_real.h b/dtm_release/local/include/gsl/gsl_fft_real.h new file mode 100644 index 0000000000000000000000000000000000000000..e07a60420c0b0af280e0a58d6ba81797827c5c82 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_fft_real.h @@ -0,0 +1,80 @@ +/* fft/gsl_fft_real.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_FFT_REAL_H__ +#define __GSL_FFT_REAL_H__ + +#include <stddef.h> + +#include <gsl/gsl_math.h> +#include <gsl/gsl_complex.h> +#include <gsl/gsl_fft.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_fft_real_radix2_transform (double data[], const size_t stride, const size_t n) ; + +typedef struct + { + size_t n; + size_t nf; + size_t factor[64]; + gsl_complex *twiddle[64]; + gsl_complex *trig; + } +gsl_fft_real_wavetable; + +typedef struct + { + size_t n; + double *scratch; + } +gsl_fft_real_workspace; + +gsl_fft_real_wavetable * gsl_fft_real_wavetable_alloc (size_t n); + +void gsl_fft_real_wavetable_free (gsl_fft_real_wavetable * wavetable); + +gsl_fft_real_workspace * gsl_fft_real_workspace_alloc (size_t n); + +void gsl_fft_real_workspace_free (gsl_fft_real_workspace * workspace); + + +int gsl_fft_real_transform (double data[], const size_t stride, const size_t n, + const gsl_fft_real_wavetable * wavetable, + gsl_fft_real_workspace * work); + + +int gsl_fft_real_unpack (const double real_coefficient[], + double complex_coefficient[], + const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_FFT_REAL_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_fft_real_float.h b/dtm_release/local/include/gsl/gsl_fft_real_float.h new file mode 100644 index 0000000000000000000000000000000000000000..7a7732f22ff9317f4b6acf73436404a0833e5ed8 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_fft_real_float.h @@ -0,0 +1,79 @@ +/* fft/gsl_fft_real_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_FFT_REAL_FLOAT_H__ +#define __GSL_FFT_REAL_FLOAT_H__ + +#include <stddef.h> + +#include <gsl/gsl_math.h> +#include <gsl/gsl_complex.h> +#include <gsl/gsl_fft.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_fft_real_float_radix2_transform (float data[], const size_t stride, const size_t n) ; + +typedef struct + { + size_t n; + size_t nf; + size_t factor[64]; + gsl_complex_float *twiddle[64]; + gsl_complex_float *trig; + } +gsl_fft_real_wavetable_float; + +typedef struct + { + size_t n; + float *scratch; + } +gsl_fft_real_workspace_float; + +gsl_fft_real_wavetable_float * gsl_fft_real_wavetable_float_alloc (size_t n); + +void gsl_fft_real_wavetable_float_free (gsl_fft_real_wavetable_float * wavetable); + +gsl_fft_real_workspace_float * gsl_fft_real_workspace_float_alloc (size_t n); + +void gsl_fft_real_workspace_float_free (gsl_fft_real_workspace_float * workspace); + +int gsl_fft_real_float_transform (float data[], const size_t stride, const size_t n, + const gsl_fft_real_wavetable_float * wavetable, + gsl_fft_real_workspace_float * work); + + +int gsl_fft_real_float_unpack (const float real_float_coefficient[], + float complex_coefficient[], + const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_FFT_REAL_FLOAT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_fit.h b/dtm_release/local/include/gsl/gsl_fit.h new file mode 100644 index 0000000000000000000000000000000000000000..de83a41d0f2231eeeab95beda9cc4ff4f22bdd67 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_fit.h @@ -0,0 +1,85 @@ +/* fit/gsl_fit.h + * + * Copyright (C) 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_FIT_H__ +#define __GSL_FIT_H__ + +#include <stdlib.h> +#include <gsl/gsl_math.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_fit_linear (const double * x, const size_t xstride, + const double * y, const size_t ystride, + const size_t n, + double * c0, double * c1, + double * cov00, double * cov01, double * cov11, + double * sumsq); + + +int gsl_fit_wlinear (const double * x, const size_t xstride, + const double * w, const size_t wstride, + const double * y, const size_t ystride, + const size_t n, + double * c0, double * c1, + double * cov00, double * cov01, double * cov11, + double * chisq); + +int +gsl_fit_linear_est (const double x, + const double c0, const double c1, + const double cov00, const double cov01, const double cov11, + double *y, double *y_err); + + +int gsl_fit_mul (const double * x, const size_t xstride, + const double * y, const size_t ystride, + const size_t n, + double * c1, + double * cov11, + double * sumsq); + +int gsl_fit_wmul (const double * x, const size_t xstride, + const double * w, const size_t wstride, + const double * y, const size_t ystride, + const size_t n, + double * c1, + double * cov11, + double * sumsq); + + +int +gsl_fit_mul_est (const double x, + const double c1, + const double cov11, + double *y, double *y_err); + +__END_DECLS + +#endif /* __GSL_FIT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_heapsort.h b/dtm_release/local/include/gsl/gsl_heapsort.h new file mode 100644 index 0000000000000000000000000000000000000000..213fae1e81f2c125c5c26655a69e2d9604e1e83b --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_heapsort.h @@ -0,0 +1,44 @@ +/* sort/gsl_heapsort.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_HEAPSORT_H__ +#define __GSL_HEAPSORT_H__ + +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef int (*gsl_comparison_fn_t) (const void *, const void *); + +void gsl_heapsort (void * array, size_t count, size_t size, gsl_comparison_fn_t compare); +int gsl_heapsort_index (size_t * p, const void * array, size_t count, size_t size, gsl_comparison_fn_t compare); + +__END_DECLS + +#endif /* __GSL_HEAPSORT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_histogram.h b/dtm_release/local/include/gsl/gsl_histogram.h new file mode 100644 index 0000000000000000000000000000000000000000..e8375c64ea447a3a130fb19969dcf78ac18abc4f --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_histogram.h @@ -0,0 +1,134 @@ +/* histogram/gsl_histogram.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_HISTOGRAM_H__ +#define __GSL_HISTOGRAM_H__ + +#include <stdlib.h> +#include <stdio.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct { + size_t n ; + double * range ; + double * bin ; +} gsl_histogram ; + +typedef struct { + size_t n ; + double * range ; + double * sum ; +} gsl_histogram_pdf ; + +gsl_histogram * gsl_histogram_alloc (size_t n); + +gsl_histogram * gsl_histogram_calloc (size_t n); +gsl_histogram * gsl_histogram_calloc_uniform (const size_t n, const double xmin, const double xmax); +void gsl_histogram_free (gsl_histogram * h); +int gsl_histogram_increment (gsl_histogram * h, double x); +int gsl_histogram_accumulate (gsl_histogram * h, double x, double weight); +int gsl_histogram_find (const gsl_histogram * h, + const double x, size_t * i); + +double gsl_histogram_get (const gsl_histogram * h, size_t i); +int gsl_histogram_get_range (const gsl_histogram * h, size_t i, + double * lower, double * upper); + +double gsl_histogram_max (const gsl_histogram * h); +double gsl_histogram_min (const gsl_histogram * h); +size_t gsl_histogram_bins (const gsl_histogram * h); + +void gsl_histogram_reset (gsl_histogram * h); + +gsl_histogram * gsl_histogram_calloc_range(size_t n, double * range); + +int +gsl_histogram_set_ranges (gsl_histogram * h, const double range[], size_t size); +int +gsl_histogram_set_ranges_uniform (gsl_histogram * h, double xmin, double xmax); + + + +int +gsl_histogram_memcpy(gsl_histogram * dest, const gsl_histogram * source); + +gsl_histogram * +gsl_histogram_clone(const gsl_histogram * source); + +double gsl_histogram_max_val (const gsl_histogram * h); + +size_t gsl_histogram_max_bin (const gsl_histogram * h); + +double gsl_histogram_min_val (const gsl_histogram * h); + +size_t gsl_histogram_min_bin (const gsl_histogram * h); + +int +gsl_histogram_equal_bins_p(const gsl_histogram *h1, const gsl_histogram *h2); + +int +gsl_histogram_add(gsl_histogram *h1, const gsl_histogram *h2); + +int +gsl_histogram_sub(gsl_histogram *h1, const gsl_histogram *h2); + +int +gsl_histogram_mul(gsl_histogram *h1, const gsl_histogram *h2); + +int +gsl_histogram_div(gsl_histogram *h1, const gsl_histogram *h2); + +int +gsl_histogram_scale(gsl_histogram *h, double scale); + +int +gsl_histogram_shift (gsl_histogram * h, double shift); + + +double gsl_histogram_sigma (const gsl_histogram * h); + +double gsl_histogram_mean (const gsl_histogram * h); + +double gsl_histogram_sum (const gsl_histogram * h); + +int gsl_histogram_fwrite (FILE * stream, const gsl_histogram * h) ; +int gsl_histogram_fread (FILE * stream, gsl_histogram * h); +int gsl_histogram_fprintf (FILE * stream, const gsl_histogram * h, + const char * range_format, const char * bin_format); +int gsl_histogram_fscanf (FILE * stream, gsl_histogram * h); + +gsl_histogram_pdf * gsl_histogram_pdf_alloc (const size_t n); +int gsl_histogram_pdf_init (gsl_histogram_pdf * p, const gsl_histogram * h); +void gsl_histogram_pdf_free (gsl_histogram_pdf * p); +double gsl_histogram_pdf_sample (const gsl_histogram_pdf * p, double r); + +__END_DECLS + +#endif /* __GSL_HISTOGRAM_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_histogram2d.h b/dtm_release/local/include/gsl/gsl_histogram2d.h new file mode 100644 index 0000000000000000000000000000000000000000..90065ac0cc2cd2675376f6248455456cdb00f4bd --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_histogram2d.h @@ -0,0 +1,172 @@ +/* histogram/gsl_histogram2d.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_HISTOGRAM2D_H__ +#define __GSL_HISTOGRAM2D_H__ + +#include <stdlib.h> +#include <stdio.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct { + size_t nx, ny ; + double * xrange ; + double * yrange ; + double * bin ; +} gsl_histogram2d ; + +typedef struct { + size_t nx, ny ; + double * xrange ; + double * yrange ; + double * sum ; +} gsl_histogram2d_pdf ; + +gsl_histogram2d * gsl_histogram2d_alloc (const size_t nx, const size_t ny); +gsl_histogram2d * gsl_histogram2d_calloc (const size_t nx, const size_t ny); +gsl_histogram2d * gsl_histogram2d_calloc_uniform (const size_t nx, const size_t ny, + const double xmin, const double xmax, + const double ymin, const double ymax); + +void gsl_histogram2d_free (gsl_histogram2d * h); + +int gsl_histogram2d_increment (gsl_histogram2d * h, double x, double y); +int gsl_histogram2d_accumulate (gsl_histogram2d * h, + double x, double y, double weight); +int gsl_histogram2d_find (const gsl_histogram2d * h, + const double x, const double y, size_t * i, size_t * j); + +double gsl_histogram2d_get (const gsl_histogram2d * h, const size_t i, const size_t j); +int gsl_histogram2d_get_xrange (const gsl_histogram2d * h, const size_t i, + double * xlower, double * xupper); +int gsl_histogram2d_get_yrange (const gsl_histogram2d * h, const size_t j, + double * ylower, double * yupper); + + +double gsl_histogram2d_xmax (const gsl_histogram2d * h); +double gsl_histogram2d_xmin (const gsl_histogram2d * h); +size_t gsl_histogram2d_nx (const gsl_histogram2d * h); + +double gsl_histogram2d_ymax (const gsl_histogram2d * h); +double gsl_histogram2d_ymin (const gsl_histogram2d * h); +size_t gsl_histogram2d_ny (const gsl_histogram2d * h); + +void gsl_histogram2d_reset (gsl_histogram2d * h); + +gsl_histogram2d * +gsl_histogram2d_calloc_range(size_t nx, size_t ny, + double *xrange, double *yrange); + +int +gsl_histogram2d_set_ranges_uniform (gsl_histogram2d * h, + double xmin, double xmax, + double ymin, double ymax); + +int +gsl_histogram2d_set_ranges (gsl_histogram2d * h, + const double xrange[], size_t xsize, + const double yrange[], size_t ysize); + +int +gsl_histogram2d_memcpy(gsl_histogram2d *dest, const gsl_histogram2d *source); + +gsl_histogram2d * +gsl_histogram2d_clone(const gsl_histogram2d * source); + +double +gsl_histogram2d_max_val(const gsl_histogram2d *h); + +void +gsl_histogram2d_max_bin (const gsl_histogram2d *h, size_t *i, size_t *j); + +double +gsl_histogram2d_min_val(const gsl_histogram2d *h); + +void +gsl_histogram2d_min_bin (const gsl_histogram2d *h, size_t *i, size_t *j); + +double +gsl_histogram2d_xmean (const gsl_histogram2d * h); + +double +gsl_histogram2d_ymean (const gsl_histogram2d * h); + +double +gsl_histogram2d_xsigma (const gsl_histogram2d * h); + +double +gsl_histogram2d_ysigma (const gsl_histogram2d * h); + +double +gsl_histogram2d_cov (const gsl_histogram2d * h); + +double +gsl_histogram2d_sum (const gsl_histogram2d *h); + +int +gsl_histogram2d_equal_bins_p(const gsl_histogram2d *h1, + const gsl_histogram2d *h2) ; + +int +gsl_histogram2d_add(gsl_histogram2d *h1, const gsl_histogram2d *h2); + +int +gsl_histogram2d_sub(gsl_histogram2d *h1, const gsl_histogram2d *h2); + +int +gsl_histogram2d_mul(gsl_histogram2d *h1, const gsl_histogram2d *h2); + +int +gsl_histogram2d_div(gsl_histogram2d *h1, const gsl_histogram2d *h2); + +int +gsl_histogram2d_scale(gsl_histogram2d *h, double scale); + +int +gsl_histogram2d_shift(gsl_histogram2d *h, double shift); + +int gsl_histogram2d_fwrite (FILE * stream, const gsl_histogram2d * h) ; +int gsl_histogram2d_fread (FILE * stream, gsl_histogram2d * h); +int gsl_histogram2d_fprintf (FILE * stream, const gsl_histogram2d * h, + const char * range_format, + const char * bin_format); +int gsl_histogram2d_fscanf (FILE * stream, gsl_histogram2d * h); + +gsl_histogram2d_pdf * gsl_histogram2d_pdf_alloc (const size_t nx, const size_t ny); +int gsl_histogram2d_pdf_init (gsl_histogram2d_pdf * p, const gsl_histogram2d * h); +void gsl_histogram2d_pdf_free (gsl_histogram2d_pdf * p); +int gsl_histogram2d_pdf_sample (const gsl_histogram2d_pdf * p, + double r1, double r2, + double * x, double * y); + +__END_DECLS + +#endif /* __GSL_HISTOGRAM2D_H__ */ + diff --git a/dtm_release/local/include/gsl/gsl_ieee_utils.h b/dtm_release/local/include/gsl/gsl_ieee_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..a961220763fdc7f460683855c0dd5625836c2b0a --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_ieee_utils.h @@ -0,0 +1,99 @@ +/* ieee-utils/gsl_ieee_utils.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_IEEE_UTILS_H__ +#define __GSL_IEEE_UTILS_H__ +#include <stdio.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +enum { + GSL_IEEE_TYPE_NAN = 1, + GSL_IEEE_TYPE_INF = 2, + GSL_IEEE_TYPE_NORMAL = 3, + GSL_IEEE_TYPE_DENORMAL = 4, + GSL_IEEE_TYPE_ZERO = 5 +} ; + +typedef struct { + int sign ; + char mantissa[24] ; /* Actual bits are 0..22, element 23 is \0 */ + int exponent ; + int type ; +} gsl_ieee_float_rep ; + +typedef struct { + int sign ; + char mantissa[53] ; /* Actual bits are 0..51, element 52 is \0 */ + int exponent ; + int type ; +} gsl_ieee_double_rep ; + + +void gsl_ieee_printf_float (const float * x) ; +void gsl_ieee_printf_double (const double * x) ; + +void gsl_ieee_fprintf_float (FILE * stream, const float * x) ; +void gsl_ieee_fprintf_double (FILE * stream, const double * x) ; + +void gsl_ieee_float_to_rep (const float * x, gsl_ieee_float_rep * r) ; +void gsl_ieee_double_to_rep (const double * x, gsl_ieee_double_rep * r) ; + +enum { + GSL_IEEE_SINGLE_PRECISION = 1, + GSL_IEEE_DOUBLE_PRECISION = 2, + GSL_IEEE_EXTENDED_PRECISION = 3 +} ; + +enum { + GSL_IEEE_ROUND_TO_NEAREST = 1, + GSL_IEEE_ROUND_DOWN = 2, + GSL_IEEE_ROUND_UP = 3, + GSL_IEEE_ROUND_TO_ZERO = 4 +} ; + +enum { + GSL_IEEE_MASK_INVALID = 1, + GSL_IEEE_MASK_DENORMALIZED = 2, + GSL_IEEE_MASK_DIVISION_BY_ZERO = 4, + GSL_IEEE_MASK_OVERFLOW = 8, + GSL_IEEE_MASK_UNDERFLOW = 16, + GSL_IEEE_MASK_ALL = 31, + GSL_IEEE_TRAP_INEXACT = 32 +} ; + +void gsl_ieee_env_setup (void) ; +int gsl_ieee_read_mode_string (const char * description, int * precision, + int * rounding, int * exception_mask) ; +int gsl_ieee_set_mode (int precision, int rounding, int exception_mask) ; + +__END_DECLS + +#endif /* __GSL_IEEE_UTILS_H__ */ + diff --git a/dtm_release/local/include/gsl/gsl_integration.h b/dtm_release/local/include/gsl/gsl_integration.h new file mode 100644 index 0000000000000000000000000000000000000000..dda6d0bdab761bcaab1aa0695688c7ce152f9e37 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_integration.h @@ -0,0 +1,252 @@ +/* integration/gsl_integration.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_INTEGRATION_H__ +#define __GSL_INTEGRATION_H__ +#include <stdlib.h> +#include <gsl/gsl_math.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Workspace for adaptive integrators */ + +typedef struct + { + size_t limit; + size_t size; + size_t nrmax; + size_t i; + size_t maximum_level; + double *alist; + double *blist; + double *rlist; + double *elist; + size_t *order; + size_t *level; + } +gsl_integration_workspace; + +gsl_integration_workspace * + gsl_integration_workspace_alloc (const size_t n); + +void + gsl_integration_workspace_free (gsl_integration_workspace * w); + + +/* Workspace for QAWS integrator */ + +typedef struct +{ + double alpha; + double beta; + int mu; + int nu; + double ri[25]; + double rj[25]; + double rg[25]; + double rh[25]; +} +gsl_integration_qaws_table; + +gsl_integration_qaws_table * +gsl_integration_qaws_table_alloc (double alpha, double beta, int mu, int nu); + +int +gsl_integration_qaws_table_set (gsl_integration_qaws_table * t, + double alpha, double beta, int mu, int nu); + +void +gsl_integration_qaws_table_free (gsl_integration_qaws_table * t); + +/* Workspace for QAWO integrator */ + +enum gsl_integration_qawo_enum { GSL_INTEG_COSINE, GSL_INTEG_SINE }; + +typedef struct +{ + size_t n; + double omega; + double L; + double par; + enum gsl_integration_qawo_enum sine; + double *chebmo; +} +gsl_integration_qawo_table; + +gsl_integration_qawo_table * +gsl_integration_qawo_table_alloc (double omega, double L, + enum gsl_integration_qawo_enum sine, + size_t n); + +int +gsl_integration_qawo_table_set (gsl_integration_qawo_table * t, + double omega, double L, + enum gsl_integration_qawo_enum sine); + +int +gsl_integration_qawo_table_set_length (gsl_integration_qawo_table * t, + double L); + +void +gsl_integration_qawo_table_free (gsl_integration_qawo_table * t); + + +/* Definition of an integration rule */ + +typedef void gsl_integration_rule (const gsl_function * f, + double a, double b, + double *result, double *abserr, + double *defabs, double *resabs); + +void gsl_integration_qk15 (const gsl_function * f, double a, double b, + double *result, double *abserr, + double *resabs, double *resasc); + +void gsl_integration_qk21 (const gsl_function * f, double a, double b, + double *result, double *abserr, + double *resabs, double *resasc); + +void gsl_integration_qk31 (const gsl_function * f, double a, double b, + double *result, double *abserr, + double *resabs, double *resasc); + +void gsl_integration_qk41 (const gsl_function * f, double a, double b, + double *result, double *abserr, + double *resabs, double *resasc); + +void gsl_integration_qk51 (const gsl_function * f, double a, double b, + double *result, double *abserr, + double *resabs, double *resasc); + +void gsl_integration_qk61 (const gsl_function * f, double a, double b, + double *result, double *abserr, + double *resabs, double *resasc); + +void gsl_integration_qcheb (gsl_function * f, double a, double b, + double *cheb12, double *cheb24); + +/* The low-level integration rules in QUADPACK are identified by small + integers (1-6). We'll use symbolic constants to refer to them. */ + +enum + { + GSL_INTEG_GAUSS15 = 1, /* 15 point Gauss-Kronrod rule */ + GSL_INTEG_GAUSS21 = 2, /* 21 point Gauss-Kronrod rule */ + GSL_INTEG_GAUSS31 = 3, /* 31 point Gauss-Kronrod rule */ + GSL_INTEG_GAUSS41 = 4, /* 41 point Gauss-Kronrod rule */ + GSL_INTEG_GAUSS51 = 5, /* 51 point Gauss-Kronrod rule */ + GSL_INTEG_GAUSS61 = 6 /* 61 point Gauss-Kronrod rule */ + }; + +void +gsl_integration_qk (const int n, const double xgk[], + const double wg[], const double wgk[], + double fv1[], double fv2[], + const gsl_function *f, double a, double b, + double * result, double * abserr, + double * resabs, double * resasc); + + +int gsl_integration_qng (const gsl_function * f, + double a, double b, + double epsabs, double epsrel, + double *result, double *abserr, + size_t * neval); + +int gsl_integration_qag (const gsl_function * f, + double a, double b, + double epsabs, double epsrel, size_t limit, + int key, + gsl_integration_workspace * workspace, + double *result, double *abserr); + +int gsl_integration_qagi (gsl_function * f, + double epsabs, double epsrel, size_t limit, + gsl_integration_workspace * workspace, + double *result, double *abserr); + +int gsl_integration_qagiu (gsl_function * f, + double a, + double epsabs, double epsrel, size_t limit, + gsl_integration_workspace * workspace, + double *result, double *abserr); + +int gsl_integration_qagil (gsl_function * f, + double b, + double epsabs, double epsrel, size_t limit, + gsl_integration_workspace * workspace, + double *result, double *abserr); + + +int gsl_integration_qags (const gsl_function * f, + double a, double b, + double epsabs, double epsrel, size_t limit, + gsl_integration_workspace * workspace, + double *result, double *abserr); + +int gsl_integration_qagp (const gsl_function * f, + double *pts, size_t npts, + double epsabs, double epsrel, size_t limit, + gsl_integration_workspace * workspace, + double *result, double *abserr); + +int gsl_integration_qawc (gsl_function *f, + const double a, const double b, const double c, + const double epsabs, const double epsrel, const size_t limit, + gsl_integration_workspace * workspace, + double * result, double * abserr); + +int gsl_integration_qaws (gsl_function * f, + const double a, const double b, + gsl_integration_qaws_table * t, + const double epsabs, const double epsrel, + const size_t limit, + gsl_integration_workspace * workspace, + double *result, double *abserr); + +int gsl_integration_qawo (gsl_function * f, + const double a, + const double epsabs, const double epsrel, + const size_t limit, + gsl_integration_workspace * workspace, + gsl_integration_qawo_table * wf, + double *result, double *abserr); + +int gsl_integration_qawf (gsl_function * f, + const double a, + const double epsabs, + const size_t limit, + gsl_integration_workspace * workspace, + gsl_integration_workspace * cycle_workspace, + gsl_integration_qawo_table * wf, + double *result, double *abserr); + +__END_DECLS + +#endif /* __GSL_INTEGRATION_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_interp.h b/dtm_release/local/include/gsl/gsl_interp.h new file mode 100644 index 0000000000000000000000000000000000000000..4a28d7122624d23359333ebf2323a86ac4e7fb20 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_interp.h @@ -0,0 +1,202 @@ +/* interpolation/gsl_interp.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman + */ +#ifndef __GSL_INTERP_H__ +#define __GSL_INTERP_H__ +#include <stdlib.h> +#include <gsl/gsl_types.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* evaluation accelerator */ +typedef struct { + size_t cache; /* cache of index */ + size_t miss_count; /* keep statistics */ + size_t hit_count; +} +gsl_interp_accel; + + +/* interpolation object type */ +typedef struct { + const char * name; + unsigned int min_size; + void * (*alloc) (size_t size); + int (*init) (void *, const double xa[], const double ya[], size_t size); + int (*eval) (const void *, const double xa[], const double ya[], size_t size, double x, gsl_interp_accel *, double * y); + int (*eval_deriv) (const void *, const double xa[], const double ya[], size_t size, double x, gsl_interp_accel *, double * y_p); + int (*eval_deriv2) (const void *, const double xa[], const double ya[], size_t size, double x, gsl_interp_accel *, double * y_pp); + int (*eval_integ) (const void *, const double xa[], const double ya[], size_t size, gsl_interp_accel *, double a, double b, double * result); + void (*free) (void *); + +} gsl_interp_type; + + +/* general interpolation object */ +typedef struct { + const gsl_interp_type * type; + double xmin; + double xmax; + size_t size; + void * state; +} gsl_interp; + + +/* available types */ +GSL_VAR const gsl_interp_type * gsl_interp_linear; +GSL_VAR const gsl_interp_type * gsl_interp_polynomial; +GSL_VAR const gsl_interp_type * gsl_interp_cspline; +GSL_VAR const gsl_interp_type * gsl_interp_cspline_periodic; +GSL_VAR const gsl_interp_type * gsl_interp_akima; +GSL_VAR const gsl_interp_type * gsl_interp_akima_periodic; + +gsl_interp_accel * +gsl_interp_accel_alloc(void); + +size_t +gsl_interp_accel_find(gsl_interp_accel * a, const double x_array[], size_t size, double x); + +int +gsl_interp_accel_reset (gsl_interp_accel * a); + +void +gsl_interp_accel_free(gsl_interp_accel * a); + +gsl_interp * +gsl_interp_alloc(const gsl_interp_type * T, size_t n); + +int +gsl_interp_init(gsl_interp * obj, const double xa[], const double ya[], size_t size); + +const char * gsl_interp_name(const gsl_interp * interp); +unsigned int gsl_interp_min_size(const gsl_interp * interp); + + +int +gsl_interp_eval_e(const gsl_interp * obj, + const double xa[], const double ya[], double x, + gsl_interp_accel * a, double * y); + +double +gsl_interp_eval(const gsl_interp * obj, + const double xa[], const double ya[], double x, + gsl_interp_accel * a); + +int +gsl_interp_eval_deriv_e(const gsl_interp * obj, + const double xa[], const double ya[], double x, + gsl_interp_accel * a, + double * d); + +double +gsl_interp_eval_deriv(const gsl_interp * obj, + const double xa[], const double ya[], double x, + gsl_interp_accel * a); + +int +gsl_interp_eval_deriv2_e(const gsl_interp * obj, + const double xa[], const double ya[], double x, + gsl_interp_accel * a, + double * d2); + +double +gsl_interp_eval_deriv2(const gsl_interp * obj, + const double xa[], const double ya[], double x, + gsl_interp_accel * a); + +int +gsl_interp_eval_integ_e(const gsl_interp * obj, + const double xa[], const double ya[], + double a, double b, + gsl_interp_accel * acc, + double * result); + +double +gsl_interp_eval_integ(const gsl_interp * obj, + const double xa[], const double ya[], + double a, double b, + gsl_interp_accel * acc); + +void +gsl_interp_free(gsl_interp * interp); + +size_t gsl_interp_bsearch(const double x_array[], double x, + size_t index_lo, size_t index_hi); + +#ifdef HAVE_INLINE +extern inline size_t +gsl_interp_bsearch(const double x_array[], double x, + size_t index_lo, size_t index_hi); + +extern inline size_t +gsl_interp_bsearch(const double x_array[], double x, + size_t index_lo, size_t index_hi) +{ + size_t ilo = index_lo; + size_t ihi = index_hi; + while(ihi > ilo + 1) { + size_t i = (ihi + ilo)/2; + if(x_array[i] > x) + ihi = i; + else + ilo = i; + } + + return ilo; +} +#endif + +#ifdef HAVE_INLINE +extern inline size_t +gsl_interp_accel_find(gsl_interp_accel * a, const double xa[], size_t len, double x) +{ + size_t x_index = a->cache; + + if(x < xa[x_index]) { + a->miss_count++; + a->cache = gsl_interp_bsearch(xa, x, 0, x_index); + } + else if(x > xa[x_index + 1]) { + a->miss_count++; + a->cache = gsl_interp_bsearch(xa, x, x_index, len-1); + } + else { + a->hit_count++; + } + + return a->cache; +} +#endif /* HAVE_INLINE */ + + +__END_DECLS + +#endif /* __GSL_INTERP_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_linalg.h b/dtm_release/local/include/gsl/gsl_linalg.h new file mode 100644 index 0000000000000000000000000000000000000000..64d13ada63767d21fea4e5ec4199071450418b3a --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_linalg.h @@ -0,0 +1,584 @@ +/* linalg/gsl_linalg.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2006, 2007 Gerard Jungman, Brian Gough, Patrick Alken + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_LINALG_H__ +#define __GSL_LINALG_H__ + +#include <gsl/gsl_mode.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector.h> +#include <gsl/gsl_matrix.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS } +#else +#define __BEGIN_DECLS /* empty */ +#define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef enum + { + GSL_LINALG_MOD_NONE = 0, + GSL_LINALG_MOD_TRANSPOSE = 1, + GSL_LINALG_MOD_CONJUGATE = 2 + } +gsl_linalg_matrix_mod_t; + + +/* Note: You can now use the gsl_blas_dgemm function instead of matmult */ + +/* Simple implementation of matrix multiply. + * Calculates C = A.B + * + * exceptions: GSL_EBADLEN + */ +int gsl_linalg_matmult (const gsl_matrix * A, + const gsl_matrix * B, + gsl_matrix * C); + + +/* Simple implementation of matrix multiply. + * Allows transposition of either matrix, so it + * can compute A.B or Trans(A).B or A.Trans(B) or Trans(A).Trans(B) + * + * exceptions: GSL_EBADLEN + */ +int gsl_linalg_matmult_mod (const gsl_matrix * A, + gsl_linalg_matrix_mod_t modA, + const gsl_matrix * B, + gsl_linalg_matrix_mod_t modB, + gsl_matrix * C); + +/* Calculate the matrix exponential by the scaling and + * squaring method described in Moler + Van Loan, + * SIAM Rev 20, 801 (1978). The mode argument allows + * choosing an optimal strategy, from the table + * given in the paper, for a given precision. + * + * exceptions: GSL_ENOTSQR, GSL_EBADLEN + */ +int gsl_linalg_exponential_ss( + const gsl_matrix * A, + gsl_matrix * eA, + gsl_mode_t mode + ); + + +/* Householder Transformations */ + +double gsl_linalg_householder_transform (gsl_vector * v); +gsl_complex gsl_linalg_complex_householder_transform (gsl_vector_complex * v); + +int gsl_linalg_householder_hm (double tau, + const gsl_vector * v, + gsl_matrix * A); + +int gsl_linalg_householder_mh (double tau, + const gsl_vector * v, + gsl_matrix * A); + +int gsl_linalg_householder_hv (double tau, + const gsl_vector * v, + gsl_vector * w); + +int gsl_linalg_householder_hm1 (double tau, + gsl_matrix * A); + +int gsl_linalg_complex_householder_hm (gsl_complex tau, + const gsl_vector_complex * v, + gsl_matrix_complex * A); + +int gsl_linalg_complex_householder_mh (gsl_complex tau, + const gsl_vector_complex * v, + gsl_matrix_complex * A); + +int gsl_linalg_complex_householder_hv (gsl_complex tau, + const gsl_vector_complex * v, + gsl_vector_complex * w); + +/* Hessenberg reduction */ + +int gsl_linalg_hessenberg_decomp(gsl_matrix *A, gsl_vector *tau); +int gsl_linalg_hessenberg_unpack(gsl_matrix * H, gsl_vector * tau, + gsl_matrix * U); +int gsl_linalg_hessenberg_unpack_accum(gsl_matrix * H, gsl_vector * tau, + gsl_matrix * U); +int gsl_linalg_hessenberg_set_zero(gsl_matrix * H); +int gsl_linalg_hessenberg_submatrix(gsl_matrix *M, gsl_matrix *A, + size_t top, gsl_vector *tau); + +/* Hessenberg-Triangular reduction */ + +int gsl_linalg_hesstri_decomp(gsl_matrix * A, gsl_matrix * B, + gsl_matrix * U, gsl_matrix * V, + gsl_vector * work); + +/* Singular Value Decomposition + + * exceptions: + */ + +int +gsl_linalg_SV_decomp (gsl_matrix * A, + gsl_matrix * V, + gsl_vector * S, + gsl_vector * work); + +int +gsl_linalg_SV_decomp_mod (gsl_matrix * A, + gsl_matrix * X, + gsl_matrix * V, + gsl_vector * S, + gsl_vector * work); + +int gsl_linalg_SV_decomp_jacobi (gsl_matrix * A, + gsl_matrix * Q, + gsl_vector * S); + +int +gsl_linalg_SV_solve (const gsl_matrix * U, + const gsl_matrix * Q, + const gsl_vector * S, + const gsl_vector * b, + gsl_vector * x); + + +/* LU Decomposition, Gaussian elimination with partial pivoting + */ + +int gsl_linalg_LU_decomp (gsl_matrix * A, gsl_permutation * p, int *signum); + +int gsl_linalg_LU_solve (const gsl_matrix * LU, + const gsl_permutation * p, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_LU_svx (const gsl_matrix * LU, + const gsl_permutation * p, + gsl_vector * x); + +int gsl_linalg_LU_refine (const gsl_matrix * A, + const gsl_matrix * LU, + const gsl_permutation * p, + const gsl_vector * b, + gsl_vector * x, + gsl_vector * residual); + +int gsl_linalg_LU_invert (const gsl_matrix * LU, + const gsl_permutation * p, + gsl_matrix * inverse); + +double gsl_linalg_LU_det (gsl_matrix * LU, int signum); +double gsl_linalg_LU_lndet (gsl_matrix * LU); +int gsl_linalg_LU_sgndet (gsl_matrix * lu, int signum); + +/* Complex LU Decomposition */ + +int gsl_linalg_complex_LU_decomp (gsl_matrix_complex * A, + gsl_permutation * p, + int *signum); + +int gsl_linalg_complex_LU_solve (const gsl_matrix_complex * LU, + const gsl_permutation * p, + const gsl_vector_complex * b, + gsl_vector_complex * x); + +int gsl_linalg_complex_LU_svx (const gsl_matrix_complex * LU, + const gsl_permutation * p, + gsl_vector_complex * x); + +int gsl_linalg_complex_LU_refine (const gsl_matrix_complex * A, + const gsl_matrix_complex * LU, + const gsl_permutation * p, + const gsl_vector_complex * b, + gsl_vector_complex * x, + gsl_vector_complex * residual); + +int gsl_linalg_complex_LU_invert (const gsl_matrix_complex * LU, + const gsl_permutation * p, + gsl_matrix_complex * inverse); + +gsl_complex gsl_linalg_complex_LU_det (gsl_matrix_complex * LU, + int signum); + +double gsl_linalg_complex_LU_lndet (gsl_matrix_complex * LU); + +gsl_complex gsl_linalg_complex_LU_sgndet (gsl_matrix_complex * LU, + int signum); + +/* QR decomposition */ + +int gsl_linalg_QR_decomp (gsl_matrix * A, + gsl_vector * tau); + +int gsl_linalg_QR_solve (const gsl_matrix * QR, + const gsl_vector * tau, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_QR_svx (const gsl_matrix * QR, + const gsl_vector * tau, + gsl_vector * x); + +int gsl_linalg_QR_lssolve (const gsl_matrix * QR, + const gsl_vector * tau, + const gsl_vector * b, + gsl_vector * x, + gsl_vector * residual); + + +int gsl_linalg_QR_QRsolve (gsl_matrix * Q, + gsl_matrix * R, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_QR_Rsolve (const gsl_matrix * QR, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_QR_Rsvx (const gsl_matrix * QR, + gsl_vector * x); + +int gsl_linalg_QR_update (gsl_matrix * Q, + gsl_matrix * R, + gsl_vector * w, + const gsl_vector * v); + +int gsl_linalg_QR_QTvec (const gsl_matrix * QR, + const gsl_vector * tau, + gsl_vector * v); + +int gsl_linalg_QR_Qvec (const gsl_matrix * QR, + const gsl_vector * tau, + gsl_vector * v); + +int gsl_linalg_QR_QTmat (const gsl_matrix * QR, + const gsl_vector * tau, + gsl_matrix * A); + +int gsl_linalg_QR_unpack (const gsl_matrix * QR, + const gsl_vector * tau, + gsl_matrix * Q, + gsl_matrix * R); + +int gsl_linalg_R_solve (const gsl_matrix * R, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_R_svx (const gsl_matrix * R, + gsl_vector * x); + + +/* Q R P^T decomposition */ + +int gsl_linalg_QRPT_decomp (gsl_matrix * A, + gsl_vector * tau, + gsl_permutation * p, + int *signum, + gsl_vector * norm); + +int gsl_linalg_QRPT_decomp2 (const gsl_matrix * A, + gsl_matrix * q, gsl_matrix * r, + gsl_vector * tau, + gsl_permutation * p, + int *signum, + gsl_vector * norm); + +int gsl_linalg_QRPT_solve (const gsl_matrix * QR, + const gsl_vector * tau, + const gsl_permutation * p, + const gsl_vector * b, + gsl_vector * x); + + +int gsl_linalg_QRPT_svx (const gsl_matrix * QR, + const gsl_vector * tau, + const gsl_permutation * p, + gsl_vector * x); + +int gsl_linalg_QRPT_QRsolve (const gsl_matrix * Q, + const gsl_matrix * R, + const gsl_permutation * p, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_QRPT_Rsolve (const gsl_matrix * QR, + const gsl_permutation * p, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_QRPT_Rsvx (const gsl_matrix * QR, + const gsl_permutation * p, + gsl_vector * x); + +int gsl_linalg_QRPT_update (gsl_matrix * Q, + gsl_matrix * R, + const gsl_permutation * p, + gsl_vector * u, + const gsl_vector * v); + +/* LQ decomposition */ + +int gsl_linalg_LQ_decomp (gsl_matrix * A, gsl_vector * tau); + +int gsl_linalg_LQ_solve_T (const gsl_matrix * LQ, const gsl_vector * tau, + const gsl_vector * b, gsl_vector * x); + +int gsl_linalg_LQ_svx_T (const gsl_matrix * LQ, const gsl_vector * tau, + gsl_vector * x); + +int gsl_linalg_LQ_lssolve_T (const gsl_matrix * LQ, const gsl_vector * tau, + const gsl_vector * b, gsl_vector * x, + gsl_vector * residual); + +int gsl_linalg_LQ_Lsolve_T (const gsl_matrix * LQ, const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_LQ_Lsvx_T (const gsl_matrix * LQ, gsl_vector * x); + +int gsl_linalg_L_solve_T (const gsl_matrix * L, const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_LQ_vecQ (const gsl_matrix * LQ, const gsl_vector * tau, + gsl_vector * v); + +int gsl_linalg_LQ_vecQT (const gsl_matrix * LQ, const gsl_vector * tau, + gsl_vector * v); + +int gsl_linalg_LQ_unpack (const gsl_matrix * LQ, const gsl_vector * tau, + gsl_matrix * Q, gsl_matrix * L); + +int gsl_linalg_LQ_update (gsl_matrix * Q, gsl_matrix * R, + const gsl_vector * v, gsl_vector * w); +int gsl_linalg_LQ_LQsolve (gsl_matrix * Q, gsl_matrix * L, + const gsl_vector * b, gsl_vector * x); + +/* P^T L Q decomposition */ + +int gsl_linalg_PTLQ_decomp (gsl_matrix * A, gsl_vector * tau, + gsl_permutation * p, int *signum, + gsl_vector * norm); + +int gsl_linalg_PTLQ_decomp2 (const gsl_matrix * A, gsl_matrix * q, + gsl_matrix * r, gsl_vector * tau, + gsl_permutation * p, int *signum, + gsl_vector * norm); + +int gsl_linalg_PTLQ_solve_T (const gsl_matrix * QR, + const gsl_vector * tau, + const gsl_permutation * p, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_PTLQ_svx_T (const gsl_matrix * LQ, + const gsl_vector * tau, + const gsl_permutation * p, + gsl_vector * x); + +int gsl_linalg_PTLQ_LQsolve_T (const gsl_matrix * Q, const gsl_matrix * L, + const gsl_permutation * p, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_PTLQ_Lsolve_T (const gsl_matrix * LQ, + const gsl_permutation * p, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_PTLQ_Lsvx_T (const gsl_matrix * LQ, + const gsl_permutation * p, + gsl_vector * x); + +int gsl_linalg_PTLQ_update (gsl_matrix * Q, gsl_matrix * L, + const gsl_permutation * p, + const gsl_vector * v, gsl_vector * w); + +/* Cholesky Decomposition */ + +int gsl_linalg_cholesky_decomp (gsl_matrix * A); + +int gsl_linalg_cholesky_solve (const gsl_matrix * cholesky, + const gsl_vector * b, + gsl_vector * x); + +int gsl_linalg_cholesky_svx (const gsl_matrix * cholesky, + gsl_vector * x); + + +/* Cholesky decomposition with unit-diagonal triangular parts. + * A = L D L^T, where diag(L) = (1,1,...,1). + * Upon exit, A contains L and L^T as for Cholesky, and + * the diagonal of A is (1,1,...,1). The vector Dis set + * to the diagonal elements of the diagonal matrix D. + */ +int gsl_linalg_cholesky_decomp_unit(gsl_matrix * A, gsl_vector * D); + +/* Complex Cholesky Decomposition */ + +int gsl_linalg_complex_cholesky_decomp (gsl_matrix_complex * A); + +int gsl_linalg_complex_cholesky_solve (const gsl_matrix_complex * cholesky, + const gsl_vector_complex * b, + gsl_vector_complex * x); + +int gsl_linalg_complex_cholesky_svx (const gsl_matrix_complex * cholesky, + gsl_vector_complex * x); + +/* Symmetric to symmetric tridiagonal decomposition */ + +int gsl_linalg_symmtd_decomp (gsl_matrix * A, + gsl_vector * tau); + +int gsl_linalg_symmtd_unpack (const gsl_matrix * A, + const gsl_vector * tau, + gsl_matrix * Q, + gsl_vector * diag, + gsl_vector * subdiag); + +int gsl_linalg_symmtd_unpack_T (const gsl_matrix * A, + gsl_vector * diag, + gsl_vector * subdiag); + +/* Hermitian to symmetric tridiagonal decomposition */ + +int gsl_linalg_hermtd_decomp (gsl_matrix_complex * A, + gsl_vector_complex * tau); + +int gsl_linalg_hermtd_unpack (const gsl_matrix_complex * A, + const gsl_vector_complex * tau, + gsl_matrix_complex * Q, + gsl_vector * diag, + gsl_vector * sudiag); + +int gsl_linalg_hermtd_unpack_T (const gsl_matrix_complex * A, + gsl_vector * diag, + gsl_vector * subdiag); + +/* Linear Solve Using Householder Transformations + + * exceptions: + */ + +int gsl_linalg_HH_solve (gsl_matrix * A, const gsl_vector * b, gsl_vector * x); +int gsl_linalg_HH_svx (gsl_matrix * A, gsl_vector * x); + +/* Linear solve for a symmetric tridiagonal system. + + * The input vectors represent the NxN matrix as follows: + * + * diag[0] offdiag[0] 0 ... + * offdiag[0] diag[1] offdiag[1] ... + * 0 offdiag[1] diag[2] ... + * 0 0 offdiag[2] ... + * ... ... ... ... + */ +int gsl_linalg_solve_symm_tridiag (const gsl_vector * diag, + const gsl_vector * offdiag, + const gsl_vector * b, + gsl_vector * x); + +/* Linear solve for a nonsymmetric tridiagonal system. + + * The input vectors represent the NxN matrix as follows: + * + * diag[0] abovediag[0] 0 ... + * belowdiag[0] diag[1] abovediag[1] ... + * 0 belowdiag[1] diag[2] ... + * 0 0 belowdiag[2] ... + * ... ... ... ... + */ +int gsl_linalg_solve_tridiag (const gsl_vector * diag, + const gsl_vector * abovediag, + const gsl_vector * belowdiag, + const gsl_vector * b, + gsl_vector * x); + + +/* Linear solve for a symmetric cyclic tridiagonal system. + + * The input vectors represent the NxN matrix as follows: + * + * diag[0] offdiag[0] 0 ..... offdiag[N-1] + * offdiag[0] diag[1] offdiag[1] ..... + * 0 offdiag[1] diag[2] ..... + * 0 0 offdiag[2] ..... + * ... ... + * offdiag[N-1] ... + */ +int gsl_linalg_solve_symm_cyc_tridiag (const gsl_vector * diag, + const gsl_vector * offdiag, + const gsl_vector * b, + gsl_vector * x); + +/* Linear solve for a nonsymmetric cyclic tridiagonal system. + + * The input vectors represent the NxN matrix as follows: + * + * diag[0] abovediag[0] 0 ..... belowdiag[N-1] + * belowdiag[0] diag[1] abovediag[1] ..... + * 0 belowdiag[1] diag[2] + * 0 0 belowdiag[2] ..... + * ... ... + * abovediag[N-1] ... + */ +int gsl_linalg_solve_cyc_tridiag (const gsl_vector * diag, + const gsl_vector * abovediag, + const gsl_vector * belowdiag, + const gsl_vector * b, + gsl_vector * x); + + +/* Bidiagonal decomposition */ + +int gsl_linalg_bidiag_decomp (gsl_matrix * A, + gsl_vector * tau_U, + gsl_vector * tau_V); + +int gsl_linalg_bidiag_unpack (const gsl_matrix * A, + const gsl_vector * tau_U, + gsl_matrix * U, + const gsl_vector * tau_V, + gsl_matrix * V, + gsl_vector * diag, + gsl_vector * superdiag); + +int gsl_linalg_bidiag_unpack2 (gsl_matrix * A, + gsl_vector * tau_U, + gsl_vector * tau_V, + gsl_matrix * V); + +int gsl_linalg_bidiag_unpack_B (const gsl_matrix * A, + gsl_vector * diag, + gsl_vector * superdiag); + +/* Balancing */ + +int gsl_linalg_balance_matrix (gsl_matrix * A, gsl_vector * D); +int gsl_linalg_balance_accum (gsl_matrix * A, gsl_vector * D); +int gsl_linalg_balance_columns (gsl_matrix * A, gsl_vector * D); + + +__END_DECLS + +#endif /* __GSL_LINALG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_machine.h b/dtm_release/local/include/gsl/gsl_machine.h new file mode 100644 index 0000000000000000000000000000000000000000..c44ffc2a4024ab4d7e1427601976f7c1fed82d80 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_machine.h @@ -0,0 +1,104 @@ +/* Author: B. Gough and G. Jungman */ +#ifndef __GSL_MACHINE_H__ +#define __GSL_MACHINE_H__ + +#include <limits.h> +#include <float.h> + +/* magic constants; mostly for the benefit of the implementation */ + +/* -*-MACHINE CONSTANTS-*- + * + * PLATFORM: Whiz-O-Matic 9000 + * FP_PLATFORM: IEEE-Virtual + * HOSTNAME: nnn.lanl.gov + * DATE: Fri Nov 20 17:53:26 MST 1998 + */ +#define GSL_DBL_EPSILON 2.2204460492503131e-16 +#define GSL_SQRT_DBL_EPSILON 1.4901161193847656e-08 +#define GSL_ROOT3_DBL_EPSILON 6.0554544523933429e-06 +#define GSL_ROOT4_DBL_EPSILON 1.2207031250000000e-04 +#define GSL_ROOT5_DBL_EPSILON 7.4009597974140505e-04 +#define GSL_ROOT6_DBL_EPSILON 2.4607833005759251e-03 +#define GSL_LOG_DBL_EPSILON (-3.6043653389117154e+01) + +#define GSL_DBL_MIN 2.2250738585072014e-308 +#define GSL_SQRT_DBL_MIN 1.4916681462400413e-154 +#define GSL_ROOT3_DBL_MIN 2.8126442852362996e-103 +#define GSL_ROOT4_DBL_MIN 1.2213386697554620e-77 +#define GSL_ROOT5_DBL_MIN 2.9476022969691763e-62 +#define GSL_ROOT6_DBL_MIN 5.3034368905798218e-52 +#define GSL_LOG_DBL_MIN (-7.0839641853226408e+02) + +#define GSL_DBL_MAX 1.7976931348623157e+308 +#define GSL_SQRT_DBL_MAX 1.3407807929942596e+154 +#define GSL_ROOT3_DBL_MAX 5.6438030941222897e+102 +#define GSL_ROOT4_DBL_MAX 1.1579208923731620e+77 +#define GSL_ROOT5_DBL_MAX 4.4765466227572707e+61 +#define GSL_ROOT6_DBL_MAX 2.3756689782295612e+51 +#define GSL_LOG_DBL_MAX 7.0978271289338397e+02 + +#define GSL_FLT_EPSILON 1.1920928955078125e-07 +#define GSL_SQRT_FLT_EPSILON 3.4526698300124393e-04 +#define GSL_ROOT3_FLT_EPSILON 4.9215666011518501e-03 +#define GSL_ROOT4_FLT_EPSILON 1.8581361171917516e-02 +#define GSL_ROOT5_FLT_EPSILON 4.1234622211652937e-02 +#define GSL_ROOT6_FLT_EPSILON 7.0153878019335827e-02 +#define GSL_LOG_FLT_EPSILON (-1.5942385152878742e+01) + +#define GSL_FLT_MIN 1.1754943508222875e-38 +#define GSL_SQRT_FLT_MIN 1.0842021724855044e-19 +#define GSL_ROOT3_FLT_MIN 2.2737367544323241e-13 +#define GSL_ROOT4_FLT_MIN 3.2927225399135965e-10 +#define GSL_ROOT5_FLT_MIN 2.5944428542140822e-08 +#define GSL_ROOT6_FLT_MIN 4.7683715820312542e-07 +#define GSL_LOG_FLT_MIN (-8.7336544750553102e+01) + +#define GSL_FLT_MAX 3.4028234663852886e+38 +#define GSL_SQRT_FLT_MAX 1.8446743523953730e+19 +#define GSL_ROOT3_FLT_MAX 6.9814635196223242e+12 +#define GSL_ROOT4_FLT_MAX 4.2949672319999986e+09 +#define GSL_ROOT5_FLT_MAX 5.0859007855960041e+07 +#define GSL_ROOT6_FLT_MAX 2.6422459233807749e+06 +#define GSL_LOG_FLT_MAX 8.8722839052068352e+01 + +#define GSL_SFLT_EPSILON 4.8828125000000000e-04 +#define GSL_SQRT_SFLT_EPSILON 2.2097086912079612e-02 +#define GSL_ROOT3_SFLT_EPSILON 7.8745065618429588e-02 +#define GSL_ROOT4_SFLT_EPSILON 1.4865088937534013e-01 +#define GSL_ROOT5_SFLT_EPSILON 2.1763764082403100e-01 +#define GSL_ROOT6_SFLT_EPSILON 2.8061551207734325e-01 +#define GSL_LOG_SFLT_EPSILON (-7.6246189861593985e+00) + +/* !MACHINE CONSTANTS! */ + + +/* a little internal backwards compatibility */ +#define GSL_MACH_EPS GSL_DBL_EPSILON + + + +/* Here are the constants related to or derived from + * machine constants. These are not to be confused with + * the constants that define various precision levels + * for the precision/error system. + * + * This information is determined at configure time + * and is platform dependent. Edit at your own risk. + * + * PLATFORM: WHIZ-O-MATIC + * CONFIG-DATE: Thu Nov 19 19:27:18 MST 1998 + * CONFIG-HOST: nnn.lanl.gov + */ + +/* machine precision constants */ +/* #define GSL_MACH_EPS 1.0e-15 */ +#define GSL_SQRT_MACH_EPS 3.2e-08 +#define GSL_ROOT3_MACH_EPS 1.0e-05 +#define GSL_ROOT4_MACH_EPS 0.000178 +#define GSL_ROOT5_MACH_EPS 0.00100 +#define GSL_ROOT6_MACH_EPS 0.00316 +#define GSL_LOG_MACH_EPS (-34.54) + + +#endif /* __GSL_MACHINE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_math.h b/dtm_release/local/include/gsl/gsl_math.h new file mode 100644 index 0000000000000000000000000000000000000000..4f6c6e389c470c240f6f1ad93676d6ced0b04b19 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_math.h @@ -0,0 +1,226 @@ +/* gsl_math.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATH_H__ +#define __GSL_MATH_H__ +#include <math.h> +#include <gsl/gsl_sys.h> +#include <gsl/gsl_machine.h> +#include <gsl/gsl_precision.h> +#include <gsl/gsl_nan.h> +#include <gsl/gsl_pow_int.h> + +#ifndef M_E +#define M_E 2.71828182845904523536028747135 /* e */ +#endif + +#ifndef M_LOG2E +#define M_LOG2E 1.44269504088896340735992468100 /* log_2 (e) */ +#endif + +#ifndef M_LOG10E +#define M_LOG10E 0.43429448190325182765112891892 /* log_10 (e) */ +#endif + +#ifndef M_SQRT2 +#define M_SQRT2 1.41421356237309504880168872421 /* sqrt(2) */ +#endif + +#ifndef M_SQRT1_2 +#define M_SQRT1_2 0.70710678118654752440084436210 /* sqrt(1/2) */ +#endif + + +#ifndef M_SQRT3 +#define M_SQRT3 1.73205080756887729352744634151 /* sqrt(3) */ +#endif + +#ifndef M_PI +#define M_PI 3.14159265358979323846264338328 /* pi */ +#endif + +#ifndef M_PI_2 +#define M_PI_2 1.57079632679489661923132169164 /* pi/2 */ +#endif + +#ifndef M_PI_4 +#define M_PI_4 0.78539816339744830961566084582 /* pi/4 */ +#endif + +#ifndef M_SQRTPI +#define M_SQRTPI 1.77245385090551602729816748334 /* sqrt(pi) */ +#endif + +#ifndef M_2_SQRTPI +#define M_2_SQRTPI 1.12837916709551257389615890312 /* 2/sqrt(pi) */ +#endif + +#ifndef M_1_PI +#define M_1_PI 0.31830988618379067153776752675 /* 1/pi */ +#endif + +#ifndef M_2_PI +#define M_2_PI 0.63661977236758134307553505349 /* 2/pi */ +#endif + +#ifndef M_LN10 +#define M_LN10 2.30258509299404568401799145468 /* ln(10) */ +#endif + +#ifndef M_LN2 +#define M_LN2 0.69314718055994530941723212146 /* ln(2) */ +#endif + +#ifndef M_LNPI +#define M_LNPI 1.14472988584940017414342735135 /* ln(pi) */ +#endif + +#ifndef M_EULER +#define M_EULER 0.57721566490153286060651209008 /* Euler constant */ +#endif + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* other needlessly compulsive abstractions */ + +#define GSL_IS_ODD(n) ((n) & 1) +#define GSL_IS_EVEN(n) (!(GSL_IS_ODD(n))) +#define GSL_SIGN(x) ((x) >= 0.0 ? 1 : -1) + +/* Return nonzero if x is a real number, i.e. non NaN or infinite. */ +#define GSL_IS_REAL(x) (gsl_finite(x)) + +/* Define MAX and MIN macros/functions if they don't exist. */ + +/* plain old macros for general use */ +#define GSL_MAX(a,b) ((a) > (b) ? (a) : (b)) +#define GSL_MIN(a,b) ((a) < (b) ? (a) : (b)) + +/* function versions of the above, in case they are needed */ +double gsl_max (double a, double b); +double gsl_min (double a, double b); + +/* inline-friendly strongly typed versions */ +#ifdef HAVE_INLINE + +extern inline int GSL_MAX_INT (int a, int b); +extern inline int GSL_MIN_INT (int a, int b); +extern inline double GSL_MAX_DBL (double a, double b); +extern inline double GSL_MIN_DBL (double a, double b); +extern inline long double GSL_MAX_LDBL (long double a, long double b); +extern inline long double GSL_MIN_LDBL (long double a, long double b); + +extern inline int +GSL_MAX_INT (int a, int b) +{ + return GSL_MAX (a, b); +} + +extern inline int +GSL_MIN_INT (int a, int b) +{ + return GSL_MIN (a, b); +} + +extern inline double +GSL_MAX_DBL (double a, double b) +{ + return GSL_MAX (a, b); +} + +extern inline double +GSL_MIN_DBL (double a, double b) +{ + return GSL_MIN (a, b); +} + +extern inline long double +GSL_MAX_LDBL (long double a, long double b) +{ + return GSL_MAX (a, b); +} + +extern inline long double +GSL_MIN_LDBL (long double a, long double b) +{ + return GSL_MIN (a, b); +} +#else +#define GSL_MAX_INT(a,b) GSL_MAX(a,b) +#define GSL_MIN_INT(a,b) GSL_MIN(a,b) +#define GSL_MAX_DBL(a,b) GSL_MAX(a,b) +#define GSL_MIN_DBL(a,b) GSL_MIN(a,b) +#define GSL_MAX_LDBL(a,b) GSL_MAX(a,b) +#define GSL_MIN_LDBL(a,b) GSL_MIN(a,b) +#endif /* HAVE_INLINE */ + +/* Definition of an arbitrary function with parameters */ + +struct gsl_function_struct +{ + double (* function) (double x, void * params); + void * params; +}; + +typedef struct gsl_function_struct gsl_function ; + +#define GSL_FN_EVAL(F,x) (*((F)->function))(x,(F)->params) + +/* Definition of an arbitrary function returning two values, r1, r2 */ + +struct gsl_function_fdf_struct +{ + double (* f) (double x, void * params); + double (* df) (double x, void * params); + void (* fdf) (double x, void * params, double * f, double * df); + void * params; +}; + +typedef struct gsl_function_fdf_struct gsl_function_fdf ; + +#define GSL_FN_FDF_EVAL_F(FDF,x) (*((FDF)->f))(x,(FDF)->params) +#define GSL_FN_FDF_EVAL_DF(FDF,x) (*((FDF)->df))(x,(FDF)->params) +#define GSL_FN_FDF_EVAL_F_DF(FDF,x,y,dy) (*((FDF)->fdf))(x,(FDF)->params,(y),(dy)) + + +/* Definition of an arbitrary vector-valued function with parameters */ + +struct gsl_function_vec_struct +{ + int (* function) (double x, double y[], void * params); + void * params; +}; + +typedef struct gsl_function_vec_struct gsl_function_vec ; + +#define GSL_FN_VEC_EVAL(F,x,y) (*((F)->function))(x,y,(F)->params) + +__END_DECLS + +#endif /* __GSL_MATH_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_matrix.h b/dtm_release/local/include/gsl/gsl_matrix.h new file mode 100644 index 0000000000000000000000000000000000000000..9b7ed76553bcced0deade240b59ad16b8cb1553b --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_matrix.h @@ -0,0 +1,25 @@ +#ifndef __GSL_MATRIX_H__ +#define __GSL_MATRIX_H__ + +#include <gsl/gsl_matrix_complex_long_double.h> +#include <gsl/gsl_matrix_complex_double.h> +#include <gsl/gsl_matrix_complex_float.h> + +#include <gsl/gsl_matrix_long_double.h> +#include <gsl/gsl_matrix_double.h> +#include <gsl/gsl_matrix_float.h> + +#include <gsl/gsl_matrix_ulong.h> +#include <gsl/gsl_matrix_long.h> + +#include <gsl/gsl_matrix_uint.h> +#include <gsl/gsl_matrix_int.h> + +#include <gsl/gsl_matrix_ushort.h> +#include <gsl/gsl_matrix_short.h> + +#include <gsl/gsl_matrix_uchar.h> +#include <gsl/gsl_matrix_char.h> + + +#endif /* __GSL_MATRIX_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_matrix_char.h b/dtm_release/local/include/gsl/gsl_matrix_char.h new file mode 100644 index 0000000000000000000000000000000000000000..8799981565512682551e0f8daef34d7977f71c08 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_matrix_char.h @@ -0,0 +1,335 @@ +/* matrix/gsl_matrix_char.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_CHAR_H__ +#define __GSL_MATRIX_CHAR_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_vector_char.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + char * data; + gsl_block_char * block; + int owner; +} gsl_matrix_char; + +typedef struct +{ + gsl_matrix_char matrix; +} _gsl_matrix_char_view; + +typedef _gsl_matrix_char_view gsl_matrix_char_view; + +typedef struct +{ + gsl_matrix_char matrix; +} _gsl_matrix_char_const_view; + +typedef const _gsl_matrix_char_const_view gsl_matrix_char_const_view; + +/* Allocation */ + +gsl_matrix_char * +gsl_matrix_char_alloc (const size_t n1, const size_t n2); + +gsl_matrix_char * +gsl_matrix_char_calloc (const size_t n1, const size_t n2); + +gsl_matrix_char * +gsl_matrix_char_alloc_from_block (gsl_block_char * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix_char * +gsl_matrix_char_alloc_from_matrix (gsl_matrix_char * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector_char * +gsl_vector_char_alloc_row_from_matrix (gsl_matrix_char * m, + const size_t i); + +gsl_vector_char * +gsl_vector_char_alloc_col_from_matrix (gsl_matrix_char * m, + const size_t j); + +void gsl_matrix_char_free (gsl_matrix_char * m); + +/* Views */ + +_gsl_matrix_char_view +gsl_matrix_char_submatrix (gsl_matrix_char * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_char_view +gsl_matrix_char_row (gsl_matrix_char * m, const size_t i); + +_gsl_vector_char_view +gsl_matrix_char_column (gsl_matrix_char * m, const size_t j); + +_gsl_vector_char_view +gsl_matrix_char_diagonal (gsl_matrix_char * m); + +_gsl_vector_char_view +gsl_matrix_char_subdiagonal (gsl_matrix_char * m, const size_t k); + +_gsl_vector_char_view +gsl_matrix_char_superdiagonal (gsl_matrix_char * m, const size_t k); + +_gsl_vector_char_view +gsl_matrix_char_subrow (gsl_matrix_char * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_char_view +gsl_matrix_char_subcolumn (gsl_matrix_char * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_char_view +gsl_matrix_char_view_array (char * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_char_view +gsl_matrix_char_view_array_with_tda (char * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_char_view +gsl_matrix_char_view_vector (gsl_vector_char * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_char_view +gsl_matrix_char_view_vector_with_tda (gsl_vector_char * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_char_const_view +gsl_matrix_char_const_submatrix (const gsl_matrix_char * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_char_const_view +gsl_matrix_char_const_row (const gsl_matrix_char * m, + const size_t i); + +_gsl_vector_char_const_view +gsl_matrix_char_const_column (const gsl_matrix_char * m, + const size_t j); + +_gsl_vector_char_const_view +gsl_matrix_char_const_diagonal (const gsl_matrix_char * m); + +_gsl_vector_char_const_view +gsl_matrix_char_const_subdiagonal (const gsl_matrix_char * m, + const size_t k); + +_gsl_vector_char_const_view +gsl_matrix_char_const_superdiagonal (const gsl_matrix_char * m, + const size_t k); + +_gsl_vector_char_const_view +gsl_matrix_char_const_subrow (const gsl_matrix_char * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_char_const_view +gsl_matrix_char_const_subcolumn (const gsl_matrix_char * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_char_const_view +gsl_matrix_char_const_view_array (const char * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_char_const_view +gsl_matrix_char_const_view_array_with_tda (const char * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_char_const_view +gsl_matrix_char_const_view_vector (const gsl_vector_char * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_char_const_view +gsl_matrix_char_const_view_vector_with_tda (const gsl_vector_char * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +char gsl_matrix_char_get(const gsl_matrix_char * m, const size_t i, const size_t j); +void gsl_matrix_char_set(gsl_matrix_char * m, const size_t i, const size_t j, const char x); + +char * gsl_matrix_char_ptr(gsl_matrix_char * m, const size_t i, const size_t j); +const char * gsl_matrix_char_const_ptr(const gsl_matrix_char * m, const size_t i, const size_t j); + +void gsl_matrix_char_set_zero (gsl_matrix_char * m); +void gsl_matrix_char_set_identity (gsl_matrix_char * m); +void gsl_matrix_char_set_all (gsl_matrix_char * m, char x); + +int gsl_matrix_char_fread (FILE * stream, gsl_matrix_char * m) ; +int gsl_matrix_char_fwrite (FILE * stream, const gsl_matrix_char * m) ; +int gsl_matrix_char_fscanf (FILE * stream, gsl_matrix_char * m); +int gsl_matrix_char_fprintf (FILE * stream, const gsl_matrix_char * m, const char * format); + +int gsl_matrix_char_memcpy(gsl_matrix_char * dest, const gsl_matrix_char * src); +int gsl_matrix_char_swap(gsl_matrix_char * m1, gsl_matrix_char * m2); + +int gsl_matrix_char_swap_rows(gsl_matrix_char * m, const size_t i, const size_t j); +int gsl_matrix_char_swap_columns(gsl_matrix_char * m, const size_t i, const size_t j); +int gsl_matrix_char_swap_rowcol(gsl_matrix_char * m, const size_t i, const size_t j); +int gsl_matrix_char_transpose (gsl_matrix_char * m); +int gsl_matrix_char_transpose_memcpy (gsl_matrix_char * dest, const gsl_matrix_char * src); + +char gsl_matrix_char_max (const gsl_matrix_char * m); +char gsl_matrix_char_min (const gsl_matrix_char * m); +void gsl_matrix_char_minmax (const gsl_matrix_char * m, char * min_out, char * max_out); + +void gsl_matrix_char_max_index (const gsl_matrix_char * m, size_t * imax, size_t *jmax); +void gsl_matrix_char_min_index (const gsl_matrix_char * m, size_t * imin, size_t *jmin); +void gsl_matrix_char_minmax_index (const gsl_matrix_char * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_char_isnull (const gsl_matrix_char * m); +int gsl_matrix_char_ispos (const gsl_matrix_char * m); +int gsl_matrix_char_isneg (const gsl_matrix_char * m); +int gsl_matrix_char_isnonneg (const gsl_matrix_char * m); + +int gsl_matrix_char_add (gsl_matrix_char * a, const gsl_matrix_char * b); +int gsl_matrix_char_sub (gsl_matrix_char * a, const gsl_matrix_char * b); +int gsl_matrix_char_mul_elements (gsl_matrix_char * a, const gsl_matrix_char * b); +int gsl_matrix_char_div_elements (gsl_matrix_char * a, const gsl_matrix_char * b); +int gsl_matrix_char_scale (gsl_matrix_char * a, const double x); +int gsl_matrix_char_add_constant (gsl_matrix_char * a, const double x); +int gsl_matrix_char_add_diagonal (gsl_matrix_char * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_char_get_row(gsl_vector_char * v, const gsl_matrix_char * m, const size_t i); +int gsl_matrix_char_get_col(gsl_vector_char * v, const gsl_matrix_char * m, const size_t j); +int gsl_matrix_char_set_row(gsl_matrix_char * m, const size_t i, const gsl_vector_char * v); +int gsl_matrix_char_set_col(gsl_matrix_char * m, const size_t j, const gsl_vector_char * v); + +/* inline functions if you are using GCC */ + +#ifdef HAVE_INLINE +extern inline +char +gsl_matrix_char_get(const gsl_matrix_char * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } +#endif + return m->data[i * m->tda + j] ; +} + +extern inline +void +gsl_matrix_char_set(gsl_matrix_char * m, const size_t i, const size_t j, const char x) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } +#endif + m->data[i * m->tda + j] = x ; +} + +extern inline +char * +gsl_matrix_char_ptr(gsl_matrix_char * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (char *) (m->data + (i * m->tda + j)) ; +} + +extern inline +const char * +gsl_matrix_char_const_ptr(const gsl_matrix_char * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (const char *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_CHAR_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_matrix_complex_double.h b/dtm_release/local/include/gsl/gsl_matrix_complex_double.h new file mode 100644 index 0000000000000000000000000000000000000000..3d74479c2000fbb73ad56f5463f324d43d4b2908 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_matrix_complex_double.h @@ -0,0 +1,333 @@ +/* matrix/gsl_matrix_complex_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_COMPLEX_DOUBLE_H__ +#define __GSL_MATRIX_COMPLEX_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_complex.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_vector_complex_double.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + double * data; + gsl_block_complex * block; + int owner; +} gsl_matrix_complex ; + +typedef struct +{ + gsl_matrix_complex matrix; +} _gsl_matrix_complex_view; + +typedef _gsl_matrix_complex_view gsl_matrix_complex_view; + +typedef struct +{ + gsl_matrix_complex matrix; +} _gsl_matrix_complex_const_view; + +typedef const _gsl_matrix_complex_const_view gsl_matrix_complex_const_view; + + +/* Allocation */ + +gsl_matrix_complex * +gsl_matrix_complex_alloc (const size_t n1, const size_t n2); + +gsl_matrix_complex * +gsl_matrix_complex_calloc (const size_t n1, const size_t n2); + +gsl_matrix_complex * +gsl_matrix_complex_alloc_from_block (gsl_block_complex * b, + const size_t offset, + const size_t n1, const size_t n2, const size_t d2); + +gsl_matrix_complex * +gsl_matrix_complex_alloc_from_matrix (gsl_matrix_complex * b, + const size_t k1, const size_t k2, + const size_t n1, const size_t n2); + +gsl_vector_complex * +gsl_vector_complex_alloc_row_from_matrix (gsl_matrix_complex * m, + const size_t i); + +gsl_vector_complex * +gsl_vector_complex_alloc_col_from_matrix (gsl_matrix_complex * m, + const size_t j); + +void gsl_matrix_complex_free (gsl_matrix_complex * m); + +/* Views */ + +_gsl_matrix_complex_view +gsl_matrix_complex_submatrix (gsl_matrix_complex * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_complex_view +gsl_matrix_complex_row (gsl_matrix_complex * m, const size_t i); + +_gsl_vector_complex_view +gsl_matrix_complex_column (gsl_matrix_complex * m, const size_t j); + +_gsl_vector_complex_view +gsl_matrix_complex_diagonal (gsl_matrix_complex * m); + +_gsl_vector_complex_view +gsl_matrix_complex_subdiagonal (gsl_matrix_complex * m, const size_t k); + +_gsl_vector_complex_view +gsl_matrix_complex_superdiagonal (gsl_matrix_complex * m, const size_t k); + +_gsl_vector_complex_view +gsl_matrix_complex_subrow (gsl_matrix_complex * m, + const size_t i, const size_t offset, + const size_t n); + +_gsl_vector_complex_view +gsl_matrix_complex_subcolumn (gsl_matrix_complex * m, + const size_t j, const size_t offset, + const size_t n); + +_gsl_matrix_complex_view +gsl_matrix_complex_view_array (double * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_view +gsl_matrix_complex_view_array_with_tda (double * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_complex_view +gsl_matrix_complex_view_vector (gsl_vector_complex * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_view +gsl_matrix_complex_view_vector_with_tda (gsl_vector_complex * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_complex_const_view +gsl_matrix_complex_const_submatrix (const gsl_matrix_complex * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_complex_const_view +gsl_matrix_complex_const_row (const gsl_matrix_complex * m, + const size_t i); + +_gsl_vector_complex_const_view +gsl_matrix_complex_const_column (const gsl_matrix_complex * m, + const size_t j); + +_gsl_vector_complex_const_view +gsl_matrix_complex_const_diagonal (const gsl_matrix_complex * m); + +_gsl_vector_complex_const_view +gsl_matrix_complex_const_subdiagonal (const gsl_matrix_complex * m, + const size_t k); + +_gsl_vector_complex_const_view +gsl_matrix_complex_const_superdiagonal (const gsl_matrix_complex * m, + const size_t k); + +_gsl_vector_complex_const_view +gsl_matrix_complex_const_subrow (const gsl_matrix_complex * m, + const size_t i, const size_t offset, + const size_t n); + +_gsl_vector_complex_const_view +gsl_matrix_complex_const_subcolumn (const gsl_matrix_complex * m, + const size_t j, const size_t offset, + const size_t n); + +_gsl_matrix_complex_const_view +gsl_matrix_complex_const_view_array (const double * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_const_view +gsl_matrix_complex_const_view_array_with_tda (const double * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_complex_const_view +gsl_matrix_complex_const_view_vector (const gsl_vector_complex * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_const_view +gsl_matrix_complex_const_view_vector_with_tda (const gsl_vector_complex * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +gsl_complex gsl_matrix_complex_get(const gsl_matrix_complex * m, const size_t i, const size_t j); +void gsl_matrix_complex_set(gsl_matrix_complex * m, const size_t i, const size_t j, const gsl_complex x); + +gsl_complex * gsl_matrix_complex_ptr(gsl_matrix_complex * m, const size_t i, const size_t j); +const gsl_complex * gsl_matrix_complex_const_ptr(const gsl_matrix_complex * m, const size_t i, const size_t j); + +void gsl_matrix_complex_set_zero (gsl_matrix_complex * m); +void gsl_matrix_complex_set_identity (gsl_matrix_complex * m); +void gsl_matrix_complex_set_all (gsl_matrix_complex * m, gsl_complex x); + +int gsl_matrix_complex_fread (FILE * stream, gsl_matrix_complex * m) ; +int gsl_matrix_complex_fwrite (FILE * stream, const gsl_matrix_complex * m) ; +int gsl_matrix_complex_fscanf (FILE * stream, gsl_matrix_complex * m); +int gsl_matrix_complex_fprintf (FILE * stream, const gsl_matrix_complex * m, const char * format); + +int gsl_matrix_complex_memcpy(gsl_matrix_complex * dest, const gsl_matrix_complex * src); +int gsl_matrix_complex_swap(gsl_matrix_complex * m1, gsl_matrix_complex * m2); + +int gsl_matrix_complex_swap_rows(gsl_matrix_complex * m, const size_t i, const size_t j); +int gsl_matrix_complex_swap_columns(gsl_matrix_complex * m, const size_t i, const size_t j); +int gsl_matrix_complex_swap_rowcol(gsl_matrix_complex * m, const size_t i, const size_t j); + +int gsl_matrix_complex_transpose (gsl_matrix_complex * m); +int gsl_matrix_complex_transpose_memcpy (gsl_matrix_complex * dest, const gsl_matrix_complex * src); + +int gsl_matrix_complex_isnull (const gsl_matrix_complex * m); +int gsl_matrix_complex_ispos (const gsl_matrix_complex * m); +int gsl_matrix_complex_isneg (const gsl_matrix_complex * m); + +int gsl_matrix_complex_add (gsl_matrix_complex * a, const gsl_matrix_complex * b); +int gsl_matrix_complex_sub (gsl_matrix_complex * a, const gsl_matrix_complex * b); +int gsl_matrix_complex_mul_elements (gsl_matrix_complex * a, const gsl_matrix_complex * b); +int gsl_matrix_complex_div_elements (gsl_matrix_complex * a, const gsl_matrix_complex * b); +int gsl_matrix_complex_scale (gsl_matrix_complex * a, const gsl_complex x); +int gsl_matrix_complex_add_constant (gsl_matrix_complex * a, const gsl_complex x); +int gsl_matrix_complex_add_diagonal (gsl_matrix_complex * a, const gsl_complex x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_complex_get_row(gsl_vector_complex * v, const gsl_matrix_complex * m, const size_t i); +int gsl_matrix_complex_get_col(gsl_vector_complex * v, const gsl_matrix_complex * m, const size_t j); +int gsl_matrix_complex_set_row(gsl_matrix_complex * m, const size_t i, const gsl_vector_complex * v); +int gsl_matrix_complex_set_col(gsl_matrix_complex * m, const size_t j, const gsl_vector_complex * v); + +#ifdef HAVE_INLINE + +extern inline +gsl_complex +gsl_matrix_complex_get(const gsl_matrix_complex * m, + const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + gsl_complex zero = {{0,0}}; + + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, zero) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, zero) ; + } +#endif + return *(gsl_complex *)(m->data + 2*(i * m->tda + j)) ; +} + +extern inline +void +gsl_matrix_complex_set(gsl_matrix_complex * m, + const size_t i, const size_t j, const gsl_complex x) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } +#endif + *(gsl_complex *)(m->data + 2*(i * m->tda + j)) = x ; +} + +extern inline +gsl_complex * +gsl_matrix_complex_ptr(gsl_matrix_complex * m, + const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (gsl_complex *)(m->data + 2*(i * m->tda + j)) ; +} + +extern inline +const gsl_complex * +gsl_matrix_complex_const_ptr(const gsl_matrix_complex * m, + const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (const gsl_complex *)(m->data + 2*(i * m->tda + j)) ; +} + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_MATRIX_COMPLEX_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_matrix_complex_float.h b/dtm_release/local/include/gsl/gsl_matrix_complex_float.h new file mode 100644 index 0000000000000000000000000000000000000000..88bd7bf43dc09a4849e32a021b6131754a3f5cd5 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_matrix_complex_float.h @@ -0,0 +1,333 @@ +/* matrix/gsl_matrix_complex_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_COMPLEX_FLOAT_H__ +#define __GSL_MATRIX_COMPLEX_FLOAT_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_complex.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_vector_complex_float.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + float * data; + gsl_block_complex_float * block; + int owner; +} gsl_matrix_complex_float ; + +typedef struct +{ + gsl_matrix_complex_float matrix; +} _gsl_matrix_complex_float_view; + +typedef _gsl_matrix_complex_float_view gsl_matrix_complex_float_view; + +typedef struct +{ + gsl_matrix_complex_float matrix; +} _gsl_matrix_complex_float_const_view; + +typedef const _gsl_matrix_complex_float_const_view gsl_matrix_complex_float_const_view; + + +/* Allocation */ + +gsl_matrix_complex_float * +gsl_matrix_complex_float_alloc (const size_t n1, const size_t n2); + +gsl_matrix_complex_float * +gsl_matrix_complex_float_calloc (const size_t n1, const size_t n2); + +gsl_matrix_complex_float * +gsl_matrix_complex_float_alloc_from_block (gsl_block_complex_float * b, + const size_t offset, + const size_t n1, const size_t n2, const size_t d2); + +gsl_matrix_complex_float * +gsl_matrix_complex_float_alloc_from_matrix (gsl_matrix_complex_float * b, + const size_t k1, const size_t k2, + const size_t n1, const size_t n2); + +gsl_vector_complex_float * +gsl_vector_complex_float_alloc_row_from_matrix (gsl_matrix_complex_float * m, + const size_t i); + +gsl_vector_complex_float * +gsl_vector_complex_float_alloc_col_from_matrix (gsl_matrix_complex_float * m, + const size_t j); + +void gsl_matrix_complex_float_free (gsl_matrix_complex_float * m); + +/* Views */ + +_gsl_matrix_complex_float_view +gsl_matrix_complex_float_submatrix (gsl_matrix_complex_float * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_complex_float_view +gsl_matrix_complex_float_row (gsl_matrix_complex_float * m, const size_t i); + +_gsl_vector_complex_float_view +gsl_matrix_complex_float_column (gsl_matrix_complex_float * m, const size_t j); + +_gsl_vector_complex_float_view +gsl_matrix_complex_float_diagonal (gsl_matrix_complex_float * m); + +_gsl_vector_complex_float_view +gsl_matrix_complex_float_subdiagonal (gsl_matrix_complex_float * m, const size_t k); + +_gsl_vector_complex_float_view +gsl_matrix_complex_float_superdiagonal (gsl_matrix_complex_float * m, const size_t k); + +_gsl_vector_complex_float_view +gsl_matrix_complex_float_subrow (gsl_matrix_complex_float * m, + const size_t i, const size_t offset, + const size_t n); + +_gsl_vector_complex_float_view +gsl_matrix_complex_float_subcolumn (gsl_matrix_complex_float * m, + const size_t j, const size_t offset, + const size_t n); + +_gsl_matrix_complex_float_view +gsl_matrix_complex_float_view_array (float * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_float_view +gsl_matrix_complex_float_view_array_with_tda (float * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_complex_float_view +gsl_matrix_complex_float_view_vector (gsl_vector_complex_float * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_float_view +gsl_matrix_complex_float_view_vector_with_tda (gsl_vector_complex_float * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_complex_float_const_view +gsl_matrix_complex_float_const_submatrix (const gsl_matrix_complex_float * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_complex_float_const_view +gsl_matrix_complex_float_const_row (const gsl_matrix_complex_float * m, + const size_t i); + +_gsl_vector_complex_float_const_view +gsl_matrix_complex_float_const_column (const gsl_matrix_complex_float * m, + const size_t j); + +_gsl_vector_complex_float_const_view +gsl_matrix_complex_float_const_diagonal (const gsl_matrix_complex_float * m); + +_gsl_vector_complex_float_const_view +gsl_matrix_complex_float_const_subdiagonal (const gsl_matrix_complex_float * m, + const size_t k); + +_gsl_vector_complex_float_const_view +gsl_matrix_complex_float_const_superdiagonal (const gsl_matrix_complex_float * m, + const size_t k); + +_gsl_vector_complex_float_const_view +gsl_matrix_complex_float_const_subrow (const gsl_matrix_complex_float * m, + const size_t i, const size_t offset, + const size_t n); + +_gsl_vector_complex_float_const_view +gsl_matrix_complex_float_const_subcolumn (const gsl_matrix_complex_float * m, + const size_t j, const size_t offset, + const size_t n); + +_gsl_matrix_complex_float_const_view +gsl_matrix_complex_float_const_view_array (const float * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_float_const_view +gsl_matrix_complex_float_const_view_array_with_tda (const float * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_complex_float_const_view +gsl_matrix_complex_float_const_view_vector (const gsl_vector_complex_float * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_float_const_view +gsl_matrix_complex_float_const_view_vector_with_tda (const gsl_vector_complex_float * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +gsl_complex_float gsl_matrix_complex_float_get(const gsl_matrix_complex_float * m, const size_t i, const size_t j); +void gsl_matrix_complex_float_set(gsl_matrix_complex_float * m, const size_t i, const size_t j, const gsl_complex_float x); + +gsl_complex_float * gsl_matrix_complex_float_ptr(gsl_matrix_complex_float * m, const size_t i, const size_t j); +const gsl_complex_float * gsl_matrix_complex_float_const_ptr(const gsl_matrix_complex_float * m, const size_t i, const size_t j); + +void gsl_matrix_complex_float_set_zero (gsl_matrix_complex_float * m); +void gsl_matrix_complex_float_set_identity (gsl_matrix_complex_float * m); +void gsl_matrix_complex_float_set_all (gsl_matrix_complex_float * m, gsl_complex_float x); + +int gsl_matrix_complex_float_fread (FILE * stream, gsl_matrix_complex_float * m) ; +int gsl_matrix_complex_float_fwrite (FILE * stream, const gsl_matrix_complex_float * m) ; +int gsl_matrix_complex_float_fscanf (FILE * stream, gsl_matrix_complex_float * m); +int gsl_matrix_complex_float_fprintf (FILE * stream, const gsl_matrix_complex_float * m, const char * format); + +int gsl_matrix_complex_float_memcpy(gsl_matrix_complex_float * dest, const gsl_matrix_complex_float * src); +int gsl_matrix_complex_float_swap(gsl_matrix_complex_float * m1, gsl_matrix_complex_float * m2); + +int gsl_matrix_complex_float_swap_rows(gsl_matrix_complex_float * m, const size_t i, const size_t j); +int gsl_matrix_complex_float_swap_columns(gsl_matrix_complex_float * m, const size_t i, const size_t j); +int gsl_matrix_complex_float_swap_rowcol(gsl_matrix_complex_float * m, const size_t i, const size_t j); + +int gsl_matrix_complex_float_transpose (gsl_matrix_complex_float * m); +int gsl_matrix_complex_float_transpose_memcpy (gsl_matrix_complex_float * dest, const gsl_matrix_complex_float * src); + +int gsl_matrix_complex_float_isnull (const gsl_matrix_complex_float * m); +int gsl_matrix_complex_float_ispos (const gsl_matrix_complex_float * m); +int gsl_matrix_complex_float_isneg (const gsl_matrix_complex_float * m); + +int gsl_matrix_complex_float_add (gsl_matrix_complex_float * a, const gsl_matrix_complex_float * b); +int gsl_matrix_complex_float_sub (gsl_matrix_complex_float * a, const gsl_matrix_complex_float * b); +int gsl_matrix_complex_float_mul_elements (gsl_matrix_complex_float * a, const gsl_matrix_complex_float * b); +int gsl_matrix_complex_float_div_elements (gsl_matrix_complex_float * a, const gsl_matrix_complex_float * b); +int gsl_matrix_complex_float_scale (gsl_matrix_complex_float * a, const gsl_complex_float x); +int gsl_matrix_complex_float_add_constant (gsl_matrix_complex_float * a, const gsl_complex_float x); +int gsl_matrix_complex_float_add_diagonal (gsl_matrix_complex_float * a, const gsl_complex_float x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_complex_float_get_row(gsl_vector_complex_float * v, const gsl_matrix_complex_float * m, const size_t i); +int gsl_matrix_complex_float_get_col(gsl_vector_complex_float * v, const gsl_matrix_complex_float * m, const size_t j); +int gsl_matrix_complex_float_set_row(gsl_matrix_complex_float * m, const size_t i, const gsl_vector_complex_float * v); +int gsl_matrix_complex_float_set_col(gsl_matrix_complex_float * m, const size_t j, const gsl_vector_complex_float * v); + +#ifdef HAVE_INLINE + +extern inline +gsl_complex_float +gsl_matrix_complex_float_get(const gsl_matrix_complex_float * m, + const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + gsl_complex_float zero = {{0,0}}; + + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, zero) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, zero) ; + } +#endif + return *(gsl_complex_float *)(m->data + 2*(i * m->tda + j)) ; +} + +extern inline +void +gsl_matrix_complex_float_set(gsl_matrix_complex_float * m, + const size_t i, const size_t j, const gsl_complex_float x) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } +#endif + *(gsl_complex_float *)(m->data + 2*(i * m->tda + j)) = x ; +} + +extern inline +gsl_complex_float * +gsl_matrix_complex_float_ptr(gsl_matrix_complex_float * m, + const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (gsl_complex_float *)(m->data + 2*(i * m->tda + j)) ; +} + +extern inline +const gsl_complex_float * +gsl_matrix_complex_float_const_ptr(const gsl_matrix_complex_float * m, + const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (const gsl_complex_float *)(m->data + 2*(i * m->tda + j)) ; +} + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_MATRIX_COMPLEX_FLOAT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_matrix_complex_long_double.h b/dtm_release/local/include/gsl/gsl_matrix_complex_long_double.h new file mode 100644 index 0000000000000000000000000000000000000000..fd677baf87a13774502c16768c0cbabf805fbb37 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_matrix_complex_long_double.h @@ -0,0 +1,333 @@ +/* matrix/gsl_matrix_complex_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_COMPLEX_LONG_DOUBLE_H__ +#define __GSL_MATRIX_COMPLEX_LONG_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_complex.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_vector_complex_long_double.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + long double * data; + gsl_block_complex_long_double * block; + int owner; +} gsl_matrix_complex_long_double ; + +typedef struct +{ + gsl_matrix_complex_long_double matrix; +} _gsl_matrix_complex_long_double_view; + +typedef _gsl_matrix_complex_long_double_view gsl_matrix_complex_long_double_view; + +typedef struct +{ + gsl_matrix_complex_long_double matrix; +} _gsl_matrix_complex_long_double_const_view; + +typedef const _gsl_matrix_complex_long_double_const_view gsl_matrix_complex_long_double_const_view; + + +/* Allocation */ + +gsl_matrix_complex_long_double * +gsl_matrix_complex_long_double_alloc (const size_t n1, const size_t n2); + +gsl_matrix_complex_long_double * +gsl_matrix_complex_long_double_calloc (const size_t n1, const size_t n2); + +gsl_matrix_complex_long_double * +gsl_matrix_complex_long_double_alloc_from_block (gsl_block_complex_long_double * b, + const size_t offset, + const size_t n1, const size_t n2, const size_t d2); + +gsl_matrix_complex_long_double * +gsl_matrix_complex_long_double_alloc_from_matrix (gsl_matrix_complex_long_double * b, + const size_t k1, const size_t k2, + const size_t n1, const size_t n2); + +gsl_vector_complex_long_double * +gsl_vector_complex_long_double_alloc_row_from_matrix (gsl_matrix_complex_long_double * m, + const size_t i); + +gsl_vector_complex_long_double * +gsl_vector_complex_long_double_alloc_col_from_matrix (gsl_matrix_complex_long_double * m, + const size_t j); + +void gsl_matrix_complex_long_double_free (gsl_matrix_complex_long_double * m); + +/* Views */ + +_gsl_matrix_complex_long_double_view +gsl_matrix_complex_long_double_submatrix (gsl_matrix_complex_long_double * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_complex_long_double_view +gsl_matrix_complex_long_double_row (gsl_matrix_complex_long_double * m, const size_t i); + +_gsl_vector_complex_long_double_view +gsl_matrix_complex_long_double_column (gsl_matrix_complex_long_double * m, const size_t j); + +_gsl_vector_complex_long_double_view +gsl_matrix_complex_long_double_diagonal (gsl_matrix_complex_long_double * m); + +_gsl_vector_complex_long_double_view +gsl_matrix_complex_long_double_subdiagonal (gsl_matrix_complex_long_double * m, const size_t k); + +_gsl_vector_complex_long_double_view +gsl_matrix_complex_long_double_superdiagonal (gsl_matrix_complex_long_double * m, const size_t k); + +_gsl_vector_complex_long_double_view +gsl_matrix_complex_long_double_subrow (gsl_matrix_complex_long_double * m, + const size_t i, const size_t offset, + const size_t n); + +_gsl_vector_complex_long_double_view +gsl_matrix_complex_long_double_subcolumn (gsl_matrix_complex_long_double * m, + const size_t j, const size_t offset, + const size_t n); + +_gsl_matrix_complex_long_double_view +gsl_matrix_complex_long_double_view_array (long double * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_long_double_view +gsl_matrix_complex_long_double_view_array_with_tda (long double * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_complex_long_double_view +gsl_matrix_complex_long_double_view_vector (gsl_vector_complex_long_double * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_long_double_view +gsl_matrix_complex_long_double_view_vector_with_tda (gsl_vector_complex_long_double * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_complex_long_double_const_view +gsl_matrix_complex_long_double_const_submatrix (const gsl_matrix_complex_long_double * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_complex_long_double_const_view +gsl_matrix_complex_long_double_const_row (const gsl_matrix_complex_long_double * m, + const size_t i); + +_gsl_vector_complex_long_double_const_view +gsl_matrix_complex_long_double_const_column (const gsl_matrix_complex_long_double * m, + const size_t j); + +_gsl_vector_complex_long_double_const_view +gsl_matrix_complex_long_double_const_diagonal (const gsl_matrix_complex_long_double * m); + +_gsl_vector_complex_long_double_const_view +gsl_matrix_complex_long_double_const_subdiagonal (const gsl_matrix_complex_long_double * m, + const size_t k); + +_gsl_vector_complex_long_double_const_view +gsl_matrix_complex_long_double_const_superdiagonal (const gsl_matrix_complex_long_double * m, + const size_t k); + +_gsl_vector_complex_long_double_const_view +gsl_matrix_complex_long_double_const_subrow (const gsl_matrix_complex_long_double * m, + const size_t i, const size_t offset, + const size_t n); + +_gsl_vector_complex_long_double_const_view +gsl_matrix_complex_long_double_const_subcolumn (const gsl_matrix_complex_long_double * m, + const size_t j, const size_t offset, + const size_t n); + +_gsl_matrix_complex_long_double_const_view +gsl_matrix_complex_long_double_const_view_array (const long double * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_long_double_const_view +gsl_matrix_complex_long_double_const_view_array_with_tda (const long double * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_complex_long_double_const_view +gsl_matrix_complex_long_double_const_view_vector (const gsl_vector_complex_long_double * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_complex_long_double_const_view +gsl_matrix_complex_long_double_const_view_vector_with_tda (const gsl_vector_complex_long_double * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +gsl_complex_long_double gsl_matrix_complex_long_double_get(const gsl_matrix_complex_long_double * m, const size_t i, const size_t j); +void gsl_matrix_complex_long_double_set(gsl_matrix_complex_long_double * m, const size_t i, const size_t j, const gsl_complex_long_double x); + +gsl_complex_long_double * gsl_matrix_complex_long_double_ptr(gsl_matrix_complex_long_double * m, const size_t i, const size_t j); +const gsl_complex_long_double * gsl_matrix_complex_long_double_const_ptr(const gsl_matrix_complex_long_double * m, const size_t i, const size_t j); + +void gsl_matrix_complex_long_double_set_zero (gsl_matrix_complex_long_double * m); +void gsl_matrix_complex_long_double_set_identity (gsl_matrix_complex_long_double * m); +void gsl_matrix_complex_long_double_set_all (gsl_matrix_complex_long_double * m, gsl_complex_long_double x); + +int gsl_matrix_complex_long_double_fread (FILE * stream, gsl_matrix_complex_long_double * m) ; +int gsl_matrix_complex_long_double_fwrite (FILE * stream, const gsl_matrix_complex_long_double * m) ; +int gsl_matrix_complex_long_double_fscanf (FILE * stream, gsl_matrix_complex_long_double * m); +int gsl_matrix_complex_long_double_fprintf (FILE * stream, const gsl_matrix_complex_long_double * m, const char * format); + +int gsl_matrix_complex_long_double_memcpy(gsl_matrix_complex_long_double * dest, const gsl_matrix_complex_long_double * src); +int gsl_matrix_complex_long_double_swap(gsl_matrix_complex_long_double * m1, gsl_matrix_complex_long_double * m2); + +int gsl_matrix_complex_long_double_swap_rows(gsl_matrix_complex_long_double * m, const size_t i, const size_t j); +int gsl_matrix_complex_long_double_swap_columns(gsl_matrix_complex_long_double * m, const size_t i, const size_t j); +int gsl_matrix_complex_long_double_swap_rowcol(gsl_matrix_complex_long_double * m, const size_t i, const size_t j); + +int gsl_matrix_complex_long_double_transpose (gsl_matrix_complex_long_double * m); +int gsl_matrix_complex_long_double_transpose_memcpy (gsl_matrix_complex_long_double * dest, const gsl_matrix_complex_long_double * src); + +int gsl_matrix_complex_long_double_isnull (const gsl_matrix_complex_long_double * m); +int gsl_matrix_complex_long_double_ispos (const gsl_matrix_complex_long_double * m); +int gsl_matrix_complex_long_double_isneg (const gsl_matrix_complex_long_double * m); + +int gsl_matrix_complex_long_double_add (gsl_matrix_complex_long_double * a, const gsl_matrix_complex_long_double * b); +int gsl_matrix_complex_long_double_sub (gsl_matrix_complex_long_double * a, const gsl_matrix_complex_long_double * b); +int gsl_matrix_complex_long_double_mul_elements (gsl_matrix_complex_long_double * a, const gsl_matrix_complex_long_double * b); +int gsl_matrix_complex_long_double_div_elements (gsl_matrix_complex_long_double * a, const gsl_matrix_complex_long_double * b); +int gsl_matrix_complex_long_double_scale (gsl_matrix_complex_long_double * a, const gsl_complex_long_double x); +int gsl_matrix_complex_long_double_add_constant (gsl_matrix_complex_long_double * a, const gsl_complex_long_double x); +int gsl_matrix_complex_long_double_add_diagonal (gsl_matrix_complex_long_double * a, const gsl_complex_long_double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_complex_long_double_get_row(gsl_vector_complex_long_double * v, const gsl_matrix_complex_long_double * m, const size_t i); +int gsl_matrix_complex_long_double_get_col(gsl_vector_complex_long_double * v, const gsl_matrix_complex_long_double * m, const size_t j); +int gsl_matrix_complex_long_double_set_row(gsl_matrix_complex_long_double * m, const size_t i, const gsl_vector_complex_long_double * v); +int gsl_matrix_complex_long_double_set_col(gsl_matrix_complex_long_double * m, const size_t j, const gsl_vector_complex_long_double * v); + +#ifdef HAVE_INLINE + +extern inline +gsl_complex_long_double +gsl_matrix_complex_long_double_get(const gsl_matrix_complex_long_double * m, + const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + gsl_complex_long_double zero = {{0,0}}; + + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, zero) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, zero) ; + } +#endif + return *(gsl_complex_long_double *)(m->data + 2*(i * m->tda + j)) ; +} + +extern inline +void +gsl_matrix_complex_long_double_set(gsl_matrix_complex_long_double * m, + const size_t i, const size_t j, const gsl_complex_long_double x) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } +#endif + *(gsl_complex_long_double *)(m->data + 2*(i * m->tda + j)) = x ; +} + +extern inline +gsl_complex_long_double * +gsl_matrix_complex_long_double_ptr(gsl_matrix_complex_long_double * m, + const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (gsl_complex_long_double *)(m->data + 2*(i * m->tda + j)) ; +} + +extern inline +const gsl_complex_long_double * +gsl_matrix_complex_long_double_const_ptr(const gsl_matrix_complex_long_double * m, + const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (const gsl_complex_long_double *)(m->data + 2*(i * m->tda + j)) ; +} + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_MATRIX_COMPLEX_LONG_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_matrix_double.h b/dtm_release/local/include/gsl/gsl_matrix_double.h new file mode 100644 index 0000000000000000000000000000000000000000..c8a420d52b22ffc536193f20fb204c5d24161a3d --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_matrix_double.h @@ -0,0 +1,335 @@ +/* matrix/gsl_matrix_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_DOUBLE_H__ +#define __GSL_MATRIX_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_vector_double.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + double * data; + gsl_block * block; + int owner; +} gsl_matrix; + +typedef struct +{ + gsl_matrix matrix; +} _gsl_matrix_view; + +typedef _gsl_matrix_view gsl_matrix_view; + +typedef struct +{ + gsl_matrix matrix; +} _gsl_matrix_const_view; + +typedef const _gsl_matrix_const_view gsl_matrix_const_view; + +/* Allocation */ + +gsl_matrix * +gsl_matrix_alloc (const size_t n1, const size_t n2); + +gsl_matrix * +gsl_matrix_calloc (const size_t n1, const size_t n2); + +gsl_matrix * +gsl_matrix_alloc_from_block (gsl_block * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix * +gsl_matrix_alloc_from_matrix (gsl_matrix * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector * +gsl_vector_alloc_row_from_matrix (gsl_matrix * m, + const size_t i); + +gsl_vector * +gsl_vector_alloc_col_from_matrix (gsl_matrix * m, + const size_t j); + +void gsl_matrix_free (gsl_matrix * m); + +/* Views */ + +_gsl_matrix_view +gsl_matrix_submatrix (gsl_matrix * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_view +gsl_matrix_row (gsl_matrix * m, const size_t i); + +_gsl_vector_view +gsl_matrix_column (gsl_matrix * m, const size_t j); + +_gsl_vector_view +gsl_matrix_diagonal (gsl_matrix * m); + +_gsl_vector_view +gsl_matrix_subdiagonal (gsl_matrix * m, const size_t k); + +_gsl_vector_view +gsl_matrix_superdiagonal (gsl_matrix * m, const size_t k); + +_gsl_vector_view +gsl_matrix_subrow (gsl_matrix * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_view +gsl_matrix_subcolumn (gsl_matrix * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_view +gsl_matrix_view_array (double * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_view +gsl_matrix_view_array_with_tda (double * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_view +gsl_matrix_view_vector (gsl_vector * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_view +gsl_matrix_view_vector_with_tda (gsl_vector * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_const_view +gsl_matrix_const_submatrix (const gsl_matrix * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_const_view +gsl_matrix_const_row (const gsl_matrix * m, + const size_t i); + +_gsl_vector_const_view +gsl_matrix_const_column (const gsl_matrix * m, + const size_t j); + +_gsl_vector_const_view +gsl_matrix_const_diagonal (const gsl_matrix * m); + +_gsl_vector_const_view +gsl_matrix_const_subdiagonal (const gsl_matrix * m, + const size_t k); + +_gsl_vector_const_view +gsl_matrix_const_superdiagonal (const gsl_matrix * m, + const size_t k); + +_gsl_vector_const_view +gsl_matrix_const_subrow (const gsl_matrix * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_const_view +gsl_matrix_const_subcolumn (const gsl_matrix * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_const_view +gsl_matrix_const_view_array (const double * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_const_view +gsl_matrix_const_view_array_with_tda (const double * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_const_view +gsl_matrix_const_view_vector (const gsl_vector * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_const_view +gsl_matrix_const_view_vector_with_tda (const gsl_vector * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +double gsl_matrix_get(const gsl_matrix * m, const size_t i, const size_t j); +void gsl_matrix_set(gsl_matrix * m, const size_t i, const size_t j, const double x); + +double * gsl_matrix_ptr(gsl_matrix * m, const size_t i, const size_t j); +const double * gsl_matrix_const_ptr(const gsl_matrix * m, const size_t i, const size_t j); + +void gsl_matrix_set_zero (gsl_matrix * m); +void gsl_matrix_set_identity (gsl_matrix * m); +void gsl_matrix_set_all (gsl_matrix * m, double x); + +int gsl_matrix_fread (FILE * stream, gsl_matrix * m) ; +int gsl_matrix_fwrite (FILE * stream, const gsl_matrix * m) ; +int gsl_matrix_fscanf (FILE * stream, gsl_matrix * m); +int gsl_matrix_fprintf (FILE * stream, const gsl_matrix * m, const char * format); + +int gsl_matrix_memcpy(gsl_matrix * dest, const gsl_matrix * src); +int gsl_matrix_swap(gsl_matrix * m1, gsl_matrix * m2); + +int gsl_matrix_swap_rows(gsl_matrix * m, const size_t i, const size_t j); +int gsl_matrix_swap_columns(gsl_matrix * m, const size_t i, const size_t j); +int gsl_matrix_swap_rowcol(gsl_matrix * m, const size_t i, const size_t j); +int gsl_matrix_transpose (gsl_matrix * m); +int gsl_matrix_transpose_memcpy (gsl_matrix * dest, const gsl_matrix * src); + +double gsl_matrix_max (const gsl_matrix * m); +double gsl_matrix_min (const gsl_matrix * m); +void gsl_matrix_minmax (const gsl_matrix * m, double * min_out, double * max_out); + +void gsl_matrix_max_index (const gsl_matrix * m, size_t * imax, size_t *jmax); +void gsl_matrix_min_index (const gsl_matrix * m, size_t * imin, size_t *jmin); +void gsl_matrix_minmax_index (const gsl_matrix * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_isnull (const gsl_matrix * m); +int gsl_matrix_ispos (const gsl_matrix * m); +int gsl_matrix_isneg (const gsl_matrix * m); +int gsl_matrix_isnonneg (const gsl_matrix * m); + +int gsl_matrix_add (gsl_matrix * a, const gsl_matrix * b); +int gsl_matrix_sub (gsl_matrix * a, const gsl_matrix * b); +int gsl_matrix_mul_elements (gsl_matrix * a, const gsl_matrix * b); +int gsl_matrix_div_elements (gsl_matrix * a, const gsl_matrix * b); +int gsl_matrix_scale (gsl_matrix * a, const double x); +int gsl_matrix_add_constant (gsl_matrix * a, const double x); +int gsl_matrix_add_diagonal (gsl_matrix * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_get_row(gsl_vector * v, const gsl_matrix * m, const size_t i); +int gsl_matrix_get_col(gsl_vector * v, const gsl_matrix * m, const size_t j); +int gsl_matrix_set_row(gsl_matrix * m, const size_t i, const gsl_vector * v); +int gsl_matrix_set_col(gsl_matrix * m, const size_t j, const gsl_vector * v); + +/* inline functions if you are using GCC */ + +#ifdef HAVE_INLINE +extern inline +double +gsl_matrix_get(const gsl_matrix * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } +#endif + return m->data[i * m->tda + j] ; +} + +extern inline +void +gsl_matrix_set(gsl_matrix * m, const size_t i, const size_t j, const double x) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } +#endif + m->data[i * m->tda + j] = x ; +} + +extern inline +double * +gsl_matrix_ptr(gsl_matrix * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (double *) (m->data + (i * m->tda + j)) ; +} + +extern inline +const double * +gsl_matrix_const_ptr(const gsl_matrix * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (const double *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_matrix_float.h b/dtm_release/local/include/gsl/gsl_matrix_float.h new file mode 100644 index 0000000000000000000000000000000000000000..284929c348324c2db4fbcaf3a24bd430aae968f3 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_matrix_float.h @@ -0,0 +1,335 @@ +/* matrix/gsl_matrix_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_FLOAT_H__ +#define __GSL_MATRIX_FLOAT_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_vector_float.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + float * data; + gsl_block_float * block; + int owner; +} gsl_matrix_float; + +typedef struct +{ + gsl_matrix_float matrix; +} _gsl_matrix_float_view; + +typedef _gsl_matrix_float_view gsl_matrix_float_view; + +typedef struct +{ + gsl_matrix_float matrix; +} _gsl_matrix_float_const_view; + +typedef const _gsl_matrix_float_const_view gsl_matrix_float_const_view; + +/* Allocation */ + +gsl_matrix_float * +gsl_matrix_float_alloc (const size_t n1, const size_t n2); + +gsl_matrix_float * +gsl_matrix_float_calloc (const size_t n1, const size_t n2); + +gsl_matrix_float * +gsl_matrix_float_alloc_from_block (gsl_block_float * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix_float * +gsl_matrix_float_alloc_from_matrix (gsl_matrix_float * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector_float * +gsl_vector_float_alloc_row_from_matrix (gsl_matrix_float * m, + const size_t i); + +gsl_vector_float * +gsl_vector_float_alloc_col_from_matrix (gsl_matrix_float * m, + const size_t j); + +void gsl_matrix_float_free (gsl_matrix_float * m); + +/* Views */ + +_gsl_matrix_float_view +gsl_matrix_float_submatrix (gsl_matrix_float * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_float_view +gsl_matrix_float_row (gsl_matrix_float * m, const size_t i); + +_gsl_vector_float_view +gsl_matrix_float_column (gsl_matrix_float * m, const size_t j); + +_gsl_vector_float_view +gsl_matrix_float_diagonal (gsl_matrix_float * m); + +_gsl_vector_float_view +gsl_matrix_float_subdiagonal (gsl_matrix_float * m, const size_t k); + +_gsl_vector_float_view +gsl_matrix_float_superdiagonal (gsl_matrix_float * m, const size_t k); + +_gsl_vector_float_view +gsl_matrix_float_subrow (gsl_matrix_float * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_float_view +gsl_matrix_float_subcolumn (gsl_matrix_float * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_float_view +gsl_matrix_float_view_array (float * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_float_view +gsl_matrix_float_view_array_with_tda (float * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_float_view +gsl_matrix_float_view_vector (gsl_vector_float * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_float_view +gsl_matrix_float_view_vector_with_tda (gsl_vector_float * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_float_const_view +gsl_matrix_float_const_submatrix (const gsl_matrix_float * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_float_const_view +gsl_matrix_float_const_row (const gsl_matrix_float * m, + const size_t i); + +_gsl_vector_float_const_view +gsl_matrix_float_const_column (const gsl_matrix_float * m, + const size_t j); + +_gsl_vector_float_const_view +gsl_matrix_float_const_diagonal (const gsl_matrix_float * m); + +_gsl_vector_float_const_view +gsl_matrix_float_const_subdiagonal (const gsl_matrix_float * m, + const size_t k); + +_gsl_vector_float_const_view +gsl_matrix_float_const_superdiagonal (const gsl_matrix_float * m, + const size_t k); + +_gsl_vector_float_const_view +gsl_matrix_float_const_subrow (const gsl_matrix_float * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_float_const_view +gsl_matrix_float_const_subcolumn (const gsl_matrix_float * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_float_const_view +gsl_matrix_float_const_view_array (const float * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_float_const_view +gsl_matrix_float_const_view_array_with_tda (const float * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_float_const_view +gsl_matrix_float_const_view_vector (const gsl_vector_float * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_float_const_view +gsl_matrix_float_const_view_vector_with_tda (const gsl_vector_float * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +float gsl_matrix_float_get(const gsl_matrix_float * m, const size_t i, const size_t j); +void gsl_matrix_float_set(gsl_matrix_float * m, const size_t i, const size_t j, const float x); + +float * gsl_matrix_float_ptr(gsl_matrix_float * m, const size_t i, const size_t j); +const float * gsl_matrix_float_const_ptr(const gsl_matrix_float * m, const size_t i, const size_t j); + +void gsl_matrix_float_set_zero (gsl_matrix_float * m); +void gsl_matrix_float_set_identity (gsl_matrix_float * m); +void gsl_matrix_float_set_all (gsl_matrix_float * m, float x); + +int gsl_matrix_float_fread (FILE * stream, gsl_matrix_float * m) ; +int gsl_matrix_float_fwrite (FILE * stream, const gsl_matrix_float * m) ; +int gsl_matrix_float_fscanf (FILE * stream, gsl_matrix_float * m); +int gsl_matrix_float_fprintf (FILE * stream, const gsl_matrix_float * m, const char * format); + +int gsl_matrix_float_memcpy(gsl_matrix_float * dest, const gsl_matrix_float * src); +int gsl_matrix_float_swap(gsl_matrix_float * m1, gsl_matrix_float * m2); + +int gsl_matrix_float_swap_rows(gsl_matrix_float * m, const size_t i, const size_t j); +int gsl_matrix_float_swap_columns(gsl_matrix_float * m, const size_t i, const size_t j); +int gsl_matrix_float_swap_rowcol(gsl_matrix_float * m, const size_t i, const size_t j); +int gsl_matrix_float_transpose (gsl_matrix_float * m); +int gsl_matrix_float_transpose_memcpy (gsl_matrix_float * dest, const gsl_matrix_float * src); + +float gsl_matrix_float_max (const gsl_matrix_float * m); +float gsl_matrix_float_min (const gsl_matrix_float * m); +void gsl_matrix_float_minmax (const gsl_matrix_float * m, float * min_out, float * max_out); + +void gsl_matrix_float_max_index (const gsl_matrix_float * m, size_t * imax, size_t *jmax); +void gsl_matrix_float_min_index (const gsl_matrix_float * m, size_t * imin, size_t *jmin); +void gsl_matrix_float_minmax_index (const gsl_matrix_float * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_float_isnull (const gsl_matrix_float * m); +int gsl_matrix_float_ispos (const gsl_matrix_float * m); +int gsl_matrix_float_isneg (const gsl_matrix_float * m); +int gsl_matrix_float_isnonneg (const gsl_matrix_float * m); + +int gsl_matrix_float_add (gsl_matrix_float * a, const gsl_matrix_float * b); +int gsl_matrix_float_sub (gsl_matrix_float * a, const gsl_matrix_float * b); +int gsl_matrix_float_mul_elements (gsl_matrix_float * a, const gsl_matrix_float * b); +int gsl_matrix_float_div_elements (gsl_matrix_float * a, const gsl_matrix_float * b); +int gsl_matrix_float_scale (gsl_matrix_float * a, const double x); +int gsl_matrix_float_add_constant (gsl_matrix_float * a, const double x); +int gsl_matrix_float_add_diagonal (gsl_matrix_float * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_float_get_row(gsl_vector_float * v, const gsl_matrix_float * m, const size_t i); +int gsl_matrix_float_get_col(gsl_vector_float * v, const gsl_matrix_float * m, const size_t j); +int gsl_matrix_float_set_row(gsl_matrix_float * m, const size_t i, const gsl_vector_float * v); +int gsl_matrix_float_set_col(gsl_matrix_float * m, const size_t j, const gsl_vector_float * v); + +/* inline functions if you are using GCC */ + +#ifdef HAVE_INLINE +extern inline +float +gsl_matrix_float_get(const gsl_matrix_float * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } +#endif + return m->data[i * m->tda + j] ; +} + +extern inline +void +gsl_matrix_float_set(gsl_matrix_float * m, const size_t i, const size_t j, const float x) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } +#endif + m->data[i * m->tda + j] = x ; +} + +extern inline +float * +gsl_matrix_float_ptr(gsl_matrix_float * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (float *) (m->data + (i * m->tda + j)) ; +} + +extern inline +const float * +gsl_matrix_float_const_ptr(const gsl_matrix_float * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (const float *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_FLOAT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_matrix_int.h b/dtm_release/local/include/gsl/gsl_matrix_int.h new file mode 100644 index 0000000000000000000000000000000000000000..ddbab577b250fc55c3a7a96335a40f8005772488 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_matrix_int.h @@ -0,0 +1,335 @@ +/* matrix/gsl_matrix_int.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_INT_H__ +#define __GSL_MATRIX_INT_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_vector_int.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + int * data; + gsl_block_int * block; + int owner; +} gsl_matrix_int; + +typedef struct +{ + gsl_matrix_int matrix; +} _gsl_matrix_int_view; + +typedef _gsl_matrix_int_view gsl_matrix_int_view; + +typedef struct +{ + gsl_matrix_int matrix; +} _gsl_matrix_int_const_view; + +typedef const _gsl_matrix_int_const_view gsl_matrix_int_const_view; + +/* Allocation */ + +gsl_matrix_int * +gsl_matrix_int_alloc (const size_t n1, const size_t n2); + +gsl_matrix_int * +gsl_matrix_int_calloc (const size_t n1, const size_t n2); + +gsl_matrix_int * +gsl_matrix_int_alloc_from_block (gsl_block_int * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix_int * +gsl_matrix_int_alloc_from_matrix (gsl_matrix_int * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector_int * +gsl_vector_int_alloc_row_from_matrix (gsl_matrix_int * m, + const size_t i); + +gsl_vector_int * +gsl_vector_int_alloc_col_from_matrix (gsl_matrix_int * m, + const size_t j); + +void gsl_matrix_int_free (gsl_matrix_int * m); + +/* Views */ + +_gsl_matrix_int_view +gsl_matrix_int_submatrix (gsl_matrix_int * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_int_view +gsl_matrix_int_row (gsl_matrix_int * m, const size_t i); + +_gsl_vector_int_view +gsl_matrix_int_column (gsl_matrix_int * m, const size_t j); + +_gsl_vector_int_view +gsl_matrix_int_diagonal (gsl_matrix_int * m); + +_gsl_vector_int_view +gsl_matrix_int_subdiagonal (gsl_matrix_int * m, const size_t k); + +_gsl_vector_int_view +gsl_matrix_int_superdiagonal (gsl_matrix_int * m, const size_t k); + +_gsl_vector_int_view +gsl_matrix_int_subrow (gsl_matrix_int * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_int_view +gsl_matrix_int_subcolumn (gsl_matrix_int * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_int_view +gsl_matrix_int_view_array (int * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_int_view +gsl_matrix_int_view_array_with_tda (int * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_int_view +gsl_matrix_int_view_vector (gsl_vector_int * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_int_view +gsl_matrix_int_view_vector_with_tda (gsl_vector_int * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_int_const_view +gsl_matrix_int_const_submatrix (const gsl_matrix_int * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_int_const_view +gsl_matrix_int_const_row (const gsl_matrix_int * m, + const size_t i); + +_gsl_vector_int_const_view +gsl_matrix_int_const_column (const gsl_matrix_int * m, + const size_t j); + +_gsl_vector_int_const_view +gsl_matrix_int_const_diagonal (const gsl_matrix_int * m); + +_gsl_vector_int_const_view +gsl_matrix_int_const_subdiagonal (const gsl_matrix_int * m, + const size_t k); + +_gsl_vector_int_const_view +gsl_matrix_int_const_superdiagonal (const gsl_matrix_int * m, + const size_t k); + +_gsl_vector_int_const_view +gsl_matrix_int_const_subrow (const gsl_matrix_int * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_int_const_view +gsl_matrix_int_const_subcolumn (const gsl_matrix_int * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_int_const_view +gsl_matrix_int_const_view_array (const int * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_int_const_view +gsl_matrix_int_const_view_array_with_tda (const int * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_int_const_view +gsl_matrix_int_const_view_vector (const gsl_vector_int * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_int_const_view +gsl_matrix_int_const_view_vector_with_tda (const gsl_vector_int * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +int gsl_matrix_int_get(const gsl_matrix_int * m, const size_t i, const size_t j); +void gsl_matrix_int_set(gsl_matrix_int * m, const size_t i, const size_t j, const int x); + +int * gsl_matrix_int_ptr(gsl_matrix_int * m, const size_t i, const size_t j); +const int * gsl_matrix_int_const_ptr(const gsl_matrix_int * m, const size_t i, const size_t j); + +void gsl_matrix_int_set_zero (gsl_matrix_int * m); +void gsl_matrix_int_set_identity (gsl_matrix_int * m); +void gsl_matrix_int_set_all (gsl_matrix_int * m, int x); + +int gsl_matrix_int_fread (FILE * stream, gsl_matrix_int * m) ; +int gsl_matrix_int_fwrite (FILE * stream, const gsl_matrix_int * m) ; +int gsl_matrix_int_fscanf (FILE * stream, gsl_matrix_int * m); +int gsl_matrix_int_fprintf (FILE * stream, const gsl_matrix_int * m, const char * format); + +int gsl_matrix_int_memcpy(gsl_matrix_int * dest, const gsl_matrix_int * src); +int gsl_matrix_int_swap(gsl_matrix_int * m1, gsl_matrix_int * m2); + +int gsl_matrix_int_swap_rows(gsl_matrix_int * m, const size_t i, const size_t j); +int gsl_matrix_int_swap_columns(gsl_matrix_int * m, const size_t i, const size_t j); +int gsl_matrix_int_swap_rowcol(gsl_matrix_int * m, const size_t i, const size_t j); +int gsl_matrix_int_transpose (gsl_matrix_int * m); +int gsl_matrix_int_transpose_memcpy (gsl_matrix_int * dest, const gsl_matrix_int * src); + +int gsl_matrix_int_max (const gsl_matrix_int * m); +int gsl_matrix_int_min (const gsl_matrix_int * m); +void gsl_matrix_int_minmax (const gsl_matrix_int * m, int * min_out, int * max_out); + +void gsl_matrix_int_max_index (const gsl_matrix_int * m, size_t * imax, size_t *jmax); +void gsl_matrix_int_min_index (const gsl_matrix_int * m, size_t * imin, size_t *jmin); +void gsl_matrix_int_minmax_index (const gsl_matrix_int * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_int_isnull (const gsl_matrix_int * m); +int gsl_matrix_int_ispos (const gsl_matrix_int * m); +int gsl_matrix_int_isneg (const gsl_matrix_int * m); +int gsl_matrix_int_isnonneg (const gsl_matrix_int * m); + +int gsl_matrix_int_add (gsl_matrix_int * a, const gsl_matrix_int * b); +int gsl_matrix_int_sub (gsl_matrix_int * a, const gsl_matrix_int * b); +int gsl_matrix_int_mul_elements (gsl_matrix_int * a, const gsl_matrix_int * b); +int gsl_matrix_int_div_elements (gsl_matrix_int * a, const gsl_matrix_int * b); +int gsl_matrix_int_scale (gsl_matrix_int * a, const double x); +int gsl_matrix_int_add_constant (gsl_matrix_int * a, const double x); +int gsl_matrix_int_add_diagonal (gsl_matrix_int * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_int_get_row(gsl_vector_int * v, const gsl_matrix_int * m, const size_t i); +int gsl_matrix_int_get_col(gsl_vector_int * v, const gsl_matrix_int * m, const size_t j); +int gsl_matrix_int_set_row(gsl_matrix_int * m, const size_t i, const gsl_vector_int * v); +int gsl_matrix_int_set_col(gsl_matrix_int * m, const size_t j, const gsl_vector_int * v); + +/* inline functions if you are using GCC */ + +#ifdef HAVE_INLINE +extern inline +int +gsl_matrix_int_get(const gsl_matrix_int * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } +#endif + return m->data[i * m->tda + j] ; +} + +extern inline +void +gsl_matrix_int_set(gsl_matrix_int * m, const size_t i, const size_t j, const int x) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } +#endif + m->data[i * m->tda + j] = x ; +} + +extern inline +int * +gsl_matrix_int_ptr(gsl_matrix_int * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (int *) (m->data + (i * m->tda + j)) ; +} + +extern inline +const int * +gsl_matrix_int_const_ptr(const gsl_matrix_int * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (const int *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_INT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_matrix_long.h b/dtm_release/local/include/gsl/gsl_matrix_long.h new file mode 100644 index 0000000000000000000000000000000000000000..92a55f20b07954a4e5925d5d856ce8aced17c765 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_matrix_long.h @@ -0,0 +1,335 @@ +/* matrix/gsl_matrix_long.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_LONG_H__ +#define __GSL_MATRIX_LONG_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_vector_long.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + long * data; + gsl_block_long * block; + int owner; +} gsl_matrix_long; + +typedef struct +{ + gsl_matrix_long matrix; +} _gsl_matrix_long_view; + +typedef _gsl_matrix_long_view gsl_matrix_long_view; + +typedef struct +{ + gsl_matrix_long matrix; +} _gsl_matrix_long_const_view; + +typedef const _gsl_matrix_long_const_view gsl_matrix_long_const_view; + +/* Allocation */ + +gsl_matrix_long * +gsl_matrix_long_alloc (const size_t n1, const size_t n2); + +gsl_matrix_long * +gsl_matrix_long_calloc (const size_t n1, const size_t n2); + +gsl_matrix_long * +gsl_matrix_long_alloc_from_block (gsl_block_long * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix_long * +gsl_matrix_long_alloc_from_matrix (gsl_matrix_long * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector_long * +gsl_vector_long_alloc_row_from_matrix (gsl_matrix_long * m, + const size_t i); + +gsl_vector_long * +gsl_vector_long_alloc_col_from_matrix (gsl_matrix_long * m, + const size_t j); + +void gsl_matrix_long_free (gsl_matrix_long * m); + +/* Views */ + +_gsl_matrix_long_view +gsl_matrix_long_submatrix (gsl_matrix_long * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_long_view +gsl_matrix_long_row (gsl_matrix_long * m, const size_t i); + +_gsl_vector_long_view +gsl_matrix_long_column (gsl_matrix_long * m, const size_t j); + +_gsl_vector_long_view +gsl_matrix_long_diagonal (gsl_matrix_long * m); + +_gsl_vector_long_view +gsl_matrix_long_subdiagonal (gsl_matrix_long * m, const size_t k); + +_gsl_vector_long_view +gsl_matrix_long_superdiagonal (gsl_matrix_long * m, const size_t k); + +_gsl_vector_long_view +gsl_matrix_long_subrow (gsl_matrix_long * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_long_view +gsl_matrix_long_subcolumn (gsl_matrix_long * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_long_view +gsl_matrix_long_view_array (long * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_long_view +gsl_matrix_long_view_array_with_tda (long * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_long_view +gsl_matrix_long_view_vector (gsl_vector_long * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_long_view +gsl_matrix_long_view_vector_with_tda (gsl_vector_long * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_long_const_view +gsl_matrix_long_const_submatrix (const gsl_matrix_long * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_long_const_view +gsl_matrix_long_const_row (const gsl_matrix_long * m, + const size_t i); + +_gsl_vector_long_const_view +gsl_matrix_long_const_column (const gsl_matrix_long * m, + const size_t j); + +_gsl_vector_long_const_view +gsl_matrix_long_const_diagonal (const gsl_matrix_long * m); + +_gsl_vector_long_const_view +gsl_matrix_long_const_subdiagonal (const gsl_matrix_long * m, + const size_t k); + +_gsl_vector_long_const_view +gsl_matrix_long_const_superdiagonal (const gsl_matrix_long * m, + const size_t k); + +_gsl_vector_long_const_view +gsl_matrix_long_const_subrow (const gsl_matrix_long * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_long_const_view +gsl_matrix_long_const_subcolumn (const gsl_matrix_long * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_long_const_view +gsl_matrix_long_const_view_array (const long * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_long_const_view +gsl_matrix_long_const_view_array_with_tda (const long * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_long_const_view +gsl_matrix_long_const_view_vector (const gsl_vector_long * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_long_const_view +gsl_matrix_long_const_view_vector_with_tda (const gsl_vector_long * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +long gsl_matrix_long_get(const gsl_matrix_long * m, const size_t i, const size_t j); +void gsl_matrix_long_set(gsl_matrix_long * m, const size_t i, const size_t j, const long x); + +long * gsl_matrix_long_ptr(gsl_matrix_long * m, const size_t i, const size_t j); +const long * gsl_matrix_long_const_ptr(const gsl_matrix_long * m, const size_t i, const size_t j); + +void gsl_matrix_long_set_zero (gsl_matrix_long * m); +void gsl_matrix_long_set_identity (gsl_matrix_long * m); +void gsl_matrix_long_set_all (gsl_matrix_long * m, long x); + +int gsl_matrix_long_fread (FILE * stream, gsl_matrix_long * m) ; +int gsl_matrix_long_fwrite (FILE * stream, const gsl_matrix_long * m) ; +int gsl_matrix_long_fscanf (FILE * stream, gsl_matrix_long * m); +int gsl_matrix_long_fprintf (FILE * stream, const gsl_matrix_long * m, const char * format); + +int gsl_matrix_long_memcpy(gsl_matrix_long * dest, const gsl_matrix_long * src); +int gsl_matrix_long_swap(gsl_matrix_long * m1, gsl_matrix_long * m2); + +int gsl_matrix_long_swap_rows(gsl_matrix_long * m, const size_t i, const size_t j); +int gsl_matrix_long_swap_columns(gsl_matrix_long * m, const size_t i, const size_t j); +int gsl_matrix_long_swap_rowcol(gsl_matrix_long * m, const size_t i, const size_t j); +int gsl_matrix_long_transpose (gsl_matrix_long * m); +int gsl_matrix_long_transpose_memcpy (gsl_matrix_long * dest, const gsl_matrix_long * src); + +long gsl_matrix_long_max (const gsl_matrix_long * m); +long gsl_matrix_long_min (const gsl_matrix_long * m); +void gsl_matrix_long_minmax (const gsl_matrix_long * m, long * min_out, long * max_out); + +void gsl_matrix_long_max_index (const gsl_matrix_long * m, size_t * imax, size_t *jmax); +void gsl_matrix_long_min_index (const gsl_matrix_long * m, size_t * imin, size_t *jmin); +void gsl_matrix_long_minmax_index (const gsl_matrix_long * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_long_isnull (const gsl_matrix_long * m); +int gsl_matrix_long_ispos (const gsl_matrix_long * m); +int gsl_matrix_long_isneg (const gsl_matrix_long * m); +int gsl_matrix_long_isnonneg (const gsl_matrix_long * m); + +int gsl_matrix_long_add (gsl_matrix_long * a, const gsl_matrix_long * b); +int gsl_matrix_long_sub (gsl_matrix_long * a, const gsl_matrix_long * b); +int gsl_matrix_long_mul_elements (gsl_matrix_long * a, const gsl_matrix_long * b); +int gsl_matrix_long_div_elements (gsl_matrix_long * a, const gsl_matrix_long * b); +int gsl_matrix_long_scale (gsl_matrix_long * a, const double x); +int gsl_matrix_long_add_constant (gsl_matrix_long * a, const double x); +int gsl_matrix_long_add_diagonal (gsl_matrix_long * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_long_get_row(gsl_vector_long * v, const gsl_matrix_long * m, const size_t i); +int gsl_matrix_long_get_col(gsl_vector_long * v, const gsl_matrix_long * m, const size_t j); +int gsl_matrix_long_set_row(gsl_matrix_long * m, const size_t i, const gsl_vector_long * v); +int gsl_matrix_long_set_col(gsl_matrix_long * m, const size_t j, const gsl_vector_long * v); + +/* inline functions if you are using GCC */ + +#ifdef HAVE_INLINE +extern inline +long +gsl_matrix_long_get(const gsl_matrix_long * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } +#endif + return m->data[i * m->tda + j] ; +} + +extern inline +void +gsl_matrix_long_set(gsl_matrix_long * m, const size_t i, const size_t j, const long x) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } +#endif + m->data[i * m->tda + j] = x ; +} + +extern inline +long * +gsl_matrix_long_ptr(gsl_matrix_long * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (long *) (m->data + (i * m->tda + j)) ; +} + +extern inline +const long * +gsl_matrix_long_const_ptr(const gsl_matrix_long * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (const long *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_LONG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_matrix_long_double.h b/dtm_release/local/include/gsl/gsl_matrix_long_double.h new file mode 100644 index 0000000000000000000000000000000000000000..2b8ec335a4b958b02473cda9f830fc9321998614 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_matrix_long_double.h @@ -0,0 +1,335 @@ +/* matrix/gsl_matrix_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_LONG_DOUBLE_H__ +#define __GSL_MATRIX_LONG_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_vector_long_double.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + long double * data; + gsl_block_long_double * block; + int owner; +} gsl_matrix_long_double; + +typedef struct +{ + gsl_matrix_long_double matrix; +} _gsl_matrix_long_double_view; + +typedef _gsl_matrix_long_double_view gsl_matrix_long_double_view; + +typedef struct +{ + gsl_matrix_long_double matrix; +} _gsl_matrix_long_double_const_view; + +typedef const _gsl_matrix_long_double_const_view gsl_matrix_long_double_const_view; + +/* Allocation */ + +gsl_matrix_long_double * +gsl_matrix_long_double_alloc (const size_t n1, const size_t n2); + +gsl_matrix_long_double * +gsl_matrix_long_double_calloc (const size_t n1, const size_t n2); + +gsl_matrix_long_double * +gsl_matrix_long_double_alloc_from_block (gsl_block_long_double * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix_long_double * +gsl_matrix_long_double_alloc_from_matrix (gsl_matrix_long_double * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector_long_double * +gsl_vector_long_double_alloc_row_from_matrix (gsl_matrix_long_double * m, + const size_t i); + +gsl_vector_long_double * +gsl_vector_long_double_alloc_col_from_matrix (gsl_matrix_long_double * m, + const size_t j); + +void gsl_matrix_long_double_free (gsl_matrix_long_double * m); + +/* Views */ + +_gsl_matrix_long_double_view +gsl_matrix_long_double_submatrix (gsl_matrix_long_double * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_long_double_view +gsl_matrix_long_double_row (gsl_matrix_long_double * m, const size_t i); + +_gsl_vector_long_double_view +gsl_matrix_long_double_column (gsl_matrix_long_double * m, const size_t j); + +_gsl_vector_long_double_view +gsl_matrix_long_double_diagonal (gsl_matrix_long_double * m); + +_gsl_vector_long_double_view +gsl_matrix_long_double_subdiagonal (gsl_matrix_long_double * m, const size_t k); + +_gsl_vector_long_double_view +gsl_matrix_long_double_superdiagonal (gsl_matrix_long_double * m, const size_t k); + +_gsl_vector_long_double_view +gsl_matrix_long_double_subrow (gsl_matrix_long_double * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_long_double_view +gsl_matrix_long_double_subcolumn (gsl_matrix_long_double * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_long_double_view +gsl_matrix_long_double_view_array (long double * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_long_double_view +gsl_matrix_long_double_view_array_with_tda (long double * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_long_double_view +gsl_matrix_long_double_view_vector (gsl_vector_long_double * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_long_double_view +gsl_matrix_long_double_view_vector_with_tda (gsl_vector_long_double * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_long_double_const_view +gsl_matrix_long_double_const_submatrix (const gsl_matrix_long_double * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_long_double_const_view +gsl_matrix_long_double_const_row (const gsl_matrix_long_double * m, + const size_t i); + +_gsl_vector_long_double_const_view +gsl_matrix_long_double_const_column (const gsl_matrix_long_double * m, + const size_t j); + +_gsl_vector_long_double_const_view +gsl_matrix_long_double_const_diagonal (const gsl_matrix_long_double * m); + +_gsl_vector_long_double_const_view +gsl_matrix_long_double_const_subdiagonal (const gsl_matrix_long_double * m, + const size_t k); + +_gsl_vector_long_double_const_view +gsl_matrix_long_double_const_superdiagonal (const gsl_matrix_long_double * m, + const size_t k); + +_gsl_vector_long_double_const_view +gsl_matrix_long_double_const_subrow (const gsl_matrix_long_double * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_long_double_const_view +gsl_matrix_long_double_const_subcolumn (const gsl_matrix_long_double * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_long_double_const_view +gsl_matrix_long_double_const_view_array (const long double * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_long_double_const_view +gsl_matrix_long_double_const_view_array_with_tda (const long double * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_long_double_const_view +gsl_matrix_long_double_const_view_vector (const gsl_vector_long_double * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_long_double_const_view +gsl_matrix_long_double_const_view_vector_with_tda (const gsl_vector_long_double * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +long double gsl_matrix_long_double_get(const gsl_matrix_long_double * m, const size_t i, const size_t j); +void gsl_matrix_long_double_set(gsl_matrix_long_double * m, const size_t i, const size_t j, const long double x); + +long double * gsl_matrix_long_double_ptr(gsl_matrix_long_double * m, const size_t i, const size_t j); +const long double * gsl_matrix_long_double_const_ptr(const gsl_matrix_long_double * m, const size_t i, const size_t j); + +void gsl_matrix_long_double_set_zero (gsl_matrix_long_double * m); +void gsl_matrix_long_double_set_identity (gsl_matrix_long_double * m); +void gsl_matrix_long_double_set_all (gsl_matrix_long_double * m, long double x); + +int gsl_matrix_long_double_fread (FILE * stream, gsl_matrix_long_double * m) ; +int gsl_matrix_long_double_fwrite (FILE * stream, const gsl_matrix_long_double * m) ; +int gsl_matrix_long_double_fscanf (FILE * stream, gsl_matrix_long_double * m); +int gsl_matrix_long_double_fprintf (FILE * stream, const gsl_matrix_long_double * m, const char * format); + +int gsl_matrix_long_double_memcpy(gsl_matrix_long_double * dest, const gsl_matrix_long_double * src); +int gsl_matrix_long_double_swap(gsl_matrix_long_double * m1, gsl_matrix_long_double * m2); + +int gsl_matrix_long_double_swap_rows(gsl_matrix_long_double * m, const size_t i, const size_t j); +int gsl_matrix_long_double_swap_columns(gsl_matrix_long_double * m, const size_t i, const size_t j); +int gsl_matrix_long_double_swap_rowcol(gsl_matrix_long_double * m, const size_t i, const size_t j); +int gsl_matrix_long_double_transpose (gsl_matrix_long_double * m); +int gsl_matrix_long_double_transpose_memcpy (gsl_matrix_long_double * dest, const gsl_matrix_long_double * src); + +long double gsl_matrix_long_double_max (const gsl_matrix_long_double * m); +long double gsl_matrix_long_double_min (const gsl_matrix_long_double * m); +void gsl_matrix_long_double_minmax (const gsl_matrix_long_double * m, long double * min_out, long double * max_out); + +void gsl_matrix_long_double_max_index (const gsl_matrix_long_double * m, size_t * imax, size_t *jmax); +void gsl_matrix_long_double_min_index (const gsl_matrix_long_double * m, size_t * imin, size_t *jmin); +void gsl_matrix_long_double_minmax_index (const gsl_matrix_long_double * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_long_double_isnull (const gsl_matrix_long_double * m); +int gsl_matrix_long_double_ispos (const gsl_matrix_long_double * m); +int gsl_matrix_long_double_isneg (const gsl_matrix_long_double * m); +int gsl_matrix_long_double_isnonneg (const gsl_matrix_long_double * m); + +int gsl_matrix_long_double_add (gsl_matrix_long_double * a, const gsl_matrix_long_double * b); +int gsl_matrix_long_double_sub (gsl_matrix_long_double * a, const gsl_matrix_long_double * b); +int gsl_matrix_long_double_mul_elements (gsl_matrix_long_double * a, const gsl_matrix_long_double * b); +int gsl_matrix_long_double_div_elements (gsl_matrix_long_double * a, const gsl_matrix_long_double * b); +int gsl_matrix_long_double_scale (gsl_matrix_long_double * a, const double x); +int gsl_matrix_long_double_add_constant (gsl_matrix_long_double * a, const double x); +int gsl_matrix_long_double_add_diagonal (gsl_matrix_long_double * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_long_double_get_row(gsl_vector_long_double * v, const gsl_matrix_long_double * m, const size_t i); +int gsl_matrix_long_double_get_col(gsl_vector_long_double * v, const gsl_matrix_long_double * m, const size_t j); +int gsl_matrix_long_double_set_row(gsl_matrix_long_double * m, const size_t i, const gsl_vector_long_double * v); +int gsl_matrix_long_double_set_col(gsl_matrix_long_double * m, const size_t j, const gsl_vector_long_double * v); + +/* inline functions if you are using GCC */ + +#ifdef HAVE_INLINE +extern inline +long double +gsl_matrix_long_double_get(const gsl_matrix_long_double * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } +#endif + return m->data[i * m->tda + j] ; +} + +extern inline +void +gsl_matrix_long_double_set(gsl_matrix_long_double * m, const size_t i, const size_t j, const long double x) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } +#endif + m->data[i * m->tda + j] = x ; +} + +extern inline +long double * +gsl_matrix_long_double_ptr(gsl_matrix_long_double * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (long double *) (m->data + (i * m->tda + j)) ; +} + +extern inline +const long double * +gsl_matrix_long_double_const_ptr(const gsl_matrix_long_double * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (const long double *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_LONG_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_matrix_short.h b/dtm_release/local/include/gsl/gsl_matrix_short.h new file mode 100644 index 0000000000000000000000000000000000000000..ad4d6ea5164fb3ec82944bfd412ddaa9d44faa7c --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_matrix_short.h @@ -0,0 +1,335 @@ +/* matrix/gsl_matrix_short.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_SHORT_H__ +#define __GSL_MATRIX_SHORT_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_vector_short.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + short * data; + gsl_block_short * block; + int owner; +} gsl_matrix_short; + +typedef struct +{ + gsl_matrix_short matrix; +} _gsl_matrix_short_view; + +typedef _gsl_matrix_short_view gsl_matrix_short_view; + +typedef struct +{ + gsl_matrix_short matrix; +} _gsl_matrix_short_const_view; + +typedef const _gsl_matrix_short_const_view gsl_matrix_short_const_view; + +/* Allocation */ + +gsl_matrix_short * +gsl_matrix_short_alloc (const size_t n1, const size_t n2); + +gsl_matrix_short * +gsl_matrix_short_calloc (const size_t n1, const size_t n2); + +gsl_matrix_short * +gsl_matrix_short_alloc_from_block (gsl_block_short * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix_short * +gsl_matrix_short_alloc_from_matrix (gsl_matrix_short * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector_short * +gsl_vector_short_alloc_row_from_matrix (gsl_matrix_short * m, + const size_t i); + +gsl_vector_short * +gsl_vector_short_alloc_col_from_matrix (gsl_matrix_short * m, + const size_t j); + +void gsl_matrix_short_free (gsl_matrix_short * m); + +/* Views */ + +_gsl_matrix_short_view +gsl_matrix_short_submatrix (gsl_matrix_short * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_short_view +gsl_matrix_short_row (gsl_matrix_short * m, const size_t i); + +_gsl_vector_short_view +gsl_matrix_short_column (gsl_matrix_short * m, const size_t j); + +_gsl_vector_short_view +gsl_matrix_short_diagonal (gsl_matrix_short * m); + +_gsl_vector_short_view +gsl_matrix_short_subdiagonal (gsl_matrix_short * m, const size_t k); + +_gsl_vector_short_view +gsl_matrix_short_superdiagonal (gsl_matrix_short * m, const size_t k); + +_gsl_vector_short_view +gsl_matrix_short_subrow (gsl_matrix_short * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_short_view +gsl_matrix_short_subcolumn (gsl_matrix_short * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_short_view +gsl_matrix_short_view_array (short * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_short_view +gsl_matrix_short_view_array_with_tda (short * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_short_view +gsl_matrix_short_view_vector (gsl_vector_short * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_short_view +gsl_matrix_short_view_vector_with_tda (gsl_vector_short * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_short_const_view +gsl_matrix_short_const_submatrix (const gsl_matrix_short * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_short_const_view +gsl_matrix_short_const_row (const gsl_matrix_short * m, + const size_t i); + +_gsl_vector_short_const_view +gsl_matrix_short_const_column (const gsl_matrix_short * m, + const size_t j); + +_gsl_vector_short_const_view +gsl_matrix_short_const_diagonal (const gsl_matrix_short * m); + +_gsl_vector_short_const_view +gsl_matrix_short_const_subdiagonal (const gsl_matrix_short * m, + const size_t k); + +_gsl_vector_short_const_view +gsl_matrix_short_const_superdiagonal (const gsl_matrix_short * m, + const size_t k); + +_gsl_vector_short_const_view +gsl_matrix_short_const_subrow (const gsl_matrix_short * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_short_const_view +gsl_matrix_short_const_subcolumn (const gsl_matrix_short * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_short_const_view +gsl_matrix_short_const_view_array (const short * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_short_const_view +gsl_matrix_short_const_view_array_with_tda (const short * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_short_const_view +gsl_matrix_short_const_view_vector (const gsl_vector_short * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_short_const_view +gsl_matrix_short_const_view_vector_with_tda (const gsl_vector_short * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +short gsl_matrix_short_get(const gsl_matrix_short * m, const size_t i, const size_t j); +void gsl_matrix_short_set(gsl_matrix_short * m, const size_t i, const size_t j, const short x); + +short * gsl_matrix_short_ptr(gsl_matrix_short * m, const size_t i, const size_t j); +const short * gsl_matrix_short_const_ptr(const gsl_matrix_short * m, const size_t i, const size_t j); + +void gsl_matrix_short_set_zero (gsl_matrix_short * m); +void gsl_matrix_short_set_identity (gsl_matrix_short * m); +void gsl_matrix_short_set_all (gsl_matrix_short * m, short x); + +int gsl_matrix_short_fread (FILE * stream, gsl_matrix_short * m) ; +int gsl_matrix_short_fwrite (FILE * stream, const gsl_matrix_short * m) ; +int gsl_matrix_short_fscanf (FILE * stream, gsl_matrix_short * m); +int gsl_matrix_short_fprintf (FILE * stream, const gsl_matrix_short * m, const char * format); + +int gsl_matrix_short_memcpy(gsl_matrix_short * dest, const gsl_matrix_short * src); +int gsl_matrix_short_swap(gsl_matrix_short * m1, gsl_matrix_short * m2); + +int gsl_matrix_short_swap_rows(gsl_matrix_short * m, const size_t i, const size_t j); +int gsl_matrix_short_swap_columns(gsl_matrix_short * m, const size_t i, const size_t j); +int gsl_matrix_short_swap_rowcol(gsl_matrix_short * m, const size_t i, const size_t j); +int gsl_matrix_short_transpose (gsl_matrix_short * m); +int gsl_matrix_short_transpose_memcpy (gsl_matrix_short * dest, const gsl_matrix_short * src); + +short gsl_matrix_short_max (const gsl_matrix_short * m); +short gsl_matrix_short_min (const gsl_matrix_short * m); +void gsl_matrix_short_minmax (const gsl_matrix_short * m, short * min_out, short * max_out); + +void gsl_matrix_short_max_index (const gsl_matrix_short * m, size_t * imax, size_t *jmax); +void gsl_matrix_short_min_index (const gsl_matrix_short * m, size_t * imin, size_t *jmin); +void gsl_matrix_short_minmax_index (const gsl_matrix_short * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_short_isnull (const gsl_matrix_short * m); +int gsl_matrix_short_ispos (const gsl_matrix_short * m); +int gsl_matrix_short_isneg (const gsl_matrix_short * m); +int gsl_matrix_short_isnonneg (const gsl_matrix_short * m); + +int gsl_matrix_short_add (gsl_matrix_short * a, const gsl_matrix_short * b); +int gsl_matrix_short_sub (gsl_matrix_short * a, const gsl_matrix_short * b); +int gsl_matrix_short_mul_elements (gsl_matrix_short * a, const gsl_matrix_short * b); +int gsl_matrix_short_div_elements (gsl_matrix_short * a, const gsl_matrix_short * b); +int gsl_matrix_short_scale (gsl_matrix_short * a, const double x); +int gsl_matrix_short_add_constant (gsl_matrix_short * a, const double x); +int gsl_matrix_short_add_diagonal (gsl_matrix_short * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_short_get_row(gsl_vector_short * v, const gsl_matrix_short * m, const size_t i); +int gsl_matrix_short_get_col(gsl_vector_short * v, const gsl_matrix_short * m, const size_t j); +int gsl_matrix_short_set_row(gsl_matrix_short * m, const size_t i, const gsl_vector_short * v); +int gsl_matrix_short_set_col(gsl_matrix_short * m, const size_t j, const gsl_vector_short * v); + +/* inline functions if you are using GCC */ + +#ifdef HAVE_INLINE +extern inline +short +gsl_matrix_short_get(const gsl_matrix_short * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } +#endif + return m->data[i * m->tda + j] ; +} + +extern inline +void +gsl_matrix_short_set(gsl_matrix_short * m, const size_t i, const size_t j, const short x) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } +#endif + m->data[i * m->tda + j] = x ; +} + +extern inline +short * +gsl_matrix_short_ptr(gsl_matrix_short * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (short *) (m->data + (i * m->tda + j)) ; +} + +extern inline +const short * +gsl_matrix_short_const_ptr(const gsl_matrix_short * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (const short *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_SHORT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_matrix_uchar.h b/dtm_release/local/include/gsl/gsl_matrix_uchar.h new file mode 100644 index 0000000000000000000000000000000000000000..8515e1402a192f5615d6d9c5a3d1887cbf9dca0a --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_matrix_uchar.h @@ -0,0 +1,335 @@ +/* matrix/gsl_matrix_uchar.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_UCHAR_H__ +#define __GSL_MATRIX_UCHAR_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_vector_uchar.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + unsigned char * data; + gsl_block_uchar * block; + int owner; +} gsl_matrix_uchar; + +typedef struct +{ + gsl_matrix_uchar matrix; +} _gsl_matrix_uchar_view; + +typedef _gsl_matrix_uchar_view gsl_matrix_uchar_view; + +typedef struct +{ + gsl_matrix_uchar matrix; +} _gsl_matrix_uchar_const_view; + +typedef const _gsl_matrix_uchar_const_view gsl_matrix_uchar_const_view; + +/* Allocation */ + +gsl_matrix_uchar * +gsl_matrix_uchar_alloc (const size_t n1, const size_t n2); + +gsl_matrix_uchar * +gsl_matrix_uchar_calloc (const size_t n1, const size_t n2); + +gsl_matrix_uchar * +gsl_matrix_uchar_alloc_from_block (gsl_block_uchar * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix_uchar * +gsl_matrix_uchar_alloc_from_matrix (gsl_matrix_uchar * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector_uchar * +gsl_vector_uchar_alloc_row_from_matrix (gsl_matrix_uchar * m, + const size_t i); + +gsl_vector_uchar * +gsl_vector_uchar_alloc_col_from_matrix (gsl_matrix_uchar * m, + const size_t j); + +void gsl_matrix_uchar_free (gsl_matrix_uchar * m); + +/* Views */ + +_gsl_matrix_uchar_view +gsl_matrix_uchar_submatrix (gsl_matrix_uchar * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_uchar_view +gsl_matrix_uchar_row (gsl_matrix_uchar * m, const size_t i); + +_gsl_vector_uchar_view +gsl_matrix_uchar_column (gsl_matrix_uchar * m, const size_t j); + +_gsl_vector_uchar_view +gsl_matrix_uchar_diagonal (gsl_matrix_uchar * m); + +_gsl_vector_uchar_view +gsl_matrix_uchar_subdiagonal (gsl_matrix_uchar * m, const size_t k); + +_gsl_vector_uchar_view +gsl_matrix_uchar_superdiagonal (gsl_matrix_uchar * m, const size_t k); + +_gsl_vector_uchar_view +gsl_matrix_uchar_subrow (gsl_matrix_uchar * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_uchar_view +gsl_matrix_uchar_subcolumn (gsl_matrix_uchar * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_uchar_view +gsl_matrix_uchar_view_array (unsigned char * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_uchar_view +gsl_matrix_uchar_view_array_with_tda (unsigned char * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_uchar_view +gsl_matrix_uchar_view_vector (gsl_vector_uchar * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_uchar_view +gsl_matrix_uchar_view_vector_with_tda (gsl_vector_uchar * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_uchar_const_view +gsl_matrix_uchar_const_submatrix (const gsl_matrix_uchar * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_uchar_const_view +gsl_matrix_uchar_const_row (const gsl_matrix_uchar * m, + const size_t i); + +_gsl_vector_uchar_const_view +gsl_matrix_uchar_const_column (const gsl_matrix_uchar * m, + const size_t j); + +_gsl_vector_uchar_const_view +gsl_matrix_uchar_const_diagonal (const gsl_matrix_uchar * m); + +_gsl_vector_uchar_const_view +gsl_matrix_uchar_const_subdiagonal (const gsl_matrix_uchar * m, + const size_t k); + +_gsl_vector_uchar_const_view +gsl_matrix_uchar_const_superdiagonal (const gsl_matrix_uchar * m, + const size_t k); + +_gsl_vector_uchar_const_view +gsl_matrix_uchar_const_subrow (const gsl_matrix_uchar * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_uchar_const_view +gsl_matrix_uchar_const_subcolumn (const gsl_matrix_uchar * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_uchar_const_view +gsl_matrix_uchar_const_view_array (const unsigned char * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_uchar_const_view +gsl_matrix_uchar_const_view_array_with_tda (const unsigned char * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_uchar_const_view +gsl_matrix_uchar_const_view_vector (const gsl_vector_uchar * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_uchar_const_view +gsl_matrix_uchar_const_view_vector_with_tda (const gsl_vector_uchar * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +unsigned char gsl_matrix_uchar_get(const gsl_matrix_uchar * m, const size_t i, const size_t j); +void gsl_matrix_uchar_set(gsl_matrix_uchar * m, const size_t i, const size_t j, const unsigned char x); + +unsigned char * gsl_matrix_uchar_ptr(gsl_matrix_uchar * m, const size_t i, const size_t j); +const unsigned char * gsl_matrix_uchar_const_ptr(const gsl_matrix_uchar * m, const size_t i, const size_t j); + +void gsl_matrix_uchar_set_zero (gsl_matrix_uchar * m); +void gsl_matrix_uchar_set_identity (gsl_matrix_uchar * m); +void gsl_matrix_uchar_set_all (gsl_matrix_uchar * m, unsigned char x); + +int gsl_matrix_uchar_fread (FILE * stream, gsl_matrix_uchar * m) ; +int gsl_matrix_uchar_fwrite (FILE * stream, const gsl_matrix_uchar * m) ; +int gsl_matrix_uchar_fscanf (FILE * stream, gsl_matrix_uchar * m); +int gsl_matrix_uchar_fprintf (FILE * stream, const gsl_matrix_uchar * m, const char * format); + +int gsl_matrix_uchar_memcpy(gsl_matrix_uchar * dest, const gsl_matrix_uchar * src); +int gsl_matrix_uchar_swap(gsl_matrix_uchar * m1, gsl_matrix_uchar * m2); + +int gsl_matrix_uchar_swap_rows(gsl_matrix_uchar * m, const size_t i, const size_t j); +int gsl_matrix_uchar_swap_columns(gsl_matrix_uchar * m, const size_t i, const size_t j); +int gsl_matrix_uchar_swap_rowcol(gsl_matrix_uchar * m, const size_t i, const size_t j); +int gsl_matrix_uchar_transpose (gsl_matrix_uchar * m); +int gsl_matrix_uchar_transpose_memcpy (gsl_matrix_uchar * dest, const gsl_matrix_uchar * src); + +unsigned char gsl_matrix_uchar_max (const gsl_matrix_uchar * m); +unsigned char gsl_matrix_uchar_min (const gsl_matrix_uchar * m); +void gsl_matrix_uchar_minmax (const gsl_matrix_uchar * m, unsigned char * min_out, unsigned char * max_out); + +void gsl_matrix_uchar_max_index (const gsl_matrix_uchar * m, size_t * imax, size_t *jmax); +void gsl_matrix_uchar_min_index (const gsl_matrix_uchar * m, size_t * imin, size_t *jmin); +void gsl_matrix_uchar_minmax_index (const gsl_matrix_uchar * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_uchar_isnull (const gsl_matrix_uchar * m); +int gsl_matrix_uchar_ispos (const gsl_matrix_uchar * m); +int gsl_matrix_uchar_isneg (const gsl_matrix_uchar * m); +int gsl_matrix_uchar_isnonneg (const gsl_matrix_uchar * m); + +int gsl_matrix_uchar_add (gsl_matrix_uchar * a, const gsl_matrix_uchar * b); +int gsl_matrix_uchar_sub (gsl_matrix_uchar * a, const gsl_matrix_uchar * b); +int gsl_matrix_uchar_mul_elements (gsl_matrix_uchar * a, const gsl_matrix_uchar * b); +int gsl_matrix_uchar_div_elements (gsl_matrix_uchar * a, const gsl_matrix_uchar * b); +int gsl_matrix_uchar_scale (gsl_matrix_uchar * a, const double x); +int gsl_matrix_uchar_add_constant (gsl_matrix_uchar * a, const double x); +int gsl_matrix_uchar_add_diagonal (gsl_matrix_uchar * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_uchar_get_row(gsl_vector_uchar * v, const gsl_matrix_uchar * m, const size_t i); +int gsl_matrix_uchar_get_col(gsl_vector_uchar * v, const gsl_matrix_uchar * m, const size_t j); +int gsl_matrix_uchar_set_row(gsl_matrix_uchar * m, const size_t i, const gsl_vector_uchar * v); +int gsl_matrix_uchar_set_col(gsl_matrix_uchar * m, const size_t j, const gsl_vector_uchar * v); + +/* inline functions if you are using GCC */ + +#ifdef HAVE_INLINE +extern inline +unsigned char +gsl_matrix_uchar_get(const gsl_matrix_uchar * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } +#endif + return m->data[i * m->tda + j] ; +} + +extern inline +void +gsl_matrix_uchar_set(gsl_matrix_uchar * m, const size_t i, const size_t j, const unsigned char x) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } +#endif + m->data[i * m->tda + j] = x ; +} + +extern inline +unsigned char * +gsl_matrix_uchar_ptr(gsl_matrix_uchar * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (unsigned char *) (m->data + (i * m->tda + j)) ; +} + +extern inline +const unsigned char * +gsl_matrix_uchar_const_ptr(const gsl_matrix_uchar * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (const unsigned char *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_UCHAR_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_matrix_uint.h b/dtm_release/local/include/gsl/gsl_matrix_uint.h new file mode 100644 index 0000000000000000000000000000000000000000..9a5baf6e2db1865cd9a0e246ef1b73a02b9edd25 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_matrix_uint.h @@ -0,0 +1,335 @@ +/* matrix/gsl_matrix_uint.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_UINT_H__ +#define __GSL_MATRIX_UINT_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_vector_uint.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + unsigned int * data; + gsl_block_uint * block; + int owner; +} gsl_matrix_uint; + +typedef struct +{ + gsl_matrix_uint matrix; +} _gsl_matrix_uint_view; + +typedef _gsl_matrix_uint_view gsl_matrix_uint_view; + +typedef struct +{ + gsl_matrix_uint matrix; +} _gsl_matrix_uint_const_view; + +typedef const _gsl_matrix_uint_const_view gsl_matrix_uint_const_view; + +/* Allocation */ + +gsl_matrix_uint * +gsl_matrix_uint_alloc (const size_t n1, const size_t n2); + +gsl_matrix_uint * +gsl_matrix_uint_calloc (const size_t n1, const size_t n2); + +gsl_matrix_uint * +gsl_matrix_uint_alloc_from_block (gsl_block_uint * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix_uint * +gsl_matrix_uint_alloc_from_matrix (gsl_matrix_uint * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector_uint * +gsl_vector_uint_alloc_row_from_matrix (gsl_matrix_uint * m, + const size_t i); + +gsl_vector_uint * +gsl_vector_uint_alloc_col_from_matrix (gsl_matrix_uint * m, + const size_t j); + +void gsl_matrix_uint_free (gsl_matrix_uint * m); + +/* Views */ + +_gsl_matrix_uint_view +gsl_matrix_uint_submatrix (gsl_matrix_uint * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_uint_view +gsl_matrix_uint_row (gsl_matrix_uint * m, const size_t i); + +_gsl_vector_uint_view +gsl_matrix_uint_column (gsl_matrix_uint * m, const size_t j); + +_gsl_vector_uint_view +gsl_matrix_uint_diagonal (gsl_matrix_uint * m); + +_gsl_vector_uint_view +gsl_matrix_uint_subdiagonal (gsl_matrix_uint * m, const size_t k); + +_gsl_vector_uint_view +gsl_matrix_uint_superdiagonal (gsl_matrix_uint * m, const size_t k); + +_gsl_vector_uint_view +gsl_matrix_uint_subrow (gsl_matrix_uint * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_uint_view +gsl_matrix_uint_subcolumn (gsl_matrix_uint * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_uint_view +gsl_matrix_uint_view_array (unsigned int * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_uint_view +gsl_matrix_uint_view_array_with_tda (unsigned int * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_uint_view +gsl_matrix_uint_view_vector (gsl_vector_uint * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_uint_view +gsl_matrix_uint_view_vector_with_tda (gsl_vector_uint * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_uint_const_view +gsl_matrix_uint_const_submatrix (const gsl_matrix_uint * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_uint_const_view +gsl_matrix_uint_const_row (const gsl_matrix_uint * m, + const size_t i); + +_gsl_vector_uint_const_view +gsl_matrix_uint_const_column (const gsl_matrix_uint * m, + const size_t j); + +_gsl_vector_uint_const_view +gsl_matrix_uint_const_diagonal (const gsl_matrix_uint * m); + +_gsl_vector_uint_const_view +gsl_matrix_uint_const_subdiagonal (const gsl_matrix_uint * m, + const size_t k); + +_gsl_vector_uint_const_view +gsl_matrix_uint_const_superdiagonal (const gsl_matrix_uint * m, + const size_t k); + +_gsl_vector_uint_const_view +gsl_matrix_uint_const_subrow (const gsl_matrix_uint * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_uint_const_view +gsl_matrix_uint_const_subcolumn (const gsl_matrix_uint * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_uint_const_view +gsl_matrix_uint_const_view_array (const unsigned int * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_uint_const_view +gsl_matrix_uint_const_view_array_with_tda (const unsigned int * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_uint_const_view +gsl_matrix_uint_const_view_vector (const gsl_vector_uint * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_uint_const_view +gsl_matrix_uint_const_view_vector_with_tda (const gsl_vector_uint * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +unsigned int gsl_matrix_uint_get(const gsl_matrix_uint * m, const size_t i, const size_t j); +void gsl_matrix_uint_set(gsl_matrix_uint * m, const size_t i, const size_t j, const unsigned int x); + +unsigned int * gsl_matrix_uint_ptr(gsl_matrix_uint * m, const size_t i, const size_t j); +const unsigned int * gsl_matrix_uint_const_ptr(const gsl_matrix_uint * m, const size_t i, const size_t j); + +void gsl_matrix_uint_set_zero (gsl_matrix_uint * m); +void gsl_matrix_uint_set_identity (gsl_matrix_uint * m); +void gsl_matrix_uint_set_all (gsl_matrix_uint * m, unsigned int x); + +int gsl_matrix_uint_fread (FILE * stream, gsl_matrix_uint * m) ; +int gsl_matrix_uint_fwrite (FILE * stream, const gsl_matrix_uint * m) ; +int gsl_matrix_uint_fscanf (FILE * stream, gsl_matrix_uint * m); +int gsl_matrix_uint_fprintf (FILE * stream, const gsl_matrix_uint * m, const char * format); + +int gsl_matrix_uint_memcpy(gsl_matrix_uint * dest, const gsl_matrix_uint * src); +int gsl_matrix_uint_swap(gsl_matrix_uint * m1, gsl_matrix_uint * m2); + +int gsl_matrix_uint_swap_rows(gsl_matrix_uint * m, const size_t i, const size_t j); +int gsl_matrix_uint_swap_columns(gsl_matrix_uint * m, const size_t i, const size_t j); +int gsl_matrix_uint_swap_rowcol(gsl_matrix_uint * m, const size_t i, const size_t j); +int gsl_matrix_uint_transpose (gsl_matrix_uint * m); +int gsl_matrix_uint_transpose_memcpy (gsl_matrix_uint * dest, const gsl_matrix_uint * src); + +unsigned int gsl_matrix_uint_max (const gsl_matrix_uint * m); +unsigned int gsl_matrix_uint_min (const gsl_matrix_uint * m); +void gsl_matrix_uint_minmax (const gsl_matrix_uint * m, unsigned int * min_out, unsigned int * max_out); + +void gsl_matrix_uint_max_index (const gsl_matrix_uint * m, size_t * imax, size_t *jmax); +void gsl_matrix_uint_min_index (const gsl_matrix_uint * m, size_t * imin, size_t *jmin); +void gsl_matrix_uint_minmax_index (const gsl_matrix_uint * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_uint_isnull (const gsl_matrix_uint * m); +int gsl_matrix_uint_ispos (const gsl_matrix_uint * m); +int gsl_matrix_uint_isneg (const gsl_matrix_uint * m); +int gsl_matrix_uint_isnonneg (const gsl_matrix_uint * m); + +int gsl_matrix_uint_add (gsl_matrix_uint * a, const gsl_matrix_uint * b); +int gsl_matrix_uint_sub (gsl_matrix_uint * a, const gsl_matrix_uint * b); +int gsl_matrix_uint_mul_elements (gsl_matrix_uint * a, const gsl_matrix_uint * b); +int gsl_matrix_uint_div_elements (gsl_matrix_uint * a, const gsl_matrix_uint * b); +int gsl_matrix_uint_scale (gsl_matrix_uint * a, const double x); +int gsl_matrix_uint_add_constant (gsl_matrix_uint * a, const double x); +int gsl_matrix_uint_add_diagonal (gsl_matrix_uint * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_uint_get_row(gsl_vector_uint * v, const gsl_matrix_uint * m, const size_t i); +int gsl_matrix_uint_get_col(gsl_vector_uint * v, const gsl_matrix_uint * m, const size_t j); +int gsl_matrix_uint_set_row(gsl_matrix_uint * m, const size_t i, const gsl_vector_uint * v); +int gsl_matrix_uint_set_col(gsl_matrix_uint * m, const size_t j, const gsl_vector_uint * v); + +/* inline functions if you are using GCC */ + +#ifdef HAVE_INLINE +extern inline +unsigned int +gsl_matrix_uint_get(const gsl_matrix_uint * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } +#endif + return m->data[i * m->tda + j] ; +} + +extern inline +void +gsl_matrix_uint_set(gsl_matrix_uint * m, const size_t i, const size_t j, const unsigned int x) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } +#endif + m->data[i * m->tda + j] = x ; +} + +extern inline +unsigned int * +gsl_matrix_uint_ptr(gsl_matrix_uint * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (unsigned int *) (m->data + (i * m->tda + j)) ; +} + +extern inline +const unsigned int * +gsl_matrix_uint_const_ptr(const gsl_matrix_uint * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (const unsigned int *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_UINT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_matrix_ulong.h b/dtm_release/local/include/gsl/gsl_matrix_ulong.h new file mode 100644 index 0000000000000000000000000000000000000000..c791514b5d6a3518a407e018362ab84111a6b7d1 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_matrix_ulong.h @@ -0,0 +1,335 @@ +/* matrix/gsl_matrix_ulong.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_ULONG_H__ +#define __GSL_MATRIX_ULONG_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_vector_ulong.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + unsigned long * data; + gsl_block_ulong * block; + int owner; +} gsl_matrix_ulong; + +typedef struct +{ + gsl_matrix_ulong matrix; +} _gsl_matrix_ulong_view; + +typedef _gsl_matrix_ulong_view gsl_matrix_ulong_view; + +typedef struct +{ + gsl_matrix_ulong matrix; +} _gsl_matrix_ulong_const_view; + +typedef const _gsl_matrix_ulong_const_view gsl_matrix_ulong_const_view; + +/* Allocation */ + +gsl_matrix_ulong * +gsl_matrix_ulong_alloc (const size_t n1, const size_t n2); + +gsl_matrix_ulong * +gsl_matrix_ulong_calloc (const size_t n1, const size_t n2); + +gsl_matrix_ulong * +gsl_matrix_ulong_alloc_from_block (gsl_block_ulong * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix_ulong * +gsl_matrix_ulong_alloc_from_matrix (gsl_matrix_ulong * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector_ulong * +gsl_vector_ulong_alloc_row_from_matrix (gsl_matrix_ulong * m, + const size_t i); + +gsl_vector_ulong * +gsl_vector_ulong_alloc_col_from_matrix (gsl_matrix_ulong * m, + const size_t j); + +void gsl_matrix_ulong_free (gsl_matrix_ulong * m); + +/* Views */ + +_gsl_matrix_ulong_view +gsl_matrix_ulong_submatrix (gsl_matrix_ulong * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_ulong_view +gsl_matrix_ulong_row (gsl_matrix_ulong * m, const size_t i); + +_gsl_vector_ulong_view +gsl_matrix_ulong_column (gsl_matrix_ulong * m, const size_t j); + +_gsl_vector_ulong_view +gsl_matrix_ulong_diagonal (gsl_matrix_ulong * m); + +_gsl_vector_ulong_view +gsl_matrix_ulong_subdiagonal (gsl_matrix_ulong * m, const size_t k); + +_gsl_vector_ulong_view +gsl_matrix_ulong_superdiagonal (gsl_matrix_ulong * m, const size_t k); + +_gsl_vector_ulong_view +gsl_matrix_ulong_subrow (gsl_matrix_ulong * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_ulong_view +gsl_matrix_ulong_subcolumn (gsl_matrix_ulong * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_ulong_view +gsl_matrix_ulong_view_array (unsigned long * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_ulong_view +gsl_matrix_ulong_view_array_with_tda (unsigned long * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_ulong_view +gsl_matrix_ulong_view_vector (gsl_vector_ulong * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_ulong_view +gsl_matrix_ulong_view_vector_with_tda (gsl_vector_ulong * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_ulong_const_view +gsl_matrix_ulong_const_submatrix (const gsl_matrix_ulong * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_ulong_const_view +gsl_matrix_ulong_const_row (const gsl_matrix_ulong * m, + const size_t i); + +_gsl_vector_ulong_const_view +gsl_matrix_ulong_const_column (const gsl_matrix_ulong * m, + const size_t j); + +_gsl_vector_ulong_const_view +gsl_matrix_ulong_const_diagonal (const gsl_matrix_ulong * m); + +_gsl_vector_ulong_const_view +gsl_matrix_ulong_const_subdiagonal (const gsl_matrix_ulong * m, + const size_t k); + +_gsl_vector_ulong_const_view +gsl_matrix_ulong_const_superdiagonal (const gsl_matrix_ulong * m, + const size_t k); + +_gsl_vector_ulong_const_view +gsl_matrix_ulong_const_subrow (const gsl_matrix_ulong * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_ulong_const_view +gsl_matrix_ulong_const_subcolumn (const gsl_matrix_ulong * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_ulong_const_view +gsl_matrix_ulong_const_view_array (const unsigned long * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_ulong_const_view +gsl_matrix_ulong_const_view_array_with_tda (const unsigned long * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_ulong_const_view +gsl_matrix_ulong_const_view_vector (const gsl_vector_ulong * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_ulong_const_view +gsl_matrix_ulong_const_view_vector_with_tda (const gsl_vector_ulong * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +unsigned long gsl_matrix_ulong_get(const gsl_matrix_ulong * m, const size_t i, const size_t j); +void gsl_matrix_ulong_set(gsl_matrix_ulong * m, const size_t i, const size_t j, const unsigned long x); + +unsigned long * gsl_matrix_ulong_ptr(gsl_matrix_ulong * m, const size_t i, const size_t j); +const unsigned long * gsl_matrix_ulong_const_ptr(const gsl_matrix_ulong * m, const size_t i, const size_t j); + +void gsl_matrix_ulong_set_zero (gsl_matrix_ulong * m); +void gsl_matrix_ulong_set_identity (gsl_matrix_ulong * m); +void gsl_matrix_ulong_set_all (gsl_matrix_ulong * m, unsigned long x); + +int gsl_matrix_ulong_fread (FILE * stream, gsl_matrix_ulong * m) ; +int gsl_matrix_ulong_fwrite (FILE * stream, const gsl_matrix_ulong * m) ; +int gsl_matrix_ulong_fscanf (FILE * stream, gsl_matrix_ulong * m); +int gsl_matrix_ulong_fprintf (FILE * stream, const gsl_matrix_ulong * m, const char * format); + +int gsl_matrix_ulong_memcpy(gsl_matrix_ulong * dest, const gsl_matrix_ulong * src); +int gsl_matrix_ulong_swap(gsl_matrix_ulong * m1, gsl_matrix_ulong * m2); + +int gsl_matrix_ulong_swap_rows(gsl_matrix_ulong * m, const size_t i, const size_t j); +int gsl_matrix_ulong_swap_columns(gsl_matrix_ulong * m, const size_t i, const size_t j); +int gsl_matrix_ulong_swap_rowcol(gsl_matrix_ulong * m, const size_t i, const size_t j); +int gsl_matrix_ulong_transpose (gsl_matrix_ulong * m); +int gsl_matrix_ulong_transpose_memcpy (gsl_matrix_ulong * dest, const gsl_matrix_ulong * src); + +unsigned long gsl_matrix_ulong_max (const gsl_matrix_ulong * m); +unsigned long gsl_matrix_ulong_min (const gsl_matrix_ulong * m); +void gsl_matrix_ulong_minmax (const gsl_matrix_ulong * m, unsigned long * min_out, unsigned long * max_out); + +void gsl_matrix_ulong_max_index (const gsl_matrix_ulong * m, size_t * imax, size_t *jmax); +void gsl_matrix_ulong_min_index (const gsl_matrix_ulong * m, size_t * imin, size_t *jmin); +void gsl_matrix_ulong_minmax_index (const gsl_matrix_ulong * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_ulong_isnull (const gsl_matrix_ulong * m); +int gsl_matrix_ulong_ispos (const gsl_matrix_ulong * m); +int gsl_matrix_ulong_isneg (const gsl_matrix_ulong * m); +int gsl_matrix_ulong_isnonneg (const gsl_matrix_ulong * m); + +int gsl_matrix_ulong_add (gsl_matrix_ulong * a, const gsl_matrix_ulong * b); +int gsl_matrix_ulong_sub (gsl_matrix_ulong * a, const gsl_matrix_ulong * b); +int gsl_matrix_ulong_mul_elements (gsl_matrix_ulong * a, const gsl_matrix_ulong * b); +int gsl_matrix_ulong_div_elements (gsl_matrix_ulong * a, const gsl_matrix_ulong * b); +int gsl_matrix_ulong_scale (gsl_matrix_ulong * a, const double x); +int gsl_matrix_ulong_add_constant (gsl_matrix_ulong * a, const double x); +int gsl_matrix_ulong_add_diagonal (gsl_matrix_ulong * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_ulong_get_row(gsl_vector_ulong * v, const gsl_matrix_ulong * m, const size_t i); +int gsl_matrix_ulong_get_col(gsl_vector_ulong * v, const gsl_matrix_ulong * m, const size_t j); +int gsl_matrix_ulong_set_row(gsl_matrix_ulong * m, const size_t i, const gsl_vector_ulong * v); +int gsl_matrix_ulong_set_col(gsl_matrix_ulong * m, const size_t j, const gsl_vector_ulong * v); + +/* inline functions if you are using GCC */ + +#ifdef HAVE_INLINE +extern inline +unsigned long +gsl_matrix_ulong_get(const gsl_matrix_ulong * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } +#endif + return m->data[i * m->tda + j] ; +} + +extern inline +void +gsl_matrix_ulong_set(gsl_matrix_ulong * m, const size_t i, const size_t j, const unsigned long x) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } +#endif + m->data[i * m->tda + j] = x ; +} + +extern inline +unsigned long * +gsl_matrix_ulong_ptr(gsl_matrix_ulong * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (unsigned long *) (m->data + (i * m->tda + j)) ; +} + +extern inline +const unsigned long * +gsl_matrix_ulong_const_ptr(const gsl_matrix_ulong * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (const unsigned long *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_ULONG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_matrix_ushort.h b/dtm_release/local/include/gsl/gsl_matrix_ushort.h new file mode 100644 index 0000000000000000000000000000000000000000..25a5dd778f62934020e33e9db0d7252a6c4fc6a8 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_matrix_ushort.h @@ -0,0 +1,335 @@ +/* matrix/gsl_matrix_ushort.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MATRIX_USHORT_H__ +#define __GSL_MATRIX_USHORT_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_vector_ushort.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size1; + size_t size2; + size_t tda; + unsigned short * data; + gsl_block_ushort * block; + int owner; +} gsl_matrix_ushort; + +typedef struct +{ + gsl_matrix_ushort matrix; +} _gsl_matrix_ushort_view; + +typedef _gsl_matrix_ushort_view gsl_matrix_ushort_view; + +typedef struct +{ + gsl_matrix_ushort matrix; +} _gsl_matrix_ushort_const_view; + +typedef const _gsl_matrix_ushort_const_view gsl_matrix_ushort_const_view; + +/* Allocation */ + +gsl_matrix_ushort * +gsl_matrix_ushort_alloc (const size_t n1, const size_t n2); + +gsl_matrix_ushort * +gsl_matrix_ushort_calloc (const size_t n1, const size_t n2); + +gsl_matrix_ushort * +gsl_matrix_ushort_alloc_from_block (gsl_block_ushort * b, + const size_t offset, + const size_t n1, + const size_t n2, + const size_t d2); + +gsl_matrix_ushort * +gsl_matrix_ushort_alloc_from_matrix (gsl_matrix_ushort * m, + const size_t k1, + const size_t k2, + const size_t n1, + const size_t n2); + +gsl_vector_ushort * +gsl_vector_ushort_alloc_row_from_matrix (gsl_matrix_ushort * m, + const size_t i); + +gsl_vector_ushort * +gsl_vector_ushort_alloc_col_from_matrix (gsl_matrix_ushort * m, + const size_t j); + +void gsl_matrix_ushort_free (gsl_matrix_ushort * m); + +/* Views */ + +_gsl_matrix_ushort_view +gsl_matrix_ushort_submatrix (gsl_matrix_ushort * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_ushort_view +gsl_matrix_ushort_row (gsl_matrix_ushort * m, const size_t i); + +_gsl_vector_ushort_view +gsl_matrix_ushort_column (gsl_matrix_ushort * m, const size_t j); + +_gsl_vector_ushort_view +gsl_matrix_ushort_diagonal (gsl_matrix_ushort * m); + +_gsl_vector_ushort_view +gsl_matrix_ushort_subdiagonal (gsl_matrix_ushort * m, const size_t k); + +_gsl_vector_ushort_view +gsl_matrix_ushort_superdiagonal (gsl_matrix_ushort * m, const size_t k); + +_gsl_vector_ushort_view +gsl_matrix_ushort_subrow (gsl_matrix_ushort * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_ushort_view +gsl_matrix_ushort_subcolumn (gsl_matrix_ushort * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_ushort_view +gsl_matrix_ushort_view_array (unsigned short * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_ushort_view +gsl_matrix_ushort_view_array_with_tda (unsigned short * base, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_ushort_view +gsl_matrix_ushort_view_vector (gsl_vector_ushort * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_ushort_view +gsl_matrix_ushort_view_vector_with_tda (gsl_vector_ushort * v, + const size_t n1, + const size_t n2, + const size_t tda); + + +_gsl_matrix_ushort_const_view +gsl_matrix_ushort_const_submatrix (const gsl_matrix_ushort * m, + const size_t i, const size_t j, + const size_t n1, const size_t n2); + +_gsl_vector_ushort_const_view +gsl_matrix_ushort_const_row (const gsl_matrix_ushort * m, + const size_t i); + +_gsl_vector_ushort_const_view +gsl_matrix_ushort_const_column (const gsl_matrix_ushort * m, + const size_t j); + +_gsl_vector_ushort_const_view +gsl_matrix_ushort_const_diagonal (const gsl_matrix_ushort * m); + +_gsl_vector_ushort_const_view +gsl_matrix_ushort_const_subdiagonal (const gsl_matrix_ushort * m, + const size_t k); + +_gsl_vector_ushort_const_view +gsl_matrix_ushort_const_superdiagonal (const gsl_matrix_ushort * m, + const size_t k); + +_gsl_vector_ushort_const_view +gsl_matrix_ushort_const_subrow (const gsl_matrix_ushort * m, const size_t i, + const size_t offset, const size_t n); + +_gsl_vector_ushort_const_view +gsl_matrix_ushort_const_subcolumn (const gsl_matrix_ushort * m, const size_t j, + const size_t offset, const size_t n); + +_gsl_matrix_ushort_const_view +gsl_matrix_ushort_const_view_array (const unsigned short * base, + const size_t n1, + const size_t n2); + +_gsl_matrix_ushort_const_view +gsl_matrix_ushort_const_view_array_with_tda (const unsigned short * base, + const size_t n1, + const size_t n2, + const size_t tda); + +_gsl_matrix_ushort_const_view +gsl_matrix_ushort_const_view_vector (const gsl_vector_ushort * v, + const size_t n1, + const size_t n2); + +_gsl_matrix_ushort_const_view +gsl_matrix_ushort_const_view_vector_with_tda (const gsl_vector_ushort * v, + const size_t n1, + const size_t n2, + const size_t tda); + +/* Operations */ + +unsigned short gsl_matrix_ushort_get(const gsl_matrix_ushort * m, const size_t i, const size_t j); +void gsl_matrix_ushort_set(gsl_matrix_ushort * m, const size_t i, const size_t j, const unsigned short x); + +unsigned short * gsl_matrix_ushort_ptr(gsl_matrix_ushort * m, const size_t i, const size_t j); +const unsigned short * gsl_matrix_ushort_const_ptr(const gsl_matrix_ushort * m, const size_t i, const size_t j); + +void gsl_matrix_ushort_set_zero (gsl_matrix_ushort * m); +void gsl_matrix_ushort_set_identity (gsl_matrix_ushort * m); +void gsl_matrix_ushort_set_all (gsl_matrix_ushort * m, unsigned short x); + +int gsl_matrix_ushort_fread (FILE * stream, gsl_matrix_ushort * m) ; +int gsl_matrix_ushort_fwrite (FILE * stream, const gsl_matrix_ushort * m) ; +int gsl_matrix_ushort_fscanf (FILE * stream, gsl_matrix_ushort * m); +int gsl_matrix_ushort_fprintf (FILE * stream, const gsl_matrix_ushort * m, const char * format); + +int gsl_matrix_ushort_memcpy(gsl_matrix_ushort * dest, const gsl_matrix_ushort * src); +int gsl_matrix_ushort_swap(gsl_matrix_ushort * m1, gsl_matrix_ushort * m2); + +int gsl_matrix_ushort_swap_rows(gsl_matrix_ushort * m, const size_t i, const size_t j); +int gsl_matrix_ushort_swap_columns(gsl_matrix_ushort * m, const size_t i, const size_t j); +int gsl_matrix_ushort_swap_rowcol(gsl_matrix_ushort * m, const size_t i, const size_t j); +int gsl_matrix_ushort_transpose (gsl_matrix_ushort * m); +int gsl_matrix_ushort_transpose_memcpy (gsl_matrix_ushort * dest, const gsl_matrix_ushort * src); + +unsigned short gsl_matrix_ushort_max (const gsl_matrix_ushort * m); +unsigned short gsl_matrix_ushort_min (const gsl_matrix_ushort * m); +void gsl_matrix_ushort_minmax (const gsl_matrix_ushort * m, unsigned short * min_out, unsigned short * max_out); + +void gsl_matrix_ushort_max_index (const gsl_matrix_ushort * m, size_t * imax, size_t *jmax); +void gsl_matrix_ushort_min_index (const gsl_matrix_ushort * m, size_t * imin, size_t *jmin); +void gsl_matrix_ushort_minmax_index (const gsl_matrix_ushort * m, size_t * imin, size_t * jmin, size_t * imax, size_t * jmax); + +int gsl_matrix_ushort_isnull (const gsl_matrix_ushort * m); +int gsl_matrix_ushort_ispos (const gsl_matrix_ushort * m); +int gsl_matrix_ushort_isneg (const gsl_matrix_ushort * m); +int gsl_matrix_ushort_isnonneg (const gsl_matrix_ushort * m); + +int gsl_matrix_ushort_add (gsl_matrix_ushort * a, const gsl_matrix_ushort * b); +int gsl_matrix_ushort_sub (gsl_matrix_ushort * a, const gsl_matrix_ushort * b); +int gsl_matrix_ushort_mul_elements (gsl_matrix_ushort * a, const gsl_matrix_ushort * b); +int gsl_matrix_ushort_div_elements (gsl_matrix_ushort * a, const gsl_matrix_ushort * b); +int gsl_matrix_ushort_scale (gsl_matrix_ushort * a, const double x); +int gsl_matrix_ushort_add_constant (gsl_matrix_ushort * a, const double x); +int gsl_matrix_ushort_add_diagonal (gsl_matrix_ushort * a, const double x); + +/***********************************************************************/ +/* The functions below are obsolete */ +/***********************************************************************/ +int gsl_matrix_ushort_get_row(gsl_vector_ushort * v, const gsl_matrix_ushort * m, const size_t i); +int gsl_matrix_ushort_get_col(gsl_vector_ushort * v, const gsl_matrix_ushort * m, const size_t j); +int gsl_matrix_ushort_set_row(gsl_matrix_ushort * m, const size_t i, const gsl_vector_ushort * v); +int gsl_matrix_ushort_set_col(gsl_matrix_ushort * m, const size_t j, const gsl_vector_ushort * v); + +/* inline functions if you are using GCC */ + +#ifdef HAVE_INLINE +extern inline +unsigned short +gsl_matrix_ushort_get(const gsl_matrix_ushort * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VAL("first index out of range", GSL_EINVAL, 0) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VAL("second index out of range", GSL_EINVAL, 0) ; + } +#endif + return m->data[i * m->tda + j] ; +} + +extern inline +void +gsl_matrix_ushort_set(gsl_matrix_ushort * m, const size_t i, const size_t j, const unsigned short x) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_VOID("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_VOID("second index out of range", GSL_EINVAL) ; + } +#endif + m->data[i * m->tda + j] = x ; +} + +extern inline +unsigned short * +gsl_matrix_ushort_ptr(gsl_matrix_ushort * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (unsigned short *) (m->data + (i * m->tda + j)) ; +} + +extern inline +const unsigned short * +gsl_matrix_ushort_const_ptr(const gsl_matrix_ushort * m, const size_t i, const size_t j) +{ +#if GSL_RANGE_CHECK + if (i >= m->size1) + { + GSL_ERROR_NULL("first index out of range", GSL_EINVAL) ; + } + else if (j >= m->size2) + { + GSL_ERROR_NULL("second index out of range", GSL_EINVAL) ; + } +#endif + return (const unsigned short *) (m->data + (i * m->tda + j)) ; +} + +#endif + +__END_DECLS + +#endif /* __GSL_MATRIX_USHORT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_message.h b/dtm_release/local/include/gsl/gsl_message.h new file mode 100644 index 0000000000000000000000000000000000000000..166ff9ddfc3641a18daccb0c66a1c4dacfac617f --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_message.h @@ -0,0 +1,80 @@ +/* err/gsl_message.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MESSAGE_H__ +#define __GSL_MESSAGE_H__ +#include <gsl/gsl_types.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Provide a general messaging service for client use. Messages can + * be selectively turned off at compile time by defining an + * appropriate message mask. Client code which uses the GSL_MESSAGE() + * macro must provide a mask which is or'ed with the GSL_MESSAGE_MASK. + * + * The messaging service can be completely turned off + * by defining GSL_MESSAGING_OFF. */ + +void gsl_message(const char * message, const char * file, int line, + unsigned int mask); + +#ifndef GSL_MESSAGE_MASK +#define GSL_MESSAGE_MASK 0xffffffffu /* default all messages allowed */ +#endif + +GSL_VAR unsigned int gsl_message_mask ; + +/* Provide some symolic masks for client ease of use. */ + +enum { + GSL_MESSAGE_MASK_A = 1, + GSL_MESSAGE_MASK_B = 2, + GSL_MESSAGE_MASK_C = 4, + GSL_MESSAGE_MASK_D = 8, + GSL_MESSAGE_MASK_E = 16, + GSL_MESSAGE_MASK_F = 32, + GSL_MESSAGE_MASK_G = 64, + GSL_MESSAGE_MASK_H = 128 +} ; + +#ifdef GSL_MESSAGING_OFF /* throw away messages */ +#define GSL_MESSAGE(message, mask) do { } while(0) +#else /* output all messages */ +#define GSL_MESSAGE(message, mask) \ + do { \ + if (mask & GSL_MESSAGE_MASK) \ + gsl_message (message, __FILE__, __LINE__, mask) ; \ + } while (0) +#endif + +__END_DECLS + +#endif /* __GSL_MESSAGE_H__ */ + + diff --git a/dtm_release/local/include/gsl/gsl_min.h b/dtm_release/local/include/gsl/gsl_min.h new file mode 100644 index 0000000000000000000000000000000000000000..b54dc69cbabc1734510065fe3d9f917b0ae44225 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_min.h @@ -0,0 +1,110 @@ +/* min/gsl_min.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MIN_H__ +#define __GSL_MIN_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_math.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct + { + const char *name; + size_t size; + int (*set) (void *state, gsl_function * f, double x_minimum, double f_minimum, double x_lower, double f_lower, double x_upper, double f_upper); + int (*iterate) (void *state, gsl_function * f, double * x_minimum, double * f_minimum, double * x_lower, double * f_lower, double * x_upper, double * f_upper); + } +gsl_min_fminimizer_type; + +typedef struct + { + const gsl_min_fminimizer_type * type; + gsl_function * function ; + double x_minimum ; + double x_lower ; + double x_upper ; + double f_minimum, f_lower, f_upper; + void *state; + } +gsl_min_fminimizer; + +gsl_min_fminimizer * +gsl_min_fminimizer_alloc (const gsl_min_fminimizer_type * T) ; + +void gsl_min_fminimizer_free (gsl_min_fminimizer * s); + +int gsl_min_fminimizer_set (gsl_min_fminimizer * s, + gsl_function * f, double x_minimum, + double x_lower, double x_upper); + +int gsl_min_fminimizer_set_with_values (gsl_min_fminimizer * s, + gsl_function * f, + double x_minimum, double f_minimum, + double x_lower, double f_lower, + double x_upper, double f_upper); + +int gsl_min_fminimizer_iterate (gsl_min_fminimizer * s); + +const char * gsl_min_fminimizer_name (const gsl_min_fminimizer * s); + +double gsl_min_fminimizer_x_minimum (const gsl_min_fminimizer * s); +double gsl_min_fminimizer_x_lower (const gsl_min_fminimizer * s); +double gsl_min_fminimizer_x_upper (const gsl_min_fminimizer * s); +double gsl_min_fminimizer_f_minimum (const gsl_min_fminimizer * s); +double gsl_min_fminimizer_f_lower (const gsl_min_fminimizer * s); +double gsl_min_fminimizer_f_upper (const gsl_min_fminimizer * s); + +/* Deprecated, use x_minimum instead */ +double gsl_min_fminimizer_minimum (const gsl_min_fminimizer * s); + +int +gsl_min_test_interval (double x_lower, double x_upper, double epsabs, double epsrel); + +GSL_VAR const gsl_min_fminimizer_type * gsl_min_fminimizer_goldensection; +GSL_VAR const gsl_min_fminimizer_type * gsl_min_fminimizer_brent; + +typedef +int (*gsl_min_bracketing_function)(gsl_function *f, + double *x_minimum,double * f_minimum, + double *x_lower, double * f_lower, + double *x_upper, double * f_upper, + size_t eval_max); + +int +gsl_min_find_bracket(gsl_function *f,double *x_minimum,double * f_minimum, + double *x_lower, double * f_lower, + double *x_upper, double * f_upper, + size_t eval_max); + +__END_DECLS + +#endif /* __GSL_MIN_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_mode.h b/dtm_release/local/include/gsl/gsl_mode.h new file mode 100644 index 0000000000000000000000000000000000000000..716ef9888dd64c7ae4e46181f7f03a6f1694fb7c --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_mode.h @@ -0,0 +1,87 @@ +/* gsl_mode.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: B. Gough and G. Jungman */ + +#ifndef __GSL_MODE_H__ +#define __GSL_MODE_H__ + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Some functions can take a mode argument. This + * is a rough method to do things like control + * the precision of the algorithm. This mainly + * occurs in special functions, but we figured + * it was ok to have a general facility. + * + * The mode type is 32-bit field. Most of + * the fields are currently unused. Users + * '|' various predefined constants to get + * a desired mode. + */ +typedef unsigned int gsl_mode_t; + + +/* Here are the predefined constants. + * Note that the precision constants + * are special because they are used + * to index arrays, so do not change + * them. The precision information is + * in the low order 3 bits of gsl_mode_t + * (the third bit is currently unused). + */ + +/* Note that "0" is double precision, + * so that you get that by default if + * you forget a flag. + */ +#define GSL_PREC_DOUBLE 0 +#define GSL_PREC_SINGLE 1 +#define GSL_PREC_APPROX 2 + +#ifdef HAVE_INLINE +extern inline unsigned int GSL_MODE_PREC(gsl_mode_t mt); + +extern inline unsigned int +GSL_MODE_PREC(gsl_mode_t mt) +{ return (mt & (unsigned int)7); } +#else /* HAVE_INLINE */ +#define GSL_MODE_PREC(mt) ((mt) & (unsigned int)7) +#endif /* HAVE_INLINE */ + + +/* Here are some predefined generic modes. + */ +#define GSL_MODE_DEFAULT 0 + + +__END_DECLS + +#endif /* __GSL_MODE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_monte.h b/dtm_release/local/include/gsl/gsl_monte.h new file mode 100644 index 0000000000000000000000000000000000000000..4d1d88e254f3fe91222a0c4c9203dd7c3fb1afc9 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_monte.h @@ -0,0 +1,55 @@ +/* monte/gsl_monte.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Michael Booth + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Some things common to all the Monte-Carlo implementations */ +/* Author: MJB */ + +#ifndef __GSL_MONTE_H__ +#define __GSL_MONTE_H__ + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Hide the function type in a typedef so that we can use it in all our + integration functions, and make it easy to change things. +*/ + +struct gsl_monte_function_struct { + double (*f)(double * x_array, size_t dim, void * params); + size_t dim; + void * params; +}; + +typedef struct gsl_monte_function_struct gsl_monte_function; + +#define GSL_MONTE_FN_EVAL(F,x) (*((F)->f))(x,(F)->dim,(F)->params) + + +__END_DECLS + +#endif /* __GSL_MONTE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_monte_miser.h b/dtm_release/local/include/gsl/gsl_monte_miser.h new file mode 100644 index 0000000000000000000000000000000000000000..b05306380fa4eef9038563c59350ed358eb73623 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_monte_miser.h @@ -0,0 +1,83 @@ +/* monte/gsl_monte_miser.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Michael Booth + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: MJB */ + +#ifndef __GSL_MONTE_MISER_H__ +#define __GSL_MONTE_MISER_H__ + +#include <gsl/gsl_rng.h> +#include <gsl/gsl_monte.h> +#include <gsl/gsl_monte_plain.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct { + size_t min_calls; + size_t min_calls_per_bisection; + double dither; + double estimate_frac; + double alpha; + size_t dim; + int estimate_style; + int depth; + int verbose; + double * x; + double * xmid; + double * sigma_l; + double * sigma_r; + double * fmax_l; + double * fmax_r; + double * fmin_l; + double * fmin_r; + double * fsum_l; + double * fsum_r; + double * fsum2_l; + double * fsum2_r; + size_t * hits_l; + size_t * hits_r; +} gsl_monte_miser_state; + +int gsl_monte_miser_integrate(gsl_monte_function * f, + const double xl[], const double xh[], + size_t dim, size_t calls, + gsl_rng *r, + gsl_monte_miser_state* state, + double *result, double *abserr); + +gsl_monte_miser_state* gsl_monte_miser_alloc(size_t dim); + +int gsl_monte_miser_init(gsl_monte_miser_state* state); + +void gsl_monte_miser_free(gsl_monte_miser_state* state); + + +__END_DECLS + +#endif /* __GSL_MONTE_MISER_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_monte_plain.h b/dtm_release/local/include/gsl/gsl_monte_plain.h new file mode 100644 index 0000000000000000000000000000000000000000..c4745b97d42c95f7a2cab1c2ed907b285c5bf08c --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_monte_plain.h @@ -0,0 +1,65 @@ +/* monte/gsl_monte_plain.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Michael Booth + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Plain Monte-Carlo. */ + +/* Author: MJB */ + +#ifndef __GSL_MONTE_PLAIN_H__ +#define __GSL_MONTE_PLAIN_H__ + +#include <stdio.h> +#include <gsl/gsl_monte.h> +#include <gsl/gsl_rng.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct { + size_t dim; + double *x; +} gsl_monte_plain_state; + +int +gsl_monte_plain_integrate (const gsl_monte_function * f, + const double xl[], const double xu[], + const size_t dim, + const size_t calls, + gsl_rng * r, + gsl_monte_plain_state * state, + double *result, double *abserr); + +gsl_monte_plain_state* gsl_monte_plain_alloc(size_t dim); + +int gsl_monte_plain_init(gsl_monte_plain_state* state); + +void gsl_monte_plain_free (gsl_monte_plain_state* state); + +__END_DECLS + +#endif /* __GSL_MONTE_PLAIN_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_monte_vegas.h b/dtm_release/local/include/gsl/gsl_monte_vegas.h new file mode 100644 index 0000000000000000000000000000000000000000..8ecef461bd811e634e716d710199e10096ff7a30 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_monte_vegas.h @@ -0,0 +1,105 @@ +/* monte/gsl_monte_vegas.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Michael Booth + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* header for the gsl "vegas" routines. Mike Booth, May 1998 */ + +#ifndef __GSL_MONTE_VEGAS_H__ +#define __GSL_MONTE_VEGAS_H__ + +#include <gsl/gsl_rng.h> +#include <gsl/gsl_monte.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +enum {GSL_VEGAS_MODE_IMPORTANCE = 1, + GSL_VEGAS_MODE_IMPORTANCE_ONLY = 0, + GSL_VEGAS_MODE_STRATIFIED = -1}; + +typedef struct { + /* grid */ + size_t dim; + size_t bins_max; + unsigned int bins; + unsigned int boxes; /* these are both counted along the axes */ + double * xi; + double * xin; + double * delx; + double * weight; + double vol; + + double * x; + int * bin; + int * box; + + /* distribution */ + double * d; + + /* control variables */ + double alpha; + int mode; + int verbose; + unsigned int iterations; + int stage; + + /* scratch variables preserved between calls to vegas1/2/3 */ + double jac; + double wtd_int_sum; + double sum_wgts; + double chi_sum; + double chisq; + + double result; + double sigma; + + unsigned int it_start; + unsigned int it_num; + unsigned int samples; + unsigned int calls_per_box; + + FILE * ostream; + +} gsl_monte_vegas_state; + +int gsl_monte_vegas_integrate(gsl_monte_function * f, + double xl[], double xu[], + size_t dim, size_t calls, + gsl_rng * r, + gsl_monte_vegas_state *state, + double* result, double* abserr); + +gsl_monte_vegas_state* gsl_monte_vegas_alloc(size_t dim); + +int gsl_monte_vegas_init(gsl_monte_vegas_state* state); + +void gsl_monte_vegas_free (gsl_monte_vegas_state* state); + +__END_DECLS + +#endif /* __GSL_MONTE_VEGAS_H__ */ + diff --git a/dtm_release/local/include/gsl/gsl_multifit.h b/dtm_release/local/include/gsl/gsl_multifit.h new file mode 100644 index 0000000000000000000000000000000000000000..3b40ca5e7c64f0151423989adcc99b0484dd9775 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_multifit.h @@ -0,0 +1,106 @@ +/* multifit/gsl_multifit.h + * + * Copyright (C) 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MULTIFIT_H__ +#define __GSL_MULTIFIT_H__ + +#include <stdlib.h> +#include <gsl/gsl_math.h> +#include <gsl/gsl_vector.h> +#include <gsl/gsl_matrix.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t n; /* number of observations */ + size_t p; /* number of parameters */ + gsl_matrix * A; + gsl_matrix * Q; + gsl_matrix * QSI; + gsl_vector * S; + gsl_vector * t; + gsl_vector * xt; + gsl_vector * D; +} +gsl_multifit_linear_workspace; + +gsl_multifit_linear_workspace * +gsl_multifit_linear_alloc (size_t n, size_t p); + +void +gsl_multifit_linear_free (gsl_multifit_linear_workspace * work); + +int +gsl_multifit_linear (const gsl_matrix * X, + const gsl_vector * y, + gsl_vector * c, + gsl_matrix * cov, + double * chisq, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_linear_svd (const gsl_matrix * X, + const gsl_vector * y, + double tol, + size_t * rank, + gsl_vector * c, + gsl_matrix * cov, + double *chisq, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_wlinear (const gsl_matrix * X, + const gsl_vector * w, + const gsl_vector * y, + gsl_vector * c, + gsl_matrix * cov, + double * chisq, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_wlinear_svd (const gsl_matrix * X, + const gsl_vector * w, + const gsl_vector * y, + double tol, + size_t * rank, + gsl_vector * c, + gsl_matrix * cov, + double *chisq, + gsl_multifit_linear_workspace * work); + +int +gsl_multifit_linear_est (const gsl_vector * x, + const gsl_vector * c, + const gsl_matrix * cov, double *y, double *y_err); + + +__END_DECLS + +#endif /* __GSL_MULTIFIT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_multifit_nlin.h b/dtm_release/local/include/gsl/gsl_multifit_nlin.h new file mode 100644 index 0000000000000000000000000000000000000000..96bd014005615ef87951a48a73b678d75d69b5a9 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_multifit_nlin.h @@ -0,0 +1,172 @@ +/* multifit_nlin/gsl_multifit_nlin.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MULTIFIT_NLIN_H__ +#define __GSL_MULTIFIT_NLIN_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_math.h> +#include <gsl/gsl_vector.h> +#include <gsl/gsl_matrix.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_multifit_gradient (const gsl_matrix * J, const gsl_vector * f, + gsl_vector * g); + +int gsl_multifit_covar (const gsl_matrix * J, double epsrel, gsl_matrix * covar); + + +/* Definition of vector-valued functions with parameters based on gsl_vector */ + +struct gsl_multifit_function_struct +{ + int (* f) (const gsl_vector * x, void * params, gsl_vector * f); + size_t n; /* number of functions */ + size_t p; /* number of independent variables */ + void * params; +}; + +typedef struct gsl_multifit_function_struct gsl_multifit_function ; + +#define GSL_MULTIFIT_FN_EVAL(F,x,y) (*((F)->f))(x,(F)->params,(y)) + +typedef struct + { + const char *name; + size_t size; + int (*alloc) (void *state, size_t n, size_t p); + int (*set) (void *state, gsl_multifit_function * function, gsl_vector * x, gsl_vector * f, gsl_vector * dx); + int (*iterate) (void *state, gsl_multifit_function * function, gsl_vector * x, gsl_vector * f, gsl_vector * dx); + void (*free) (void *state); + } +gsl_multifit_fsolver_type; + +typedef struct + { + const gsl_multifit_fsolver_type * type; + gsl_multifit_function * function ; + gsl_vector * x ; + gsl_vector * f ; + gsl_vector * dx ; + void *state; + } +gsl_multifit_fsolver; + +gsl_multifit_fsolver * +gsl_multifit_fsolver_alloc (const gsl_multifit_fsolver_type * T, + size_t n, size_t p); + +void gsl_multifit_fsolver_free (gsl_multifit_fsolver * s); + +int gsl_multifit_fsolver_set (gsl_multifit_fsolver * s, + gsl_multifit_function * f, + const gsl_vector * x); + +int gsl_multifit_fsolver_iterate (gsl_multifit_fsolver * s); + +const char * gsl_multifit_fsolver_name (const gsl_multifit_fsolver * s); +gsl_vector * gsl_multifit_fsolver_position (const gsl_multifit_fsolver * s); + +/* Definition of vector-valued functions and gradient with parameters + based on gsl_vector */ + +struct gsl_multifit_function_fdf_struct +{ + int (* f) (const gsl_vector * x, void * params, gsl_vector * f); + int (* df) (const gsl_vector * x, void * params, gsl_matrix * df); + int (* fdf) (const gsl_vector * x, void * params, gsl_vector * f, gsl_matrix *df); + size_t n; /* number of functions */ + size_t p; /* number of independent variables */ + void * params; +}; + +typedef struct gsl_multifit_function_fdf_struct gsl_multifit_function_fdf ; + +#define GSL_MULTIFIT_FN_EVAL_F(F,x,y) ((*((F)->f))(x,(F)->params,(y))) +#define GSL_MULTIFIT_FN_EVAL_DF(F,x,dy) ((*((F)->df))(x,(F)->params,(dy))) +#define GSL_MULTIFIT_FN_EVAL_F_DF(F,x,y,dy) ((*((F)->fdf))(x,(F)->params,(y),(dy))) + +typedef struct + { + const char *name; + size_t size; + int (*alloc) (void *state, size_t n, size_t p); + int (*set) (void *state, gsl_multifit_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx); + int (*iterate) (void *state, gsl_multifit_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx); + void (*free) (void *state); + } +gsl_multifit_fdfsolver_type; + +typedef struct + { + const gsl_multifit_fdfsolver_type * type; + gsl_multifit_function_fdf * fdf ; + gsl_vector * x; + gsl_vector * f; + gsl_matrix * J; + gsl_vector * dx; + void *state; + } +gsl_multifit_fdfsolver; + + +gsl_multifit_fdfsolver * +gsl_multifit_fdfsolver_alloc (const gsl_multifit_fdfsolver_type * T, + size_t n, size_t p); + +int +gsl_multifit_fdfsolver_set (gsl_multifit_fdfsolver * s, + gsl_multifit_function_fdf * fdf, + const gsl_vector * x); + +int +gsl_multifit_fdfsolver_iterate (gsl_multifit_fdfsolver * s); + +void +gsl_multifit_fdfsolver_free (gsl_multifit_fdfsolver * s); + +const char * gsl_multifit_fdfsolver_name (const gsl_multifit_fdfsolver * s); +gsl_vector * gsl_multifit_fdfsolver_position (const gsl_multifit_fdfsolver * s); + +int gsl_multifit_test_delta (const gsl_vector * dx, const gsl_vector * x, + double epsabs, double epsrel); + +int gsl_multifit_test_gradient (const gsl_vector * g, double epsabs); + +/* extern const gsl_multifit_fsolver_type * gsl_multifit_fsolver_gradient; */ + +GSL_VAR const gsl_multifit_fdfsolver_type * gsl_multifit_fdfsolver_lmder; +GSL_VAR const gsl_multifit_fdfsolver_type * gsl_multifit_fdfsolver_lmsder; + + +__END_DECLS + +#endif /* __GSL_MULTIFIT_NLIN_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_multimin.h b/dtm_release/local/include/gsl/gsl_multimin.h new file mode 100644 index 0000000000000000000000000000000000000000..c77840060e72f809ae312709bc120e8203458b25 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_multimin.h @@ -0,0 +1,225 @@ +/* multimin/gsl_multimin.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Fabrice Rossi + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Modified by Tuomo Keskitalo to include fminimizer and + Nelder Mead related lines */ + +#ifndef __GSL_MULTIMIN_H__ +#define __GSL_MULTIMIN_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_math.h> +#include <gsl/gsl_vector.h> +#include <gsl/gsl_matrix.h> +#include <gsl/gsl_min.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Definition of an arbitrary real-valued function with gsl_vector input and */ +/* parameters */ +struct gsl_multimin_function_struct +{ + double (* f) (const gsl_vector * x, void * params); + size_t n; + void * params; +}; + +typedef struct gsl_multimin_function_struct gsl_multimin_function; + +#define GSL_MULTIMIN_FN_EVAL(F,x) (*((F)->f))(x,(F)->params) + +/* Definition of an arbitrary differentiable real-valued function */ +/* with gsl_vector input and parameters */ +struct gsl_multimin_function_fdf_struct +{ + double (* f) (const gsl_vector * x, void * params); + void (* df) (const gsl_vector * x, void * params,gsl_vector * df); + void (* fdf) (const gsl_vector * x, void * params,double *f,gsl_vector * df); + size_t n; + void * params; +}; + +typedef struct gsl_multimin_function_fdf_struct gsl_multimin_function_fdf; + +#define GSL_MULTIMIN_FN_EVAL_F(F,x) (*((F)->f))(x,(F)->params) +#define GSL_MULTIMIN_FN_EVAL_DF(F,x,g) (*((F)->df))(x,(F)->params,(g)) +#define GSL_MULTIMIN_FN_EVAL_F_DF(F,x,y,g) (*((F)->fdf))(x,(F)->params,(y),(g)) + +int gsl_multimin_diff (const gsl_multimin_function * f, + const gsl_vector * x, gsl_vector * g); + +/* minimization of non-differentiable functions */ + +typedef struct +{ + const char *name; + size_t size; + int (*alloc) (void *state, size_t n); + int (*set) (void *state, gsl_multimin_function * f, + const gsl_vector * x, + double * size, + const gsl_vector * step_size); + int (*iterate) (void *state, gsl_multimin_function * f, + gsl_vector * x, + double * size, + double * fval); + void (*free) (void *state); +} +gsl_multimin_fminimizer_type; + +typedef struct +{ + /* multi dimensional part */ + const gsl_multimin_fminimizer_type *type; + gsl_multimin_function *f; + + double fval; + gsl_vector * x; + + double size; + + void *state; +} +gsl_multimin_fminimizer; + +gsl_multimin_fminimizer * +gsl_multimin_fminimizer_alloc(const gsl_multimin_fminimizer_type *T, + size_t n); + +int +gsl_multimin_fminimizer_set (gsl_multimin_fminimizer * s, + gsl_multimin_function * f, + const gsl_vector * x, + const gsl_vector * step_size); + +void +gsl_multimin_fminimizer_free(gsl_multimin_fminimizer *s); + +const char * +gsl_multimin_fminimizer_name (const gsl_multimin_fminimizer * s); + +int +gsl_multimin_fminimizer_iterate(gsl_multimin_fminimizer *s); + +gsl_vector * +gsl_multimin_fminimizer_x (const gsl_multimin_fminimizer * s); + +double +gsl_multimin_fminimizer_minimum (const gsl_multimin_fminimizer * s); + +double +gsl_multimin_fminimizer_size (const gsl_multimin_fminimizer * s); + +/* Convergence test functions */ + +int +gsl_multimin_test_gradient(const gsl_vector * g,double epsabs); + +int +gsl_multimin_test_size(const double size ,double epsabs); + +/* minimisation of differentiable functions */ + +typedef struct +{ + const char *name; + size_t size; + int (*alloc) (void *state, size_t n); + int (*set) (void *state, gsl_multimin_function_fdf * fdf, + const gsl_vector * x, double * f, + gsl_vector * gradient, double step_size, double tol); + int (*iterate) (void *state,gsl_multimin_function_fdf * fdf, + gsl_vector * x, double * f, + gsl_vector * gradient, gsl_vector * dx); + int (*restart) (void *state); + void (*free) (void *state); +} +gsl_multimin_fdfminimizer_type; + +typedef struct +{ + /* multi dimensional part */ + const gsl_multimin_fdfminimizer_type *type; + gsl_multimin_function_fdf *fdf; + + double f; + gsl_vector * x; + gsl_vector * gradient; + gsl_vector * dx; + + void *state; +} +gsl_multimin_fdfminimizer; + +gsl_multimin_fdfminimizer * +gsl_multimin_fdfminimizer_alloc(const gsl_multimin_fdfminimizer_type *T, + size_t n); + +int +gsl_multimin_fdfminimizer_set (gsl_multimin_fdfminimizer * s, + gsl_multimin_function_fdf *fdf, + const gsl_vector * x, + double step_size, double tol); + +void +gsl_multimin_fdfminimizer_free(gsl_multimin_fdfminimizer *s); + +const char * +gsl_multimin_fdfminimizer_name (const gsl_multimin_fdfminimizer * s); + +int +gsl_multimin_fdfminimizer_iterate(gsl_multimin_fdfminimizer *s); + +int +gsl_multimin_fdfminimizer_restart(gsl_multimin_fdfminimizer *s); + +gsl_vector * +gsl_multimin_fdfminimizer_x (gsl_multimin_fdfminimizer * s); + +gsl_vector * +gsl_multimin_fdfminimizer_dx (gsl_multimin_fdfminimizer * s); + +gsl_vector * +gsl_multimin_fdfminimizer_gradient (gsl_multimin_fdfminimizer * s); + +double +gsl_multimin_fdfminimizer_minimum (gsl_multimin_fdfminimizer * s); + +GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_steepest_descent; +GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_conjugate_pr; +GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_conjugate_fr; +GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_vector_bfgs; +GSL_VAR const gsl_multimin_fdfminimizer_type *gsl_multimin_fdfminimizer_vector_bfgs2; +GSL_VAR const gsl_multimin_fminimizer_type *gsl_multimin_fminimizer_nmsimplex; + + +__END_DECLS + +#endif /* __GSL_MULTIMIN_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_multiroots.h b/dtm_release/local/include/gsl/gsl_multiroots.h new file mode 100644 index 0000000000000000000000000000000000000000..7f661547f8e39063fc6a55fba434b7c6dc0470b2 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_multiroots.h @@ -0,0 +1,177 @@ +/* multiroots/gsl_multiroots.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_MULTIROOTS_H__ +#define __GSL_MULTIROOTS_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_math.h> +#include <gsl/gsl_vector.h> +#include <gsl/gsl_matrix.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Definition of vector-valued functions with parameters based on gsl_vector */ + +struct gsl_multiroot_function_struct +{ + int (* f) (const gsl_vector * x, void * params, gsl_vector * f); + size_t n; + void * params; +}; + +typedef struct gsl_multiroot_function_struct gsl_multiroot_function ; + +#define GSL_MULTIROOT_FN_EVAL(F,x,y) (*((F)->f))(x,(F)->params,(y)) + +int gsl_multiroot_fdjacobian (gsl_multiroot_function * F, + const gsl_vector * x, const gsl_vector * f, + double epsrel, gsl_matrix * jacobian); + + +typedef struct + { + const char *name; + size_t size; + int (*alloc) (void *state, size_t n); + int (*set) (void *state, gsl_multiroot_function * function, gsl_vector * x, gsl_vector * f, gsl_vector * dx); + int (*iterate) (void *state, gsl_multiroot_function * function, gsl_vector * x, gsl_vector * f, gsl_vector * dx); + void (*free) (void *state); + } +gsl_multiroot_fsolver_type; + +typedef struct + { + const gsl_multiroot_fsolver_type * type; + gsl_multiroot_function * function ; + gsl_vector * x ; + gsl_vector * f ; + gsl_vector * dx ; + void *state; + } +gsl_multiroot_fsolver; + +gsl_multiroot_fsolver * +gsl_multiroot_fsolver_alloc (const gsl_multiroot_fsolver_type * T, + size_t n); + +void gsl_multiroot_fsolver_free (gsl_multiroot_fsolver * s); + +int gsl_multiroot_fsolver_set (gsl_multiroot_fsolver * s, + gsl_multiroot_function * f, + const gsl_vector * x); + +int gsl_multiroot_fsolver_iterate (gsl_multiroot_fsolver * s); + +const char * gsl_multiroot_fsolver_name (const gsl_multiroot_fsolver * s); +gsl_vector * gsl_multiroot_fsolver_root (const gsl_multiroot_fsolver * s); +gsl_vector * gsl_multiroot_fsolver_dx (const gsl_multiroot_fsolver * s); +gsl_vector * gsl_multiroot_fsolver_f (const gsl_multiroot_fsolver * s); + +/* Definition of vector-valued functions and gradient with parameters + based on gsl_vector */ + +struct gsl_multiroot_function_fdf_struct +{ + int (* f) (const gsl_vector * x, void * params, gsl_vector * f); + int (* df) (const gsl_vector * x, void * params, gsl_matrix * df); + int (* fdf) (const gsl_vector * x, void * params, gsl_vector * f, gsl_matrix *df); + size_t n; + void * params; +}; + +typedef struct gsl_multiroot_function_fdf_struct gsl_multiroot_function_fdf ; + +#define GSL_MULTIROOT_FN_EVAL_F(F,x,y) ((*((F)->f))(x,(F)->params,(y))) +#define GSL_MULTIROOT_FN_EVAL_DF(F,x,dy) ((*((F)->df))(x,(F)->params,(dy))) +#define GSL_MULTIROOT_FN_EVAL_F_DF(F,x,y,dy) ((*((F)->fdf))(x,(F)->params,(y),(dy))) + +typedef struct + { + const char *name; + size_t size; + int (*alloc) (void *state, size_t n); + int (*set) (void *state, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx); + int (*iterate) (void *state, gsl_multiroot_function_fdf * fdf, gsl_vector * x, gsl_vector * f, gsl_matrix * J, gsl_vector * dx); + void (*free) (void *state); + } +gsl_multiroot_fdfsolver_type; + +typedef struct + { + const gsl_multiroot_fdfsolver_type * type; + gsl_multiroot_function_fdf * fdf ; + gsl_vector * x; + gsl_vector * f; + gsl_matrix * J; + gsl_vector * dx; + void *state; + } +gsl_multiroot_fdfsolver; + +gsl_multiroot_fdfsolver * +gsl_multiroot_fdfsolver_alloc (const gsl_multiroot_fdfsolver_type * T, + size_t n); + +int +gsl_multiroot_fdfsolver_set (gsl_multiroot_fdfsolver * s, + gsl_multiroot_function_fdf * fdf, + const gsl_vector * x); + +int +gsl_multiroot_fdfsolver_iterate (gsl_multiroot_fdfsolver * s); + +void +gsl_multiroot_fdfsolver_free (gsl_multiroot_fdfsolver * s); + +const char * gsl_multiroot_fdfsolver_name (const gsl_multiroot_fdfsolver * s); +gsl_vector * gsl_multiroot_fdfsolver_root (const gsl_multiroot_fdfsolver * s); +gsl_vector * gsl_multiroot_fdfsolver_dx (const gsl_multiroot_fdfsolver * s); +gsl_vector * gsl_multiroot_fdfsolver_f (const gsl_multiroot_fdfsolver * s); + +int gsl_multiroot_test_delta (const gsl_vector * dx, const gsl_vector * x, + double epsabs, double epsrel); + +int gsl_multiroot_test_residual (const gsl_vector * f, double epsabs); + +GSL_VAR const gsl_multiroot_fsolver_type * gsl_multiroot_fsolver_dnewton; +GSL_VAR const gsl_multiroot_fsolver_type * gsl_multiroot_fsolver_broyden; +GSL_VAR const gsl_multiroot_fsolver_type * gsl_multiroot_fsolver_hybrid; +GSL_VAR const gsl_multiroot_fsolver_type * gsl_multiroot_fsolver_hybrids; + +GSL_VAR const gsl_multiroot_fdfsolver_type * gsl_multiroot_fdfsolver_newton; +GSL_VAR const gsl_multiroot_fdfsolver_type * gsl_multiroot_fdfsolver_gnewton; +GSL_VAR const gsl_multiroot_fdfsolver_type * gsl_multiroot_fdfsolver_hybridj; +GSL_VAR const gsl_multiroot_fdfsolver_type * gsl_multiroot_fdfsolver_hybridsj; + + +__END_DECLS + +#endif /* __GSL_MULTIROOTS_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_nan.h b/dtm_release/local/include/gsl/gsl_nan.h new file mode 100644 index 0000000000000000000000000000000000000000..23c23df1c9f3ffe53e3b09ea648a4299ebd09489 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_nan.h @@ -0,0 +1,45 @@ +/* gsl_nan.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_NAN_H__ +#define __GSL_NAN_H__ + +#ifdef INFINITY +# define GSL_POSINF INFINITY +# define GSL_NEGINF (-INFINITY) +#elif defined(HUGE_VAL) +# define GSL_POSINF HUGE_VAL +# define GSL_NEGINF (-HUGE_VAL) +#else +# define GSL_POSINF (gsl_posinf()) +# define GSL_NEGINF (gsl_neginf()) +#endif + +#ifdef NAN +# define GSL_NAN NAN +#elif defined(INFINITY) +# define GSL_NAN (INFINITY/INFINITY) +#else +# define GSL_NAN (gsl_nan()) +#endif + +#define GSL_POSZERO (+0) +#define GSL_NEGZERO (-0) + +#endif /* __GSL_NAN_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_ntuple.h b/dtm_release/local/include/gsl/gsl_ntuple.h new file mode 100644 index 0000000000000000000000000000000000000000..90d8a26c313f7745d76dee2c99c08112ad215889 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_ntuple.h @@ -0,0 +1,82 @@ +/* histogram/ntuple.h + * + * Copyright (C) 2000 Simone Piccardi + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* Jan/2001 Modified by Brian Gough. Minor changes for GSL */ + +#ifndef __GSL_NTUPLE_H__ +#define __GSL_NTUPLE_H__ + +#include <stdlib.h> +#include <stdio.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_histogram.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct { + FILE * file; + void * ntuple_data; + size_t size; +} gsl_ntuple; + +typedef struct { + int (* function) (void * ntuple_data, void * params); + void * params; +} gsl_ntuple_select_fn; + +typedef struct { + double (* function) (void * ntuple_data, void * params); + void * params; +} gsl_ntuple_value_fn; + +gsl_ntuple * +gsl_ntuple_open (char * filename, void * ntuple_data, size_t size); + +gsl_ntuple * +gsl_ntuple_create (char * filename, void * ntuple_data, size_t size); + +int gsl_ntuple_write (gsl_ntuple * ntuple); +int gsl_ntuple_read (gsl_ntuple * ntuple); + +int gsl_ntuple_bookdata (gsl_ntuple * ntuple); /* synonym for write */ + +int gsl_ntuple_project (gsl_histogram * h, gsl_ntuple * ntuple, + gsl_ntuple_value_fn *value_func, + gsl_ntuple_select_fn *select_func); + +int gsl_ntuple_close (gsl_ntuple * ntuple); + +__END_DECLS + +#endif /* __GSL_NTUPLE_H__ */ + + + + diff --git a/dtm_release/local/include/gsl/gsl_odeiv.h b/dtm_release/local/include/gsl/gsl_odeiv.h new file mode 100644 index 0000000000000000000000000000000000000000..f1aec17dac3dd0e6187dd013e24141aefa059741 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_odeiv.h @@ -0,0 +1,230 @@ +/* ode-initval/gsl_odeiv.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman + */ +#ifndef __GSL_ODEIV_H__ +#define __GSL_ODEIV_H__ + +#include <stdio.h> +#include <stdlib.h> +#include <gsl/gsl_types.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Description of a system of ODEs. + * + * y' = f(t,y) = dydt(t, y) + * + * The system is specified by giving the right-hand-side + * of the equation and possibly a jacobian function. + * + * Some methods require the jacobian function, which calculates + * the matrix dfdy and the vector dfdt. The matrix dfdy conforms + * to the GSL standard, being a continuous range of floating point + * values, in row-order. + * + * As with GSL function objects, user-supplied parameter + * data is also present. + */ + +typedef struct +{ + int (* function) (double t, const double y[], double dydt[], void * params); + int (* jacobian) (double t, const double y[], double * dfdy, double dfdt[], void * params); + size_t dimension; + void * params; +} +gsl_odeiv_system; + +#define GSL_ODEIV_FN_EVAL(S,t,y,f) (*((S)->function))(t,y,f,(S)->params) +#define GSL_ODEIV_JA_EVAL(S,t,y,dfdy,dfdt) (*((S)->jacobian))(t,y,dfdy,dfdt,(S)->params) + + +/* General stepper object. + * + * Opaque object for stepping an ODE system from t to t+h. + * In general the object has some state which facilitates + * iterating the stepping operation. + */ + +typedef struct +{ + const char * name; + int can_use_dydt_in; + int gives_exact_dydt_out; + void * (*alloc) (size_t dim); + int (*apply) (void * state, size_t dim, double t, double h, double y[], double yerr[], const double dydt_in[], double dydt_out[], const gsl_odeiv_system * dydt); + int (*reset) (void * state, size_t dim); + unsigned int (*order) (void * state); + void (*free) (void * state); +} +gsl_odeiv_step_type; + +typedef struct { + const gsl_odeiv_step_type * type; + size_t dimension; + void * state; +} +gsl_odeiv_step; + + +/* Available stepper types. + * + * rk2 : embedded 2nd(3rd) Runge-Kutta + * rk4 : 4th order (classical) Runge-Kutta + * rkck : embedded 4th(5th) Runge-Kutta, Cash-Karp + * rk8pd : embedded 8th(9th) Runge-Kutta, Prince-Dormand + * rk2imp : implicit 2nd order Runge-Kutta at Gaussian points + * rk4imp : implicit 4th order Runge-Kutta at Gaussian points + * gear1 : M=1 implicit Gear method + * gear2 : M=2 implicit Gear method + */ + +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rk2; +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rk4; +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rkf45; +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rkck; +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rk8pd; +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rk2imp; +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rk2simp; +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_rk4imp; +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_bsimp; +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_gear1; +GSL_VAR const gsl_odeiv_step_type *gsl_odeiv_step_gear2; + + +/* Constructor for specialized stepper objects. + */ +gsl_odeiv_step * gsl_odeiv_step_alloc(const gsl_odeiv_step_type * T, size_t dim); +int gsl_odeiv_step_reset(gsl_odeiv_step * s); +void gsl_odeiv_step_free(gsl_odeiv_step * s); + +/* General stepper object methods. + */ +const char * gsl_odeiv_step_name(const gsl_odeiv_step *); +unsigned int gsl_odeiv_step_order(const gsl_odeiv_step * s); + +int gsl_odeiv_step_apply(gsl_odeiv_step *, double t, double h, double y[], double yerr[], const double dydt_in[], double dydt_out[], const gsl_odeiv_system * dydt); + +/* General step size control object. + * + * The hadjust() method controls the adjustment of + * step size given the result of a step and the error. + * Valid hadjust() methods must return one of the codes below. + * + * The general data can be used by specializations + * to store state and control their heuristics. + */ + +typedef struct +{ + const char * name; + void * (*alloc) (void); + int (*init) (void * state, double eps_abs, double eps_rel, double a_y, double a_dydt); + int (*hadjust) (void * state, size_t dim, unsigned int ord, const double y[], const double yerr[], const double yp[], double * h); + void (*free) (void * state); +} +gsl_odeiv_control_type; + +typedef struct +{ + const gsl_odeiv_control_type * type; + void * state; +} +gsl_odeiv_control; + +/* Possible return values for an hadjust() evolution method. + */ +#define GSL_ODEIV_HADJ_INC 1 /* step was increased */ +#define GSL_ODEIV_HADJ_NIL 0 /* step unchanged */ +#define GSL_ODEIV_HADJ_DEC (-1) /* step decreased */ + +gsl_odeiv_control * gsl_odeiv_control_alloc(const gsl_odeiv_control_type * T); +int gsl_odeiv_control_init(gsl_odeiv_control * c, double eps_abs, double eps_rel, double a_y, double a_dydt); +void gsl_odeiv_control_free(gsl_odeiv_control * c); +int gsl_odeiv_control_hadjust (gsl_odeiv_control * c, gsl_odeiv_step * s, const double y[], const double yerr[], const double dydt[], double * h); +const char * gsl_odeiv_control_name(const gsl_odeiv_control * c); + +/* Available control object constructors. + * + * The standard control object is a four parameter heuristic + * defined as follows: + * D0 = eps_abs + eps_rel * (a_y |y| + a_dydt h |y'|) + * D1 = |yerr| + * q = consistency order of method (q=4 for 4(5) embedded RK) + * S = safety factor (0.9 say) + * + * / (D0/D1)^(1/(q+1)) D0 >= D1 + * h_NEW = S h_OLD * | + * \ (D0/D1)^(1/q) D0 < D1 + * + * This encompasses all the standard error scaling methods. + * + * The y method is the standard method with a_y=1, a_dydt=0. + * The yp method is the standard method with a_y=0, a_dydt=1. + */ + +gsl_odeiv_control * gsl_odeiv_control_standard_new(double eps_abs, double eps_rel, double a_y, double a_dydt); +gsl_odeiv_control * gsl_odeiv_control_y_new(double eps_abs, double eps_rel); +gsl_odeiv_control * gsl_odeiv_control_yp_new(double eps_abs, double eps_rel); + +/* This controller computes errors using different absolute errors for + * each component + * + * D0 = eps_abs * scale_abs[i] + eps_rel * (a_y |y| + a_dydt h |y'|) + */ +gsl_odeiv_control * gsl_odeiv_control_scaled_new(double eps_abs, double eps_rel, double a_y, double a_dydt, const double scale_abs[], size_t dim); + +/* General evolution object. + */ +typedef struct { + size_t dimension; + double * y0; + double * yerr; + double * dydt_in; + double * dydt_out; + double last_step; + unsigned long int count; + unsigned long int failed_steps; +} +gsl_odeiv_evolve; + +/* Evolution object methods. + */ +gsl_odeiv_evolve * gsl_odeiv_evolve_alloc(size_t dim); +int gsl_odeiv_evolve_apply(gsl_odeiv_evolve *, gsl_odeiv_control * con, gsl_odeiv_step * step, const gsl_odeiv_system * dydt, double * t, double t1, double * h, double y[]); +int gsl_odeiv_evolve_reset(gsl_odeiv_evolve *); +void gsl_odeiv_evolve_free(gsl_odeiv_evolve *); + + +__END_DECLS + +#endif /* __GSL_ODEIV_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permutation.h b/dtm_release/local/include/gsl/gsl_permutation.h new file mode 100644 index 0000000000000000000000000000000000000000..9f20a2bc3bfd0414c582393f959a3e696eaa1e9a --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permutation.h @@ -0,0 +1,98 @@ +/* permutation/gsl_permutation.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTATION_H__ +#define __GSL_PERMUTATION_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_permutation_struct +{ + size_t size; + size_t *data; +}; + +typedef struct gsl_permutation_struct gsl_permutation; + +gsl_permutation *gsl_permutation_alloc (const size_t n); +gsl_permutation *gsl_permutation_calloc (const size_t n); +void gsl_permutation_init (gsl_permutation * p); +void gsl_permutation_free (gsl_permutation * p); +int gsl_permutation_memcpy (gsl_permutation * dest, const gsl_permutation * src); + +int gsl_permutation_fread (FILE * stream, gsl_permutation * p); +int gsl_permutation_fwrite (FILE * stream, const gsl_permutation * p); +int gsl_permutation_fscanf (FILE * stream, gsl_permutation * p); +int gsl_permutation_fprintf (FILE * stream, const gsl_permutation * p, const char *format); + +size_t gsl_permutation_size (const gsl_permutation * p); +size_t * gsl_permutation_data (const gsl_permutation * p); + +size_t gsl_permutation_get (const gsl_permutation * p, const size_t i); +int gsl_permutation_swap (gsl_permutation * p, const size_t i, const size_t j); + +int gsl_permutation_valid (gsl_permutation * p); +void gsl_permutation_reverse (gsl_permutation * p); +int gsl_permutation_inverse (gsl_permutation * inv, const gsl_permutation * p); +int gsl_permutation_next (gsl_permutation * p); +int gsl_permutation_prev (gsl_permutation * p); +int gsl_permutation_mul (gsl_permutation * p, const gsl_permutation * pa, const gsl_permutation * pb); + +int gsl_permutation_linear_to_canonical (gsl_permutation * q, const gsl_permutation * p); +int gsl_permutation_canonical_to_linear (gsl_permutation * p, const gsl_permutation * q); + +size_t gsl_permutation_inversions (const gsl_permutation * p); +size_t gsl_permutation_linear_cycles (const gsl_permutation * p); +size_t gsl_permutation_canonical_cycles (const gsl_permutation * q); + +#ifdef HAVE_INLINE + +extern inline +size_t +gsl_permutation_get (const gsl_permutation * p, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= p->size) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return p->data[i]; +} + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_PERMUTATION_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute.h b/dtm_release/local/include/gsl/gsl_permute.h new file mode 100644 index 0000000000000000000000000000000000000000..23f09a6f077f4d6d9be5a7c489f2424e1e2a813d --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute.h @@ -0,0 +1,24 @@ +#ifndef __GSL_PERMUTE_H__ +#define __GSL_PERMUTE_H__ + +#include <gsl/gsl_permute_complex_long_double.h> +#include <gsl/gsl_permute_complex_double.h> +#include <gsl/gsl_permute_complex_float.h> + +#include <gsl/gsl_permute_long_double.h> +#include <gsl/gsl_permute_double.h> +#include <gsl/gsl_permute_float.h> + +#include <gsl/gsl_permute_ulong.h> +#include <gsl/gsl_permute_long.h> + +#include <gsl/gsl_permute_uint.h> +#include <gsl/gsl_permute_int.h> + +#include <gsl/gsl_permute_ushort.h> +#include <gsl/gsl_permute_short.h> + +#include <gsl/gsl_permute_uchar.h> +#include <gsl/gsl_permute_char.h> + +#endif /* __GSL_PERMUTE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_char.h b/dtm_release/local/include/gsl/gsl_permute_char.h new file mode 100644 index 0000000000000000000000000000000000000000..bf2ebb1dc7019835d814ce6a02dfc9d7e9ca2331 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_char.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_char.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_CHAR_H__ +#define __GSL_PERMUTE_CHAR_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_char (const size_t * p, char * data, const size_t stride, const size_t n); +int gsl_permute_char_inverse (const size_t * p, char * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_CHAR_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_complex_double.h b/dtm_release/local/include/gsl/gsl_permute_complex_double.h new file mode 100644 index 0000000000000000000000000000000000000000..c20442b6a747cac82ee5cd8c781dc273240b0766 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_complex_double.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_complex_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_COMPLEX_DOUBLE_H__ +#define __GSL_PERMUTE_COMPLEX_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_complex.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_complex (const size_t * p, double * data, const size_t stride, const size_t n); +int gsl_permute_complex_inverse (const size_t * p, double * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_COMPLEX_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_complex_float.h b/dtm_release/local/include/gsl/gsl_permute_complex_float.h new file mode 100644 index 0000000000000000000000000000000000000000..65ee0fe4487254befa9adbaf12258f54a0b35db1 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_complex_float.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_complex_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_COMPLEX_FLOAT_H__ +#define __GSL_PERMUTE_COMPLEX_FLOAT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_complex.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_complex_float (const size_t * p, float * data, const size_t stride, const size_t n); +int gsl_permute_complex_float_inverse (const size_t * p, float * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_COMPLEX_FLOAT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_complex_long_double.h b/dtm_release/local/include/gsl/gsl_permute_complex_long_double.h new file mode 100644 index 0000000000000000000000000000000000000000..4849b15df514a07c8fbfc93c4bda45914f0ce558 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_complex_long_double.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_complex_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_COMPLEX_LONG_DOUBLE_H__ +#define __GSL_PERMUTE_COMPLEX_LONG_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_complex.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_complex_long_double (const size_t * p, long double * data, const size_t stride, const size_t n); +int gsl_permute_complex_long_double_inverse (const size_t * p, long double * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_COMPLEX_LONG_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_double.h b/dtm_release/local/include/gsl/gsl_permute_double.h new file mode 100644 index 0000000000000000000000000000000000000000..58be1812b23a609c5308c872d9ea2fece1ed28bd --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_double.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_DOUBLE_H__ +#define __GSL_PERMUTE_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute (const size_t * p, double * data, const size_t stride, const size_t n); +int gsl_permute_inverse (const size_t * p, double * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_float.h b/dtm_release/local/include/gsl/gsl_permute_float.h new file mode 100644 index 0000000000000000000000000000000000000000..bc79bd5a432b82adc7be6593d0dd45ad3d1cbfdb --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_float.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_FLOAT_H__ +#define __GSL_PERMUTE_FLOAT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_float (const size_t * p, float * data, const size_t stride, const size_t n); +int gsl_permute_float_inverse (const size_t * p, float * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_FLOAT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_int.h b/dtm_release/local/include/gsl/gsl_permute_int.h new file mode 100644 index 0000000000000000000000000000000000000000..b6ff5008068ee7b8dd2ac3b78d00d7deecaf3d8d --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_int.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_int.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_INT_H__ +#define __GSL_PERMUTE_INT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_int (const size_t * p, int * data, const size_t stride, const size_t n); +int gsl_permute_int_inverse (const size_t * p, int * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_INT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_long.h b/dtm_release/local/include/gsl/gsl_permute_long.h new file mode 100644 index 0000000000000000000000000000000000000000..383294c5a8d1a82d87e37c0c5ac3f38c297b803c --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_long.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_long.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_LONG_H__ +#define __GSL_PERMUTE_LONG_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_long (const size_t * p, long * data, const size_t stride, const size_t n); +int gsl_permute_long_inverse (const size_t * p, long * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_LONG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_long_double.h b/dtm_release/local/include/gsl/gsl_permute_long_double.h new file mode 100644 index 0000000000000000000000000000000000000000..f58e1cd8adc891efdee7a6afc99cc1ec9041dee6 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_long_double.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_LONG_DOUBLE_H__ +#define __GSL_PERMUTE_LONG_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_long_double (const size_t * p, long double * data, const size_t stride, const size_t n); +int gsl_permute_long_double_inverse (const size_t * p, long double * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_LONG_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_short.h b/dtm_release/local/include/gsl/gsl_permute_short.h new file mode 100644 index 0000000000000000000000000000000000000000..39cf55d674ba25408307b932caf2cd2514aaceb6 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_short.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_short.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_SHORT_H__ +#define __GSL_PERMUTE_SHORT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_short (const size_t * p, short * data, const size_t stride, const size_t n); +int gsl_permute_short_inverse (const size_t * p, short * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_SHORT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_uchar.h b/dtm_release/local/include/gsl/gsl_permute_uchar.h new file mode 100644 index 0000000000000000000000000000000000000000..54bb401b0d85e7c934d68d5db0543e8eae0ce781 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_uchar.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_uchar.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_UCHAR_H__ +#define __GSL_PERMUTE_UCHAR_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_uchar (const size_t * p, unsigned char * data, const size_t stride, const size_t n); +int gsl_permute_uchar_inverse (const size_t * p, unsigned char * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_UCHAR_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_uint.h b/dtm_release/local/include/gsl/gsl_permute_uint.h new file mode 100644 index 0000000000000000000000000000000000000000..8915b7bc64699e26c5f4cbeb165d5affa1d4ec10 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_uint.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_uint.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_UINT_H__ +#define __GSL_PERMUTE_UINT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_uint (const size_t * p, unsigned int * data, const size_t stride, const size_t n); +int gsl_permute_uint_inverse (const size_t * p, unsigned int * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_UINT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_ulong.h b/dtm_release/local/include/gsl/gsl_permute_ulong.h new file mode 100644 index 0000000000000000000000000000000000000000..0084c506caf12736ae2c3b24aa10f2aea686782d --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_ulong.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_ulong.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_ULONG_H__ +#define __GSL_PERMUTE_ULONG_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_ulong (const size_t * p, unsigned long * data, const size_t stride, const size_t n); +int gsl_permute_ulong_inverse (const size_t * p, unsigned long * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_ULONG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_ushort.h b/dtm_release/local/include/gsl/gsl_permute_ushort.h new file mode 100644 index 0000000000000000000000000000000000000000..eff079a57749b052123eb00dd4fca9a74b7ea0ef --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_ushort.h @@ -0,0 +1,44 @@ +/* permutation/gsl_permute_ushort.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_USHORT_H__ +#define __GSL_PERMUTE_USHORT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_ushort (const size_t * p, unsigned short * data, const size_t stride, const size_t n); +int gsl_permute_ushort_inverse (const size_t * p, unsigned short * data, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_PERMUTE_USHORT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_vector.h b/dtm_release/local/include/gsl/gsl_permute_vector.h new file mode 100644 index 0000000000000000000000000000000000000000..4369e49554f488a849d585f6db6c172eedbaccff --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_vector.h @@ -0,0 +1,24 @@ +#ifndef __GSL_PERMUTE_VECTOR_H__ +#define __GSL_PERMUTE_VECTOR_H__ + +#include <gsl/gsl_permute_vector_complex_long_double.h> +#include <gsl/gsl_permute_vector_complex_double.h> +#include <gsl/gsl_permute_vector_complex_float.h> + +#include <gsl/gsl_permute_vector_long_double.h> +#include <gsl/gsl_permute_vector_double.h> +#include <gsl/gsl_permute_vector_float.h> + +#include <gsl/gsl_permute_vector_ulong.h> +#include <gsl/gsl_permute_vector_long.h> + +#include <gsl/gsl_permute_vector_uint.h> +#include <gsl/gsl_permute_vector_int.h> + +#include <gsl/gsl_permute_vector_ushort.h> +#include <gsl/gsl_permute_vector_short.h> + +#include <gsl/gsl_permute_vector_uchar.h> +#include <gsl/gsl_permute_vector_char.h> + +#endif /* __GSL_PERMUTE_VECTOR_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_vector_char.h b/dtm_release/local/include/gsl/gsl_permute_vector_char.h new file mode 100644 index 0000000000000000000000000000000000000000..15278eddf4e9c49613653cfa6305ecde69e99277 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_vector_char.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_char.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_CHAR_H__ +#define __GSL_PERMUTE_VECTOR_CHAR_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_char.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_char (const gsl_permutation * p, gsl_vector_char * v); +int gsl_permute_vector_char_inverse (const gsl_permutation * p, gsl_vector_char * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_CHAR_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_vector_complex_double.h b/dtm_release/local/include/gsl/gsl_permute_vector_complex_double.h new file mode 100644 index 0000000000000000000000000000000000000000..60558e21aebbd04ae488a3377faa0d4735ff5883 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_vector_complex_double.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_complex_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_COMPLEX_DOUBLE_H__ +#define __GSL_PERMUTE_VECTOR_COMPLEX_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_complex_double.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_complex (const gsl_permutation * p, gsl_vector_complex * v); +int gsl_permute_vector_complex_inverse (const gsl_permutation * p, gsl_vector_complex * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_COMPLEX_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_vector_complex_float.h b/dtm_release/local/include/gsl/gsl_permute_vector_complex_float.h new file mode 100644 index 0000000000000000000000000000000000000000..b08696bc6cd3484fba465483aa69e9c470182acb --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_vector_complex_float.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_complex_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_COMPLEX_FLOAT_H__ +#define __GSL_PERMUTE_VECTOR_COMPLEX_FLOAT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_complex_float.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_complex_float (const gsl_permutation * p, gsl_vector_complex_float * v); +int gsl_permute_vector_complex_float_inverse (const gsl_permutation * p, gsl_vector_complex_float * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_COMPLEX_FLOAT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_vector_complex_long_double.h b/dtm_release/local/include/gsl/gsl_permute_vector_complex_long_double.h new file mode 100644 index 0000000000000000000000000000000000000000..c19ac25d8357787f014d2036573aa8dffcd39817 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_vector_complex_long_double.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_complex_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_COMPLEX_LONG_DOUBLE_H__ +#define __GSL_PERMUTE_VECTOR_COMPLEX_LONG_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_complex_long_double.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_complex_long_double (const gsl_permutation * p, gsl_vector_complex_long_double * v); +int gsl_permute_vector_complex_long_double_inverse (const gsl_permutation * p, gsl_vector_complex_long_double * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_COMPLEX_LONG_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_vector_double.h b/dtm_release/local/include/gsl/gsl_permute_vector_double.h new file mode 100644 index 0000000000000000000000000000000000000000..65f61674478b67a7d01deb5e5123b6dc152e8e5d --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_vector_double.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_DOUBLE_H__ +#define __GSL_PERMUTE_VECTOR_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_double.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector (const gsl_permutation * p, gsl_vector * v); +int gsl_permute_vector_inverse (const gsl_permutation * p, gsl_vector * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_vector_float.h b/dtm_release/local/include/gsl/gsl_permute_vector_float.h new file mode 100644 index 0000000000000000000000000000000000000000..bdd9d1a635ec1fea5be8defb8cc907e2aeb3b852 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_vector_float.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_FLOAT_H__ +#define __GSL_PERMUTE_VECTOR_FLOAT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_float.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_float (const gsl_permutation * p, gsl_vector_float * v); +int gsl_permute_vector_float_inverse (const gsl_permutation * p, gsl_vector_float * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_FLOAT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_vector_int.h b/dtm_release/local/include/gsl/gsl_permute_vector_int.h new file mode 100644 index 0000000000000000000000000000000000000000..3316d504f73664308006e51fccc25c9f1af22ced --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_vector_int.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_int.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_INT_H__ +#define __GSL_PERMUTE_VECTOR_INT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_int.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_int (const gsl_permutation * p, gsl_vector_int * v); +int gsl_permute_vector_int_inverse (const gsl_permutation * p, gsl_vector_int * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_INT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_vector_long.h b/dtm_release/local/include/gsl/gsl_permute_vector_long.h new file mode 100644 index 0000000000000000000000000000000000000000..291f949b3f43d32490f46ce1d8b13cc454d8035d --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_vector_long.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_long.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_LONG_H__ +#define __GSL_PERMUTE_VECTOR_LONG_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_long.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_long (const gsl_permutation * p, gsl_vector_long * v); +int gsl_permute_vector_long_inverse (const gsl_permutation * p, gsl_vector_long * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_LONG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_vector_long_double.h b/dtm_release/local/include/gsl/gsl_permute_vector_long_double.h new file mode 100644 index 0000000000000000000000000000000000000000..a6b02960a2c468f36156735dfa45fa55c5387437 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_vector_long_double.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_LONG_DOUBLE_H__ +#define __GSL_PERMUTE_VECTOR_LONG_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_long_double.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_long_double (const gsl_permutation * p, gsl_vector_long_double * v); +int gsl_permute_vector_long_double_inverse (const gsl_permutation * p, gsl_vector_long_double * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_LONG_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_vector_short.h b/dtm_release/local/include/gsl/gsl_permute_vector_short.h new file mode 100644 index 0000000000000000000000000000000000000000..cd0dd6b4b79cdedc79b4024dcce8cfec30105d9a --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_vector_short.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_short.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_SHORT_H__ +#define __GSL_PERMUTE_VECTOR_SHORT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_short.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_short (const gsl_permutation * p, gsl_vector_short * v); +int gsl_permute_vector_short_inverse (const gsl_permutation * p, gsl_vector_short * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_SHORT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_vector_uchar.h b/dtm_release/local/include/gsl/gsl_permute_vector_uchar.h new file mode 100644 index 0000000000000000000000000000000000000000..df069a0a65eb8f55d028d13231ec81a9b95ebbf3 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_vector_uchar.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_uchar.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_UCHAR_H__ +#define __GSL_PERMUTE_VECTOR_UCHAR_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_uchar.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_uchar (const gsl_permutation * p, gsl_vector_uchar * v); +int gsl_permute_vector_uchar_inverse (const gsl_permutation * p, gsl_vector_uchar * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_UCHAR_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_vector_uint.h b/dtm_release/local/include/gsl/gsl_permute_vector_uint.h new file mode 100644 index 0000000000000000000000000000000000000000..ee5218af95953027740d31365b77e6a1af6a741b --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_vector_uint.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_uint.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_UINT_H__ +#define __GSL_PERMUTE_VECTOR_UINT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_uint.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_uint (const gsl_permutation * p, gsl_vector_uint * v); +int gsl_permute_vector_uint_inverse (const gsl_permutation * p, gsl_vector_uint * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_UINT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_vector_ulong.h b/dtm_release/local/include/gsl/gsl_permute_vector_ulong.h new file mode 100644 index 0000000000000000000000000000000000000000..e536d9a8ac5f0904ad421b75d742006bf7af6f86 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_vector_ulong.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_ulong.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_ULONG_H__ +#define __GSL_PERMUTE_VECTOR_ULONG_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_ulong.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_ulong (const gsl_permutation * p, gsl_vector_ulong * v); +int gsl_permute_vector_ulong_inverse (const gsl_permutation * p, gsl_vector_ulong * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_ULONG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_permute_vector_ushort.h b/dtm_release/local/include/gsl/gsl_permute_vector_ushort.h new file mode 100644 index 0000000000000000000000000000000000000000..7533ba00a0925983bc0b1a9c9f59e3c7d6ab0410 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_permute_vector_ushort.h @@ -0,0 +1,45 @@ +/* permutation/gsl_permute_vector_ushort.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_PERMUTE_VECTOR_USHORT_H__ +#define __GSL_PERMUTE_VECTOR_USHORT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_ushort.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_permute_vector_ushort (const gsl_permutation * p, gsl_vector_ushort * v); +int gsl_permute_vector_ushort_inverse (const gsl_permutation * p, gsl_vector_ushort * v); + +__END_DECLS + +#endif /* __GSL_PERMUTE_VECTOR_USHORT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_poly.h b/dtm_release/local/include/gsl/gsl_poly.h new file mode 100644 index 0000000000000000000000000000000000000000..2032a8fe65a41523a470c2727e94f4047033f02c --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_poly.h @@ -0,0 +1,134 @@ +/* poly/gsl_poly.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_POLY_H__ +#define __GSL_POLY_H__ + +#include <stdlib.h> +#include <gsl/gsl_complex.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Evaluate polynomial + * + * c[0] + c[1] x + c[2] x^2 + ... + c[len-1] x^(len-1) + * + * exceptions: none + */ +double gsl_poly_eval(const double c[], const int len, const double x); + + +#ifdef HAVE_INLINE +extern inline +double +gsl_poly_eval(const double c[], const int len, const double x) +{ + int i; + double ans = c[len-1]; + for(i=len-1; i>0; i--) ans = c[i-1] + x * ans; + return ans; +} +#endif /* HAVE_INLINE */ + +/* Work with divided-difference polynomials, Abramowitz & Stegun 25.2.26 */ + +int +gsl_poly_dd_init (double dd[], const double x[], const double y[], + size_t size); + +double +gsl_poly_dd_eval (const double dd[], const double xa[], const size_t size, const double x); + +#ifdef HAVE_INLINE +extern inline +double +gsl_poly_dd_eval(const double dd[], const double xa[], const size_t size, const double x) +{ + size_t i; + double y = dd[size - 1]; + for (i = size - 1; i--;) y = dd[i] + (x - xa[i]) * y; + return y; +} +#endif /* HAVE_INLINE */ + + +int +gsl_poly_dd_taylor (double c[], double xp, + const double dd[], const double x[], size_t size, + double w[]); + +/* Solve for real or complex roots of the standard quadratic equation, + * returning the number of real roots. + * + * Roots are returned ordered. + */ +int gsl_poly_solve_quadratic (double a, double b, double c, + double * x0, double * x1); + +int +gsl_poly_complex_solve_quadratic (double a, double b, double c, + gsl_complex * z0, gsl_complex * z1); + + +/* Solve for real roots of the cubic equation + * x^3 + a x^2 + b x + c = 0, returning the + * number of real roots. + * + * Roots are returned ordered. + */ +int gsl_poly_solve_cubic (double a, double b, double c, + double * x0, double * x1, double * x2); + +int +gsl_poly_complex_solve_cubic (double a, double b, double c, + gsl_complex * z0, gsl_complex * z1, + gsl_complex * z2); + + +/* Solve for the complex roots of a general real polynomial */ + +typedef struct +{ + size_t nc ; + double * matrix ; +} +gsl_poly_complex_workspace ; + +gsl_poly_complex_workspace * gsl_poly_complex_workspace_alloc (size_t n); +void gsl_poly_complex_workspace_free (gsl_poly_complex_workspace * w); + +int +gsl_poly_complex_solve (const double * a, size_t n, + gsl_poly_complex_workspace * w, + gsl_complex_packed_ptr z); + +__END_DECLS + +#endif /* __GSL_POLY_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_pow_int.h b/dtm_release/local/include/gsl/gsl_pow_int.h new file mode 100644 index 0000000000000000000000000000000000000000..a4f2ba3ea60ac8a2bb5ba74c69a04d09d25058fb --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_pow_int.h @@ -0,0 +1,68 @@ +/* gsl_pow_int.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_POW_INT_H__ +#define __GSL_POW_INT_H__ + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +#ifdef HAVE_INLINE +extern inline double gsl_pow_2(const double x); +extern inline double gsl_pow_3(const double x); +extern inline double gsl_pow_4(const double x); +extern inline double gsl_pow_5(const double x); +extern inline double gsl_pow_6(const double x); +extern inline double gsl_pow_7(const double x); +extern inline double gsl_pow_8(const double x); +extern inline double gsl_pow_9(const double x); + +extern inline double gsl_pow_2(const double x) { return x*x; } +extern inline double gsl_pow_3(const double x) { return x*x*x; } +extern inline double gsl_pow_4(const double x) { double x2 = x*x; return x2*x2; } +extern inline double gsl_pow_5(const double x) { double x2 = x*x; return x2*x2*x; } +extern inline double gsl_pow_6(const double x) { double x2 = x*x; return x2*x2*x2; } +extern inline double gsl_pow_7(const double x) { double x3 = x*x*x; return x3*x3*x; } +extern inline double gsl_pow_8(const double x) { double x2 = x*x; double x4 = x2*x2; return x4*x4; } +extern inline double gsl_pow_9(const double x) { double x3 = x*x*x; return x3*x3*x3; } +#else +double gsl_pow_2(const double x); +double gsl_pow_3(const double x); +double gsl_pow_4(const double x); +double gsl_pow_5(const double x); +double gsl_pow_6(const double x); +double gsl_pow_7(const double x); +double gsl_pow_8(const double x); +double gsl_pow_9(const double x); +#endif + +double gsl_pow_int(double x, int n); + +__END_DECLS + +#endif /* __GSL_POW_INT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_precision.h b/dtm_release/local/include/gsl/gsl_precision.h new file mode 100644 index 0000000000000000000000000000000000000000..97a204eadfb6eef132f95638ce64852912327b81 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_precision.h @@ -0,0 +1,66 @@ +/* gsl_precision.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: B. Gough and G. Jungman */ + +#ifndef __GSL_PRECISION_H__ +#define __GSL_PRECISION_H__ +#include <gsl/gsl_types.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* A type for the precision indicator. + * This is mainly for pedagogy. + */ +typedef unsigned int gsl_prec_t; + + +/* The number of precision types. + * Remember that precision-mode + * can index an array. + */ +#define _GSL_PREC_T_NUM 3 + + +/* Arrays containing derived + * precision constants for the + * different precision levels. + */ +GSL_VAR const double gsl_prec_eps[]; +GSL_VAR const double gsl_prec_sqrt_eps[]; +GSL_VAR const double gsl_prec_root3_eps[]; +GSL_VAR const double gsl_prec_root4_eps[]; +GSL_VAR const double gsl_prec_root5_eps[]; +GSL_VAR const double gsl_prec_root6_eps[]; + + +__END_DECLS + +#endif /* __GSL_PRECISION_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_qrng.h b/dtm_release/local/include/gsl/gsl_qrng.h new file mode 100644 index 0000000000000000000000000000000000000000..889799a79628b4bd434eb6714dff64a0a3289d41 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_qrng.h @@ -0,0 +1,110 @@ +/* Author: G. Jungman + */ +#ifndef __GSL_QRNG_H__ +#define __GSL_QRNG_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Once again, more inane C-style OOP... kill me now. */ + +/* Structure describing a type of generator. + */ +typedef struct +{ + const char * name; + unsigned int max_dimension; + size_t (*state_size) (unsigned int dimension); + int (*init_state) (void * state, unsigned int dimension); + int (*get) (void * state, unsigned int dimension, double x[]); +} +gsl_qrng_type; + +/* Structure describing a generator instance of a + * specified type, with generator-specific state info + * and dimension-specific info. + */ +typedef struct +{ + const gsl_qrng_type * type; + unsigned int dimension; + size_t state_size; + void * state; +} +gsl_qrng; + + +/* Supported generator types. + */ +GSL_VAR const gsl_qrng_type * gsl_qrng_niederreiter_2; +GSL_VAR const gsl_qrng_type * gsl_qrng_sobol; + + +/* Allocate and initialize a generator + * of the specified type, in the given + * space dimension. + */ +gsl_qrng * gsl_qrng_alloc (const gsl_qrng_type * T, unsigned int dimension); + + +/* Copy a generator. */ +int gsl_qrng_memcpy (gsl_qrng * dest, const gsl_qrng * src); + + +/* Clone a generator. */ +gsl_qrng * gsl_qrng_clone (const gsl_qrng * q); + + +/* Free a generator. */ +void gsl_qrng_free (gsl_qrng * q); + + +/* Intialize a generator. */ +void gsl_qrng_init (gsl_qrng * q); + + +/* Get the standardized name of the generator. */ +const char * gsl_qrng_name (const gsl_qrng * q); + + +/* ISN'T THIS CONFUSING FOR PEOPLE? + WHAT IF SOMEBODY TRIES TO COPY WITH THIS ??? + */ +size_t gsl_qrng_size (const gsl_qrng * q); + + +void * gsl_qrng_state (const gsl_qrng * q); + + +/* Retrieve next vector in sequence. */ +int gsl_qrng_get (const gsl_qrng * q, double x[]); + + +#ifdef HAVE_INLINE +extern inline int gsl_qrng_get (const gsl_qrng * q, double x[]); +extern inline int gsl_qrng_get (const gsl_qrng * q, double x[]) +{ + return (q->type->get) (q->state, q->dimension, x); +} + +#endif /* HAVE_INLINE */ + + +__END_DECLS + + +#endif /* !__GSL_QRNG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_randist.h b/dtm_release/local/include/gsl/gsl_randist.h new file mode 100644 index 0000000000000000000000000000000000000000..6f4b0e3151d42b4ff0361a22e6da91d33575c291 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_randist.h @@ -0,0 +1,185 @@ +/* randist/gsl_randist.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 James Theiler, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_RANDIST_H__ +#define __GSL_RANDIST_H__ +#include <gsl/gsl_rng.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +unsigned int gsl_ran_bernoulli (const gsl_rng * r, double p); +double gsl_ran_bernoulli_pdf (const unsigned int k, double p); + +double gsl_ran_beta (const gsl_rng * r, const double a, const double b); +double gsl_ran_beta_pdf (const double x, const double a, const double b); + +unsigned int gsl_ran_binomial (const gsl_rng * r, double p, unsigned int n); +unsigned int gsl_ran_binomial_knuth (const gsl_rng * r, double p, unsigned int n); +unsigned int gsl_ran_binomial_tpe (const gsl_rng * r, double p, unsigned int n); +double gsl_ran_binomial_pdf (const unsigned int k, const double p, const unsigned int n); + +double gsl_ran_exponential (const gsl_rng * r, const double mu); +double gsl_ran_exponential_pdf (const double x, const double mu); + +double gsl_ran_exppow (const gsl_rng * r, const double a, const double b); +double gsl_ran_exppow_pdf (const double x, const double a, const double b); + +double gsl_ran_cauchy (const gsl_rng * r, const double a); +double gsl_ran_cauchy_pdf (const double x, const double a); + +double gsl_ran_chisq (const gsl_rng * r, const double nu); +double gsl_ran_chisq_pdf (const double x, const double nu); + +void gsl_ran_dirichlet (const gsl_rng * r, const size_t K, const double alpha[], double theta[]); +double gsl_ran_dirichlet_pdf (const size_t K, const double alpha[], const double theta[]); +double gsl_ran_dirichlet_lnpdf (const size_t K, const double alpha[], const double theta[]); + +double gsl_ran_erlang (const gsl_rng * r, const double a, const double n); +double gsl_ran_erlang_pdf (const double x, const double a, const double n); + +double gsl_ran_fdist (const gsl_rng * r, const double nu1, const double nu2); +double gsl_ran_fdist_pdf (const double x, const double nu1, const double nu2); + +double gsl_ran_flat (const gsl_rng * r, const double a, const double b); +double gsl_ran_flat_pdf (double x, const double a, const double b); + +double gsl_ran_gamma (const gsl_rng * r, const double a, const double b); +double gsl_ran_gamma_int (const gsl_rng * r, const unsigned int a); +double gsl_ran_gamma_pdf (const double x, const double a, const double b); +double gsl_ran_gamma_mt (const gsl_rng * r, const double a, const double b); +double gsl_ran_gamma_knuth (const gsl_rng * r, const double a, const double b); + +double gsl_ran_gaussian (const gsl_rng * r, const double sigma); +double gsl_ran_gaussian_ratio_method (const gsl_rng * r, const double sigma); +double gsl_ran_gaussian_ziggurat (const gsl_rng * r, const double sigma); +double gsl_ran_gaussian_pdf (const double x, const double sigma); + +double gsl_ran_ugaussian (const gsl_rng * r); +double gsl_ran_ugaussian_ratio_method (const gsl_rng * r); +double gsl_ran_ugaussian_pdf (const double x); + +double gsl_ran_gaussian_tail (const gsl_rng * r, const double a, const double sigma); +double gsl_ran_gaussian_tail_pdf (const double x, const double a, const double sigma); + +double gsl_ran_ugaussian_tail (const gsl_rng * r, const double a); +double gsl_ran_ugaussian_tail_pdf (const double x, const double a); + +void gsl_ran_bivariate_gaussian (const gsl_rng * r, double sigma_x, double sigma_y, double rho, double *x, double *y); +double gsl_ran_bivariate_gaussian_pdf (const double x, const double y, const double sigma_x, const double sigma_y, const double rho); + +double gsl_ran_landau (const gsl_rng * r); +double gsl_ran_landau_pdf (const double x); + +unsigned int gsl_ran_geometric (const gsl_rng * r, const double p); +double gsl_ran_geometric_pdf (const unsigned int k, const double p); + +unsigned int gsl_ran_hypergeometric (const gsl_rng * r, unsigned int n1, unsigned int n2, unsigned int t); +double gsl_ran_hypergeometric_pdf (const unsigned int k, const unsigned int n1, const unsigned int n2, unsigned int t); + +double gsl_ran_gumbel1 (const gsl_rng * r, const double a, const double b); +double gsl_ran_gumbel1_pdf (const double x, const double a, const double b); + +double gsl_ran_gumbel2 (const gsl_rng * r, const double a, const double b); +double gsl_ran_gumbel2_pdf (const double x, const double a, const double b); + +double gsl_ran_logistic (const gsl_rng * r, const double a); +double gsl_ran_logistic_pdf (const double x, const double a); + +double gsl_ran_lognormal (const gsl_rng * r, const double zeta, const double sigma); +double gsl_ran_lognormal_pdf (const double x, const double zeta, const double sigma); + +unsigned int gsl_ran_logarithmic (const gsl_rng * r, const double p); +double gsl_ran_logarithmic_pdf (const unsigned int k, const double p); + +void gsl_ran_multinomial (const gsl_rng * r, const size_t K, + const unsigned int N, const double p[], + unsigned int n[] ); +double gsl_ran_multinomial_pdf (const size_t K, + const double p[], const unsigned int n[] ); +double gsl_ran_multinomial_lnpdf (const size_t K, + const double p[], const unsigned int n[] ); + + +unsigned int gsl_ran_negative_binomial (const gsl_rng * r, double p, double n); +double gsl_ran_negative_binomial_pdf (const unsigned int k, const double p, double n); + +unsigned int gsl_ran_pascal (const gsl_rng * r, double p, unsigned int n); +double gsl_ran_pascal_pdf (const unsigned int k, const double p, unsigned int n); + +double gsl_ran_pareto (const gsl_rng * r, double a, const double b); +double gsl_ran_pareto_pdf (const double x, const double a, const double b); + +unsigned int gsl_ran_poisson (const gsl_rng * r, double mu); +void gsl_ran_poisson_array (const gsl_rng * r, size_t n, unsigned int array[], + double mu); +double gsl_ran_poisson_pdf (const unsigned int k, const double mu); + +double gsl_ran_rayleigh (const gsl_rng * r, const double sigma); +double gsl_ran_rayleigh_pdf (const double x, const double sigma); + +double gsl_ran_rayleigh_tail (const gsl_rng * r, const double a, const double sigma); +double gsl_ran_rayleigh_tail_pdf (const double x, const double a, const double sigma); + +double gsl_ran_tdist (const gsl_rng * r, const double nu); +double gsl_ran_tdist_pdf (const double x, const double nu); + +double gsl_ran_laplace (const gsl_rng * r, const double a); +double gsl_ran_laplace_pdf (const double x, const double a); + +double gsl_ran_levy (const gsl_rng * r, const double c, const double alpha); +double gsl_ran_levy_skew (const gsl_rng * r, const double c, const double alpha, const double beta); + +double gsl_ran_weibull (const gsl_rng * r, const double a, const double b); +double gsl_ran_weibull_pdf (const double x, const double a, const double b); + +void gsl_ran_dir_2d (const gsl_rng * r, double * x, double * y); +void gsl_ran_dir_2d_trig_method (const gsl_rng * r, double * x, double * y); +void gsl_ran_dir_3d (const gsl_rng * r, double * x, double * y, double * z); +void gsl_ran_dir_nd (const gsl_rng * r, size_t n, double * x); + +void gsl_ran_shuffle (const gsl_rng * r, void * base, size_t nmembm, size_t size); +int gsl_ran_choose (const gsl_rng * r, void * dest, size_t k, void * src, size_t n, size_t size) ; +void gsl_ran_sample (const gsl_rng * r, void * dest, size_t k, void * src, size_t n, size_t size) ; + + +typedef struct { /* struct for Walker algorithm */ + size_t K; + size_t *A; + double *F; +} gsl_ran_discrete_t; + +gsl_ran_discrete_t * gsl_ran_discrete_preproc (size_t K, const double *P); +void gsl_ran_discrete_free(gsl_ran_discrete_t *g); +size_t gsl_ran_discrete (const gsl_rng *r, const gsl_ran_discrete_t *g); +double gsl_ran_discrete_pdf (size_t k, const gsl_ran_discrete_t *g); + + +__END_DECLS + +#endif /* __GSL_RANDIST_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_rng.h b/dtm_release/local/include/gsl/gsl_rng.h new file mode 100644 index 0000000000000000000000000000000000000000..0169036f119f28e34cd779aaa4d165dda57d8489 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_rng.h @@ -0,0 +1,218 @@ +/* rng/gsl_rng.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2007 James Theiler, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_RNG_H__ +#define __GSL_RNG_H__ +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct + { + const char *name; + unsigned long int max; + unsigned long int min; + size_t size; + void (*set) (void *state, unsigned long int seed); + unsigned long int (*get) (void *state); + double (*get_double) (void *state); + } +gsl_rng_type; + +typedef struct + { + const gsl_rng_type * type; + void *state; + } +gsl_rng; + + +/* These structs also need to appear in default.c so you can select + them via the environment variable GSL_RNG_TYPE */ + +GSL_VAR const gsl_rng_type *gsl_rng_borosh13; +GSL_VAR const gsl_rng_type *gsl_rng_coveyou; +GSL_VAR const gsl_rng_type *gsl_rng_cmrg; +GSL_VAR const gsl_rng_type *gsl_rng_fishman18; +GSL_VAR const gsl_rng_type *gsl_rng_fishman20; +GSL_VAR const gsl_rng_type *gsl_rng_fishman2x; +GSL_VAR const gsl_rng_type *gsl_rng_gfsr4; +GSL_VAR const gsl_rng_type *gsl_rng_knuthran; +GSL_VAR const gsl_rng_type *gsl_rng_knuthran2; +GSL_VAR const gsl_rng_type *gsl_rng_knuthran2002; +GSL_VAR const gsl_rng_type *gsl_rng_lecuyer21; +GSL_VAR const gsl_rng_type *gsl_rng_minstd; +GSL_VAR const gsl_rng_type *gsl_rng_mrg; +GSL_VAR const gsl_rng_type *gsl_rng_mt19937; +GSL_VAR const gsl_rng_type *gsl_rng_mt19937_1999; +GSL_VAR const gsl_rng_type *gsl_rng_mt19937_1998; +GSL_VAR const gsl_rng_type *gsl_rng_r250; +GSL_VAR const gsl_rng_type *gsl_rng_ran0; +GSL_VAR const gsl_rng_type *gsl_rng_ran1; +GSL_VAR const gsl_rng_type *gsl_rng_ran2; +GSL_VAR const gsl_rng_type *gsl_rng_ran3; +GSL_VAR const gsl_rng_type *gsl_rng_rand; +GSL_VAR const gsl_rng_type *gsl_rng_rand48; +GSL_VAR const gsl_rng_type *gsl_rng_random128_bsd; +GSL_VAR const gsl_rng_type *gsl_rng_random128_glibc2; +GSL_VAR const gsl_rng_type *gsl_rng_random128_libc5; +GSL_VAR const gsl_rng_type *gsl_rng_random256_bsd; +GSL_VAR const gsl_rng_type *gsl_rng_random256_glibc2; +GSL_VAR const gsl_rng_type *gsl_rng_random256_libc5; +GSL_VAR const gsl_rng_type *gsl_rng_random32_bsd; +GSL_VAR const gsl_rng_type *gsl_rng_random32_glibc2; +GSL_VAR const gsl_rng_type *gsl_rng_random32_libc5; +GSL_VAR const gsl_rng_type *gsl_rng_random64_bsd; +GSL_VAR const gsl_rng_type *gsl_rng_random64_glibc2; +GSL_VAR const gsl_rng_type *gsl_rng_random64_libc5; +GSL_VAR const gsl_rng_type *gsl_rng_random8_bsd; +GSL_VAR const gsl_rng_type *gsl_rng_random8_glibc2; +GSL_VAR const gsl_rng_type *gsl_rng_random8_libc5; +GSL_VAR const gsl_rng_type *gsl_rng_random_bsd; +GSL_VAR const gsl_rng_type *gsl_rng_random_glibc2; +GSL_VAR const gsl_rng_type *gsl_rng_random_libc5; +GSL_VAR const gsl_rng_type *gsl_rng_randu; +GSL_VAR const gsl_rng_type *gsl_rng_ranf; +GSL_VAR const gsl_rng_type *gsl_rng_ranlux; +GSL_VAR const gsl_rng_type *gsl_rng_ranlux389; +GSL_VAR const gsl_rng_type *gsl_rng_ranlxd1; +GSL_VAR const gsl_rng_type *gsl_rng_ranlxd2; +GSL_VAR const gsl_rng_type *gsl_rng_ranlxs0; +GSL_VAR const gsl_rng_type *gsl_rng_ranlxs1; +GSL_VAR const gsl_rng_type *gsl_rng_ranlxs2; +GSL_VAR const gsl_rng_type *gsl_rng_ranmar; +GSL_VAR const gsl_rng_type *gsl_rng_slatec; +GSL_VAR const gsl_rng_type *gsl_rng_taus; +GSL_VAR const gsl_rng_type *gsl_rng_taus2; +GSL_VAR const gsl_rng_type *gsl_rng_taus113; +GSL_VAR const gsl_rng_type *gsl_rng_transputer; +GSL_VAR const gsl_rng_type *gsl_rng_tt800; +GSL_VAR const gsl_rng_type *gsl_rng_uni; +GSL_VAR const gsl_rng_type *gsl_rng_uni32; +GSL_VAR const gsl_rng_type *gsl_rng_vax; +GSL_VAR const gsl_rng_type *gsl_rng_waterman14; +GSL_VAR const gsl_rng_type *gsl_rng_zuf; + +const gsl_rng_type ** gsl_rng_types_setup(void); + +GSL_VAR const gsl_rng_type *gsl_rng_default; +GSL_VAR unsigned long int gsl_rng_default_seed; + +gsl_rng *gsl_rng_alloc (const gsl_rng_type * T); +int gsl_rng_memcpy (gsl_rng * dest, const gsl_rng * src); +gsl_rng *gsl_rng_clone (const gsl_rng * r); + +void gsl_rng_free (gsl_rng * r); + +void gsl_rng_set (const gsl_rng * r, unsigned long int seed); +unsigned long int gsl_rng_max (const gsl_rng * r); +unsigned long int gsl_rng_min (const gsl_rng * r); +const char *gsl_rng_name (const gsl_rng * r); + +int gsl_rng_fread (FILE * stream, gsl_rng * r); +int gsl_rng_fwrite (FILE * stream, const gsl_rng * r); + +size_t gsl_rng_size (const gsl_rng * r); +void * gsl_rng_state (const gsl_rng * r); + +void gsl_rng_print_state (const gsl_rng * r); + +const gsl_rng_type * gsl_rng_env_setup (void); + +unsigned long int gsl_rng_get (const gsl_rng * r); +double gsl_rng_uniform (const gsl_rng * r); +double gsl_rng_uniform_pos (const gsl_rng * r); +unsigned long int gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n); + + +#ifdef HAVE_INLINE +extern inline unsigned long int gsl_rng_get (const gsl_rng * r); + +extern inline unsigned long int +gsl_rng_get (const gsl_rng * r) +{ + return (r->type->get) (r->state); +} + +extern inline double gsl_rng_uniform (const gsl_rng * r); + +extern inline double +gsl_rng_uniform (const gsl_rng * r) +{ + return (r->type->get_double) (r->state); +} + +extern inline double gsl_rng_uniform_pos (const gsl_rng * r); + +extern inline double +gsl_rng_uniform_pos (const gsl_rng * r) +{ + double x ; + do + { + x = (r->type->get_double) (r->state) ; + } + while (x == 0) ; + + return x ; +} + +extern inline unsigned long int gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n); + +extern inline unsigned long int +gsl_rng_uniform_int (const gsl_rng * r, unsigned long int n) +{ + unsigned long int offset = r->type->min; + unsigned long int range = r->type->max - offset; + unsigned long int scale; + unsigned long int k; + + if (n > range || n == 0) + { + GSL_ERROR_VAL ("invalid n, either 0 or exceeds maximum value of generator", + GSL_EINVAL, 0) ; + } + + scale = range / n; + + do + { + k = (((r->type->get) (r->state)) - offset) / scale; + } + while (k >= n); + + return k; +} +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_RNG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_roots.h b/dtm_release/local/include/gsl/gsl_roots.h new file mode 100644 index 0000000000000000000000000000000000000000..46e4587064f7e02e8e38b1e42dd800841b650313 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_roots.h @@ -0,0 +1,127 @@ +/* roots/gsl_roots.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Reid Priedhorsky, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_ROOTS_H__ +#define __GSL_ROOTS_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_math.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct + { + const char *name; + size_t size; + int (*set) (void *state, gsl_function * f, double * root, double x_lower, double x_upper); + int (*iterate) (void *state, gsl_function * f, double * root, double * x_lower, double * x_upper); + } +gsl_root_fsolver_type; + +typedef struct + { + const gsl_root_fsolver_type * type; + gsl_function * function ; + double root ; + double x_lower; + double x_upper; + void *state; + } +gsl_root_fsolver; + +typedef struct + { + const char *name; + size_t size; + int (*set) (void *state, gsl_function_fdf * f, double * root); + int (*iterate) (void *state, gsl_function_fdf * f, double * root); + } +gsl_root_fdfsolver_type; + +typedef struct + { + const gsl_root_fdfsolver_type * type; + gsl_function_fdf * fdf ; + double root ; + void *state; + } +gsl_root_fdfsolver; + +gsl_root_fsolver * +gsl_root_fsolver_alloc (const gsl_root_fsolver_type * T); +void gsl_root_fsolver_free (gsl_root_fsolver * s); + +int gsl_root_fsolver_set (gsl_root_fsolver * s, + gsl_function * f, + double x_lower, double x_upper); + +int gsl_root_fsolver_iterate (gsl_root_fsolver * s); + +const char * gsl_root_fsolver_name (const gsl_root_fsolver * s); +double gsl_root_fsolver_root (const gsl_root_fsolver * s); +double gsl_root_fsolver_x_lower (const gsl_root_fsolver * s); +double gsl_root_fsolver_x_upper (const gsl_root_fsolver * s); + + +gsl_root_fdfsolver * +gsl_root_fdfsolver_alloc (const gsl_root_fdfsolver_type * T); + +int +gsl_root_fdfsolver_set (gsl_root_fdfsolver * s, + gsl_function_fdf * fdf, double root); + +int +gsl_root_fdfsolver_iterate (gsl_root_fdfsolver * s); + +void +gsl_root_fdfsolver_free (gsl_root_fdfsolver * s); + +const char * gsl_root_fdfsolver_name (const gsl_root_fdfsolver * s); +double gsl_root_fdfsolver_root (const gsl_root_fdfsolver * s); + +int +gsl_root_test_interval (double x_lower, double x_upper, double epsabs, double epsrel); + +int +gsl_root_test_residual (double f, double epsabs); + +int +gsl_root_test_delta (double x1, double x0, double epsabs, double epsrel); + +GSL_VAR const gsl_root_fsolver_type * gsl_root_fsolver_bisection; +GSL_VAR const gsl_root_fsolver_type * gsl_root_fsolver_brent; +GSL_VAR const gsl_root_fsolver_type * gsl_root_fsolver_falsepos; +GSL_VAR const gsl_root_fdfsolver_type * gsl_root_fdfsolver_newton; +GSL_VAR const gsl_root_fdfsolver_type * gsl_root_fdfsolver_secant; +GSL_VAR const gsl_root_fdfsolver_type * gsl_root_fdfsolver_steffenson; + +__END_DECLS + +#endif /* __GSL_ROOTS_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf.h b/dtm_release/local/include/gsl/gsl_sf.h new file mode 100644 index 0000000000000000000000000000000000000000..643cf34151de66fa9351655a427ae4b47b36067a --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf.h @@ -0,0 +1,39 @@ +/* Author: G. Jungman */ + +#ifndef __GSL_SF_H__ +#define __GSL_SF_H__ + +#include <gsl/gsl_sf_result.h> + +#include <gsl/gsl_sf_airy.h> +#include <gsl/gsl_sf_bessel.h> +#include <gsl/gsl_sf_clausen.h> +#include <gsl/gsl_sf_coupling.h> +#include <gsl/gsl_sf_coulomb.h> +#include <gsl/gsl_sf_dawson.h> +#include <gsl/gsl_sf_debye.h> +#include <gsl/gsl_sf_dilog.h> +#include <gsl/gsl_sf_elementary.h> +#include <gsl/gsl_sf_ellint.h> +#include <gsl/gsl_sf_elljac.h> +#include <gsl/gsl_sf_erf.h> +#include <gsl/gsl_sf_exp.h> +#include <gsl/gsl_sf_expint.h> +#include <gsl/gsl_sf_fermi_dirac.h> +#include <gsl/gsl_sf_gamma.h> +#include <gsl/gsl_sf_gegenbauer.h> +#include <gsl/gsl_sf_hyperg.h> +#include <gsl/gsl_sf_laguerre.h> +#include <gsl/gsl_sf_lambert.h> +#include <gsl/gsl_sf_legendre.h> +#include <gsl/gsl_sf_log.h> +#include <gsl/gsl_sf_mathieu.h> +#include <gsl/gsl_sf_pow_int.h> +#include <gsl/gsl_sf_psi.h> +#include <gsl/gsl_sf_synchrotron.h> +#include <gsl/gsl_sf_transport.h> +#include <gsl/gsl_sf_trig.h> +#include <gsl/gsl_sf_zeta.h> + + +#endif /* __GSL_SF_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_airy.h b/dtm_release/local/include/gsl/gsl_sf_airy.h new file mode 100644 index 0000000000000000000000000000000000000000..7033383069c29626a588dd9a61f3143ed60e63a2 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_airy.h @@ -0,0 +1,139 @@ +/* specfunc/gsl_sf_airy.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_AIRY_H__ +#define __GSL_SF_AIRY_H__ + +#include <gsl/gsl_mode.h> +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Airy function Ai(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_airy_Ai_e(const double x, const gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_airy_Ai(const double x, gsl_mode_t mode); + + +/* Airy function Bi(x) + * + * exceptions: GSL_EOVRFLW + */ +int gsl_sf_airy_Bi_e(const double x, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_airy_Bi(const double x, gsl_mode_t mode); + + +/* scaled Ai(x): + * Ai(x) x < 0 + * exp(+2/3 x^{3/2}) Ai(x) x > 0 + * + * exceptions: none + */ +int gsl_sf_airy_Ai_scaled_e(const double x, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_airy_Ai_scaled(const double x, gsl_mode_t mode); + + +/* scaled Bi(x): + * Bi(x) x < 0 + * exp(-2/3 x^{3/2}) Bi(x) x > 0 + * + * exceptions: none + */ +int gsl_sf_airy_Bi_scaled_e(const double x, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_airy_Bi_scaled(const double x, gsl_mode_t mode); + + +/* derivative Ai'(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_airy_Ai_deriv_e(const double x, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_airy_Ai_deriv(const double x, gsl_mode_t mode); + + +/* derivative Bi'(x) + * + * exceptions: GSL_EOVRFLW + */ +int gsl_sf_airy_Bi_deriv_e(const double x, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_airy_Bi_deriv(const double x, gsl_mode_t mode); + + +/* scaled derivative Ai'(x): + * Ai'(x) x < 0 + * exp(+2/3 x^{3/2}) Ai'(x) x > 0 + * + * exceptions: none + */ +int gsl_sf_airy_Ai_deriv_scaled_e(const double x, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_airy_Ai_deriv_scaled(const double x, gsl_mode_t mode); + + +/* scaled derivative: + * Bi'(x) x < 0 + * exp(-2/3 x^{3/2}) Bi'(x) x > 0 + * + * exceptions: none + */ +int gsl_sf_airy_Bi_deriv_scaled_e(const double x, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_airy_Bi_deriv_scaled(const double x, gsl_mode_t mode); + + +/* Zeros of Ai(x) + */ +int gsl_sf_airy_zero_Ai_e(unsigned int s, gsl_sf_result * result); +double gsl_sf_airy_zero_Ai(unsigned int s); + + +/* Zeros of Bi(x) + */ +int gsl_sf_airy_zero_Bi_e(unsigned int s, gsl_sf_result * result); +double gsl_sf_airy_zero_Bi(unsigned int s); + + +/* Zeros of Ai'(x) + */ +int gsl_sf_airy_zero_Ai_deriv_e(unsigned int s, gsl_sf_result * result); +double gsl_sf_airy_zero_Ai_deriv(unsigned int s); + + +/* Zeros of Bi'(x) + */ +int gsl_sf_airy_zero_Bi_deriv_e(unsigned int s, gsl_sf_result * result); +double gsl_sf_airy_zero_Bi_deriv(unsigned int s); + + +__END_DECLS + +#endif /* __GSL_SF_AIRY_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_bessel.h b/dtm_release/local/include/gsl/gsl_sf_bessel.h new file mode 100644 index 0000000000000000000000000000000000000000..cf45d55d0fe660423556018dc4dc648716cf2334 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_bessel.h @@ -0,0 +1,548 @@ +/* specfunc/gsl_sf_bessel.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_BESSEL_H__ +#define __GSL_SF_BESSEL_H__ + +#include <stdlib.h> +#include <gsl/gsl_mode.h> +#include <gsl/gsl_precision.h> +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Regular Bessel Function J_0(x) + * + * exceptions: none + */ +int gsl_sf_bessel_J0_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_J0(const double x); + + +/* Regular Bessel Function J_1(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_J1_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_J1(const double x); + + +/* Regular Bessel Function J_n(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_Jn_e(int n, double x, gsl_sf_result * result); +double gsl_sf_bessel_Jn(const int n, const double x); + + +/* Regular Bessel Function J_n(x), nmin <= n <= nmax + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Jn_array(int nmin, int nmax, double x, double * result_array); + + +/* Irregular Bessel function Y_0(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Y0_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_Y0(const double x); + + +/* Irregular Bessel function Y_1(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Y1_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_Y1(const double x); + + +/* Irregular Bessel function Y_n(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Yn_e(int n,const double x, gsl_sf_result * result); +double gsl_sf_bessel_Yn(const int n,const double x); + + +/* Irregular Bessel function Y_n(x), nmin <= n <= nmax + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Yn_array(const int nmin, const int nmax, const double x, double * result_array); + + +/* Regular modified Bessel function I_0(x) + * + * exceptions: GSL_EOVRFLW + */ +int gsl_sf_bessel_I0_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_I0(const double x); + + +/* Regular modified Bessel function I_1(x) + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_bessel_I1_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_I1(const double x); + + +/* Regular modified Bessel function I_n(x) + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_bessel_In_e(const int n, const double x, gsl_sf_result * result); +double gsl_sf_bessel_In(const int n, const double x); + + +/* Regular modified Bessel function I_n(x) for n=nmin,...,nmax + * + * nmin >=0, nmax >= nmin + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_bessel_In_array(const int nmin, const int nmax, const double x, double * result_array); + + +/* Scaled regular modified Bessel function + * exp(-|x|) I_0(x) + * + * exceptions: none + */ +int gsl_sf_bessel_I0_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_I0_scaled(const double x); + + +/* Scaled regular modified Bessel function + * exp(-|x|) I_1(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_I1_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_I1_scaled(const double x); + + +/* Scaled regular modified Bessel function + * exp(-|x|) I_n(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_In_scaled_e(int n, const double x, gsl_sf_result * result); +double gsl_sf_bessel_In_scaled(const int n, const double x); + + +/* Scaled regular modified Bessel function + * exp(-|x|) I_n(x) for n=nmin,...,nmax + * + * nmin >=0, nmax >= nmin + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_In_scaled_array(const int nmin, const int nmax, const double x, double * result_array); + + +/* Irregular modified Bessel function K_0(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_K0_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_K0(const double x); + + +/* Irregular modified Bessel function K_1(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_bessel_K1_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_K1(const double x); + + +/* Irregular modified Bessel function K_n(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Kn_e(const int n, const double x, gsl_sf_result * result); +double gsl_sf_bessel_Kn(const int n, const double x); + + +/* Irregular modified Bessel function K_n(x) for n=nmin,...,nmax + * + * x > 0.0, nmin >=0, nmax >= nmin + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Kn_array(const int nmin, const int nmax, const double x, double * result_array); + + +/* Scaled irregular modified Bessel function + * exp(x) K_0(x) + * + * x > 0.0 + * exceptions: GSL_EDOM + */ +int gsl_sf_bessel_K0_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_K0_scaled(const double x); + + +/* Scaled irregular modified Bessel function + * exp(x) K_1(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_K1_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_K1_scaled(const double x); + + +/* Scaled irregular modified Bessel function + * exp(x) K_n(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Kn_scaled_e(int n, const double x, gsl_sf_result * result); +double gsl_sf_bessel_Kn_scaled(const int n, const double x); + + +/* Scaled irregular modified Bessel function exp(x) K_n(x) for n=nmin,...,nmax + * + * x > 0.0, nmin >=0, nmax >= nmin + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Kn_scaled_array(const int nmin, const int nmax, const double x, double * result_array); + + +/* Regular spherical Bessel function j_0(x) = sin(x)/x + * + * exceptions: none + */ +int gsl_sf_bessel_j0_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_j0(const double x); + + +/* Regular spherical Bessel function j_1(x) = (sin(x)/x - cos(x))/x + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_j1_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_j1(const double x); + + +/* Regular spherical Bessel function j_2(x) = ((3/x^2 - 1)sin(x) - 3cos(x)/x)/x + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_j2_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_j2(const double x); + + +/* Regular spherical Bessel function j_l(x) + * + * l >= 0, x >= 0.0 + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_jl_e(const int l, const double x, gsl_sf_result * result); +double gsl_sf_bessel_jl(const int l, const double x); + + +/* Regular spherical Bessel function j_l(x) for l=0,1,...,lmax + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_jl_array(const int lmax, const double x, double * result_array); + + +/* Regular spherical Bessel function j_l(x) for l=0,1,...,lmax + * Uses Steed's method. + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_jl_steed_array(const int lmax, const double x, double * jl_x_array); + + +/* Irregular spherical Bessel function y_0(x) + * + * exceptions: none + */ +int gsl_sf_bessel_y0_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_y0(const double x); + + +/* Irregular spherical Bessel function y_1(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_y1_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_y1(const double x); + + +/* Irregular spherical Bessel function y_2(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_y2_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_y2(const double x); + + +/* Irregular spherical Bessel function y_l(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_yl_e(int l, const double x, gsl_sf_result * result); +double gsl_sf_bessel_yl(const int l, const double x); + + +/* Irregular spherical Bessel function y_l(x) for l=0,1,...,lmax + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_yl_array(const int lmax, const double x, double * result_array); + + +/* Regular scaled modified spherical Bessel function + * + * Exp[-|x|] i_0(x) + * + * exceptions: none + */ +int gsl_sf_bessel_i0_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_i0_scaled(const double x); + + +/* Regular scaled modified spherical Bessel function + * + * Exp[-|x|] i_1(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_i1_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_i1_scaled(const double x); + + +/* Regular scaled modified spherical Bessel function + * + * Exp[-|x|] i_2(x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_i2_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_i2_scaled(const double x); + + +/* Regular scaled modified spherical Bessel functions + * + * Exp[-|x|] i_l(x) + * + * i_l(x) = Sqrt[Pi/(2x)] BesselI[l+1/2,x] + * + * l >= 0 + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_il_scaled_e(const int l, double x, gsl_sf_result * result); +double gsl_sf_bessel_il_scaled(const int l, const double x); + + +/* Regular scaled modified spherical Bessel functions + * + * Exp[-|x|] i_l(x) + * for l=0,1,...,lmax + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_bessel_il_scaled_array(const int lmax, const double x, double * result_array); + + +/* Irregular scaled modified spherical Bessel function + * Exp[x] k_0(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_k0_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_k0_scaled(const double x); + + +/* Irregular modified spherical Bessel function + * Exp[x] k_1(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_bessel_k1_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_k1_scaled(const double x); + + +/* Irregular modified spherical Bessel function + * Exp[x] k_2(x) + * + * x > 0.0 + * exceptions: GSL_EDOM, GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_bessel_k2_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_bessel_k2_scaled(const double x); + + +/* Irregular modified spherical Bessel function + * Exp[x] k_l[x] + * + * k_l(x) = Sqrt[Pi/(2x)] BesselK[l+1/2,x] + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_kl_scaled_e(int l, const double x, gsl_sf_result * result); +double gsl_sf_bessel_kl_scaled(const int l, const double x); + + +/* Irregular scaled modified spherical Bessel function + * Exp[x] k_l(x) + * + * for l=0,1,...,lmax + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_kl_scaled_array(const int lmax, const double x, double * result_array); + + +/* Regular cylindrical Bessel function J_nu(x) + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Jnu_e(const double nu, const double x, gsl_sf_result * result); +double gsl_sf_bessel_Jnu(const double nu, const double x); + + +/* Irregular cylindrical Bessel function Y_nu(x) + * + * exceptions: + */ +int gsl_sf_bessel_Ynu_e(double nu, double x, gsl_sf_result * result); +double gsl_sf_bessel_Ynu(const double nu, const double x); + + +/* Regular cylindrical Bessel function J_nu(x) + * evaluated at a series of x values. The array + * contains the x values. They are assumed to be + * strictly ordered and positive. The array is + * over-written with the values of J_nu(x_i). + * + * exceptions: GSL_EDOM, GSL_EINVAL + */ +int gsl_sf_bessel_sequence_Jnu_e(double nu, gsl_mode_t mode, size_t size, double * v); + + +/* Scaled modified cylindrical Bessel functions + * + * Exp[-|x|] BesselI[nu, x] + * x >= 0, nu >= 0 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_bessel_Inu_scaled_e(double nu, double x, gsl_sf_result * result); +double gsl_sf_bessel_Inu_scaled(double nu, double x); + + +/* Modified cylindrical Bessel functions + * + * BesselI[nu, x] + * x >= 0, nu >= 0 + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_bessel_Inu_e(double nu, double x, gsl_sf_result * result); +double gsl_sf_bessel_Inu(double nu, double x); + + +/* Scaled modified cylindrical Bessel functions + * + * Exp[+|x|] BesselK[nu, x] + * x > 0, nu >= 0 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_bessel_Knu_scaled_e(const double nu, const double x, gsl_sf_result * result); +double gsl_sf_bessel_Knu_scaled(const double nu, const double x); + + +/* Modified cylindrical Bessel functions + * + * BesselK[nu, x] + * x > 0, nu >= 0 + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_bessel_Knu_e(const double nu, const double x, gsl_sf_result * result); +double gsl_sf_bessel_Knu(const double nu, const double x); + + +/* Logarithm of modified cylindrical Bessel functions. + * + * Log[BesselK[nu, x]] + * x > 0, nu >= 0 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_bessel_lnKnu_e(const double nu, const double x, gsl_sf_result * result); +double gsl_sf_bessel_lnKnu(const double nu, const double x); + + +/* s'th positive zero of the Bessel function J_0(x). + * + * exceptions: + */ +int gsl_sf_bessel_zero_J0_e(unsigned int s, gsl_sf_result * result); +double gsl_sf_bessel_zero_J0(unsigned int s); + + +/* s'th positive zero of the Bessel function J_1(x). + * + * exceptions: + */ +int gsl_sf_bessel_zero_J1_e(unsigned int s, gsl_sf_result * result); +double gsl_sf_bessel_zero_J1(unsigned int s); + + +/* s'th positive zero of the Bessel function J_nu(x). + * + * exceptions: + */ +int gsl_sf_bessel_zero_Jnu_e(double nu, unsigned int s, gsl_sf_result * result); +double gsl_sf_bessel_zero_Jnu(double nu, unsigned int s); + + +__END_DECLS + +#endif /* __GSL_SF_BESSEL_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_clausen.h b/dtm_release/local/include/gsl/gsl_sf_clausen.h new file mode 100644 index 0000000000000000000000000000000000000000..8e4ccd24451e07180e8a63b0e764f28616fb110b --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_clausen.h @@ -0,0 +1,52 @@ +/* specfunc/gsl_sf_clausen.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_CLAUSEN_H__ +#define __GSL_SF_CLAUSEN_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Calculate the Clausen integral: + * Cl_2(x) := Integrate[-Log[2 Sin[t/2]], {t,0,x}] + * + * Relation to dilogarithm: + * Cl_2(theta) = Im[ Li_2(e^(i theta)) ] + */ +int gsl_sf_clausen_e(double x, gsl_sf_result * result); +double gsl_sf_clausen(const double x); + + +__END_DECLS + +#endif /* __GSL_SF_CLAUSEN_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_coulomb.h b/dtm_release/local/include/gsl/gsl_sf_coulomb.h new file mode 100644 index 0000000000000000000000000000000000000000..764a5714d28d454a7bfa406b9f53684ca0f8b844 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_coulomb.h @@ -0,0 +1,128 @@ +/* specfunc/gsl_sf_coulomb.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_COULOMB_H__ +#define __GSL_SF_COULOMB_H__ + +#include <gsl/gsl_mode.h> +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Normalized hydrogenic bound states, radial dependence. */ + +/* R_1 := 2Z sqrt(Z) exp(-Z r) + */ +int gsl_sf_hydrogenicR_1_e(const double Z, const double r, gsl_sf_result * result); +double gsl_sf_hydrogenicR_1(const double Z, const double r); + +/* R_n := norm exp(-Z r/n) (2Z/n)^l Laguerre[n-l-1, 2l+1, 2Z/n r] + * + * normalization such that psi(n,l,r) = R_n Y_{lm} + */ +int gsl_sf_hydrogenicR_e(const int n, const int l, const double Z, const double r, gsl_sf_result * result); +double gsl_sf_hydrogenicR(const int n, const int l, const double Z, const double r); + + +/* Coulomb wave functions F_{lam_F}(eta,x), G_{lam_G}(eta,x) + * and their derivatives; lam_G := lam_F - k_lam_G + * + * lam_F, lam_G > -0.5 + * x > 0.0 + * + * Conventions of Abramowitz+Stegun. + * + * Because there can be a large dynamic range of values, + * overflows are handled gracefully. If an overflow occurs, + * GSL_EOVRFLW is signalled and exponent(s) are returned + * through exp_F, exp_G. These are such that + * + * F_L(eta,x) = fc[k_L] * exp(exp_F) + * G_L(eta,x) = gc[k_L] * exp(exp_G) + * F_L'(eta,x) = fcp[k_L] * exp(exp_F) + * G_L'(eta,x) = gcp[k_L] * exp(exp_G) + */ +int +gsl_sf_coulomb_wave_FG_e(const double eta, const double x, + const double lam_F, + const int k_lam_G, + gsl_sf_result * F, gsl_sf_result * Fp, + gsl_sf_result * G, gsl_sf_result * Gp, + double * exp_F, double * exp_G); + + +/* F_L(eta,x) as array */ +int gsl_sf_coulomb_wave_F_array( + double lam_min, int kmax, + double eta, double x, + double * fc_array, + double * F_exponent + ); + +/* F_L(eta,x), G_L(eta,x) as arrays */ +int gsl_sf_coulomb_wave_FG_array(double lam_min, int kmax, + double eta, double x, + double * fc_array, double * gc_array, + double * F_exponent, + double * G_exponent + ); + +/* F_L(eta,x), G_L(eta,x), F'_L(eta,x), G'_L(eta,x) as arrays */ +int gsl_sf_coulomb_wave_FGp_array(double lam_min, int kmax, + double eta, double x, + double * fc_array, double * fcp_array, + double * gc_array, double * gcp_array, + double * F_exponent, + double * G_exponent + ); + +/* Coulomb wave function divided by the argument, + * F(eta, x)/x. This is the function which reduces to + * spherical Bessel functions in the limit eta->0. + */ +int gsl_sf_coulomb_wave_sphF_array(double lam_min, int kmax, + double eta, double x, + double * fc_array, + double * F_exponent + ); + + +/* Coulomb wave function normalization constant. + * [Abramowitz+Stegun 14.1.8, 14.1.9] + */ +int gsl_sf_coulomb_CL_e(double L, double eta, gsl_sf_result * result); +int gsl_sf_coulomb_CL_array(double Lmin, int kmax, double eta, double * cl); + + +__END_DECLS + +#endif /* __GSL_SF_COULOMB_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_coupling.h b/dtm_release/local/include/gsl/gsl_sf_coupling.h new file mode 100644 index 0000000000000000000000000000000000000000..c46b9f583ffa0459f930f3aba708a65117416734 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_coupling.h @@ -0,0 +1,125 @@ +/* specfunc/gsl_sf_coupling.h + * + * Copyright (C) 1996,1997,1998,1999,2000,2001,2002 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_COUPLING_H__ +#define __GSL_SF_COUPLING_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* 3j Symbols: / ja jb jc \ + * \ ma mb mc / + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_coupling_3j_e(int two_ja, int two_jb, int two_jc, + int two_ma, int two_mb, int two_mc, + gsl_sf_result * result + ); +double gsl_sf_coupling_3j(int two_ja, int two_jb, int two_jc, + int two_ma, int two_mb, int two_mc + ); + + +/* 6j Symbols: / ja jb jc \ + * \ jd je jf / + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_coupling_6j_e(int two_ja, int two_jb, int two_jc, + int two_jd, int two_je, int two_jf, + gsl_sf_result * result + ); +double gsl_sf_coupling_6j(int two_ja, int two_jb, int two_jc, + int two_jd, int two_je, int two_jf + ); + +/* Racah W coefficients: + * + * W(a b c d; e f) = (-1)^{a+b+c+d} / a b e \ + * \ d c f / + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_coupling_RacahW_e(int two_ja, int two_jb, int two_jc, + int two_jd, int two_je, int two_jf, + gsl_sf_result * result + ); +double gsl_sf_coupling_RacahW(int two_ja, int two_jb, int two_jc, + int two_jd, int two_je, int two_jf + ); + + +/* 9j Symbols: / ja jb jc \ + * | jd je jf | + * \ jg jh ji / + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_coupling_9j_e(int two_ja, int two_jb, int two_jc, + int two_jd, int two_je, int two_jf, + int two_jg, int two_jh, int two_ji, + gsl_sf_result * result + ); +double gsl_sf_coupling_9j(int two_ja, int two_jb, int two_jc, + int two_jd, int two_je, int two_jf, + int two_jg, int two_jh, int two_ji + ); + + +/* INCORRECT version of 6j Symbols: + * This function actually calculates + * / ja jb je \ + * \ jd jc jf / + * It represents the original implementation, + * which had the above permutation of the + * arguments. This was wrong and confusing, + * and I had to fix it. Sorry for the trouble. + * [GJ] Tue Nov 26 12:53:39 MST 2002 + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +#ifndef GSL_DISABLE_DEPRECATED +int gsl_sf_coupling_6j_INCORRECT_e(int two_ja, int two_jb, int two_jc, + int two_jd, int two_je, int two_jf, + gsl_sf_result * result + ); +double gsl_sf_coupling_6j_INCORRECT(int two_ja, int two_jb, int two_jc, + int two_jd, int two_je, int two_jf + ); +#endif /* !GSL_DISABLE_DEPRECATED */ + + +__END_DECLS + +#endif /* __GSL_SF_COUPLING_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_dawson.h b/dtm_release/local/include/gsl/gsl_sf_dawson.h new file mode 100644 index 0000000000000000000000000000000000000000..7c11f9f4120d418cfe32a2f7c1d11448b7681071 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_dawson.h @@ -0,0 +1,52 @@ +/* specfunc/gsl_sf_dawson.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_DAWSON_H__ +#define __GSL_SF_DAWSON_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Dawson's integral: + * + * Exp[-x^2] Integral[ Exp[t^2], {t,0,x}] + * + * exceptions: GSL_EUNDRFLW; + */ +int gsl_sf_dawson_e(double x, gsl_sf_result * result); +double gsl_sf_dawson(double x); + + +__END_DECLS + +#endif /* __GSL_SF_DAWSON_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_debye.h b/dtm_release/local/include/gsl/gsl_sf_debye.h new file mode 100644 index 0000000000000000000000000000000000000000..bc732b17b3475046abfeefedd254b330de7829ef --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_debye.h @@ -0,0 +1,91 @@ +/* specfunc/gsl_sf_debye.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ +/* augmented by D_5(x) and D_6(x) by Richard J. Mathar, 2005-11-08 */ + +#ifndef __GSL_SF_DEBYE_H__ +#define __GSL_SF_DEBYE_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* D_n(x) := n/x^n Integrate[t^n/(e^t - 1), {t,0,x}] */ + +/* D_1(x) + * + * exceptions: GSL_EDOM + */ +int gsl_sf_debye_1_e(const double x, gsl_sf_result * result); +double gsl_sf_debye_1(const double x); + + +/* D_2(x) + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_debye_2_e(const double x, gsl_sf_result * result); +double gsl_sf_debye_2(const double x); + + +/* D_3(x) + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_debye_3_e(const double x, gsl_sf_result * result); +double gsl_sf_debye_3(const double x); + + +/* D_4(x) + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_debye_4_e(const double x, gsl_sf_result * result); +double gsl_sf_debye_4(const double x); + +/* D_5(x) + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_debye_5_e(const double x, gsl_sf_result * result); +double gsl_sf_debye_5(const double x); + +/* D_6(x) + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_debye_6_e(const double x, gsl_sf_result * result); +double gsl_sf_debye_6(const double x); + + +__END_DECLS + +#endif /* __GSL_SF_DEBYE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_dilog.h b/dtm_release/local/include/gsl/gsl_sf_dilog.h new file mode 100644 index 0000000000000000000000000000000000000000..79b2b76f5f51ca0c83e442ddc27a2bc111cd7ddf --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_dilog.h @@ -0,0 +1,130 @@ +/* specfunc/gsl_sf_dilog.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_DILOG_H__ +#define __GSL_SF_DILOG_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Real part of DiLogarithm(x), for real argument. + * In Lewin's notation, this is Li_2(x). + * + * Li_2(x) = - Re[ Integrate[ Log[1-s] / s, {s, 0, x}] ] + * + * The function in the complex plane has a branch point + * at z = 1; we place the cut in the conventional way, + * on [1, +infty). This means that the value for real x > 1 + * is a matter of definition; however, this choice does not + * affect the real part and so is not relevant to the + * interpretation of this implemented function. + */ +int gsl_sf_dilog_e(const double x, gsl_sf_result * result); +double gsl_sf_dilog(const double x); + + +/* DiLogarithm(z), for complex argument z = x + i y. + * Computes the principal branch. + * + * Recall that the branch cut is on the real axis with x > 1. + * The imaginary part of the computed value on the cut is given + * by -Pi*log(x), which is the limiting value taken approaching + * from y < 0. This is a conventional choice, though there is no + * true standardized choice. + * + * Note that there is no canonical way to lift the defining + * contour to the full Riemann surface because of the appearance + * of a "hidden branch point" at z = 0 on non-principal sheets. + * Experts will know the simple algebraic prescription for + * obtaining the sheet they want; non-experts will not want + * to know anything about it. This is why GSL chooses to compute + * only on the principal branch. + */ +int +gsl_sf_complex_dilog_xy_e( + const double x, + const double y, + gsl_sf_result * result_re, + gsl_sf_result * result_im + ); + + + +/* DiLogarithm(z), for complex argument z = r Exp[i theta]. + * Computes the principal branch, thereby assuming an + * implicit reduction of theta to the range (-2 pi, 2 pi). + * + * If theta is identically zero, the imaginary part is computed + * as if approaching from y > 0. For other values of theta no + * special consideration is given, since it is assumed that + * no other machine representations of multiples of pi will + * produce y = 0 precisely. This assumption depends on some + * subtle properties of the machine arithmetic, such as + * correct rounding and monotonicity of the underlying + * implementation of sin() and cos(). + * + * This function is ok, but the interface is confusing since + * it makes it appear that the branch structure is resolved. + * Furthermore the handling of values close to the branch + * cut is subtle. Perhap this interface should be deprecated. + */ +int +gsl_sf_complex_dilog_e( + const double r, + const double theta, + gsl_sf_result * result_re, + gsl_sf_result * result_im + ); + + + +/* Spence integral; spence(s) := Li_2(1-s) + * + * This function has a branch point at 0; we place the + * cut on (-infty,0). Because of our choice for the value + * of Li_2(z) on the cut, spence(s) is continuous as + * s approaches the cut from above. In other words, + * we define spence(x) = spence(x + i 0+). + */ +int +gsl_sf_complex_spence_xy_e( + const double x, + const double y, + gsl_sf_result * real_sp, + gsl_sf_result * imag_sp + ); + + +__END_DECLS + +#endif /* __GSL_SF_DILOG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_elementary.h b/dtm_release/local/include/gsl/gsl_sf_elementary.h new file mode 100644 index 0000000000000000000000000000000000000000..467bfdaabc4097f1d46b5fe12f36d55b0cbc22b2 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_elementary.h @@ -0,0 +1,57 @@ +/* specfunc/gsl_sf_elementary.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +/* Miscellaneous elementary functions and operations. + */ +#ifndef __GSL_SF_ELEMENTARY_H__ +#define __GSL_SF_ELEMENTARY_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Multiplication. + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_multiply_e(const double x, const double y, gsl_sf_result * result); +double gsl_sf_multiply(const double x, const double y); + + +/* Multiplication of quantities with associated errors. + */ +int gsl_sf_multiply_err_e(const double x, const double dx, const double y, const double dy, gsl_sf_result * result); + + +__END_DECLS + +#endif /* __GSL_SF_ELEMENTARY_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_ellint.h b/dtm_release/local/include/gsl/gsl_sf_ellint.h new file mode 100644 index 0000000000000000000000000000000000000000..7d92a1e5ae31cf0bc476421fccd68a200df39624 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_ellint.h @@ -0,0 +1,112 @@ +/* specfunc/gsl_sf_ellint.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_ELLINT_H__ +#define __GSL_SF_ELLINT_H__ + +#include <gsl/gsl_mode.h> +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Legendre form of complete elliptic integrals + * + * K(k) = Integral[1/Sqrt[1 - k^2 Sin[t]^2], {t, 0, Pi/2}] + * E(k) = Integral[ Sqrt[1 - k^2 Sin[t]^2], {t, 0, Pi/2}] + * + * exceptions: GSL_EDOM + */ +int gsl_sf_ellint_Kcomp_e(double k, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_Kcomp(double k, gsl_mode_t mode); + +int gsl_sf_ellint_Ecomp_e(double k, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_Ecomp(double k, gsl_mode_t mode); + +int gsl_sf_ellint_Pcomp_e(double k, double n, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_Pcomp(double k, double n, gsl_mode_t mode); + +int gsl_sf_ellint_Dcomp_e(double k, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_Dcomp(double k, gsl_mode_t mode); + + +/* Legendre form of incomplete elliptic integrals + * + * F(phi,k) = Integral[1/Sqrt[1 - k^2 Sin[t]^2], {t, 0, phi}] + * E(phi,k) = Integral[ Sqrt[1 - k^2 Sin[t]^2], {t, 0, phi}] + * P(phi,k,n) = Integral[(1 + n Sin[t]^2)^(-1)/Sqrt[1 - k^2 Sin[t]^2], {t, 0, phi}] + * D(phi,k,n) = R_D(1-Sin[phi]^2, 1-k^2 Sin[phi]^2, 1.0) + * + * F: [Carlson, Numerische Mathematik 33 (1979) 1, (4.1)] + * E: [Carlson, ", (4.2)] + * P: [Carlson, ", (4.3)] + * D: [Carlson, ", (4.4)] + * + * exceptions: GSL_EDOM + */ +int gsl_sf_ellint_F_e(double phi, double k, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_F(double phi, double k, gsl_mode_t mode); + +int gsl_sf_ellint_E_e(double phi, double k, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_E(double phi, double k, gsl_mode_t mode); + +int gsl_sf_ellint_P_e(double phi, double k, double n, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_P(double phi, double k, double n, gsl_mode_t mode); + +int gsl_sf_ellint_D_e(double phi, double k, double n, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_D(double phi, double k, double n, gsl_mode_t mode); + + +/* Carlson's symmetric basis of functions + * + * RC(x,y) = 1/2 Integral[(t+x)^(-1/2) (t+y)^(-1)], {t,0,Inf}] + * RD(x,y,z) = 3/2 Integral[(t+x)^(-1/2) (t+y)^(-1/2) (t+z)^(-3/2), {t,0,Inf}] + * RF(x,y,z) = 1/2 Integral[(t+x)^(-1/2) (t+y)^(-1/2) (t+z)^(-1/2), {t,0,Inf}] + * RJ(x,y,z,p) = 3/2 Integral[(t+x)^(-1/2) (t+y)^(-1/2) (t+z)^(-1/2) (t+p)^(-1), {t,0,Inf}] + * + * exceptions: GSL_EDOM + */ +int gsl_sf_ellint_RC_e(double x, double y, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_RC(double x, double y, gsl_mode_t mode); + +int gsl_sf_ellint_RD_e(double x, double y, double z, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_RD(double x, double y, double z, gsl_mode_t mode); + +int gsl_sf_ellint_RF_e(double x, double y, double z, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_RF(double x, double y, double z, gsl_mode_t mode); + +int gsl_sf_ellint_RJ_e(double x, double y, double z, double p, gsl_mode_t mode, gsl_sf_result * result); +double gsl_sf_ellint_RJ(double x, double y, double z, double p, gsl_mode_t mode); + + +__END_DECLS + +#endif /* __GSL_SF_ELLINT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_elljac.h b/dtm_release/local/include/gsl/gsl_sf_elljac.h new file mode 100644 index 0000000000000000000000000000000000000000..7f804a5c504d60ed04ad05e8c3823e3f599e247f --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_elljac.h @@ -0,0 +1,48 @@ +/* specfunc/gsl_sf_elljac.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_ELLJAC_H__ +#define __GSL_SF_ELLJAC_H__ + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Jacobian elliptic functions sn, dn, cn, + * by descending Landen transformations + * + * exceptions: GSL_EDOM + */ +int gsl_sf_elljac_e(double u, double m, double * sn, double * cn, double * dn); + + +__END_DECLS + +#endif /* __GSL_SF_ELLJAC_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_erf.h b/dtm_release/local/include/gsl/gsl_sf_erf.h new file mode 100644 index 0000000000000000000000000000000000000000..a196d0dfe3d2f556fe97b1d9afe602d1427dd731 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_erf.h @@ -0,0 +1,91 @@ +/* specfunc/gsl_sf_erf.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_ERF_H__ +#define __GSL_SF_ERF_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Complementary Error Function + * erfc(x) := 2/Sqrt[Pi] Integrate[Exp[-t^2], {t,x,Infinity}] + * + * exceptions: none + */ +int gsl_sf_erfc_e(double x, gsl_sf_result * result); +double gsl_sf_erfc(double x); + + +/* Log Complementary Error Function + * + * exceptions: none + */ +int gsl_sf_log_erfc_e(double x, gsl_sf_result * result); +double gsl_sf_log_erfc(double x); + + +/* Error Function + * erf(x) := 2/Sqrt[Pi] Integrate[Exp[-t^2], {t,0,x}] + * + * exceptions: none + */ +int gsl_sf_erf_e(double x, gsl_sf_result * result); +double gsl_sf_erf(double x); + + +/* Probability functions: + * Z(x) : Abramowitz+Stegun 26.2.1 + * Q(x) : Abramowitz+Stegun 26.2.3 + * + * exceptions: none + */ +int gsl_sf_erf_Z_e(double x, gsl_sf_result * result); +int gsl_sf_erf_Q_e(double x, gsl_sf_result * result); +double gsl_sf_erf_Z(double x); +double gsl_sf_erf_Q(double x); + + +/* Hazard function, also known as the inverse Mill's ratio. + * + * H(x) := Z(x)/Q(x) + * = Sqrt[2/Pi] Exp[-x^2 / 2] / Erfc[x/Sqrt[2]] + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_hazard_e(double x, gsl_sf_result * result); +double gsl_sf_hazard(double x); + + +__END_DECLS + +#endif /* __GSL_SF_ERF_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_exp.h b/dtm_release/local/include/gsl/gsl_sf_exp.h new file mode 100644 index 0000000000000000000000000000000000000000..331460d5dccb1650cf0a569f193f994fbf1efb8a --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_exp.h @@ -0,0 +1,132 @@ +/* specfunc/gsl_sf_exp.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_EXP_H__ +#define __GSL_SF_EXP_H__ + +#include <gsl/gsl_sf_result.h> +#include <gsl/gsl_precision.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Provide an exp() function with GSL semantics, + * i.e. with proper error checking, etc. + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_exp_e(const double x, gsl_sf_result * result); +double gsl_sf_exp(const double x); + + +/* Exp(x) + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_exp_e10_e(const double x, gsl_sf_result_e10 * result); + + +/* Exponentiate and multiply by a given factor: y * Exp(x) + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_exp_mult_e(const double x, const double y, gsl_sf_result * result); +double gsl_sf_exp_mult(const double x, const double y); + + +/* Exponentiate and multiply by a given factor: y * Exp(x) + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_exp_mult_e10_e(const double x, const double y, gsl_sf_result_e10 * result); + + +/* exp(x)-1 + * + * exceptions: GSL_EOVRFLW + */ +int gsl_sf_expm1_e(const double x, gsl_sf_result * result); +double gsl_sf_expm1(const double x); + + +/* (exp(x)-1)/x = 1 + x/2 + x^2/(2*3) + x^3/(2*3*4) + ... + * + * exceptions: GSL_EOVRFLW + */ +int gsl_sf_exprel_e(const double x, gsl_sf_result * result); +double gsl_sf_exprel(const double x); + + +/* 2(exp(x)-1-x)/x^2 = 1 + x/3 + x^2/(3*4) + x^3/(3*4*5) + ... + * + * exceptions: GSL_EOVRFLW + */ +int gsl_sf_exprel_2_e(double x, gsl_sf_result * result); +double gsl_sf_exprel_2(const double x); + + +/* Similarly for the N-th generalization of + * the above. The so-called N-relative exponential + * + * exprel_N(x) = N!/x^N (exp(x) - Sum[x^k/k!, {k,0,N-1}]) + * = 1 + x/(N+1) + x^2/((N+1)(N+2)) + ... + * = 1F1(1,1+N,x) + */ +int gsl_sf_exprel_n_e(const int n, const double x, gsl_sf_result * result); +double gsl_sf_exprel_n(const int n, const double x); + + +/* Exponentiate a quantity with an associated error. + */ +int gsl_sf_exp_err_e(const double x, const double dx, gsl_sf_result * result); + +/* Exponentiate a quantity with an associated error. + */ +int gsl_sf_exp_err_e10_e(const double x, const double dx, gsl_sf_result_e10 * result); + + +/* Exponentiate and multiply by a given factor: y * Exp(x), + * for quantities with associated errors. + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_exp_mult_err_e(const double x, const double dx, const double y, const double dy, gsl_sf_result * result); + + +/* Exponentiate and multiply by a given factor: y * Exp(x), + * for quantities with associated errors. + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_exp_mult_err_e10_e(const double x, const double dx, const double y, const double dy, gsl_sf_result_e10 * result); + +__END_DECLS + +#endif /* __GSL_SF_EXP_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_expint.h b/dtm_release/local/include/gsl/gsl_sf_expint.h new file mode 100644 index 0000000000000000000000000000000000000000..4005f72a678c03568767bc022cefb9ee0c025527 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_expint.h @@ -0,0 +1,167 @@ +/* specfunc/gsl_sf_expint.h + * + * Copyright (C) 2007 Brian Gough + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_EXPINT_H__ +#define __GSL_SF_EXPINT_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* E_1(x) := Re[ Integrate[ Exp[-xt]/t, {t,1,Infinity}] ] + * + * x != 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_expint_E1_e(const double x, gsl_sf_result * result); +double gsl_sf_expint_E1(const double x); + + +/* E_2(x) := Re[ Integrate[ Exp[-xt]/t^2, {t,1,Infinity}] ] + * + * x != 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_expint_E2_e(const double x, gsl_sf_result * result); +double gsl_sf_expint_E2(const double x); + + +/* E_n(x) := Re[ Integrate[ Exp[-xt]/t^n, {t,1,Infinity}] ] + * + * x != 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_expint_En_e(const int n, const double x, gsl_sf_result * result); +double gsl_sf_expint_En(const int n, const double x); + + +/* E_1_scaled(x) := exp(x) E_1(x) + * + * x != 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_expint_E1_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_expint_E1_scaled(const double x); + + +/* E_2_scaled(x) := exp(x) E_2(x) + * + * x != 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_expint_E2_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_expint_E2_scaled(const double x); + +/* E_n_scaled(x) := exp(x) E_n(x) + * + * x != 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_expint_En_scaled_e(const int n, const double x, gsl_sf_result * result); +double gsl_sf_expint_En_scaled(const int n, const double x); + + +/* Ei(x) := - PV Integrate[ Exp[-t]/t, {t,-x,Infinity}] + * := PV Integrate[ Exp[t]/t, {t,-Infinity,x}] + * + * x != 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_expint_Ei_e(const double x, gsl_sf_result * result); +double gsl_sf_expint_Ei(const double x); + + +/* Ei_scaled(x) := exp(-x) Ei(x) + * + * x != 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_expint_Ei_scaled_e(const double x, gsl_sf_result * result); +double gsl_sf_expint_Ei_scaled(const double x); + + +/* Shi(x) := Integrate[ Sinh[t]/t, {t,0,x}] + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_Shi_e(const double x, gsl_sf_result * result); +double gsl_sf_Shi(const double x); + + +/* Chi(x) := Re[ M_EULER + log(x) + Integrate[(Cosh[t]-1)/t, {t,0,x}] ] + * + * x != 0.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_Chi_e(const double x, gsl_sf_result * result); +double gsl_sf_Chi(const double x); + + +/* Ei_3(x) := Integral[ Exp[-t^3], {t,0,x}] + * + * x >= 0.0 + * exceptions: GSL_EDOM + */ +int gsl_sf_expint_3_e(const double x, gsl_sf_result * result); +double gsl_sf_expint_3(double x); + + +/* Si(x) := Integrate[ Sin[t]/t, {t,0,x}] + * + * exceptions: none + */ +int gsl_sf_Si_e(const double x, gsl_sf_result * result); +double gsl_sf_Si(const double x); + + +/* Ci(x) := -Integrate[ Cos[t]/t, {t,x,Infinity}] + * + * x > 0.0 + * exceptions: GSL_EDOM + */ +int gsl_sf_Ci_e(const double x, gsl_sf_result * result); +double gsl_sf_Ci(const double x); + + +/* AtanInt(x) := Integral[ Arctan[t]/t, {t,0,x}] + * + * + * exceptions: + */ +int gsl_sf_atanint_e(const double x, gsl_sf_result * result); +double gsl_sf_atanint(const double x); + + +__END_DECLS + +#endif /* __GSL_SF_EXPINT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_fermi_dirac.h b/dtm_release/local/include/gsl/gsl_sf_fermi_dirac.h new file mode 100644 index 0000000000000000000000000000000000000000..8f708cd2b3778ce2a73090f155a321cbd9672c31 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_fermi_dirac.h @@ -0,0 +1,126 @@ +/* specfunc/gsl_sf_fermi_dirac.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_FERMI_DIRAC_H__ +#define __GSL_SF_FERMI_DIRAC_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Complete Fermi-Dirac Integrals: + * + * F_j(x) := 1/Gamma[j+1] Integral[ t^j /(Exp[t-x] + 1), {t,0,Infinity}] + * + * + * Incomplete Fermi-Dirac Integrals: + * + * F_j(x,b) := 1/Gamma[j+1] Integral[ t^j /(Exp[t-x] + 1), {t,b,Infinity}] + */ + + +/* Complete integral F_{-1}(x) = e^x / (1 + e^x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_fermi_dirac_m1_e(const double x, gsl_sf_result * result); +double gsl_sf_fermi_dirac_m1(const double x); + + +/* Complete integral F_0(x) = ln(1 + e^x) + * + * exceptions: GSL_EUNDRFLW + */ +int gsl_sf_fermi_dirac_0_e(const double x, gsl_sf_result * result); +double gsl_sf_fermi_dirac_0(const double x); + + +/* Complete integral F_1(x) + * + * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_fermi_dirac_1_e(const double x, gsl_sf_result * result); +double gsl_sf_fermi_dirac_1(const double x); + + +/* Complete integral F_2(x) + * + * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_fermi_dirac_2_e(const double x, gsl_sf_result * result); +double gsl_sf_fermi_dirac_2(const double x); + + +/* Complete integral F_j(x) + * for integer j + * + * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_fermi_dirac_int_e(const int j, const double x, gsl_sf_result * result); +double gsl_sf_fermi_dirac_int(const int j, const double x); + + +/* Complete integral F_{-1/2}(x) + * + * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_fermi_dirac_mhalf_e(const double x, gsl_sf_result * result); +double gsl_sf_fermi_dirac_mhalf(const double x); + + +/* Complete integral F_{1/2}(x) + * + * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_fermi_dirac_half_e(const double x, gsl_sf_result * result); +double gsl_sf_fermi_dirac_half(const double x); + + +/* Complete integral F_{3/2}(x) + * + * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_fermi_dirac_3half_e(const double x, gsl_sf_result * result); +double gsl_sf_fermi_dirac_3half(const double x); + + +/* Incomplete integral F_0(x,b) = ln(1 + e^(b-x)) - (b-x) + * + * exceptions: GSL_EUNDRFLW, GSL_EDOM + */ +int gsl_sf_fermi_dirac_inc_0_e(const double x, const double b, gsl_sf_result * result); +double gsl_sf_fermi_dirac_inc_0(const double x, const double b); + + +__END_DECLS + +#endif /* __GSL_SF_FERMI_DIRAC_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_gamma.h b/dtm_release/local/include/gsl/gsl_sf_gamma.h new file mode 100644 index 0000000000000000000000000000000000000000..a06b74edd456d2220d8614fd20fdacb58890a997 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_gamma.h @@ -0,0 +1,293 @@ +/* specfunc/gsl_sf_gamma.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_GAMMA_H__ +#define __GSL_SF_GAMMA_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Log[Gamma(x)], x not a negative integer + * Uses real Lanczos method. + * Returns the real part of Log[Gamma[x]] when x < 0, + * i.e. Log[|Gamma[x]|]. + * + * exceptions: GSL_EDOM, GSL_EROUND + */ +int gsl_sf_lngamma_e(double x, gsl_sf_result * result); +double gsl_sf_lngamma(const double x); + + +/* Log[Gamma(x)], x not a negative integer + * Uses real Lanczos method. Determines + * the sign of Gamma[x] as well as Log[|Gamma[x]|] for x < 0. + * So Gamma[x] = sgn * Exp[result_lg]. + * + * exceptions: GSL_EDOM, GSL_EROUND + */ +int gsl_sf_lngamma_sgn_e(double x, gsl_sf_result * result_lg, double *sgn); + + +/* Gamma(x), x not a negative integer + * Uses real Lanczos method. + * + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EROUND + */ +int gsl_sf_gamma_e(const double x, gsl_sf_result * result); +double gsl_sf_gamma(const double x); + + +/* Regulated Gamma Function, x > 0 + * Gamma^*(x) = Gamma(x)/(Sqrt[2Pi] x^(x-1/2) exp(-x)) + * = (1 + 1/(12x) + ...), x->Inf + * A useful suggestion of Temme. + * + * exceptions: GSL_EDOM + */ +int gsl_sf_gammastar_e(const double x, gsl_sf_result * result); +double gsl_sf_gammastar(const double x); + + +/* 1/Gamma(x) + * Uses real Lanczos method. + * + * exceptions: GSL_EUNDRFLW, GSL_EROUND + */ +int gsl_sf_gammainv_e(const double x, gsl_sf_result * result); +double gsl_sf_gammainv(const double x); + + +/* Log[Gamma(z)] for z complex, z not a negative integer + * Uses complex Lanczos method. Note that the phase part (arg) + * is not well-determined when |z| is very large, due + * to inevitable roundoff in restricting to (-Pi,Pi]. + * This will raise the GSL_ELOSS exception when it occurs. + * The absolute value part (lnr), however, never suffers. + * + * Calculates: + * lnr = log|Gamma(z)| + * arg = arg(Gamma(z)) in (-Pi, Pi] + * + * exceptions: GSL_EDOM, GSL_ELOSS + */ +int gsl_sf_lngamma_complex_e(double zr, double zi, gsl_sf_result * lnr, gsl_sf_result * arg); + + +/* x^n / n! + * + * x >= 0.0, n >= 0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_taylorcoeff_e(const int n, const double x, gsl_sf_result * result); +double gsl_sf_taylorcoeff(const int n, const double x); + + +/* n! + * + * exceptions: GSL_EDOM, GSL_OVRFLW + */ +int gsl_sf_fact_e(const unsigned int n, gsl_sf_result * result); +double gsl_sf_fact(const unsigned int n); + + +/* n!! = n(n-2)(n-4) ... + * + * exceptions: GSL_EDOM, GSL_OVRFLW + */ +int gsl_sf_doublefact_e(const unsigned int n, gsl_sf_result * result); +double gsl_sf_doublefact(const unsigned int n); + + +/* log(n!) + * Faster than ln(Gamma(n+1)) for n < 170; defers for larger n. + * + * exceptions: none + */ +int gsl_sf_lnfact_e(const unsigned int n, gsl_sf_result * result); +double gsl_sf_lnfact(const unsigned int n); + + +/* log(n!!) + * + * exceptions: none + */ +int gsl_sf_lndoublefact_e(const unsigned int n, gsl_sf_result * result); +double gsl_sf_lndoublefact(const unsigned int n); + + +/* log(n choose m) + * + * exceptions: GSL_EDOM + */ +int gsl_sf_lnchoose_e(unsigned int n, unsigned int m, gsl_sf_result * result); +double gsl_sf_lnchoose(unsigned int n, unsigned int m); + + +/* n choose m + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_choose_e(unsigned int n, unsigned int m, gsl_sf_result * result); +double gsl_sf_choose(unsigned int n, unsigned int m); + + +/* Logarithm of Pochhammer (Apell) symbol + * log( (a)_x ) + * where (a)_x := Gamma[a + x]/Gamma[a] + * + * a > 0, a+x > 0 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_lnpoch_e(const double a, const double x, gsl_sf_result * result); +double gsl_sf_lnpoch(const double a, const double x); + + +/* Logarithm of Pochhammer (Apell) symbol, with sign information. + * result = log( |(a)_x| ) + * sgn = sgn( (a)_x ) + * where (a)_x := Gamma[a + x]/Gamma[a] + * + * a != neg integer, a+x != neg integer + * + * exceptions: GSL_EDOM + */ +int gsl_sf_lnpoch_sgn_e(const double a, const double x, gsl_sf_result * result, double * sgn); + + +/* Pochhammer (Apell) symbol + * (a)_x := Gamma[a + x]/Gamma[x] + * + * a != neg integer, a+x != neg integer + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_poch_e(const double a, const double x, gsl_sf_result * result); +double gsl_sf_poch(const double a, const double x); + + +/* Relative Pochhammer (Apell) symbol + * ((a,x) - 1)/x + * where (a,x) = (a)_x := Gamma[a + x]/Gamma[a] + * + * exceptions: GSL_EDOM + */ +int gsl_sf_pochrel_e(const double a, const double x, gsl_sf_result * result); +double gsl_sf_pochrel(const double a, const double x); + + +/* Normalized Incomplete Gamma Function + * + * Q(a,x) = 1/Gamma(a) Integral[ t^(a-1) e^(-t), {t,x,Infinity} ] + * + * a >= 0, x >= 0 + * Q(a,0) := 1 + * Q(0,x) := 0, x != 0 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_gamma_inc_Q_e(const double a, const double x, gsl_sf_result * result); +double gsl_sf_gamma_inc_Q(const double a, const double x); + + +/* Complementary Normalized Incomplete Gamma Function + * + * P(a,x) = 1/Gamma(a) Integral[ t^(a-1) e^(-t), {t,0,x} ] + * + * a > 0, x >= 0 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_gamma_inc_P_e(const double a, const double x, gsl_sf_result * result); +double gsl_sf_gamma_inc_P(const double a, const double x); + + +/* Non-normalized Incomplete Gamma Function + * + * Gamma(a,x) := Integral[ t^(a-1) e^(-t), {t,x,Infinity} ] + * + * x >= 0.0 + * Gamma(a, 0) := Gamma(a) + * + * exceptions: GSL_EDOM + */ +int gsl_sf_gamma_inc_e(const double a, const double x, gsl_sf_result * result); +double gsl_sf_gamma_inc(const double a, const double x); + + +/* Logarithm of Beta Function + * Log[B(a,b)] + * + * a > 0, b > 0 + * exceptions: GSL_EDOM + */ +int gsl_sf_lnbeta_e(const double a, const double b, gsl_sf_result * result); +double gsl_sf_lnbeta(const double a, const double b); + +int gsl_sf_lnbeta_sgn_e(const double x, const double y, gsl_sf_result * result, double * sgn); + + +/* Beta Function + * B(a,b) + * + * a > 0, b > 0 + * exceptions: GSL_EDOM, GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_beta_e(const double a, const double b, gsl_sf_result * result); +double gsl_sf_beta(const double a, const double b); + + +/* Normalized Incomplete Beta Function + * B_x(a,b)/B(a,b) + * + * a > 0, b > 0, 0 <= x <= 1 + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_beta_inc_e(const double a, const double b, const double x, gsl_sf_result * result); +double gsl_sf_beta_inc(const double a, const double b, const double x); + + +/* The maximum x such that gamma(x) is not + * considered an overflow. + */ +#define GSL_SF_GAMMA_XMAX 171.0 + +/* The maximum n such that gsl_sf_fact(n) does not give an overflow. */ +#define GSL_SF_FACT_NMAX 170 + +/* The maximum n such that gsl_sf_doublefact(n) does not give an overflow. */ +#define GSL_SF_DOUBLEFACT_NMAX 297 + +__END_DECLS + +#endif /* __GSL_SF_GAMMA_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_gegenbauer.h b/dtm_release/local/include/gsl/gsl_sf_gegenbauer.h new file mode 100644 index 0000000000000000000000000000000000000000..bf41d218ee91c3c2d061b798f44263906f014134 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_gegenbauer.h @@ -0,0 +1,73 @@ +/* specfunc/gsl_sf_gegenbauer.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_GEGENBAUER_H__ +#define __GSL_SF_GEGENBAUER_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Evaluate Gegenbauer polynomials + * using explicit representations. + * + * exceptions: none + */ +int gsl_sf_gegenpoly_1_e(double lambda, double x, gsl_sf_result * result); +int gsl_sf_gegenpoly_2_e(double lambda, double x, gsl_sf_result * result); +int gsl_sf_gegenpoly_3_e(double lambda, double x, gsl_sf_result * result); +double gsl_sf_gegenpoly_1(double lambda, double x); +double gsl_sf_gegenpoly_2(double lambda, double x); +double gsl_sf_gegenpoly_3(double lambda, double x); + + +/* Evaluate Gegenbauer polynomials. + * + * lambda > -1/2, n >= 0 + * exceptions: GSL_EDOM + */ +int gsl_sf_gegenpoly_n_e(int n, double lambda, double x, gsl_sf_result * result); +double gsl_sf_gegenpoly_n(int n, double lambda, double x); + + +/* Calculate array of Gegenbauer polynomials + * for n = (0, 1, 2, ... nmax) + * + * lambda > -1/2, nmax >= 0 + * exceptions: GSL_EDOM + */ +int gsl_sf_gegenpoly_array(int nmax, double lambda, double x, double * result_array); + + +__END_DECLS + +#endif /* __GSL_SF_GEGENBAUER_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_hyperg.h b/dtm_release/local/include/gsl/gsl_sf_hyperg.h new file mode 100644 index 0000000000000000000000000000000000000000..8366b88d04cd3c1048dd0f64711508bc92b33703 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_hyperg.h @@ -0,0 +1,154 @@ +/* specfunc/gsl_sf_hyperg.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_HYPERG_H__ +#define __GSL_SF_HYPERG_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Hypergeometric function related to Bessel functions + * 0F1[c,x] = + * Gamma[c] x^(1/2(1-c)) I_{c-1}(2 Sqrt[x]) + * Gamma[c] (-x)^(1/2(1-c)) J_{c-1}(2 Sqrt[-x]) + * + * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW + */ +int gsl_sf_hyperg_0F1_e(double c, double x, gsl_sf_result * result); +double gsl_sf_hyperg_0F1(const double c, const double x); + + +/* Confluent hypergeometric function for integer parameters. + * 1F1[m,n,x] = M(m,n,x) + * + * exceptions: + */ +int gsl_sf_hyperg_1F1_int_e(const int m, const int n, const double x, gsl_sf_result * result); +double gsl_sf_hyperg_1F1_int(const int m, const int n, double x); + + +/* Confluent hypergeometric function. + * 1F1[a,b,x] = M(a,b,x) + * + * exceptions: + */ +int gsl_sf_hyperg_1F1_e(const double a, const double b, const double x, gsl_sf_result * result); +double gsl_sf_hyperg_1F1(double a, double b, double x); + + +/* Confluent hypergeometric function for integer parameters. + * U(m,n,x) + * + * exceptions: + */ +int gsl_sf_hyperg_U_int_e(const int m, const int n, const double x, gsl_sf_result * result); +double gsl_sf_hyperg_U_int(const int m, const int n, const double x); + + +/* Confluent hypergeometric function for integer parameters. + * U(m,n,x) + * + * exceptions: + */ +int gsl_sf_hyperg_U_int_e10_e(const int m, const int n, const double x, gsl_sf_result_e10 * result); + + +/* Confluent hypergeometric function. + * U(a,b,x) + * + * exceptions: + */ +int gsl_sf_hyperg_U_e(const double a, const double b, const double x, gsl_sf_result * result); +double gsl_sf_hyperg_U(const double a, const double b, const double x); + + +/* Confluent hypergeometric function. + * U(a,b,x) + * + * exceptions: + */ +int gsl_sf_hyperg_U_e10_e(const double a, const double b, const double x, gsl_sf_result_e10 * result); + + +/* Gauss hypergeometric function 2F1[a,b,c,x] + * |x| < 1 + * + * exceptions: + */ +int gsl_sf_hyperg_2F1_e(double a, double b, const double c, const double x, gsl_sf_result * result); +double gsl_sf_hyperg_2F1(double a, double b, double c, double x); + + +/* Gauss hypergeometric function + * 2F1[aR + I aI, aR - I aI, c, x] + * |x| < 1 + * + * exceptions: + */ +int gsl_sf_hyperg_2F1_conj_e(const double aR, const double aI, const double c, const double x, gsl_sf_result * result); +double gsl_sf_hyperg_2F1_conj(double aR, double aI, double c, double x); + + +/* Renormalized Gauss hypergeometric function + * 2F1[a,b,c,x] / Gamma[c] + * |x| < 1 + * + * exceptions: + */ +int gsl_sf_hyperg_2F1_renorm_e(const double a, const double b, const double c, const double x, gsl_sf_result * result); +double gsl_sf_hyperg_2F1_renorm(double a, double b, double c, double x); + + +/* Renormalized Gauss hypergeometric function + * 2F1[aR + I aI, aR - I aI, c, x] / Gamma[c] + * |x| < 1 + * + * exceptions: + */ +int gsl_sf_hyperg_2F1_conj_renorm_e(const double aR, const double aI, const double c, const double x, gsl_sf_result * result); +double gsl_sf_hyperg_2F1_conj_renorm(double aR, double aI, double c, double x); + + +/* Mysterious hypergeometric function. The series representation + * is a divergent hypergeometric series. However, for x < 0 we + * have 2F0(a,b,x) = (-1/x)^a U(a,1+a-b,-1/x) + * + * exceptions: GSL_EDOM + */ +int gsl_sf_hyperg_2F0_e(const double a, const double b, const double x, gsl_sf_result * result); +double gsl_sf_hyperg_2F0(const double a, const double b, const double x); + + +__END_DECLS + +#endif /* __GSL_SF_HYPERG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_laguerre.h b/dtm_release/local/include/gsl/gsl_sf_laguerre.h new file mode 100644 index 0000000000000000000000000000000000000000..0d7f1c370b53e79d5eecee8fff54d43a5b085b6f --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_laguerre.h @@ -0,0 +1,68 @@ +/* specfunc/gsl_sf_laguerre.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_LAGUERRE_H__ +#define __GSL_SF_LAGUERRE_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* L^a_n(x) = (a+1)_n / n! 1F1(-n,a+1,x) */ + + +/* Evaluate generalized Laguerre polynomials + * using explicit representations. + * + * exceptions: none + */ +int gsl_sf_laguerre_1_e(const double a, const double x, gsl_sf_result * result); +int gsl_sf_laguerre_2_e(const double a, const double x, gsl_sf_result * result); +int gsl_sf_laguerre_3_e(const double a, const double x, gsl_sf_result * result); +double gsl_sf_laguerre_1(double a, double x); +double gsl_sf_laguerre_2(double a, double x); +double gsl_sf_laguerre_3(double a, double x); + + +/* Evaluate generalized Laguerre polynomials. + * + * a > -1.0 + * n >= 0 + * exceptions: GSL_EDOM + */ +int gsl_sf_laguerre_n_e(const int n, const double a, const double x, gsl_sf_result * result); +double gsl_sf_laguerre_n(int n, double a, double x); + + +__END_DECLS + +#endif /* __GSL_SF_LAGUERRE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_lambert.h b/dtm_release/local/include/gsl/gsl_sf_lambert.h new file mode 100644 index 0000000000000000000000000000000000000000..53b70a3a3f7296e9016865d8b73585404fbb2257 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_lambert.h @@ -0,0 +1,69 @@ +/* specfunc/gsl_sf_lambert.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_LAMBERT_H__ +#define __GSL_SF_LAMBERT_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Lambert's Function W_0(x) + * + * W_0(x) is the principal branch of the + * implicit function defined by W e^W = x. + * + * -1/E < x < \infty + * + * exceptions: GSL_EMAXITER; + */ +int gsl_sf_lambert_W0_e(double x, gsl_sf_result * result); +double gsl_sf_lambert_W0(double x); + + +/* Lambert's Function W_{-1}(x) + * + * W_{-1}(x) is the second real branch of the + * implicit function defined by W e^W = x. + * It agrees with W_0(x) when x >= 0. + * + * -1/E < x < \infty + * + * exceptions: GSL_MAXITER; + */ +int gsl_sf_lambert_Wm1_e(double x, gsl_sf_result * result); +double gsl_sf_lambert_Wm1(double x); + + +__END_DECLS + +#endif /* __GSL_SF_LAMBERT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_legendre.h b/dtm_release/local/include/gsl/gsl_sf_legendre.h new file mode 100644 index 0000000000000000000000000000000000000000..235244f0ffc83a01dc1be1e7820b077ecce05632 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_legendre.h @@ -0,0 +1,326 @@ +/* specfunc/gsl_sf_legendre.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_LEGENDRE_H__ +#define __GSL_SF_LEGENDRE_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* P_l(x) l >= 0; |x| <= 1 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_Pl_e(const int l, const double x, gsl_sf_result * result); +double gsl_sf_legendre_Pl(const int l, const double x); + + +/* P_l(x) for l=0,...,lmax; |x| <= 1 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_Pl_array( + const int lmax, const double x, + double * result_array + ); + + +/* P_l(x) and P_l'(x) for l=0,...,lmax; |x| <= 1 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_Pl_deriv_array( + const int lmax, const double x, + double * result_array, + double * result_deriv_array + ); + + +/* P_l(x), l=1,2,3 + * + * exceptions: none + */ +int gsl_sf_legendre_P1_e(double x, gsl_sf_result * result); +int gsl_sf_legendre_P2_e(double x, gsl_sf_result * result); +int gsl_sf_legendre_P3_e(double x, gsl_sf_result * result); +double gsl_sf_legendre_P1(const double x); +double gsl_sf_legendre_P2(const double x); +double gsl_sf_legendre_P3(const double x); + + +/* Q_0(x), x > -1, x != 1 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_Q0_e(const double x, gsl_sf_result * result); +double gsl_sf_legendre_Q0(const double x); + + +/* Q_1(x), x > -1, x != 1 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_Q1_e(const double x, gsl_sf_result * result); +double gsl_sf_legendre_Q1(const double x); + + +/* Q_l(x), x > -1, x != 1, l >= 0 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_Ql_e(const int l, const double x, gsl_sf_result * result); +double gsl_sf_legendre_Ql(const int l, const double x); + + +/* P_l^m(x) m >= 0; l >= m; |x| <= 1.0 + * + * Note that this function grows combinatorially with l. + * Therefore we can easily generate an overflow for l larger + * than about 150. + * + * There is no trouble for small m, but when m and l are both large, + * then there will be trouble. Rather than allow overflows, these + * functions refuse to calculate when they can sense that l and m are + * too big. + * + * If you really want to calculate a spherical harmonic, then DO NOT + * use this. Instead use legendre_sphPlm() below, which uses a similar + * recursion, but with the normalized functions. + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_legendre_Plm_e(const int l, const int m, const double x, gsl_sf_result * result); +double gsl_sf_legendre_Plm(const int l, const int m, const double x); + + +/* P_l^m(x) m >= 0; l >= m; |x| <= 1.0 + * l=|m|,...,lmax + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_legendre_Plm_array( + const int lmax, const int m, const double x, + double * result_array + ); + + +/* P_l^m(x) and d(P_l^m(x))/dx; m >= 0; lmax >= m; |x| <= 1.0 + * l=|m|,...,lmax + * + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_legendre_Plm_deriv_array( + const int lmax, const int m, const double x, + double * result_array, + double * result_deriv_array + ); + + +/* P_l^m(x), normalized properly for use in spherical harmonics + * m >= 0; l >= m; |x| <= 1.0 + * + * There is no overflow problem, as there is for the + * standard normalization of P_l^m(x). + * + * Specifically, it returns: + * + * sqrt((2l+1)/(4pi)) sqrt((l-m)!/(l+m)!) P_l^m(x) + * + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_sphPlm_e(const int l, int m, const double x, gsl_sf_result * result); +double gsl_sf_legendre_sphPlm(const int l, const int m, const double x); + + +/* sphPlm(l,m,x) values + * m >= 0; l >= m; |x| <= 1.0 + * l=|m|,...,lmax + * + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_sphPlm_array( + const int lmax, int m, const double x, + double * result_array + ); + + +/* sphPlm(l,m,x) and d(sphPlm(l,m,x))/dx values + * m >= 0; l >= m; |x| <= 1.0 + * l=|m|,...,lmax + * + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_sphPlm_deriv_array( + const int lmax, const int m, const double x, + double * result_array, + double * result_deriv_array + ); + + + +/* size of result_array[] needed for the array versions of Plm + * (lmax - m + 1) + */ +int gsl_sf_legendre_array_size(const int lmax, const int m); + + +/* Irregular Spherical Conical Function + * P^{1/2}_{-1/2 + I lambda}(x) + * + * x > -1.0 + * exceptions: GSL_EDOM + */ +int gsl_sf_conicalP_half_e(const double lambda, const double x, gsl_sf_result * result); +double gsl_sf_conicalP_half(const double lambda, const double x); + + +/* Regular Spherical Conical Function + * P^{-1/2}_{-1/2 + I lambda}(x) + * + * x > -1.0 + * exceptions: GSL_EDOM + */ +int gsl_sf_conicalP_mhalf_e(const double lambda, const double x, gsl_sf_result * result); +double gsl_sf_conicalP_mhalf(const double lambda, const double x); + + +/* Conical Function + * P^{0}_{-1/2 + I lambda}(x) + * + * x > -1.0 + * exceptions: GSL_EDOM + */ +int gsl_sf_conicalP_0_e(const double lambda, const double x, gsl_sf_result * result); +double gsl_sf_conicalP_0(const double lambda, const double x); + + +/* Conical Function + * P^{1}_{-1/2 + I lambda}(x) + * + * x > -1.0 + * exceptions: GSL_EDOM + */ +int gsl_sf_conicalP_1_e(const double lambda, const double x, gsl_sf_result * result); +double gsl_sf_conicalP_1(const double lambda, const double x); + + +/* Regular Spherical Conical Function + * P^{-1/2-l}_{-1/2 + I lambda}(x) + * + * x > -1.0, l >= -1 + * exceptions: GSL_EDOM + */ +int gsl_sf_conicalP_sph_reg_e(const int l, const double lambda, const double x, gsl_sf_result * result); +double gsl_sf_conicalP_sph_reg(const int l, const double lambda, const double x); + + +/* Regular Cylindrical Conical Function + * P^{-m}_{-1/2 + I lambda}(x) + * + * x > -1.0, m >= -1 + * exceptions: GSL_EDOM + */ +int gsl_sf_conicalP_cyl_reg_e(const int m, const double lambda, const double x, gsl_sf_result * result); +double gsl_sf_conicalP_cyl_reg(const int m, const double lambda, const double x); + + +/* The following spherical functions are specializations + * of Legendre functions which give the regular eigenfunctions + * of the Laplacian on a 3-dimensional hyperbolic space. + * Of particular interest is the flat limit, which is + * Flat-Lim := {lambda->Inf, eta->0, lambda*eta fixed}. + */ + +/* Zeroth radial eigenfunction of the Laplacian on the + * 3-dimensional hyperbolic space. + * + * legendre_H3d_0(lambda,eta) := sin(lambda*eta)/(lambda*sinh(eta)) + * + * Normalization: + * Flat-Lim legendre_H3d_0(lambda,eta) = j_0(lambda*eta) + * + * eta >= 0.0 + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_H3d_0_e(const double lambda, const double eta, gsl_sf_result * result); +double gsl_sf_legendre_H3d_0(const double lambda, const double eta); + + +/* First radial eigenfunction of the Laplacian on the + * 3-dimensional hyperbolic space. + * + * legendre_H3d_1(lambda,eta) := + * 1/sqrt(lambda^2 + 1) sin(lam eta)/(lam sinh(eta)) + * (coth(eta) - lambda cot(lambda*eta)) + * + * Normalization: + * Flat-Lim legendre_H3d_1(lambda,eta) = j_1(lambda*eta) + * + * eta >= 0.0 + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_H3d_1_e(const double lambda, const double eta, gsl_sf_result * result); +double gsl_sf_legendre_H3d_1(const double lambda, const double eta); + + +/* l'th radial eigenfunction of the Laplacian on the + * 3-dimensional hyperbolic space. + * + * Normalization: + * Flat-Lim legendre_H3d_l(l,lambda,eta) = j_l(lambda*eta) + * + * eta >= 0.0, l >= 0 + * exceptions: GSL_EDOM + */ +int gsl_sf_legendre_H3d_e(const int l, const double lambda, const double eta, gsl_sf_result * result); +double gsl_sf_legendre_H3d(const int l, const double lambda, const double eta); + + +/* Array of H3d(ell), 0 <= ell <= lmax + */ +int gsl_sf_legendre_H3d_array(const int lmax, const double lambda, const double eta, double * result_array); + + +#ifdef HAVE_INLINE +extern inline +int +gsl_sf_legendre_array_size(const int lmax, const int m) +{ + return lmax-m+1; +} +#endif /* HAVE_INLINE */ + + +__END_DECLS + +#endif /* __GSL_SF_LEGENDRE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_log.h b/dtm_release/local/include/gsl/gsl_sf_log.h new file mode 100644 index 0000000000000000000000000000000000000000..92aa685741a6d902d03cbb89b9f36b79578fb7c0 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_log.h @@ -0,0 +1,82 @@ +/* specfunc/gsl_sf_log.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_LOG_H__ +#define __GSL_SF_LOG_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Provide a logarithm function with GSL semantics. + * + * exceptions: GSL_EDOM + */ +int gsl_sf_log_e(const double x, gsl_sf_result * result); +double gsl_sf_log(const double x); + + +/* Log(|x|) + * + * exceptions: GSL_EDOM + */ +int gsl_sf_log_abs_e(const double x, gsl_sf_result * result); +double gsl_sf_log_abs(const double x); + + +/* Complex Logarithm + * exp(lnr + I theta) = zr + I zi + * Returns argument in [-pi,pi]. + * + * exceptions: GSL_EDOM + */ +int gsl_sf_complex_log_e(const double zr, const double zi, gsl_sf_result * lnr, gsl_sf_result * theta); + + +/* Log(1 + x) + * + * exceptions: GSL_EDOM + */ +int gsl_sf_log_1plusx_e(const double x, gsl_sf_result * result); +double gsl_sf_log_1plusx(const double x); + + +/* Log(1 + x) - x + * + * exceptions: GSL_EDOM + */ +int gsl_sf_log_1plusx_mx_e(const double x, gsl_sf_result * result); +double gsl_sf_log_1plusx_mx(const double x); + +__END_DECLS + +#endif /* __GSL_SF_LOG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_mathieu.h b/dtm_release/local/include/gsl/gsl_sf_mathieu.h new file mode 100644 index 0000000000000000000000000000000000000000..19d82561afdf4fb0f6167e7390a7bc1efa0a2655 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_mathieu.h @@ -0,0 +1,107 @@ +/* specfunc/gsl_sf_mathieu.h + * + * Copyright (C) 2002 Lowell Johnson + * + * 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* Author: L. Johnson */ + +#ifndef __GSL_SF_MATHIEU_H__ +#define __GSL_SF_MATHIEU_H__ + +#include <gsl/gsl_sf_result.h> +#include <gsl/gsl_eigen.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +#define GSL_SF_MATHIEU_COEFF 100 + +typedef struct +{ + size_t size; + size_t even_order; + size_t odd_order; + int extra_values; + double qa; /* allow for caching of results: not implemented yet */ + double qb; /* allow for caching of results: not implemented yet */ + double *aa; + double *bb; + double *dd; + double *ee; + double *tt; + double *e2; + double *zz; + gsl_vector *eval; + gsl_matrix *evec; + gsl_eigen_symmv_workspace *wmat; +} gsl_sf_mathieu_workspace; + + +/* Compute an array of characteristic (eigen) values from the recurrence + matrices for the Mathieu equations. */ +int gsl_sf_mathieu_a_array(int order_min, int order_max, double qq, gsl_sf_mathieu_workspace *work, double result_array[]); +int gsl_sf_mathieu_b_array(int order_min, int order_max, double qq, gsl_sf_mathieu_workspace *work, double result_array[]); + +/* Compute the characteristic value for a Mathieu function of order n and + type ntype. */ +int gsl_sf_mathieu_a(int order, double qq, gsl_sf_result *result); +int gsl_sf_mathieu_b(int order, double qq, gsl_sf_result *result); + +/* Compute the Fourier coefficients for a Mathieu function. */ +int gsl_sf_mathieu_a_coeff(int order, double qq, double aa, double coeff[]); +int gsl_sf_mathieu_b_coeff(int order, double qq, double aa, double coeff[]); + +/* Allocate computational storage space for eigenvalue solution. */ +gsl_sf_mathieu_workspace *gsl_sf_mathieu_alloc(const size_t nn, + const double qq); +void gsl_sf_mathieu_free(gsl_sf_mathieu_workspace *workspace); + +/* Compute an angular Mathieu function. */ +int gsl_sf_mathieu_ce(int order, double qq, double zz, gsl_sf_result *result); +int gsl_sf_mathieu_se(int order, double qq, double zz, gsl_sf_result *result); +int gsl_sf_mathieu_ce_array(int nmin, int nmax, double qq, double zz, + gsl_sf_mathieu_workspace *work, + double result_array[]); +int gsl_sf_mathieu_se_array(int nmin, int nmax, double qq, double zz, + gsl_sf_mathieu_workspace *work, + double result_array[]); + +/* Compute a radial Mathieu function. */ +int gsl_sf_mathieu_Mc(int kind, int order, double qq, double zz, + gsl_sf_result *result); +int gsl_sf_mathieu_Ms(int kind, int order, double qq, double zz, + gsl_sf_result *result); +int gsl_sf_mathieu_Mc_array(int kind, int nmin, int nmax, double qq, + double zz, gsl_sf_mathieu_workspace *work, + double result_array[]); +int gsl_sf_mathieu_Ms_array(int kind, int nmin, int nmax, double qq, + double zz, gsl_sf_mathieu_workspace *work, + double result_array[]); + + +__END_DECLS + +#endif /* !__GSL_SF_MATHIEU_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_pow_int.h b/dtm_release/local/include/gsl/gsl_sf_pow_int.h new file mode 100644 index 0000000000000000000000000000000000000000..e535d5721ae4959cc642aab38fd5f9870cbd707d --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_pow_int.h @@ -0,0 +1,49 @@ +/* specfunc/gsl_sf_pow_int.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_POW_INT_H__ +#define __GSL_SF_POW_INT_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Calculate x^n. + * Does not check for overflow/underflow. + */ +int gsl_sf_pow_int_e(double x, int n, gsl_sf_result * result); +double gsl_sf_pow_int(const double x, const int n); + + +__END_DECLS + +#endif /* __GSL_SF_POW_INT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_psi.h b/dtm_release/local/include/gsl/gsl_sf_psi.h new file mode 100644 index 0000000000000000000000000000000000000000..ec61179064badea3ab91c368f6d2d1b8286512e3 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_psi.h @@ -0,0 +1,113 @@ +/* specfunc/gsl_sf_psi.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_PSI_H__ +#define __GSL_SF_PSI_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Poly-Gamma Functions + * + * psi(m,x) := (d/dx)^m psi(0,x) = (d/dx)^{m+1} log(gamma(x)) + */ + + +/* Di-Gamma Function psi(n) = psi(0,n) + * + * n > 0 + * exceptions: GSL_EDOM + */ +int gsl_sf_psi_int_e(const int n, gsl_sf_result * result); +double gsl_sf_psi_int(const int n); + + +/* Di-Gamma Function psi(x) = psi(0, x) + * + * x != 0.0, -1.0, -2.0, ... + * exceptions: GSL_EDOM, GSL_ELOSS + */ +int gsl_sf_psi_e(const double x, gsl_sf_result * result); +double gsl_sf_psi(const double x); + + +/* Di-Gamma Function Re[psi(1 + I y)] + * + * exceptions: none + */ +int gsl_sf_psi_1piy_e(const double y, gsl_sf_result * result); +double gsl_sf_psi_1piy(const double y); + + +/* Di-Gamma Function psi(z) for general complex argument z = x + iy + * + * exceptions: GSL_EDOM + */ +int gsl_sf_complex_psi_e( + const double x, + const double y, + gsl_sf_result * result_re, + gsl_sf_result * result_im + ); + + +/* Tri-Gamma Function psi^(1)(n) + * + * n > 0 + * exceptions: GSL_EDOM + */ +int gsl_sf_psi_1_int_e(const int n, gsl_sf_result * result); +double gsl_sf_psi_1_int(const int n); + + +/* Tri-Gamma Function psi^(1)(x) + * + * x != 0.0, -1.0, -2.0, ... + * exceptions: GSL_EDOM, GSL_ELOSS + */ +int gsl_sf_psi_1_e(const double x, gsl_sf_result * result); +double gsl_sf_psi_1(const double x); + + +/* Poly-Gamma Function psi^(n)(x) + * + * n >= 0, x > 0.0 + * exceptions: GSL_EDOM + */ +int gsl_sf_psi_n_e(const int n, const double x, gsl_sf_result * result); +double gsl_sf_psi_n(const int n, const double x); + + +__END_DECLS + +#endif /* __GSL_SF_PSI_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_result.h b/dtm_release/local/include/gsl/gsl_sf_result.h new file mode 100644 index 0000000000000000000000000000000000000000..512bad7c43f142559923725a7a561360b5e66dfa --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_result.h @@ -0,0 +1,59 @@ +/* specfunc/gsl_sf_result.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_RESULT_H__ +#define __GSL_SF_RESULT_H__ + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +struct gsl_sf_result_struct { + double val; + double err; +}; +typedef struct gsl_sf_result_struct gsl_sf_result; + +#define GSL_SF_RESULT_SET(r,v,e) do { (r)->val=(v); (r)->err=(e); } while(0) + + +struct gsl_sf_result_e10_struct { + double val; + double err; + int e10; +}; +typedef struct gsl_sf_result_e10_struct gsl_sf_result_e10; + + +int gsl_sf_result_smash_e(const gsl_sf_result_e10 * re, gsl_sf_result * r); + + +__END_DECLS + +#endif /* __GSL_SF_RESULT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_synchrotron.h b/dtm_release/local/include/gsl/gsl_sf_synchrotron.h new file mode 100644 index 0000000000000000000000000000000000000000..26028c8939ca995e1dded36995ac81dd6e07cbbd --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_synchrotron.h @@ -0,0 +1,60 @@ +/* specfunc/gsl_sf_synchrotron.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_SYNCHROTRON_H__ +#define __GSL_SF_SYNCHROTRON_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* First synchrotron function: + * synchrotron_1(x) = x Integral[ K_{5/3}(t), {t, x, Infinity}] + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_synchrotron_1_e(const double x, gsl_sf_result * result); +double gsl_sf_synchrotron_1(const double x); + + +/* Second synchroton function: + * synchrotron_2(x) = x * K_{2/3}(x) + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_synchrotron_2_e(const double x, gsl_sf_result * result); +double gsl_sf_synchrotron_2(const double x); + + +__END_DECLS + +#endif /* __GSL_SF_SYNCHROTRON_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_transport.h b/dtm_release/local/include/gsl/gsl_sf_transport.h new file mode 100644 index 0000000000000000000000000000000000000000..c0fd7fc23ceea537803bd61ae517c011af2820cd --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_transport.h @@ -0,0 +1,78 @@ +/* specfunc/gsl_sf_transport.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_TRANSPORT_H__ +#define __GSL_SF_TRANSPORT_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Transport function: + * J(n,x) := Integral[ t^n e^t /(e^t - 1)^2, {t,0,x}] + */ + +/* J(2,x) + * + * exceptions: GSL_EDOM + */ +int gsl_sf_transport_2_e(const double x, gsl_sf_result * result); +double gsl_sf_transport_2(const double x); + + +/* J(3,x) + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_transport_3_e(const double x, gsl_sf_result * result); +double gsl_sf_transport_3(const double x); + + +/* J(4,x) + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_transport_4_e(const double x, gsl_sf_result * result); +double gsl_sf_transport_4(const double x); + + +/* J(5,x) + * + * exceptions: GSL_EDOM, GSL_EUNDRFLW + */ +int gsl_sf_transport_5_e(const double x, gsl_sf_result * result); +double gsl_sf_transport_5(const double x); + + +__END_DECLS + +#endif /* __GSL_SF_TRANSPORT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_trig.h b/dtm_release/local/include/gsl/gsl_sf_trig.h new file mode 100644 index 0000000000000000000000000000000000000000..e2c5722d9e651d87837970b847c0bcdab9c73be3 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_trig.h @@ -0,0 +1,152 @@ +/* specfunc/gsl_sf_trig.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_TRIG_H__ +#define __GSL_SF_TRIG_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Sin(x) with GSL semantics. This is actually important + * because we want to control the error estimate, and trying + * to guess the error for the standard library implementation + * every time it is used would be a little goofy. + */ +int gsl_sf_sin_e(double x, gsl_sf_result * result); +double gsl_sf_sin(const double x); + + +/* Cos(x) with GSL semantics. + */ +int gsl_sf_cos_e(double x, gsl_sf_result * result); +double gsl_sf_cos(const double x); + + +/* Hypot(x,y) with GSL semantics. + */ +int gsl_sf_hypot_e(const double x, const double y, gsl_sf_result * result); +double gsl_sf_hypot(const double x, const double y); + + +/* Sin(z) for complex z + * + * exceptions: GSL_EOVRFLW + */ +int gsl_sf_complex_sin_e(const double zr, const double zi, gsl_sf_result * szr, gsl_sf_result * szi); + + +/* Cos(z) for complex z + * + * exceptions: GSL_EOVRFLW + */ +int gsl_sf_complex_cos_e(const double zr, const double zi, gsl_sf_result * czr, gsl_sf_result * czi); + + +/* Log(Sin(z)) for complex z + * + * exceptions: GSL_EDOM, GSL_ELOSS + */ +int gsl_sf_complex_logsin_e(const double zr, const double zi, gsl_sf_result * lszr, gsl_sf_result * lszi); + + +/* Sinc(x) = sin(pi x) / (pi x) + * + * exceptions: none + */ +int gsl_sf_sinc_e(double x, gsl_sf_result * result); +double gsl_sf_sinc(const double x); + + +/* Log(Sinh(x)), x > 0 + * + * exceptions: GSL_EDOM + */ +int gsl_sf_lnsinh_e(const double x, gsl_sf_result * result); +double gsl_sf_lnsinh(const double x); + + +/* Log(Cosh(x)) + * + * exceptions: none + */ +int gsl_sf_lncosh_e(const double x, gsl_sf_result * result); +double gsl_sf_lncosh(const double x); + + +/* Convert polar to rectlinear coordinates. + * + * exceptions: GSL_ELOSS + */ +int gsl_sf_polar_to_rect(const double r, const double theta, gsl_sf_result * x, gsl_sf_result * y); + +/* Convert rectilinear to polar coordinates. + * return argument in range [-pi, pi] + * + * exceptions: GSL_EDOM + */ +int gsl_sf_rect_to_polar(const double x, const double y, gsl_sf_result * r, gsl_sf_result * theta); + +/* Sin(x) for quantity with an associated error. + */ +int gsl_sf_sin_err_e(const double x, const double dx, gsl_sf_result * result); + + +/* Cos(x) for quantity with an associated error. + */ +int gsl_sf_cos_err_e(const double x, const double dx, gsl_sf_result * result); + + +/* Force an angle to lie in the range (-pi,pi]. + * + * exceptions: GSL_ELOSS + */ +int gsl_sf_angle_restrict_symm_e(double * theta); +double gsl_sf_angle_restrict_symm(const double theta); + + +/* Force an angle to lie in the range [0, 2pi) + * + * exceptions: GSL_ELOSS + */ +int gsl_sf_angle_restrict_pos_e(double * theta); +double gsl_sf_angle_restrict_pos(const double theta); + + +int gsl_sf_angle_restrict_symm_err_e(const double theta, gsl_sf_result * result); + +int gsl_sf_angle_restrict_pos_err_e(const double theta, gsl_sf_result * result); + + +__END_DECLS + +#endif /* __GSL_SF_TRIG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sf_zeta.h b/dtm_release/local/include/gsl/gsl_sf_zeta.h new file mode 100644 index 0000000000000000000000000000000000000000..2d7fad0adcbc1d4070b7ad3bde515b2c6ccc568c --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sf_zeta.h @@ -0,0 +1,112 @@ +/* specfunc/gsl_sf_zeta.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + +#ifndef __GSL_SF_ZETA_H__ +#define __GSL_SF_ZETA_H__ + +#include <gsl/gsl_sf_result.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* Riemann Zeta Function + * zeta(n) = Sum[ k^(-n), {k,1,Infinity} ] + * + * n=integer, n != 1 + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_zeta_int_e(const int n, gsl_sf_result * result); +double gsl_sf_zeta_int(const int n); + + +/* Riemann Zeta Function + * zeta(x) = Sum[ k^(-s), {k,1,Infinity} ], s != 1.0 + * + * s != 1.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_zeta_e(const double s, gsl_sf_result * result); +double gsl_sf_zeta(const double s); + + +/* Riemann Zeta Function minus 1 + * useful for evaluating the fractional part + * of Riemann zeta for large argument + * + * s != 1.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_zetam1_e(const double s, gsl_sf_result * result); +double gsl_sf_zetam1(const double s); + + +/* Riemann Zeta Function minus 1 for integer arg + * useful for evaluating the fractional part + * of Riemann zeta for large argument + * + * s != 1.0 + * exceptions: GSL_EDOM, GSL_EOVRFLW + */ +int gsl_sf_zetam1_int_e(const int s, gsl_sf_result * result); +double gsl_sf_zetam1_int(const int s); + + +/* Hurwitz Zeta Function + * zeta(s,q) = Sum[ (k+q)^(-s), {k,0,Infinity} ] + * + * s > 1.0, q > 0.0 + * exceptions: GSL_EDOM, GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_hzeta_e(const double s, const double q, gsl_sf_result * result); +double gsl_sf_hzeta(const double s, const double q); + + +/* Eta Function + * eta(n) = (1-2^(1-n)) zeta(n) + * + * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_eta_int_e(int n, gsl_sf_result * result); +double gsl_sf_eta_int(const int n); + + +/* Eta Function + * eta(s) = (1-2^(1-s)) zeta(s) + * + * exceptions: GSL_EUNDRFLW, GSL_EOVRFLW + */ +int gsl_sf_eta_e(const double s, gsl_sf_result * result); +double gsl_sf_eta(const double s); + + +__END_DECLS + +#endif /* __GSL_SF_ZETA_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_siman.h b/dtm_release/local/include/gsl/gsl_siman.h new file mode 100644 index 0000000000000000000000000000000000000000..a16f7c7c7896fd054b8dcb3ac5e468b03200e1eb --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_siman.h @@ -0,0 +1,82 @@ +/* siman/gsl_siman.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000 Mark Galassi + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SIMAN_H__ +#define __GSL_SIMAN_H__ +#include <stdlib.h> +#include <gsl/gsl_rng.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* types for the function pointers passed to gsl_siman_solve */ + +typedef double (*gsl_siman_Efunc_t) (void *xp); +typedef void (*gsl_siman_step_t) (const gsl_rng *r, void *xp, double step_size); +typedef double (*gsl_siman_metric_t) (void *xp, void *yp); +typedef void (*gsl_siman_print_t) (void *xp); +typedef void (*gsl_siman_copy_t) (void *source, void *dest); +typedef void * (*gsl_siman_copy_construct_t) (void *xp); +typedef void (*gsl_siman_destroy_t) (void *xp); + +/* this structure contains all the information needed to structure the + search, beyond the energy function, the step function and the + initial guess. */ + +typedef struct { + int n_tries; /* how many points to try for each step */ + int iters_fixed_T; /* how many iterations at each temperature? */ + double step_size; /* max step size in the random walk */ + /* the following parameters are for the Boltzmann distribution */ + double k, t_initial, mu_t, t_min; +} gsl_siman_params_t; + +/* prototype for the workhorse function */ + +void gsl_siman_solve(const gsl_rng * r, + void *x0_p, gsl_siman_Efunc_t Ef, + gsl_siman_step_t take_step, + gsl_siman_metric_t distance, + gsl_siman_print_t print_position, + gsl_siman_copy_t copyfunc, + gsl_siman_copy_construct_t copy_constructor, + gsl_siman_destroy_t destructor, + size_t element_size, + gsl_siman_params_t params); + +void +gsl_siman_solve_many (const gsl_rng * r, void *x0_p, gsl_siman_Efunc_t Ef, + gsl_siman_step_t take_step, + gsl_siman_metric_t distance, + gsl_siman_print_t print_position, + size_t element_size, + gsl_siman_params_t params); + +__END_DECLS + +#endif /* __GSL_SIMAN_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort.h b/dtm_release/local/include/gsl/gsl_sort.h new file mode 100644 index 0000000000000000000000000000000000000000..b1496c2efbfe8973743213f869d15bf416bc40d0 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort.h @@ -0,0 +1,20 @@ +#ifndef __GSL_SORT_H__ +#define __GSL_SORT_H__ + +#include <gsl/gsl_sort_long_double.h> +#include <gsl/gsl_sort_double.h> +#include <gsl/gsl_sort_float.h> + +#include <gsl/gsl_sort_ulong.h> +#include <gsl/gsl_sort_long.h> + +#include <gsl/gsl_sort_uint.h> +#include <gsl/gsl_sort_int.h> + +#include <gsl/gsl_sort_ushort.h> +#include <gsl/gsl_sort_short.h> + +#include <gsl/gsl_sort_uchar.h> +#include <gsl/gsl_sort_char.h> + +#endif /* __GSL_SORT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_char.h b/dtm_release/local/include/gsl/gsl_sort_char.h new file mode 100644 index 0000000000000000000000000000000000000000..f709e3db43abdbd3204f1f7c3ad6828965f201bf --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_char.h @@ -0,0 +1,50 @@ +/* sort/gsl_sort_char.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_CHAR_H__ +#define __GSL_SORT_CHAR_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_char (char * data, const size_t stride, const size_t n); +void gsl_sort_char_index (size_t * p, const char * data, const size_t stride, const size_t n); + +int gsl_sort_char_smallest (char * dest, const size_t k, const char * src, const size_t stride, const size_t n); +int gsl_sort_char_smallest_index (size_t * p, const size_t k, const char * src, const size_t stride, const size_t n); + +int gsl_sort_char_largest (char * dest, const size_t k, const char * src, const size_t stride, const size_t n); +int gsl_sort_char_largest_index (size_t * p, const size_t k, const char * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_CHAR_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_double.h b/dtm_release/local/include/gsl/gsl_sort_double.h new file mode 100644 index 0000000000000000000000000000000000000000..aa44ab14877610708ecf52133f3d8ff5c2a9de6d --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_double.h @@ -0,0 +1,50 @@ +/* sort/gsl_sort_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_DOUBLE_H__ +#define __GSL_SORT_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort (double * data, const size_t stride, const size_t n); +void gsl_sort_index (size_t * p, const double * data, const size_t stride, const size_t n); + +int gsl_sort_smallest (double * dest, const size_t k, const double * src, const size_t stride, const size_t n); +int gsl_sort_smallest_index (size_t * p, const size_t k, const double * src, const size_t stride, const size_t n); + +int gsl_sort_largest (double * dest, const size_t k, const double * src, const size_t stride, const size_t n); +int gsl_sort_largest_index (size_t * p, const size_t k, const double * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_float.h b/dtm_release/local/include/gsl/gsl_sort_float.h new file mode 100644 index 0000000000000000000000000000000000000000..116a2f2a8abfdbf550f614cb9762989d100673f6 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_float.h @@ -0,0 +1,50 @@ +/* sort/gsl_sort_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_FLOAT_H__ +#define __GSL_SORT_FLOAT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_float (float * data, const size_t stride, const size_t n); +void gsl_sort_float_index (size_t * p, const float * data, const size_t stride, const size_t n); + +int gsl_sort_float_smallest (float * dest, const size_t k, const float * src, const size_t stride, const size_t n); +int gsl_sort_float_smallest_index (size_t * p, const size_t k, const float * src, const size_t stride, const size_t n); + +int gsl_sort_float_largest (float * dest, const size_t k, const float * src, const size_t stride, const size_t n); +int gsl_sort_float_largest_index (size_t * p, const size_t k, const float * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_FLOAT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_int.h b/dtm_release/local/include/gsl/gsl_sort_int.h new file mode 100644 index 0000000000000000000000000000000000000000..3b1e210c07fa6c105c267aadf0d3397bdbcaa074 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_int.h @@ -0,0 +1,50 @@ +/* sort/gsl_sort_int.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_INT_H__ +#define __GSL_SORT_INT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_int (int * data, const size_t stride, const size_t n); +void gsl_sort_int_index (size_t * p, const int * data, const size_t stride, const size_t n); + +int gsl_sort_int_smallest (int * dest, const size_t k, const int * src, const size_t stride, const size_t n); +int gsl_sort_int_smallest_index (size_t * p, const size_t k, const int * src, const size_t stride, const size_t n); + +int gsl_sort_int_largest (int * dest, const size_t k, const int * src, const size_t stride, const size_t n); +int gsl_sort_int_largest_index (size_t * p, const size_t k, const int * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_INT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_long.h b/dtm_release/local/include/gsl/gsl_sort_long.h new file mode 100644 index 0000000000000000000000000000000000000000..3b851d1091d1bace2fa29879e1568c593fc73858 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_long.h @@ -0,0 +1,50 @@ +/* sort/gsl_sort_long.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_LONG_H__ +#define __GSL_SORT_LONG_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_long (long * data, const size_t stride, const size_t n); +void gsl_sort_long_index (size_t * p, const long * data, const size_t stride, const size_t n); + +int gsl_sort_long_smallest (long * dest, const size_t k, const long * src, const size_t stride, const size_t n); +int gsl_sort_long_smallest_index (size_t * p, const size_t k, const long * src, const size_t stride, const size_t n); + +int gsl_sort_long_largest (long * dest, const size_t k, const long * src, const size_t stride, const size_t n); +int gsl_sort_long_largest_index (size_t * p, const size_t k, const long * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_LONG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_long_double.h b/dtm_release/local/include/gsl/gsl_sort_long_double.h new file mode 100644 index 0000000000000000000000000000000000000000..49288652749ea9092b8a2a37e7ba693930d3328e --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_long_double.h @@ -0,0 +1,50 @@ +/* sort/gsl_sort_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_LONG_DOUBLE_H__ +#define __GSL_SORT_LONG_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_long_double (long double * data, const size_t stride, const size_t n); +void gsl_sort_long_double_index (size_t * p, const long double * data, const size_t stride, const size_t n); + +int gsl_sort_long_double_smallest (long double * dest, const size_t k, const long double * src, const size_t stride, const size_t n); +int gsl_sort_long_double_smallest_index (size_t * p, const size_t k, const long double * src, const size_t stride, const size_t n); + +int gsl_sort_long_double_largest (long double * dest, const size_t k, const long double * src, const size_t stride, const size_t n); +int gsl_sort_long_double_largest_index (size_t * p, const size_t k, const long double * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_LONG_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_short.h b/dtm_release/local/include/gsl/gsl_sort_short.h new file mode 100644 index 0000000000000000000000000000000000000000..0773cb1c1e8eeaf3557b9d8ac1df32d234afa2e7 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_short.h @@ -0,0 +1,50 @@ +/* sort/gsl_sort_short.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_SHORT_H__ +#define __GSL_SORT_SHORT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_short (short * data, const size_t stride, const size_t n); +void gsl_sort_short_index (size_t * p, const short * data, const size_t stride, const size_t n); + +int gsl_sort_short_smallest (short * dest, const size_t k, const short * src, const size_t stride, const size_t n); +int gsl_sort_short_smallest_index (size_t * p, const size_t k, const short * src, const size_t stride, const size_t n); + +int gsl_sort_short_largest (short * dest, const size_t k, const short * src, const size_t stride, const size_t n); +int gsl_sort_short_largest_index (size_t * p, const size_t k, const short * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_SHORT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_uchar.h b/dtm_release/local/include/gsl/gsl_sort_uchar.h new file mode 100644 index 0000000000000000000000000000000000000000..0292dfef3e831d689d56718a4753732fc39be4ba --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_uchar.h @@ -0,0 +1,50 @@ +/* sort/gsl_sort_uchar.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_UCHAR_H__ +#define __GSL_SORT_UCHAR_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_uchar (unsigned char * data, const size_t stride, const size_t n); +void gsl_sort_uchar_index (size_t * p, const unsigned char * data, const size_t stride, const size_t n); + +int gsl_sort_uchar_smallest (unsigned char * dest, const size_t k, const unsigned char * src, const size_t stride, const size_t n); +int gsl_sort_uchar_smallest_index (size_t * p, const size_t k, const unsigned char * src, const size_t stride, const size_t n); + +int gsl_sort_uchar_largest (unsigned char * dest, const size_t k, const unsigned char * src, const size_t stride, const size_t n); +int gsl_sort_uchar_largest_index (size_t * p, const size_t k, const unsigned char * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_UCHAR_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_uint.h b/dtm_release/local/include/gsl/gsl_sort_uint.h new file mode 100644 index 0000000000000000000000000000000000000000..740df820253fa4bfa129e49c90c0a5a89b1d740d --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_uint.h @@ -0,0 +1,50 @@ +/* sort/gsl_sort_uint.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_UINT_H__ +#define __GSL_SORT_UINT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_uint (unsigned int * data, const size_t stride, const size_t n); +void gsl_sort_uint_index (size_t * p, const unsigned int * data, const size_t stride, const size_t n); + +int gsl_sort_uint_smallest (unsigned int * dest, const size_t k, const unsigned int * src, const size_t stride, const size_t n); +int gsl_sort_uint_smallest_index (size_t * p, const size_t k, const unsigned int * src, const size_t stride, const size_t n); + +int gsl_sort_uint_largest (unsigned int * dest, const size_t k, const unsigned int * src, const size_t stride, const size_t n); +int gsl_sort_uint_largest_index (size_t * p, const size_t k, const unsigned int * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_UINT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_ulong.h b/dtm_release/local/include/gsl/gsl_sort_ulong.h new file mode 100644 index 0000000000000000000000000000000000000000..bdbd4c6517e941d353a303afcaeb8d544340c7f6 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_ulong.h @@ -0,0 +1,50 @@ +/* sort/gsl_sort_ulong.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_ULONG_H__ +#define __GSL_SORT_ULONG_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_ulong (unsigned long * data, const size_t stride, const size_t n); +void gsl_sort_ulong_index (size_t * p, const unsigned long * data, const size_t stride, const size_t n); + +int gsl_sort_ulong_smallest (unsigned long * dest, const size_t k, const unsigned long * src, const size_t stride, const size_t n); +int gsl_sort_ulong_smallest_index (size_t * p, const size_t k, const unsigned long * src, const size_t stride, const size_t n); + +int gsl_sort_ulong_largest (unsigned long * dest, const size_t k, const unsigned long * src, const size_t stride, const size_t n); +int gsl_sort_ulong_largest_index (size_t * p, const size_t k, const unsigned long * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_ULONG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_ushort.h b/dtm_release/local/include/gsl/gsl_sort_ushort.h new file mode 100644 index 0000000000000000000000000000000000000000..a29bb693a6823799363677f84e84a224bc3a4189 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_ushort.h @@ -0,0 +1,50 @@ +/* sort/gsl_sort_ushort.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_USHORT_H__ +#define __GSL_SORT_USHORT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_ushort (unsigned short * data, const size_t stride, const size_t n); +void gsl_sort_ushort_index (size_t * p, const unsigned short * data, const size_t stride, const size_t n); + +int gsl_sort_ushort_smallest (unsigned short * dest, const size_t k, const unsigned short * src, const size_t stride, const size_t n); +int gsl_sort_ushort_smallest_index (size_t * p, const size_t k, const unsigned short * src, const size_t stride, const size_t n); + +int gsl_sort_ushort_largest (unsigned short * dest, const size_t k, const unsigned short * src, const size_t stride, const size_t n); +int gsl_sort_ushort_largest_index (size_t * p, const size_t k, const unsigned short * src, const size_t stride, const size_t n); + +__END_DECLS + +#endif /* __GSL_SORT_USHORT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_vector.h b/dtm_release/local/include/gsl/gsl_sort_vector.h new file mode 100644 index 0000000000000000000000000000000000000000..d65a9ee9bb97679e47bd3ebd5f85f187f240d593 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_vector.h @@ -0,0 +1,20 @@ +#ifndef __GSL_SORT_VECTOR_H__ +#define __GSL_SORT_VECTOR_H__ + +#include <gsl/gsl_sort_vector_long_double.h> +#include <gsl/gsl_sort_vector_double.h> +#include <gsl/gsl_sort_vector_float.h> + +#include <gsl/gsl_sort_vector_ulong.h> +#include <gsl/gsl_sort_vector_long.h> + +#include <gsl/gsl_sort_vector_uint.h> +#include <gsl/gsl_sort_vector_int.h> + +#include <gsl/gsl_sort_vector_ushort.h> +#include <gsl/gsl_sort_vector_short.h> + +#include <gsl/gsl_sort_vector_uchar.h> +#include <gsl/gsl_sort_vector_char.h> + +#endif /* __GSL_SORT_VECTOR_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_vector_char.h b/dtm_release/local/include/gsl/gsl_sort_vector_char.h new file mode 100644 index 0000000000000000000000000000000000000000..488fdc69b44d1af0f3a10e8895fb8ce1735f6516 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_vector_char.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_vector_char.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_CHAR_H__ +#define __GSL_SORT_VECTOR_CHAR_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_char.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector_char (gsl_vector_char * v); +int gsl_sort_vector_char_index (gsl_permutation * p, const gsl_vector_char * v); + +int gsl_sort_vector_char_smallest (char * dest, const size_t k, const gsl_vector_char * v); +int gsl_sort_vector_char_largest (char * dest, const size_t k, const gsl_vector_char * v); + +int gsl_sort_vector_char_smallest_index (size_t * p, const size_t k, const gsl_vector_char * v); +int gsl_sort_vector_char_largest_index (size_t * p, const size_t k, const gsl_vector_char * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_CHAR_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_vector_double.h b/dtm_release/local/include/gsl/gsl_sort_vector_double.h new file mode 100644 index 0000000000000000000000000000000000000000..9430fd4ed10922fed3349892c2bfce167a288e03 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_vector_double.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_vector_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_DOUBLE_H__ +#define __GSL_SORT_VECTOR_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_double.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector (gsl_vector * v); +int gsl_sort_vector_index (gsl_permutation * p, const gsl_vector * v); + +int gsl_sort_vector_smallest (double * dest, const size_t k, const gsl_vector * v); +int gsl_sort_vector_largest (double * dest, const size_t k, const gsl_vector * v); + +int gsl_sort_vector_smallest_index (size_t * p, const size_t k, const gsl_vector * v); +int gsl_sort_vector_largest_index (size_t * p, const size_t k, const gsl_vector * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_vector_float.h b/dtm_release/local/include/gsl/gsl_sort_vector_float.h new file mode 100644 index 0000000000000000000000000000000000000000..fc0df550424423b3a8ab44151d1243b2360647e1 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_vector_float.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_vector_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_FLOAT_H__ +#define __GSL_SORT_VECTOR_FLOAT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_float.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector_float (gsl_vector_float * v); +int gsl_sort_vector_float_index (gsl_permutation * p, const gsl_vector_float * v); + +int gsl_sort_vector_float_smallest (float * dest, const size_t k, const gsl_vector_float * v); +int gsl_sort_vector_float_largest (float * dest, const size_t k, const gsl_vector_float * v); + +int gsl_sort_vector_float_smallest_index (size_t * p, const size_t k, const gsl_vector_float * v); +int gsl_sort_vector_float_largest_index (size_t * p, const size_t k, const gsl_vector_float * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_FLOAT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_vector_int.h b/dtm_release/local/include/gsl/gsl_sort_vector_int.h new file mode 100644 index 0000000000000000000000000000000000000000..4ac5a5d74184eee6d0682c8967495c7976f7badc --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_vector_int.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_vector_int.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_INT_H__ +#define __GSL_SORT_VECTOR_INT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_int.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector_int (gsl_vector_int * v); +int gsl_sort_vector_int_index (gsl_permutation * p, const gsl_vector_int * v); + +int gsl_sort_vector_int_smallest (int * dest, const size_t k, const gsl_vector_int * v); +int gsl_sort_vector_int_largest (int * dest, const size_t k, const gsl_vector_int * v); + +int gsl_sort_vector_int_smallest_index (size_t * p, const size_t k, const gsl_vector_int * v); +int gsl_sort_vector_int_largest_index (size_t * p, const size_t k, const gsl_vector_int * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_INT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_vector_long.h b/dtm_release/local/include/gsl/gsl_sort_vector_long.h new file mode 100644 index 0000000000000000000000000000000000000000..6ccb21c493ccfad6864368ef40a92f17b72b9376 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_vector_long.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_vector_long.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_LONG_H__ +#define __GSL_SORT_VECTOR_LONG_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_long.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector_long (gsl_vector_long * v); +int gsl_sort_vector_long_index (gsl_permutation * p, const gsl_vector_long * v); + +int gsl_sort_vector_long_smallest (long * dest, const size_t k, const gsl_vector_long * v); +int gsl_sort_vector_long_largest (long * dest, const size_t k, const gsl_vector_long * v); + +int gsl_sort_vector_long_smallest_index (size_t * p, const size_t k, const gsl_vector_long * v); +int gsl_sort_vector_long_largest_index (size_t * p, const size_t k, const gsl_vector_long * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_LONG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_vector_long_double.h b/dtm_release/local/include/gsl/gsl_sort_vector_long_double.h new file mode 100644 index 0000000000000000000000000000000000000000..3f12ca61c7ae31ebce4315a2c1923a2288ff0794 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_vector_long_double.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_vector_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_LONG_DOUBLE_H__ +#define __GSL_SORT_VECTOR_LONG_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_long_double.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector_long_double (gsl_vector_long_double * v); +int gsl_sort_vector_long_double_index (gsl_permutation * p, const gsl_vector_long_double * v); + +int gsl_sort_vector_long_double_smallest (long double * dest, const size_t k, const gsl_vector_long_double * v); +int gsl_sort_vector_long_double_largest (long double * dest, const size_t k, const gsl_vector_long_double * v); + +int gsl_sort_vector_long_double_smallest_index (size_t * p, const size_t k, const gsl_vector_long_double * v); +int gsl_sort_vector_long_double_largest_index (size_t * p, const size_t k, const gsl_vector_long_double * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_LONG_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_vector_short.h b/dtm_release/local/include/gsl/gsl_sort_vector_short.h new file mode 100644 index 0000000000000000000000000000000000000000..b55e2e470525906d3d956772cf2f98afb81dc9b4 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_vector_short.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_vector_short.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_SHORT_H__ +#define __GSL_SORT_VECTOR_SHORT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_short.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector_short (gsl_vector_short * v); +int gsl_sort_vector_short_index (gsl_permutation * p, const gsl_vector_short * v); + +int gsl_sort_vector_short_smallest (short * dest, const size_t k, const gsl_vector_short * v); +int gsl_sort_vector_short_largest (short * dest, const size_t k, const gsl_vector_short * v); + +int gsl_sort_vector_short_smallest_index (size_t * p, const size_t k, const gsl_vector_short * v); +int gsl_sort_vector_short_largest_index (size_t * p, const size_t k, const gsl_vector_short * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_SHORT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_vector_uchar.h b/dtm_release/local/include/gsl/gsl_sort_vector_uchar.h new file mode 100644 index 0000000000000000000000000000000000000000..4209e153241852dfcb9b3de5a080172341652d98 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_vector_uchar.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_vector_uchar.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_UCHAR_H__ +#define __GSL_SORT_VECTOR_UCHAR_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_uchar.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector_uchar (gsl_vector_uchar * v); +int gsl_sort_vector_uchar_index (gsl_permutation * p, const gsl_vector_uchar * v); + +int gsl_sort_vector_uchar_smallest (unsigned char * dest, const size_t k, const gsl_vector_uchar * v); +int gsl_sort_vector_uchar_largest (unsigned char * dest, const size_t k, const gsl_vector_uchar * v); + +int gsl_sort_vector_uchar_smallest_index (size_t * p, const size_t k, const gsl_vector_uchar * v); +int gsl_sort_vector_uchar_largest_index (size_t * p, const size_t k, const gsl_vector_uchar * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_UCHAR_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_vector_uint.h b/dtm_release/local/include/gsl/gsl_sort_vector_uint.h new file mode 100644 index 0000000000000000000000000000000000000000..4c2caa27589e129a6cb71ee1b26330c11ebf7161 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_vector_uint.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_vector_uint.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_UINT_H__ +#define __GSL_SORT_VECTOR_UINT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_uint.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector_uint (gsl_vector_uint * v); +int gsl_sort_vector_uint_index (gsl_permutation * p, const gsl_vector_uint * v); + +int gsl_sort_vector_uint_smallest (unsigned int * dest, const size_t k, const gsl_vector_uint * v); +int gsl_sort_vector_uint_largest (unsigned int * dest, const size_t k, const gsl_vector_uint * v); + +int gsl_sort_vector_uint_smallest_index (size_t * p, const size_t k, const gsl_vector_uint * v); +int gsl_sort_vector_uint_largest_index (size_t * p, const size_t k, const gsl_vector_uint * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_UINT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_vector_ulong.h b/dtm_release/local/include/gsl/gsl_sort_vector_ulong.h new file mode 100644 index 0000000000000000000000000000000000000000..e61446a39276807dfedc64fbd522ffdc6b96937b --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_vector_ulong.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_vector_ulong.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_ULONG_H__ +#define __GSL_SORT_VECTOR_ULONG_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_ulong.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector_ulong (gsl_vector_ulong * v); +int gsl_sort_vector_ulong_index (gsl_permutation * p, const gsl_vector_ulong * v); + +int gsl_sort_vector_ulong_smallest (unsigned long * dest, const size_t k, const gsl_vector_ulong * v); +int gsl_sort_vector_ulong_largest (unsigned long * dest, const size_t k, const gsl_vector_ulong * v); + +int gsl_sort_vector_ulong_smallest_index (size_t * p, const size_t k, const gsl_vector_ulong * v); +int gsl_sort_vector_ulong_largest_index (size_t * p, const size_t k, const gsl_vector_ulong * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_ULONG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sort_vector_ushort.h b/dtm_release/local/include/gsl/gsl_sort_vector_ushort.h new file mode 100644 index 0000000000000000000000000000000000000000..c3776dc7d946b445084d4d5ab573115fd1630aa1 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sort_vector_ushort.h @@ -0,0 +1,51 @@ +/* sort/gsl_sort_vector_ushort.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Thomas Walter, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SORT_VECTOR_USHORT_H__ +#define __GSL_SORT_VECTOR_USHORT_H__ + +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_permutation.h> +#include <gsl/gsl_vector_ushort.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void gsl_sort_vector_ushort (gsl_vector_ushort * v); +int gsl_sort_vector_ushort_index (gsl_permutation * p, const gsl_vector_ushort * v); + +int gsl_sort_vector_ushort_smallest (unsigned short * dest, const size_t k, const gsl_vector_ushort * v); +int gsl_sort_vector_ushort_largest (unsigned short * dest, const size_t k, const gsl_vector_ushort * v); + +int gsl_sort_vector_ushort_smallest_index (size_t * p, const size_t k, const gsl_vector_ushort * v); +int gsl_sort_vector_ushort_largest_index (size_t * p, const size_t k, const gsl_vector_ushort * v); + +__END_DECLS + +#endif /* __GSL_SORT_VECTOR_USHORT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_specfunc.h b/dtm_release/local/include/gsl/gsl_specfunc.h new file mode 100644 index 0000000000000000000000000000000000000000..e07b5aa08049270dec62b59691ff4dd38d3b254b --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_specfunc.h @@ -0,0 +1,10 @@ +/* Author: G. Jungman */ + + +/* Convenience header */ +#ifndef __GSL_SPECFUNC_H__ +#define __GSL_SPECFUNC_H__ + +#include <gsl/gsl_sf.h> + +#endif /* __GSL_SPECFUNC_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_spline.h b/dtm_release/local/include/gsl/gsl_spline.h new file mode 100644 index 0000000000000000000000000000000000000000..08255ca88de9d6e83dc05704bf1abdc590bae946 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_spline.h @@ -0,0 +1,101 @@ +/* interpolation/gsl_spline.h + * + * Copyright (C) 2001, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SPLINE_H__ +#define __GSL_SPLINE_H__ +#include <stdlib.h> +#include <gsl/gsl_interp.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + + +/* general interpolation object */ +typedef struct { + gsl_interp * interp; + double * x; + double * y; + size_t size; +} gsl_spline; + +gsl_spline * +gsl_spline_alloc(const gsl_interp_type * T, size_t size); + +int +gsl_spline_init(gsl_spline * spline, const double xa[], const double ya[], size_t size); + +const char * gsl_spline_name(const gsl_spline * spline); +unsigned int gsl_spline_min_size(const gsl_spline * spline); + + +int +gsl_spline_eval_e(const gsl_spline * spline, double x, + gsl_interp_accel * a, double * y); + +double +gsl_spline_eval(const gsl_spline * spline, double x, gsl_interp_accel * a); + +int +gsl_spline_eval_deriv_e(const gsl_spline * spline, + double x, + gsl_interp_accel * a, + double * y); + +double +gsl_spline_eval_deriv(const gsl_spline * spline, + double x, + gsl_interp_accel * a); + +int +gsl_spline_eval_deriv2_e(const gsl_spline * spline, + double x, + gsl_interp_accel * a, + double * y); + +double +gsl_spline_eval_deriv2(const gsl_spline * spline, + double x, + gsl_interp_accel * a); + +int +gsl_spline_eval_integ_e(const gsl_spline * spline, + double a, double b, + gsl_interp_accel * acc, + double * y); + +double +gsl_spline_eval_integ(const gsl_spline * spline, + double a, double b, + gsl_interp_accel * acc); + +void +gsl_spline_free(gsl_spline * spline); + +__END_DECLS + +#endif /* __GSL_INTERP_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_statistics.h b/dtm_release/local/include/gsl/gsl_statistics.h new file mode 100644 index 0000000000000000000000000000000000000000..9fb414f28451253f91efc9dfafb1fbffd2c03233 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_statistics.h @@ -0,0 +1,20 @@ +#ifndef __GSL_STATISTICS_H__ +#define __GSL_STATISTICS_H__ + +#include <gsl/gsl_statistics_long_double.h> +#include <gsl/gsl_statistics_double.h> +#include <gsl/gsl_statistics_float.h> + +#include <gsl/gsl_statistics_ulong.h> +#include <gsl/gsl_statistics_long.h> + +#include <gsl/gsl_statistics_uint.h> +#include <gsl/gsl_statistics_int.h> + +#include <gsl/gsl_statistics_ushort.h> +#include <gsl/gsl_statistics_short.h> + +#include <gsl/gsl_statistics_uchar.h> +#include <gsl/gsl_statistics_char.h> + +#endif /* __GSL_STATISTICS_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_statistics_char.h b/dtm_release/local/include/gsl/gsl_statistics_char.h new file mode 100644 index 0000000000000000000000000000000000000000..3312cfa6973935d9d14cd94090279c48d7622669 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_statistics_char.h @@ -0,0 +1,76 @@ +/* statistics/gsl_statistics_char.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_CHAR_H__ +#define __GSL_STATISTICS_CHAR_H__ + +#include <stddef.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_char_mean (const char data[], const size_t stride, const size_t n); +double gsl_stats_char_variance (const char data[], const size_t stride, const size_t n); +double gsl_stats_char_sd (const char data[], const size_t stride, const size_t n); +double gsl_stats_char_variance_with_fixed_mean (const char data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_char_sd_with_fixed_mean (const char data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_char_absdev (const char data[], const size_t stride, const size_t n); +double gsl_stats_char_skew (const char data[], const size_t stride, const size_t n); +double gsl_stats_char_kurtosis (const char data[], const size_t stride, const size_t n); +double gsl_stats_char_lag1_autocorrelation (const char data[], const size_t stride, const size_t n); + +double gsl_stats_char_covariance (const char data1[], const size_t stride1,const char data2[], const size_t stride2, const size_t n); +double gsl_stats_char_correlation (const char data1[], const size_t stride1,const char data2[], const size_t stride2, const size_t n); + +double gsl_stats_char_variance_m (const char data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_char_sd_m (const char data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_char_absdev_m (const char data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_char_skew_m_sd (const char data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_char_kurtosis_m_sd (const char data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_char_lag1_autocorrelation_m (const char data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_char_covariance_m (const char data1[], const size_t stride1,const char data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + + +double gsl_stats_char_pvariance (const char data1[], const size_t stride1, const size_t n1, const char data2[], const size_t stride2, const size_t n2); +double gsl_stats_char_ttest (const char data1[], const size_t stride1, const size_t n1, const char data2[], const size_t stride2, const size_t n2); + +char gsl_stats_char_max (const char data[], const size_t stride, const size_t n); +char gsl_stats_char_min (const char data[], const size_t stride, const size_t n); +void gsl_stats_char_minmax (char * min, char * max, const char data[], const size_t stride, const size_t n); + +size_t gsl_stats_char_max_index (const char data[], const size_t stride, const size_t n); +size_t gsl_stats_char_min_index (const char data[], const size_t stride, const size_t n); +void gsl_stats_char_minmax_index (size_t * min_index, size_t * max_index, const char data[], const size_t stride, const size_t n); + +double gsl_stats_char_median_from_sorted_data (const char sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_char_quantile_from_sorted_data (const char sorted_data[], const size_t stride, const size_t n, const double f) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_CHAR_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_statistics_double.h b/dtm_release/local/include/gsl/gsl_statistics_double.h new file mode 100644 index 0000000000000000000000000000000000000000..e3511ec6d361c0ee7dbe2a0f37add4555a30f829 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_statistics_double.h @@ -0,0 +1,94 @@ +/* statistics/gsl_statistics_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_DOUBLE_H__ +#define __GSL_STATISTICS_DOUBLE_H__ + +#include <stddef.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_mean (const double data[], const size_t stride, const size_t n); +double gsl_stats_variance (const double data[], const size_t stride, const size_t n); +double gsl_stats_sd (const double data[], const size_t stride, const size_t n); +double gsl_stats_variance_with_fixed_mean (const double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_sd_with_fixed_mean (const double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_absdev (const double data[], const size_t stride, const size_t n); +double gsl_stats_skew (const double data[], const size_t stride, const size_t n); +double gsl_stats_kurtosis (const double data[], const size_t stride, const size_t n); +double gsl_stats_lag1_autocorrelation (const double data[], const size_t stride, const size_t n); + +double gsl_stats_covariance (const double data1[], const size_t stride1,const double data2[], const size_t stride2, const size_t n); +double gsl_stats_correlation (const double data1[], const size_t stride1,const double data2[], const size_t stride2, const size_t n); + +double gsl_stats_variance_m (const double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_sd_m (const double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_absdev_m (const double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_skew_m_sd (const double data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_kurtosis_m_sd (const double data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_lag1_autocorrelation_m (const double data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_covariance_m (const double data1[], const size_t stride1,const double data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + +/* DEFINED FOR FLOATING POINT TYPES ONLY */ + +double gsl_stats_wmean (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n); +double gsl_stats_wvariance (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n); +double gsl_stats_wsd (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n); +double gsl_stats_wvariance_with_fixed_mean (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_wsd_with_fixed_mean (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_wabsdev (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n); +double gsl_stats_wskew (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n); +double gsl_stats_wkurtosis (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n); + +double gsl_stats_wvariance_m (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_wsd_m (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_wabsdev_m (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_wskew_m_sd (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double wmean, const double wsd); +double gsl_stats_wkurtosis_m_sd (const double w[], const size_t wstride, const double data[], const size_t stride, const size_t n, const double wmean, const double wsd); + +/* END OF FLOATING POINT TYPES */ + +double gsl_stats_pvariance (const double data1[], const size_t stride1, const size_t n1, const double data2[], const size_t stride2, const size_t n2); +double gsl_stats_ttest (const double data1[], const size_t stride1, const size_t n1, const double data2[], const size_t stride2, const size_t n2); + +double gsl_stats_max (const double data[], const size_t stride, const size_t n); +double gsl_stats_min (const double data[], const size_t stride, const size_t n); +void gsl_stats_minmax (double * min, double * max, const double data[], const size_t stride, const size_t n); + +size_t gsl_stats_max_index (const double data[], const size_t stride, const size_t n); +size_t gsl_stats_min_index (const double data[], const size_t stride, const size_t n); +void gsl_stats_minmax_index (size_t * min_index, size_t * max_index, const double data[], const size_t stride, const size_t n); + +double gsl_stats_median_from_sorted_data (const double sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_quantile_from_sorted_data (const double sorted_data[], const size_t stride, const size_t n, const double f) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_statistics_float.h b/dtm_release/local/include/gsl/gsl_statistics_float.h new file mode 100644 index 0000000000000000000000000000000000000000..daaf2f17c85e5432d5254ee0cfb2e15423148754 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_statistics_float.h @@ -0,0 +1,94 @@ +/* statistics/gsl_statistics_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_FLOAT_H__ +#define __GSL_STATISTICS_FLOAT_H__ + +#include <stddef.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_float_mean (const float data[], const size_t stride, const size_t n); +double gsl_stats_float_variance (const float data[], const size_t stride, const size_t n); +double gsl_stats_float_sd (const float data[], const size_t stride, const size_t n); +double gsl_stats_float_variance_with_fixed_mean (const float data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_float_sd_with_fixed_mean (const float data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_float_absdev (const float data[], const size_t stride, const size_t n); +double gsl_stats_float_skew (const float data[], const size_t stride, const size_t n); +double gsl_stats_float_kurtosis (const float data[], const size_t stride, const size_t n); +double gsl_stats_float_lag1_autocorrelation (const float data[], const size_t stride, const size_t n); + +double gsl_stats_float_covariance (const float data1[], const size_t stride1,const float data2[], const size_t stride2, const size_t n); +double gsl_stats_float_correlation (const float data1[], const size_t stride1,const float data2[], const size_t stride2, const size_t n); + +double gsl_stats_float_variance_m (const float data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_float_sd_m (const float data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_float_absdev_m (const float data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_float_skew_m_sd (const float data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_float_kurtosis_m_sd (const float data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_float_lag1_autocorrelation_m (const float data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_float_covariance_m (const float data1[], const size_t stride1,const float data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + +/* DEFINED FOR FLOATING POINT TYPES ONLY */ + +double gsl_stats_float_wmean (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n); +double gsl_stats_float_wvariance (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n); +double gsl_stats_float_wsd (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n); +double gsl_stats_float_wvariance_with_fixed_mean (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_float_wsd_with_fixed_mean (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_float_wabsdev (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n); +double gsl_stats_float_wskew (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n); +double gsl_stats_float_wkurtosis (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n); + +double gsl_stats_float_wvariance_m (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_float_wsd_m (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_float_wabsdev_m (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_float_wskew_m_sd (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double wmean, const double wsd); +double gsl_stats_float_wkurtosis_m_sd (const float w[], const size_t wstride, const float data[], const size_t stride, const size_t n, const double wmean, const double wsd); + +/* END OF FLOATING POINT TYPES */ + +double gsl_stats_float_pvariance (const float data1[], const size_t stride1, const size_t n1, const float data2[], const size_t stride2, const size_t n2); +double gsl_stats_float_ttest (const float data1[], const size_t stride1, const size_t n1, const float data2[], const size_t stride2, const size_t n2); + +float gsl_stats_float_max (const float data[], const size_t stride, const size_t n); +float gsl_stats_float_min (const float data[], const size_t stride, const size_t n); +void gsl_stats_float_minmax (float * min, float * max, const float data[], const size_t stride, const size_t n); + +size_t gsl_stats_float_max_index (const float data[], const size_t stride, const size_t n); +size_t gsl_stats_float_min_index (const float data[], const size_t stride, const size_t n); +void gsl_stats_float_minmax_index (size_t * min_index, size_t * max_index, const float data[], const size_t stride, const size_t n); + +double gsl_stats_float_median_from_sorted_data (const float sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_float_quantile_from_sorted_data (const float sorted_data[], const size_t stride, const size_t n, const double f) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_FLOAT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_statistics_int.h b/dtm_release/local/include/gsl/gsl_statistics_int.h new file mode 100644 index 0000000000000000000000000000000000000000..308a7761aeff4df5b944d1dd2afa5cfb066f959d --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_statistics_int.h @@ -0,0 +1,76 @@ +/* statistics/gsl_statistics_int.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_INT_H__ +#define __GSL_STATISTICS_INT_H__ + +#include <stddef.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_int_mean (const int data[], const size_t stride, const size_t n); +double gsl_stats_int_variance (const int data[], const size_t stride, const size_t n); +double gsl_stats_int_sd (const int data[], const size_t stride, const size_t n); +double gsl_stats_int_variance_with_fixed_mean (const int data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_int_sd_with_fixed_mean (const int data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_int_absdev (const int data[], const size_t stride, const size_t n); +double gsl_stats_int_skew (const int data[], const size_t stride, const size_t n); +double gsl_stats_int_kurtosis (const int data[], const size_t stride, const size_t n); +double gsl_stats_int_lag1_autocorrelation (const int data[], const size_t stride, const size_t n); + +double gsl_stats_int_covariance (const int data1[], const size_t stride1,const int data2[], const size_t stride2, const size_t n); +double gsl_stats_int_correlation (const int data1[], const size_t stride1,const int data2[], const size_t stride2, const size_t n); + +double gsl_stats_int_variance_m (const int data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_int_sd_m (const int data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_int_absdev_m (const int data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_int_skew_m_sd (const int data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_int_kurtosis_m_sd (const int data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_int_lag1_autocorrelation_m (const int data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_int_covariance_m (const int data1[], const size_t stride1,const int data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + + +double gsl_stats_int_pvariance (const int data1[], const size_t stride1, const size_t n1, const int data2[], const size_t stride2, const size_t n2); +double gsl_stats_int_ttest (const int data1[], const size_t stride1, const size_t n1, const int data2[], const size_t stride2, const size_t n2); + +int gsl_stats_int_max (const int data[], const size_t stride, const size_t n); +int gsl_stats_int_min (const int data[], const size_t stride, const size_t n); +void gsl_stats_int_minmax (int * min, int * max, const int data[], const size_t stride, const size_t n); + +size_t gsl_stats_int_max_index (const int data[], const size_t stride, const size_t n); +size_t gsl_stats_int_min_index (const int data[], const size_t stride, const size_t n); +void gsl_stats_int_minmax_index (size_t * min_index, size_t * max_index, const int data[], const size_t stride, const size_t n); + +double gsl_stats_int_median_from_sorted_data (const int sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_int_quantile_from_sorted_data (const int sorted_data[], const size_t stride, const size_t n, const double f) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_INT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_statistics_long.h b/dtm_release/local/include/gsl/gsl_statistics_long.h new file mode 100644 index 0000000000000000000000000000000000000000..af1ef7954e0878da4860c590eafa1e0f84c3ad3c --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_statistics_long.h @@ -0,0 +1,76 @@ +/* statistics/gsl_statistics_long.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_LONG_H__ +#define __GSL_STATISTICS_LONG_H__ + +#include <stddef.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_long_mean (const long data[], const size_t stride, const size_t n); +double gsl_stats_long_variance (const long data[], const size_t stride, const size_t n); +double gsl_stats_long_sd (const long data[], const size_t stride, const size_t n); +double gsl_stats_long_variance_with_fixed_mean (const long data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_sd_with_fixed_mean (const long data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_absdev (const long data[], const size_t stride, const size_t n); +double gsl_stats_long_skew (const long data[], const size_t stride, const size_t n); +double gsl_stats_long_kurtosis (const long data[], const size_t stride, const size_t n); +double gsl_stats_long_lag1_autocorrelation (const long data[], const size_t stride, const size_t n); + +double gsl_stats_long_covariance (const long data1[], const size_t stride1,const long data2[], const size_t stride2, const size_t n); +double gsl_stats_long_correlation (const long data1[], const size_t stride1,const long data2[], const size_t stride2, const size_t n); + +double gsl_stats_long_variance_m (const long data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_sd_m (const long data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_absdev_m (const long data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_skew_m_sd (const long data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_long_kurtosis_m_sd (const long data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_long_lag1_autocorrelation_m (const long data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_long_covariance_m (const long data1[], const size_t stride1,const long data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + + +double gsl_stats_long_pvariance (const long data1[], const size_t stride1, const size_t n1, const long data2[], const size_t stride2, const size_t n2); +double gsl_stats_long_ttest (const long data1[], const size_t stride1, const size_t n1, const long data2[], const size_t stride2, const size_t n2); + +long gsl_stats_long_max (const long data[], const size_t stride, const size_t n); +long gsl_stats_long_min (const long data[], const size_t stride, const size_t n); +void gsl_stats_long_minmax (long * min, long * max, const long data[], const size_t stride, const size_t n); + +size_t gsl_stats_long_max_index (const long data[], const size_t stride, const size_t n); +size_t gsl_stats_long_min_index (const long data[], const size_t stride, const size_t n); +void gsl_stats_long_minmax_index (size_t * min_index, size_t * max_index, const long data[], const size_t stride, const size_t n); + +double gsl_stats_long_median_from_sorted_data (const long sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_long_quantile_from_sorted_data (const long sorted_data[], const size_t stride, const size_t n, const double f) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_LONG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_statistics_long_double.h b/dtm_release/local/include/gsl/gsl_statistics_long_double.h new file mode 100644 index 0000000000000000000000000000000000000000..7e16032bd10dc73b86f3bde2a30f4538b5a603f1 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_statistics_long_double.h @@ -0,0 +1,94 @@ +/* statistics/gsl_statistics_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_LONG_DOUBLE_H__ +#define __GSL_STATISTICS_LONG_DOUBLE_H__ + +#include <stddef.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_long_double_mean (const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_variance (const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_sd (const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_variance_with_fixed_mean (const long double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_double_sd_with_fixed_mean (const long double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_double_absdev (const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_skew (const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_kurtosis (const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_lag1_autocorrelation (const long double data[], const size_t stride, const size_t n); + +double gsl_stats_long_double_covariance (const long double data1[], const size_t stride1,const long double data2[], const size_t stride2, const size_t n); +double gsl_stats_long_double_correlation (const long double data1[], const size_t stride1,const long double data2[], const size_t stride2, const size_t n); + +double gsl_stats_long_double_variance_m (const long double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_double_sd_m (const long double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_double_absdev_m (const long double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_double_skew_m_sd (const long double data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_long_double_kurtosis_m_sd (const long double data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_long_double_lag1_autocorrelation_m (const long double data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_long_double_covariance_m (const long double data1[], const size_t stride1,const long double data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + +/* DEFINED FOR FLOATING POINT TYPES ONLY */ + +double gsl_stats_long_double_wmean (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_wvariance (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_wsd (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_wvariance_with_fixed_mean (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_double_wsd_with_fixed_mean (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_long_double_wabsdev (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_wskew (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n); +double gsl_stats_long_double_wkurtosis (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n); + +double gsl_stats_long_double_wvariance_m (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_long_double_wsd_m (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_long_double_wabsdev_m (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double wmean); +double gsl_stats_long_double_wskew_m_sd (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double wmean, const double wsd); +double gsl_stats_long_double_wkurtosis_m_sd (const long double w[], const size_t wstride, const long double data[], const size_t stride, const size_t n, const double wmean, const double wsd); + +/* END OF FLOATING POINT TYPES */ + +double gsl_stats_long_double_pvariance (const long double data1[], const size_t stride1, const size_t n1, const long double data2[], const size_t stride2, const size_t n2); +double gsl_stats_long_double_ttest (const long double data1[], const size_t stride1, const size_t n1, const long double data2[], const size_t stride2, const size_t n2); + +long double gsl_stats_long_double_max (const long double data[], const size_t stride, const size_t n); +long double gsl_stats_long_double_min (const long double data[], const size_t stride, const size_t n); +void gsl_stats_long_double_minmax (long double * min, long double * max, const long double data[], const size_t stride, const size_t n); + +size_t gsl_stats_long_double_max_index (const long double data[], const size_t stride, const size_t n); +size_t gsl_stats_long_double_min_index (const long double data[], const size_t stride, const size_t n); +void gsl_stats_long_double_minmax_index (size_t * min_index, size_t * max_index, const long double data[], const size_t stride, const size_t n); + +double gsl_stats_long_double_median_from_sorted_data (const long double sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_long_double_quantile_from_sorted_data (const long double sorted_data[], const size_t stride, const size_t n, const double f) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_LONG_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_statistics_short.h b/dtm_release/local/include/gsl/gsl_statistics_short.h new file mode 100644 index 0000000000000000000000000000000000000000..5854eac798f01867c4a5df4c5bd3c350b5136d24 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_statistics_short.h @@ -0,0 +1,76 @@ +/* statistics/gsl_statistics_short.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_SHORT_H__ +#define __GSL_STATISTICS_SHORT_H__ + +#include <stddef.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_short_mean (const short data[], const size_t stride, const size_t n); +double gsl_stats_short_variance (const short data[], const size_t stride, const size_t n); +double gsl_stats_short_sd (const short data[], const size_t stride, const size_t n); +double gsl_stats_short_variance_with_fixed_mean (const short data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_short_sd_with_fixed_mean (const short data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_short_absdev (const short data[], const size_t stride, const size_t n); +double gsl_stats_short_skew (const short data[], const size_t stride, const size_t n); +double gsl_stats_short_kurtosis (const short data[], const size_t stride, const size_t n); +double gsl_stats_short_lag1_autocorrelation (const short data[], const size_t stride, const size_t n); + +double gsl_stats_short_covariance (const short data1[], const size_t stride1,const short data2[], const size_t stride2, const size_t n); +double gsl_stats_short_correlation (const short data1[], const size_t stride1,const short data2[], const size_t stride2, const size_t n); + +double gsl_stats_short_variance_m (const short data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_short_sd_m (const short data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_short_absdev_m (const short data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_short_skew_m_sd (const short data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_short_kurtosis_m_sd (const short data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_short_lag1_autocorrelation_m (const short data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_short_covariance_m (const short data1[], const size_t stride1,const short data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + + +double gsl_stats_short_pvariance (const short data1[], const size_t stride1, const size_t n1, const short data2[], const size_t stride2, const size_t n2); +double gsl_stats_short_ttest (const short data1[], const size_t stride1, const size_t n1, const short data2[], const size_t stride2, const size_t n2); + +short gsl_stats_short_max (const short data[], const size_t stride, const size_t n); +short gsl_stats_short_min (const short data[], const size_t stride, const size_t n); +void gsl_stats_short_minmax (short * min, short * max, const short data[], const size_t stride, const size_t n); + +size_t gsl_stats_short_max_index (const short data[], const size_t stride, const size_t n); +size_t gsl_stats_short_min_index (const short data[], const size_t stride, const size_t n); +void gsl_stats_short_minmax_index (size_t * min_index, size_t * max_index, const short data[], const size_t stride, const size_t n); + +double gsl_stats_short_median_from_sorted_data (const short sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_short_quantile_from_sorted_data (const short sorted_data[], const size_t stride, const size_t n, const double f) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_SHORT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_statistics_uchar.h b/dtm_release/local/include/gsl/gsl_statistics_uchar.h new file mode 100644 index 0000000000000000000000000000000000000000..03aaa8ef16e631e3e33fab2cbf3188feafdf5bb8 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_statistics_uchar.h @@ -0,0 +1,76 @@ +/* statistics/gsl_statistics_uchar.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_UCHAR_H__ +#define __GSL_STATISTICS_UCHAR_H__ + +#include <stddef.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_uchar_mean (const unsigned char data[], const size_t stride, const size_t n); +double gsl_stats_uchar_variance (const unsigned char data[], const size_t stride, const size_t n); +double gsl_stats_uchar_sd (const unsigned char data[], const size_t stride, const size_t n); +double gsl_stats_uchar_variance_with_fixed_mean (const unsigned char data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_uchar_sd_with_fixed_mean (const unsigned char data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_uchar_absdev (const unsigned char data[], const size_t stride, const size_t n); +double gsl_stats_uchar_skew (const unsigned char data[], const size_t stride, const size_t n); +double gsl_stats_uchar_kurtosis (const unsigned char data[], const size_t stride, const size_t n); +double gsl_stats_uchar_lag1_autocorrelation (const unsigned char data[], const size_t stride, const size_t n); + +double gsl_stats_uchar_covariance (const unsigned char data1[], const size_t stride1,const unsigned char data2[], const size_t stride2, const size_t n); +double gsl_stats_uchar_correlation (const unsigned char data1[], const size_t stride1,const unsigned char data2[], const size_t stride2, const size_t n); + +double gsl_stats_uchar_variance_m (const unsigned char data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_uchar_sd_m (const unsigned char data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_uchar_absdev_m (const unsigned char data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_uchar_skew_m_sd (const unsigned char data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_uchar_kurtosis_m_sd (const unsigned char data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_uchar_lag1_autocorrelation_m (const unsigned char data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_uchar_covariance_m (const unsigned char data1[], const size_t stride1,const unsigned char data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + + +double gsl_stats_uchar_pvariance (const unsigned char data1[], const size_t stride1, const size_t n1, const unsigned char data2[], const size_t stride2, const size_t n2); +double gsl_stats_uchar_ttest (const unsigned char data1[], const size_t stride1, const size_t n1, const unsigned char data2[], const size_t stride2, const size_t n2); + +unsigned char gsl_stats_uchar_max (const unsigned char data[], const size_t stride, const size_t n); +unsigned char gsl_stats_uchar_min (const unsigned char data[], const size_t stride, const size_t n); +void gsl_stats_uchar_minmax (unsigned char * min, unsigned char * max, const unsigned char data[], const size_t stride, const size_t n); + +size_t gsl_stats_uchar_max_index (const unsigned char data[], const size_t stride, const size_t n); +size_t gsl_stats_uchar_min_index (const unsigned char data[], const size_t stride, const size_t n); +void gsl_stats_uchar_minmax_index (size_t * min_index, size_t * max_index, const unsigned char data[], const size_t stride, const size_t n); + +double gsl_stats_uchar_median_from_sorted_data (const unsigned char sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_uchar_quantile_from_sorted_data (const unsigned char sorted_data[], const size_t stride, const size_t n, const double f) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_UCHAR_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_statistics_uint.h b/dtm_release/local/include/gsl/gsl_statistics_uint.h new file mode 100644 index 0000000000000000000000000000000000000000..ecd7b21b93865c3f91368ea02d63d7e7194bb67a --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_statistics_uint.h @@ -0,0 +1,76 @@ +/* statistics/gsl_statistics_uint.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_UINT_H__ +#define __GSL_STATISTICS_UINT_H__ + +#include <stddef.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_uint_mean (const unsigned int data[], const size_t stride, const size_t n); +double gsl_stats_uint_variance (const unsigned int data[], const size_t stride, const size_t n); +double gsl_stats_uint_sd (const unsigned int data[], const size_t stride, const size_t n); +double gsl_stats_uint_variance_with_fixed_mean (const unsigned int data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_uint_sd_with_fixed_mean (const unsigned int data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_uint_absdev (const unsigned int data[], const size_t stride, const size_t n); +double gsl_stats_uint_skew (const unsigned int data[], const size_t stride, const size_t n); +double gsl_stats_uint_kurtosis (const unsigned int data[], const size_t stride, const size_t n); +double gsl_stats_uint_lag1_autocorrelation (const unsigned int data[], const size_t stride, const size_t n); + +double gsl_stats_uint_covariance (const unsigned int data1[], const size_t stride1,const unsigned int data2[], const size_t stride2, const size_t n); +double gsl_stats_uint_correlation (const unsigned int data1[], const size_t stride1,const unsigned int data2[], const size_t stride2, const size_t n); + +double gsl_stats_uint_variance_m (const unsigned int data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_uint_sd_m (const unsigned int data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_uint_absdev_m (const unsigned int data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_uint_skew_m_sd (const unsigned int data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_uint_kurtosis_m_sd (const unsigned int data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_uint_lag1_autocorrelation_m (const unsigned int data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_uint_covariance_m (const unsigned int data1[], const size_t stride1,const unsigned int data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + + +double gsl_stats_uint_pvariance (const unsigned int data1[], const size_t stride1, const size_t n1, const unsigned int data2[], const size_t stride2, const size_t n2); +double gsl_stats_uint_ttest (const unsigned int data1[], const size_t stride1, const size_t n1, const unsigned int data2[], const size_t stride2, const size_t n2); + +unsigned int gsl_stats_uint_max (const unsigned int data[], const size_t stride, const size_t n); +unsigned int gsl_stats_uint_min (const unsigned int data[], const size_t stride, const size_t n); +void gsl_stats_uint_minmax (unsigned int * min, unsigned int * max, const unsigned int data[], const size_t stride, const size_t n); + +size_t gsl_stats_uint_max_index (const unsigned int data[], const size_t stride, const size_t n); +size_t gsl_stats_uint_min_index (const unsigned int data[], const size_t stride, const size_t n); +void gsl_stats_uint_minmax_index (size_t * min_index, size_t * max_index, const unsigned int data[], const size_t stride, const size_t n); + +double gsl_stats_uint_median_from_sorted_data (const unsigned int sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_uint_quantile_from_sorted_data (const unsigned int sorted_data[], const size_t stride, const size_t n, const double f) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_UINT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_statistics_ulong.h b/dtm_release/local/include/gsl/gsl_statistics_ulong.h new file mode 100644 index 0000000000000000000000000000000000000000..2f2712abdb783ec3b3aba3bd9e5ab9744e02d708 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_statistics_ulong.h @@ -0,0 +1,76 @@ +/* statistics/gsl_statistics_ulong.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_ULONG_H__ +#define __GSL_STATISTICS_ULONG_H__ + +#include <stddef.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_ulong_mean (const unsigned long data[], const size_t stride, const size_t n); +double gsl_stats_ulong_variance (const unsigned long data[], const size_t stride, const size_t n); +double gsl_stats_ulong_sd (const unsigned long data[], const size_t stride, const size_t n); +double gsl_stats_ulong_variance_with_fixed_mean (const unsigned long data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_ulong_sd_with_fixed_mean (const unsigned long data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_ulong_absdev (const unsigned long data[], const size_t stride, const size_t n); +double gsl_stats_ulong_skew (const unsigned long data[], const size_t stride, const size_t n); +double gsl_stats_ulong_kurtosis (const unsigned long data[], const size_t stride, const size_t n); +double gsl_stats_ulong_lag1_autocorrelation (const unsigned long data[], const size_t stride, const size_t n); + +double gsl_stats_ulong_covariance (const unsigned long data1[], const size_t stride1,const unsigned long data2[], const size_t stride2, const size_t n); +double gsl_stats_ulong_correlation (const unsigned long data1[], const size_t stride1,const unsigned long data2[], const size_t stride2, const size_t n); + +double gsl_stats_ulong_variance_m (const unsigned long data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_ulong_sd_m (const unsigned long data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_ulong_absdev_m (const unsigned long data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_ulong_skew_m_sd (const unsigned long data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_ulong_kurtosis_m_sd (const unsigned long data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_ulong_lag1_autocorrelation_m (const unsigned long data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_ulong_covariance_m (const unsigned long data1[], const size_t stride1,const unsigned long data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + + +double gsl_stats_ulong_pvariance (const unsigned long data1[], const size_t stride1, const size_t n1, const unsigned long data2[], const size_t stride2, const size_t n2); +double gsl_stats_ulong_ttest (const unsigned long data1[], const size_t stride1, const size_t n1, const unsigned long data2[], const size_t stride2, const size_t n2); + +unsigned long gsl_stats_ulong_max (const unsigned long data[], const size_t stride, const size_t n); +unsigned long gsl_stats_ulong_min (const unsigned long data[], const size_t stride, const size_t n); +void gsl_stats_ulong_minmax (unsigned long * min, unsigned long * max, const unsigned long data[], const size_t stride, const size_t n); + +size_t gsl_stats_ulong_max_index (const unsigned long data[], const size_t stride, const size_t n); +size_t gsl_stats_ulong_min_index (const unsigned long data[], const size_t stride, const size_t n); +void gsl_stats_ulong_minmax_index (size_t * min_index, size_t * max_index, const unsigned long data[], const size_t stride, const size_t n); + +double gsl_stats_ulong_median_from_sorted_data (const unsigned long sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_ulong_quantile_from_sorted_data (const unsigned long sorted_data[], const size_t stride, const size_t n, const double f) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_ULONG_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_statistics_ushort.h b/dtm_release/local/include/gsl/gsl_statistics_ushort.h new file mode 100644 index 0000000000000000000000000000000000000000..b022552c437d4743efdc57df66971c9346e1225f --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_statistics_ushort.h @@ -0,0 +1,76 @@ +/* statistics/gsl_statistics_ushort.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_STATISTICS_USHORT_H__ +#define __GSL_STATISTICS_USHORT_H__ + +#include <stddef.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_stats_ushort_mean (const unsigned short data[], const size_t stride, const size_t n); +double gsl_stats_ushort_variance (const unsigned short data[], const size_t stride, const size_t n); +double gsl_stats_ushort_sd (const unsigned short data[], const size_t stride, const size_t n); +double gsl_stats_ushort_variance_with_fixed_mean (const unsigned short data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_ushort_sd_with_fixed_mean (const unsigned short data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_ushort_absdev (const unsigned short data[], const size_t stride, const size_t n); +double gsl_stats_ushort_skew (const unsigned short data[], const size_t stride, const size_t n); +double gsl_stats_ushort_kurtosis (const unsigned short data[], const size_t stride, const size_t n); +double gsl_stats_ushort_lag1_autocorrelation (const unsigned short data[], const size_t stride, const size_t n); + +double gsl_stats_ushort_covariance (const unsigned short data1[], const size_t stride1,const unsigned short data2[], const size_t stride2, const size_t n); +double gsl_stats_ushort_correlation (const unsigned short data1[], const size_t stride1,const unsigned short data2[], const size_t stride2, const size_t n); + +double gsl_stats_ushort_variance_m (const unsigned short data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_ushort_sd_m (const unsigned short data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_ushort_absdev_m (const unsigned short data[], const size_t stride, const size_t n, const double mean); +double gsl_stats_ushort_skew_m_sd (const unsigned short data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_ushort_kurtosis_m_sd (const unsigned short data[], const size_t stride, const size_t n, const double mean, const double sd); +double gsl_stats_ushort_lag1_autocorrelation_m (const unsigned short data[], const size_t stride, const size_t n, const double mean); + +double gsl_stats_ushort_covariance_m (const unsigned short data1[], const size_t stride1,const unsigned short data2[], const size_t stride2, const size_t n, const double mean1, const double mean2); + + +double gsl_stats_ushort_pvariance (const unsigned short data1[], const size_t stride1, const size_t n1, const unsigned short data2[], const size_t stride2, const size_t n2); +double gsl_stats_ushort_ttest (const unsigned short data1[], const size_t stride1, const size_t n1, const unsigned short data2[], const size_t stride2, const size_t n2); + +unsigned short gsl_stats_ushort_max (const unsigned short data[], const size_t stride, const size_t n); +unsigned short gsl_stats_ushort_min (const unsigned short data[], const size_t stride, const size_t n); +void gsl_stats_ushort_minmax (unsigned short * min, unsigned short * max, const unsigned short data[], const size_t stride, const size_t n); + +size_t gsl_stats_ushort_max_index (const unsigned short data[], const size_t stride, const size_t n); +size_t gsl_stats_ushort_min_index (const unsigned short data[], const size_t stride, const size_t n); +void gsl_stats_ushort_minmax_index (size_t * min_index, size_t * max_index, const unsigned short data[], const size_t stride, const size_t n); + +double gsl_stats_ushort_median_from_sorted_data (const unsigned short sorted_data[], const size_t stride, const size_t n) ; +double gsl_stats_ushort_quantile_from_sorted_data (const unsigned short sorted_data[], const size_t stride, const size_t n, const double f) ; + +__END_DECLS + +#endif /* __GSL_STATISTICS_USHORT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sum.h b/dtm_release/local/include/gsl/gsl_sum.h new file mode 100644 index 0000000000000000000000000000000000000000..d9c4da81a7c8421f7e5b1bc7030bd6740d0f48cc --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sum.h @@ -0,0 +1,162 @@ +/* sum/gsl_sum.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Author: G. Jungman */ + + +#ifndef __GSL_SUM_H__ +#define __GSL_SUM_H__ + +#include <stdlib.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +/* Workspace for Levin U Transform with error estimation, + * + * size = number of terms the workspace can handle + * sum_plain = simple sum of series + * q_num = backward diagonal of numerator; length = size + * q_den = backward diagonal of denominator; length = size + * dq_num = table of numerator derivatives; length = size**2 + * dq_den = table of denominator derivatives; length = size**2 + * dsum = derivative of sum wrt term i; length = size + */ + +typedef struct +{ + size_t size; + size_t i; /* position in array */ + size_t terms_used; /* number of calls */ + double sum_plain; + double *q_num; + double *q_den; + double *dq_num; + double *dq_den; + double *dsum; +} +gsl_sum_levin_u_workspace; + +gsl_sum_levin_u_workspace *gsl_sum_levin_u_alloc (size_t n); +void gsl_sum_levin_u_free (gsl_sum_levin_u_workspace * w); + +/* Basic Levin-u acceleration method. + * + * array = array of series elements + * n = size of array + * sum_accel = result of summation acceleration + * err = estimated error + * + * See [Fessler et al., ACM TOMS 9, 346 (1983) and TOMS-602] + */ + +int gsl_sum_levin_u_accel (const double *array, + const size_t n, + gsl_sum_levin_u_workspace * w, + double *sum_accel, double *abserr); + +/* Basic Levin-u acceleration method with constraints on the terms + * used, + * + * array = array of series elements + * n = size of array + * min_terms = minimum number of terms to sum + * max_terms = maximum number of terms to sum + * sum_accel = result of summation acceleration + * err = estimated error + * + * See [Fessler et al., ACM TOMS 9, 346 (1983) and TOMS-602] + */ + +int gsl_sum_levin_u_minmax (const double *array, + const size_t n, + const size_t min_terms, + const size_t max_terms, + gsl_sum_levin_u_workspace * w, + double *sum_accel, double *abserr); + +/* Basic Levin-u step w/o reference to the array of terms. + * We only need to specify the value of the current term + * to execute the step. See TOMS-745. + * + * sum = t0 + ... + t_{n-1} + term; term = t_{n} + * + * term = value of the series term to be added + * n = position of term in series (starting from 0) + * sum_accel = result of summation acceleration + * sum_plain = simple sum of series + */ + +int +gsl_sum_levin_u_step (const double term, + const size_t n, + const size_t nmax, + gsl_sum_levin_u_workspace * w, + double *sum_accel); + +/* The following functions perform the same calculation without + estimating the errors. They require O(N) storage instead of O(N^2). + This may be useful for summing many similar series where the size + of the error has already been estimated reliably and is not + expected to change. */ + +typedef struct +{ + size_t size; + size_t i; /* position in array */ + size_t terms_used; /* number of calls */ + double sum_plain; + double *q_num; + double *q_den; + double *dsum; +} +gsl_sum_levin_utrunc_workspace; + +gsl_sum_levin_utrunc_workspace *gsl_sum_levin_utrunc_alloc (size_t n); +void gsl_sum_levin_utrunc_free (gsl_sum_levin_utrunc_workspace * w); + +int gsl_sum_levin_utrunc_accel (const double *array, + const size_t n, + gsl_sum_levin_utrunc_workspace * w, + double *sum_accel, double *abserr_trunc); + +int gsl_sum_levin_utrunc_minmax (const double *array, + const size_t n, + const size_t min_terms, + const size_t max_terms, + gsl_sum_levin_utrunc_workspace * w, + double *sum_accel, double *abserr_trunc); + +int gsl_sum_levin_utrunc_step (const double term, + const size_t n, + gsl_sum_levin_utrunc_workspace * w, + double *sum_accel); + +__END_DECLS + +#endif /* __GSL_SUM_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_sys.h b/dtm_release/local/include/gsl/gsl_sys.h new file mode 100644 index 0000000000000000000000000000000000000000..25e13486288ea59a9fade77d3408aa23cdf9fef8 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_sys.h @@ -0,0 +1,63 @@ +/* sys/gsl_sys.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_SYS_H__ +#define __GSL_SYS_H__ + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +double gsl_log1p (const double x); +double gsl_expm1 (const double x); +double gsl_hypot (const double x, const double y); +double gsl_hypot3 (const double x, const double y, const double z); +double gsl_acosh (const double x); +double gsl_asinh (const double x); +double gsl_atanh (const double x); + +int gsl_isnan (const double x); +int gsl_isinf (const double x); +int gsl_finite (const double x); + +double gsl_nan (void); +double gsl_posinf (void); +double gsl_neginf (void); +double gsl_fdiv (const double x, const double y); + +double gsl_coerce_double (const double x); +float gsl_coerce_float (const float x); +long double gsl_coerce_long_double (const long double x); + +double gsl_ldexp(const double x, const int e); +double gsl_frexp(const double x, int * e); + +int gsl_fcmp (const double x1, const double x2, const double epsilon); + +__END_DECLS + +#endif /* __GSL_SYS_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_test.h b/dtm_release/local/include/gsl/gsl_test.h new file mode 100644 index 0000000000000000000000000000000000000000..bb86896ce77157b603f0ac1a3ba54b62746aca7b --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_test.h @@ -0,0 +1,66 @@ +/* err/gsl_test.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_TEST_H__ +#define __GSL_TEST_H__ + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +void + gsl_test (int status, const char *test_description, ...); + +void +gsl_test_rel (double result, double expected, double relative_error, + const char *test_description, ...) ; + +void +gsl_test_abs (double result, double expected, double absolute_error, + const char *test_description, ...) ; + +void +gsl_test_factor (double result, double expected, double factor, + const char *test_description, ...) ; + +void +gsl_test_int (int result, int expected, const char *test_description, ...) ; + +void +gsl_test_str (const char * result, const char * expected, + const char *test_description, ...) ; + +void + gsl_test_verbose (int verbose) ; + +int + gsl_test_summary (void) ; + + +__END_DECLS + +#endif /* __GSL_TEST_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_types.h b/dtm_release/local/include/gsl/gsl_types.h new file mode 100644 index 0000000000000000000000000000000000000000..0330f551f34ced702e3c9040b88cc1c7b9b8bddb --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_types.h @@ -0,0 +1,41 @@ +/* gsl_types.h + * + * Copyright (C) 2001, 2007 Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_TYPES_H__ +#define __GSL_TYPES_H__ + +#ifndef GSL_VAR + +#ifdef WIN32 +# ifdef GSL_DLL +# ifdef DLL_EXPORT +# define GSL_VAR extern __declspec(dllexport) +# else +# define GSL_VAR extern __declspec(dllimport) +# endif +# else +# define GSL_VAR extern +# endif +#else +# define GSL_VAR extern +#endif + +#endif + +#endif /* __GSL_TYPES_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_vector.h b/dtm_release/local/include/gsl/gsl_vector.h new file mode 100644 index 0000000000000000000000000000000000000000..cf762e42fa949be09907f99b62ef90e9e2fede31 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_vector.h @@ -0,0 +1,25 @@ +#ifndef __GSL_VECTOR_H__ +#define __GSL_VECTOR_H__ + +#include <gsl/gsl_vector_complex_long_double.h> +#include <gsl/gsl_vector_complex_double.h> +#include <gsl/gsl_vector_complex_float.h> + +#include <gsl/gsl_vector_long_double.h> +#include <gsl/gsl_vector_double.h> +#include <gsl/gsl_vector_float.h> + +#include <gsl/gsl_vector_ulong.h> +#include <gsl/gsl_vector_long.h> + +#include <gsl/gsl_vector_uint.h> +#include <gsl/gsl_vector_int.h> + +#include <gsl/gsl_vector_ushort.h> +#include <gsl/gsl_vector_short.h> + +#include <gsl/gsl_vector_uchar.h> +#include <gsl/gsl_vector_char.h> + + +#endif /* __GSL_VECTOR_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_vector_char.h b/dtm_release/local/include/gsl/gsl_vector_char.h new file mode 100644 index 0000000000000000000000000000000000000000..66766ea03522a134ac9f41f3e08a2d976f090d91 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_vector_char.h @@ -0,0 +1,229 @@ +/* vector/gsl_vector_char.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_CHAR_H__ +#define __GSL_VECTOR_CHAR_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_block_char.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + char *data; + gsl_block_char *block; + int owner; +} +gsl_vector_char; + +typedef struct +{ + gsl_vector_char vector; +} _gsl_vector_char_view; + +typedef _gsl_vector_char_view gsl_vector_char_view; + +typedef struct +{ + gsl_vector_char vector; +} _gsl_vector_char_const_view; + +typedef const _gsl_vector_char_const_view gsl_vector_char_const_view; + + +/* Allocation */ + +gsl_vector_char *gsl_vector_char_alloc (const size_t n); +gsl_vector_char *gsl_vector_char_calloc (const size_t n); + +gsl_vector_char *gsl_vector_char_alloc_from_block (gsl_block_char * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_char *gsl_vector_char_alloc_from_vector (gsl_vector_char * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_char_free (gsl_vector_char * v); + +/* Views */ + +_gsl_vector_char_view +gsl_vector_char_view_array (char *v, size_t n); + +_gsl_vector_char_view +gsl_vector_char_view_array_with_stride (char *base, + size_t stride, + size_t n); + +_gsl_vector_char_const_view +gsl_vector_char_const_view_array (const char *v, size_t n); + +_gsl_vector_char_const_view +gsl_vector_char_const_view_array_with_stride (const char *base, + size_t stride, + size_t n); + +_gsl_vector_char_view +gsl_vector_char_subvector (gsl_vector_char *v, + size_t i, + size_t n); + +_gsl_vector_char_view +gsl_vector_char_subvector_with_stride (gsl_vector_char *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_char_const_view +gsl_vector_char_const_subvector (const gsl_vector_char *v, + size_t i, + size_t n); + +_gsl_vector_char_const_view +gsl_vector_char_const_subvector_with_stride (const gsl_vector_char *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +char gsl_vector_char_get (const gsl_vector_char * v, const size_t i); +void gsl_vector_char_set (gsl_vector_char * v, const size_t i, char x); + +char *gsl_vector_char_ptr (gsl_vector_char * v, const size_t i); +const char *gsl_vector_char_const_ptr (const gsl_vector_char * v, const size_t i); + +void gsl_vector_char_set_zero (gsl_vector_char * v); +void gsl_vector_char_set_all (gsl_vector_char * v, char x); +int gsl_vector_char_set_basis (gsl_vector_char * v, size_t i); + +int gsl_vector_char_fread (FILE * stream, gsl_vector_char * v); +int gsl_vector_char_fwrite (FILE * stream, const gsl_vector_char * v); +int gsl_vector_char_fscanf (FILE * stream, gsl_vector_char * v); +int gsl_vector_char_fprintf (FILE * stream, const gsl_vector_char * v, + const char *format); + +int gsl_vector_char_memcpy (gsl_vector_char * dest, const gsl_vector_char * src); + +int gsl_vector_char_reverse (gsl_vector_char * v); + +int gsl_vector_char_swap (gsl_vector_char * v, gsl_vector_char * w); +int gsl_vector_char_swap_elements (gsl_vector_char * v, const size_t i, const size_t j); + +char gsl_vector_char_max (const gsl_vector_char * v); +char gsl_vector_char_min (const gsl_vector_char * v); +void gsl_vector_char_minmax (const gsl_vector_char * v, char * min_out, char * max_out); + +size_t gsl_vector_char_max_index (const gsl_vector_char * v); +size_t gsl_vector_char_min_index (const gsl_vector_char * v); +void gsl_vector_char_minmax_index (const gsl_vector_char * v, size_t * imin, size_t * imax); + +int gsl_vector_char_add (gsl_vector_char * a, const gsl_vector_char * b); +int gsl_vector_char_sub (gsl_vector_char * a, const gsl_vector_char * b); +int gsl_vector_char_mul (gsl_vector_char * a, const gsl_vector_char * b); +int gsl_vector_char_div (gsl_vector_char * a, const gsl_vector_char * b); +int gsl_vector_char_scale (gsl_vector_char * a, const double x); +int gsl_vector_char_add_constant (gsl_vector_char * a, const double x); + +int gsl_vector_char_isnull (const gsl_vector_char * v); +int gsl_vector_char_ispos (const gsl_vector_char * v); +int gsl_vector_char_isneg (const gsl_vector_char * v); +int gsl_vector_char_isnonneg (const gsl_vector_char * v); + +#ifdef HAVE_INLINE + +extern inline +char +gsl_vector_char_get (const gsl_vector_char * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +extern inline +void +gsl_vector_char_set (gsl_vector_char * v, const size_t i, char x) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +extern inline +char * +gsl_vector_char_ptr (gsl_vector_char * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (char *) (v->data + i * v->stride); +} + +extern inline +const char * +gsl_vector_char_const_ptr (const gsl_vector_char * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const char *) (v->data + i * v->stride); +} + + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_CHAR_H__ */ + + diff --git a/dtm_release/local/include/gsl/gsl_vector_complex.h b/dtm_release/local/include/gsl/gsl_vector_complex.h new file mode 100644 index 0000000000000000000000000000000000000000..27676159c71820177e8054da9f44e83011e53ca2 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_vector_complex.h @@ -0,0 +1,17 @@ +#ifndef __GSL_VECTOR_COMPLEX_H__ +#define __GSL_VECTOR_COMPLEX_H__ + +#define GSL_VECTOR_REAL(z, i) ((z)->data[2*(i)*(z)->stride]) +#define GSL_VECTOR_IMAG(z, i) ((z)->data[2*(i)*(z)->stride + 1]) + +#if GSL_RANGE_CHECK +#define GSL_VECTOR_COMPLEX(zv, i) (((i) >= (zv)->size ? (gsl_error ("index out of range", __FILE__, __LINE__, GSL_EINVAL), 0):0 , *GSL_COMPLEX_AT((zv),(i)))) +#else +#define GSL_VECTOR_COMPLEX(zv, i) (GSL_COMPLEX_AT((zv),(i))) +#endif + +#define GSL_COMPLEX_AT(zv,i) ((gsl_complex*)&((zv)->data[2*(i)*(zv)->stride])) +#define GSL_COMPLEX_FLOAT_AT(zv,i) ((gsl_complex_float*)&((zv)->data[2*(i)*(zv)->stride])) +#define GSL_COMPLEX_LONG_DOUBLE_AT(zv,i) ((gsl_complex_long_double*)&((zv)->data[2*(i)*(zv)->stride])) + +#endif /* __GSL_VECTOR_COMPLEX_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_vector_complex_double.h b/dtm_release/local/include/gsl/gsl_vector_complex_double.h new file mode 100644 index 0000000000000000000000000000000000000000..195ee1ed72c037c09ddefa1df7792e49d3a93483 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_vector_complex_double.h @@ -0,0 +1,247 @@ +/* vector/gsl_vector_complex_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_COMPLEX_DOUBLE_H__ +#define __GSL_VECTOR_COMPLEX_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_complex.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_vector_double.h> +#include <gsl/gsl_vector_complex.h> +#include <gsl/gsl_block_complex_double.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + double *data; + gsl_block_complex *block; + int owner; +} gsl_vector_complex; + +typedef struct +{ + gsl_vector_complex vector; +} _gsl_vector_complex_view; + +typedef _gsl_vector_complex_view gsl_vector_complex_view; + +typedef struct +{ + gsl_vector_complex vector; +} _gsl_vector_complex_const_view; + +typedef const _gsl_vector_complex_const_view gsl_vector_complex_const_view; + +/* Allocation */ + +gsl_vector_complex *gsl_vector_complex_alloc (const size_t n); +gsl_vector_complex *gsl_vector_complex_calloc (const size_t n); + +gsl_vector_complex * +gsl_vector_complex_alloc_from_block (gsl_block_complex * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_complex * +gsl_vector_complex_alloc_from_vector (gsl_vector_complex * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_complex_free (gsl_vector_complex * v); + +/* Views */ + +_gsl_vector_complex_view +gsl_vector_complex_view_array (double *base, + size_t n); + +_gsl_vector_complex_view +gsl_vector_complex_view_array_with_stride (double *base, + size_t stride, + size_t n); + +_gsl_vector_complex_const_view +gsl_vector_complex_const_view_array (const double *base, + size_t n); + +_gsl_vector_complex_const_view +gsl_vector_complex_const_view_array_with_stride (const double *base, + size_t stride, + size_t n); + +_gsl_vector_complex_view +gsl_vector_complex_subvector (gsl_vector_complex *base, + size_t i, + size_t n); + + +_gsl_vector_complex_view +gsl_vector_complex_subvector_with_stride (gsl_vector_complex *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_complex_const_view +gsl_vector_complex_const_subvector (const gsl_vector_complex *base, + size_t i, + size_t n); + + +_gsl_vector_complex_const_view +gsl_vector_complex_const_subvector_with_stride (const gsl_vector_complex *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_view +gsl_vector_complex_real (gsl_vector_complex *v); + +_gsl_vector_view +gsl_vector_complex_imag (gsl_vector_complex *v); + +_gsl_vector_const_view +gsl_vector_complex_const_real (const gsl_vector_complex *v); + +_gsl_vector_const_view +gsl_vector_complex_const_imag (const gsl_vector_complex *v); + + +/* Operations */ + +gsl_complex +gsl_vector_complex_get (const gsl_vector_complex * v, const size_t i); + +void gsl_vector_complex_set (gsl_vector_complex * v, const size_t i, + gsl_complex z); + +gsl_complex +*gsl_vector_complex_ptr (gsl_vector_complex * v, const size_t i); + +const gsl_complex +*gsl_vector_complex_const_ptr (const gsl_vector_complex * v, const size_t i); + +void gsl_vector_complex_set_zero (gsl_vector_complex * v); +void gsl_vector_complex_set_all (gsl_vector_complex * v, + gsl_complex z); +int gsl_vector_complex_set_basis (gsl_vector_complex * v, size_t i); + +int gsl_vector_complex_fread (FILE * stream, + gsl_vector_complex * v); +int gsl_vector_complex_fwrite (FILE * stream, + const gsl_vector_complex * v); +int gsl_vector_complex_fscanf (FILE * stream, + gsl_vector_complex * v); +int gsl_vector_complex_fprintf (FILE * stream, + const gsl_vector_complex * v, + const char *format); + +int gsl_vector_complex_memcpy (gsl_vector_complex * dest, const gsl_vector_complex * src); + +int gsl_vector_complex_reverse (gsl_vector_complex * v); + +int gsl_vector_complex_swap (gsl_vector_complex * v, gsl_vector_complex * w); +int gsl_vector_complex_swap_elements (gsl_vector_complex * v, const size_t i, const size_t j); + +int gsl_vector_complex_isnull (const gsl_vector_complex * v); +int gsl_vector_complex_ispos (const gsl_vector_complex * v); +int gsl_vector_complex_isneg (const gsl_vector_complex * v); + +#ifdef HAVE_INLINE + +extern inline +gsl_complex +gsl_vector_complex_get (const gsl_vector_complex * v, + const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + gsl_complex zero = {{0, 0}}; + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, zero); + } +#endif + return *GSL_COMPLEX_AT (v, i); +} + +extern inline +void +gsl_vector_complex_set (gsl_vector_complex * v, + const size_t i, gsl_complex z) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + *GSL_COMPLEX_AT (v, i) = z; +} + +extern inline +gsl_complex * +gsl_vector_complex_ptr (gsl_vector_complex * v, + const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return GSL_COMPLEX_AT (v, i); +} + +extern inline +const gsl_complex * +gsl_vector_complex_const_ptr (const gsl_vector_complex * v, + const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return GSL_COMPLEX_AT (v, i); +} + + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_COMPLEX_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_vector_complex_float.h b/dtm_release/local/include/gsl/gsl_vector_complex_float.h new file mode 100644 index 0000000000000000000000000000000000000000..d2a8d59386ee7f4386790c7b649c578cef5ab7a9 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_vector_complex_float.h @@ -0,0 +1,247 @@ +/* vector/gsl_vector_complex_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_COMPLEX_FLOAT_H__ +#define __GSL_VECTOR_COMPLEX_FLOAT_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_complex.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_vector_float.h> +#include <gsl/gsl_vector_complex.h> +#include <gsl/gsl_block_complex_float.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + float *data; + gsl_block_complex_float *block; + int owner; +} gsl_vector_complex_float; + +typedef struct +{ + gsl_vector_complex_float vector; +} _gsl_vector_complex_float_view; + +typedef _gsl_vector_complex_float_view gsl_vector_complex_float_view; + +typedef struct +{ + gsl_vector_complex_float vector; +} _gsl_vector_complex_float_const_view; + +typedef const _gsl_vector_complex_float_const_view gsl_vector_complex_float_const_view; + +/* Allocation */ + +gsl_vector_complex_float *gsl_vector_complex_float_alloc (const size_t n); +gsl_vector_complex_float *gsl_vector_complex_float_calloc (const size_t n); + +gsl_vector_complex_float * +gsl_vector_complex_float_alloc_from_block (gsl_block_complex_float * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_complex_float * +gsl_vector_complex_float_alloc_from_vector (gsl_vector_complex_float * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_complex_float_free (gsl_vector_complex_float * v); + +/* Views */ + +_gsl_vector_complex_float_view +gsl_vector_complex_float_view_array (float *base, + size_t n); + +_gsl_vector_complex_float_view +gsl_vector_complex_float_view_array_with_stride (float *base, + size_t stride, + size_t n); + +_gsl_vector_complex_float_const_view +gsl_vector_complex_float_const_view_array (const float *base, + size_t n); + +_gsl_vector_complex_float_const_view +gsl_vector_complex_float_const_view_array_with_stride (const float *base, + size_t stride, + size_t n); + +_gsl_vector_complex_float_view +gsl_vector_complex_float_subvector (gsl_vector_complex_float *base, + size_t i, + size_t n); + + +_gsl_vector_complex_float_view +gsl_vector_complex_float_subvector_with_stride (gsl_vector_complex_float *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_complex_float_const_view +gsl_vector_complex_float_const_subvector (const gsl_vector_complex_float *base, + size_t i, + size_t n); + + +_gsl_vector_complex_float_const_view +gsl_vector_complex_float_const_subvector_with_stride (const gsl_vector_complex_float *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_float_view +gsl_vector_complex_float_real (gsl_vector_complex_float *v); + +_gsl_vector_float_view +gsl_vector_complex_float_imag (gsl_vector_complex_float *v); + +_gsl_vector_float_const_view +gsl_vector_complex_float_const_real (const gsl_vector_complex_float *v); + +_gsl_vector_float_const_view +gsl_vector_complex_float_const_imag (const gsl_vector_complex_float *v); + + +/* Operations */ + +gsl_complex_float +gsl_vector_complex_float_get (const gsl_vector_complex_float * v, const size_t i); + +void gsl_vector_complex_float_set (gsl_vector_complex_float * v, const size_t i, + gsl_complex_float z); + +gsl_complex_float +*gsl_vector_complex_float_ptr (gsl_vector_complex_float * v, const size_t i); + +const gsl_complex_float +*gsl_vector_complex_float_const_ptr (const gsl_vector_complex_float * v, const size_t i); + +void gsl_vector_complex_float_set_zero (gsl_vector_complex_float * v); +void gsl_vector_complex_float_set_all (gsl_vector_complex_float * v, + gsl_complex_float z); +int gsl_vector_complex_float_set_basis (gsl_vector_complex_float * v, size_t i); + +int gsl_vector_complex_float_fread (FILE * stream, + gsl_vector_complex_float * v); +int gsl_vector_complex_float_fwrite (FILE * stream, + const gsl_vector_complex_float * v); +int gsl_vector_complex_float_fscanf (FILE * stream, + gsl_vector_complex_float * v); +int gsl_vector_complex_float_fprintf (FILE * stream, + const gsl_vector_complex_float * v, + const char *format); + +int gsl_vector_complex_float_memcpy (gsl_vector_complex_float * dest, const gsl_vector_complex_float * src); + +int gsl_vector_complex_float_reverse (gsl_vector_complex_float * v); + +int gsl_vector_complex_float_swap (gsl_vector_complex_float * v, gsl_vector_complex_float * w); +int gsl_vector_complex_float_swap_elements (gsl_vector_complex_float * v, const size_t i, const size_t j); + +int gsl_vector_complex_float_isnull (const gsl_vector_complex_float * v); +int gsl_vector_complex_float_ispos (const gsl_vector_complex_float * v); +int gsl_vector_complex_float_isneg (const gsl_vector_complex_float * v); + +#ifdef HAVE_INLINE + +extern inline +gsl_complex_float +gsl_vector_complex_float_get (const gsl_vector_complex_float * v, + const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + gsl_complex_float zero = {{0, 0}}; + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, zero); + } +#endif + return *GSL_COMPLEX_FLOAT_AT (v, i); +} + +extern inline +void +gsl_vector_complex_float_set (gsl_vector_complex_float * v, + const size_t i, gsl_complex_float z) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + *GSL_COMPLEX_FLOAT_AT (v, i) = z; +} + +extern inline +gsl_complex_float * +gsl_vector_complex_float_ptr (gsl_vector_complex_float * v, + const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return GSL_COMPLEX_FLOAT_AT (v, i); +} + +extern inline +const gsl_complex_float * +gsl_vector_complex_float_const_ptr (const gsl_vector_complex_float * v, + const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return GSL_COMPLEX_FLOAT_AT (v, i); +} + + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_COMPLEX_FLOAT_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_vector_complex_long_double.h b/dtm_release/local/include/gsl/gsl_vector_complex_long_double.h new file mode 100644 index 0000000000000000000000000000000000000000..d553fa234ceac97c54d651616442c722fa326224 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_vector_complex_long_double.h @@ -0,0 +1,247 @@ +/* vector/gsl_vector_complex_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_COMPLEX_LONG_DOUBLE_H__ +#define __GSL_VECTOR_COMPLEX_LONG_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_complex.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_vector_long_double.h> +#include <gsl/gsl_vector_complex.h> +#include <gsl/gsl_block_complex_long_double.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + long double *data; + gsl_block_complex_long_double *block; + int owner; +} gsl_vector_complex_long_double; + +typedef struct +{ + gsl_vector_complex_long_double vector; +} _gsl_vector_complex_long_double_view; + +typedef _gsl_vector_complex_long_double_view gsl_vector_complex_long_double_view; + +typedef struct +{ + gsl_vector_complex_long_double vector; +} _gsl_vector_complex_long_double_const_view; + +typedef const _gsl_vector_complex_long_double_const_view gsl_vector_complex_long_double_const_view; + +/* Allocation */ + +gsl_vector_complex_long_double *gsl_vector_complex_long_double_alloc (const size_t n); +gsl_vector_complex_long_double *gsl_vector_complex_long_double_calloc (const size_t n); + +gsl_vector_complex_long_double * +gsl_vector_complex_long_double_alloc_from_block (gsl_block_complex_long_double * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_complex_long_double * +gsl_vector_complex_long_double_alloc_from_vector (gsl_vector_complex_long_double * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_complex_long_double_free (gsl_vector_complex_long_double * v); + +/* Views */ + +_gsl_vector_complex_long_double_view +gsl_vector_complex_long_double_view_array (long double *base, + size_t n); + +_gsl_vector_complex_long_double_view +gsl_vector_complex_long_double_view_array_with_stride (long double *base, + size_t stride, + size_t n); + +_gsl_vector_complex_long_double_const_view +gsl_vector_complex_long_double_const_view_array (const long double *base, + size_t n); + +_gsl_vector_complex_long_double_const_view +gsl_vector_complex_long_double_const_view_array_with_stride (const long double *base, + size_t stride, + size_t n); + +_gsl_vector_complex_long_double_view +gsl_vector_complex_long_double_subvector (gsl_vector_complex_long_double *base, + size_t i, + size_t n); + + +_gsl_vector_complex_long_double_view +gsl_vector_complex_long_double_subvector_with_stride (gsl_vector_complex_long_double *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_complex_long_double_const_view +gsl_vector_complex_long_double_const_subvector (const gsl_vector_complex_long_double *base, + size_t i, + size_t n); + + +_gsl_vector_complex_long_double_const_view +gsl_vector_complex_long_double_const_subvector_with_stride (const gsl_vector_complex_long_double *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_long_double_view +gsl_vector_complex_long_double_real (gsl_vector_complex_long_double *v); + +_gsl_vector_long_double_view +gsl_vector_complex_long_double_imag (gsl_vector_complex_long_double *v); + +_gsl_vector_long_double_const_view +gsl_vector_complex_long_double_const_real (const gsl_vector_complex_long_double *v); + +_gsl_vector_long_double_const_view +gsl_vector_complex_long_double_const_imag (const gsl_vector_complex_long_double *v); + + +/* Operations */ + +gsl_complex_long_double +gsl_vector_complex_long_double_get (const gsl_vector_complex_long_double * v, const size_t i); + +void gsl_vector_complex_long_double_set (gsl_vector_complex_long_double * v, const size_t i, + gsl_complex_long_double z); + +gsl_complex_long_double +*gsl_vector_complex_long_double_ptr (gsl_vector_complex_long_double * v, const size_t i); + +const gsl_complex_long_double +*gsl_vector_complex_long_double_const_ptr (const gsl_vector_complex_long_double * v, const size_t i); + +void gsl_vector_complex_long_double_set_zero (gsl_vector_complex_long_double * v); +void gsl_vector_complex_long_double_set_all (gsl_vector_complex_long_double * v, + gsl_complex_long_double z); +int gsl_vector_complex_long_double_set_basis (gsl_vector_complex_long_double * v, size_t i); + +int gsl_vector_complex_long_double_fread (FILE * stream, + gsl_vector_complex_long_double * v); +int gsl_vector_complex_long_double_fwrite (FILE * stream, + const gsl_vector_complex_long_double * v); +int gsl_vector_complex_long_double_fscanf (FILE * stream, + gsl_vector_complex_long_double * v); +int gsl_vector_complex_long_double_fprintf (FILE * stream, + const gsl_vector_complex_long_double * v, + const char *format); + +int gsl_vector_complex_long_double_memcpy (gsl_vector_complex_long_double * dest, const gsl_vector_complex_long_double * src); + +int gsl_vector_complex_long_double_reverse (gsl_vector_complex_long_double * v); + +int gsl_vector_complex_long_double_swap (gsl_vector_complex_long_double * v, gsl_vector_complex_long_double * w); +int gsl_vector_complex_long_double_swap_elements (gsl_vector_complex_long_double * v, const size_t i, const size_t j); + +int gsl_vector_complex_long_double_isnull (const gsl_vector_complex_long_double * v); +int gsl_vector_complex_long_double_ispos (const gsl_vector_complex_long_double * v); +int gsl_vector_complex_long_double_isneg (const gsl_vector_complex_long_double * v); + +#ifdef HAVE_INLINE + +extern inline +gsl_complex_long_double +gsl_vector_complex_long_double_get (const gsl_vector_complex_long_double * v, + const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + gsl_complex_long_double zero = {{0, 0}}; + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, zero); + } +#endif + return *GSL_COMPLEX_LONG_DOUBLE_AT (v, i); +} + +extern inline +void +gsl_vector_complex_long_double_set (gsl_vector_complex_long_double * v, + const size_t i, gsl_complex_long_double z) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + *GSL_COMPLEX_LONG_DOUBLE_AT (v, i) = z; +} + +extern inline +gsl_complex_long_double * +gsl_vector_complex_long_double_ptr (gsl_vector_complex_long_double * v, + const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return GSL_COMPLEX_LONG_DOUBLE_AT (v, i); +} + +extern inline +const gsl_complex_long_double * +gsl_vector_complex_long_double_const_ptr (const gsl_vector_complex_long_double * v, + const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return GSL_COMPLEX_LONG_DOUBLE_AT (v, i); +} + + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_COMPLEX_LONG_DOUBLE_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_vector_double.h b/dtm_release/local/include/gsl/gsl_vector_double.h new file mode 100644 index 0000000000000000000000000000000000000000..54a37d46bddf76900f5bb74ffbfc11490db280a6 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_vector_double.h @@ -0,0 +1,229 @@ +/* vector/gsl_vector_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_DOUBLE_H__ +#define __GSL_VECTOR_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_block_double.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + double *data; + gsl_block *block; + int owner; +} +gsl_vector; + +typedef struct +{ + gsl_vector vector; +} _gsl_vector_view; + +typedef _gsl_vector_view gsl_vector_view; + +typedef struct +{ + gsl_vector vector; +} _gsl_vector_const_view; + +typedef const _gsl_vector_const_view gsl_vector_const_view; + + +/* Allocation */ + +gsl_vector *gsl_vector_alloc (const size_t n); +gsl_vector *gsl_vector_calloc (const size_t n); + +gsl_vector *gsl_vector_alloc_from_block (gsl_block * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector *gsl_vector_alloc_from_vector (gsl_vector * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_free (gsl_vector * v); + +/* Views */ + +_gsl_vector_view +gsl_vector_view_array (double *v, size_t n); + +_gsl_vector_view +gsl_vector_view_array_with_stride (double *base, + size_t stride, + size_t n); + +_gsl_vector_const_view +gsl_vector_const_view_array (const double *v, size_t n); + +_gsl_vector_const_view +gsl_vector_const_view_array_with_stride (const double *base, + size_t stride, + size_t n); + +_gsl_vector_view +gsl_vector_subvector (gsl_vector *v, + size_t i, + size_t n); + +_gsl_vector_view +gsl_vector_subvector_with_stride (gsl_vector *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_const_view +gsl_vector_const_subvector (const gsl_vector *v, + size_t i, + size_t n); + +_gsl_vector_const_view +gsl_vector_const_subvector_with_stride (const gsl_vector *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +double gsl_vector_get (const gsl_vector * v, const size_t i); +void gsl_vector_set (gsl_vector * v, const size_t i, double x); + +double *gsl_vector_ptr (gsl_vector * v, const size_t i); +const double *gsl_vector_const_ptr (const gsl_vector * v, const size_t i); + +void gsl_vector_set_zero (gsl_vector * v); +void gsl_vector_set_all (gsl_vector * v, double x); +int gsl_vector_set_basis (gsl_vector * v, size_t i); + +int gsl_vector_fread (FILE * stream, gsl_vector * v); +int gsl_vector_fwrite (FILE * stream, const gsl_vector * v); +int gsl_vector_fscanf (FILE * stream, gsl_vector * v); +int gsl_vector_fprintf (FILE * stream, const gsl_vector * v, + const char *format); + +int gsl_vector_memcpy (gsl_vector * dest, const gsl_vector * src); + +int gsl_vector_reverse (gsl_vector * v); + +int gsl_vector_swap (gsl_vector * v, gsl_vector * w); +int gsl_vector_swap_elements (gsl_vector * v, const size_t i, const size_t j); + +double gsl_vector_max (const gsl_vector * v); +double gsl_vector_min (const gsl_vector * v); +void gsl_vector_minmax (const gsl_vector * v, double * min_out, double * max_out); + +size_t gsl_vector_max_index (const gsl_vector * v); +size_t gsl_vector_min_index (const gsl_vector * v); +void gsl_vector_minmax_index (const gsl_vector * v, size_t * imin, size_t * imax); + +int gsl_vector_add (gsl_vector * a, const gsl_vector * b); +int gsl_vector_sub (gsl_vector * a, const gsl_vector * b); +int gsl_vector_mul (gsl_vector * a, const gsl_vector * b); +int gsl_vector_div (gsl_vector * a, const gsl_vector * b); +int gsl_vector_scale (gsl_vector * a, const double x); +int gsl_vector_add_constant (gsl_vector * a, const double x); + +int gsl_vector_isnull (const gsl_vector * v); +int gsl_vector_ispos (const gsl_vector * v); +int gsl_vector_isneg (const gsl_vector * v); +int gsl_vector_isnonneg (const gsl_vector * v); + +#ifdef HAVE_INLINE + +extern inline +double +gsl_vector_get (const gsl_vector * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +extern inline +void +gsl_vector_set (gsl_vector * v, const size_t i, double x) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +extern inline +double * +gsl_vector_ptr (gsl_vector * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (double *) (v->data + i * v->stride); +} + +extern inline +const double * +gsl_vector_const_ptr (const gsl_vector * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const double *) (v->data + i * v->stride); +} + + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_DOUBLE_H__ */ + + diff --git a/dtm_release/local/include/gsl/gsl_vector_float.h b/dtm_release/local/include/gsl/gsl_vector_float.h new file mode 100644 index 0000000000000000000000000000000000000000..cca3930aff8eac49748a02b25bcf28d3ab380097 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_vector_float.h @@ -0,0 +1,229 @@ +/* vector/gsl_vector_float.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_FLOAT_H__ +#define __GSL_VECTOR_FLOAT_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_block_float.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + float *data; + gsl_block_float *block; + int owner; +} +gsl_vector_float; + +typedef struct +{ + gsl_vector_float vector; +} _gsl_vector_float_view; + +typedef _gsl_vector_float_view gsl_vector_float_view; + +typedef struct +{ + gsl_vector_float vector; +} _gsl_vector_float_const_view; + +typedef const _gsl_vector_float_const_view gsl_vector_float_const_view; + + +/* Allocation */ + +gsl_vector_float *gsl_vector_float_alloc (const size_t n); +gsl_vector_float *gsl_vector_float_calloc (const size_t n); + +gsl_vector_float *gsl_vector_float_alloc_from_block (gsl_block_float * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_float *gsl_vector_float_alloc_from_vector (gsl_vector_float * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_float_free (gsl_vector_float * v); + +/* Views */ + +_gsl_vector_float_view +gsl_vector_float_view_array (float *v, size_t n); + +_gsl_vector_float_view +gsl_vector_float_view_array_with_stride (float *base, + size_t stride, + size_t n); + +_gsl_vector_float_const_view +gsl_vector_float_const_view_array (const float *v, size_t n); + +_gsl_vector_float_const_view +gsl_vector_float_const_view_array_with_stride (const float *base, + size_t stride, + size_t n); + +_gsl_vector_float_view +gsl_vector_float_subvector (gsl_vector_float *v, + size_t i, + size_t n); + +_gsl_vector_float_view +gsl_vector_float_subvector_with_stride (gsl_vector_float *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_float_const_view +gsl_vector_float_const_subvector (const gsl_vector_float *v, + size_t i, + size_t n); + +_gsl_vector_float_const_view +gsl_vector_float_const_subvector_with_stride (const gsl_vector_float *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +float gsl_vector_float_get (const gsl_vector_float * v, const size_t i); +void gsl_vector_float_set (gsl_vector_float * v, const size_t i, float x); + +float *gsl_vector_float_ptr (gsl_vector_float * v, const size_t i); +const float *gsl_vector_float_const_ptr (const gsl_vector_float * v, const size_t i); + +void gsl_vector_float_set_zero (gsl_vector_float * v); +void gsl_vector_float_set_all (gsl_vector_float * v, float x); +int gsl_vector_float_set_basis (gsl_vector_float * v, size_t i); + +int gsl_vector_float_fread (FILE * stream, gsl_vector_float * v); +int gsl_vector_float_fwrite (FILE * stream, const gsl_vector_float * v); +int gsl_vector_float_fscanf (FILE * stream, gsl_vector_float * v); +int gsl_vector_float_fprintf (FILE * stream, const gsl_vector_float * v, + const char *format); + +int gsl_vector_float_memcpy (gsl_vector_float * dest, const gsl_vector_float * src); + +int gsl_vector_float_reverse (gsl_vector_float * v); + +int gsl_vector_float_swap (gsl_vector_float * v, gsl_vector_float * w); +int gsl_vector_float_swap_elements (gsl_vector_float * v, const size_t i, const size_t j); + +float gsl_vector_float_max (const gsl_vector_float * v); +float gsl_vector_float_min (const gsl_vector_float * v); +void gsl_vector_float_minmax (const gsl_vector_float * v, float * min_out, float * max_out); + +size_t gsl_vector_float_max_index (const gsl_vector_float * v); +size_t gsl_vector_float_min_index (const gsl_vector_float * v); +void gsl_vector_float_minmax_index (const gsl_vector_float * v, size_t * imin, size_t * imax); + +int gsl_vector_float_add (gsl_vector_float * a, const gsl_vector_float * b); +int gsl_vector_float_sub (gsl_vector_float * a, const gsl_vector_float * b); +int gsl_vector_float_mul (gsl_vector_float * a, const gsl_vector_float * b); +int gsl_vector_float_div (gsl_vector_float * a, const gsl_vector_float * b); +int gsl_vector_float_scale (gsl_vector_float * a, const double x); +int gsl_vector_float_add_constant (gsl_vector_float * a, const double x); + +int gsl_vector_float_isnull (const gsl_vector_float * v); +int gsl_vector_float_ispos (const gsl_vector_float * v); +int gsl_vector_float_isneg (const gsl_vector_float * v); +int gsl_vector_float_isnonneg (const gsl_vector_float * v); + +#ifdef HAVE_INLINE + +extern inline +float +gsl_vector_float_get (const gsl_vector_float * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +extern inline +void +gsl_vector_float_set (gsl_vector_float * v, const size_t i, float x) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +extern inline +float * +gsl_vector_float_ptr (gsl_vector_float * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (float *) (v->data + i * v->stride); +} + +extern inline +const float * +gsl_vector_float_const_ptr (const gsl_vector_float * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const float *) (v->data + i * v->stride); +} + + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_FLOAT_H__ */ + + diff --git a/dtm_release/local/include/gsl/gsl_vector_int.h b/dtm_release/local/include/gsl/gsl_vector_int.h new file mode 100644 index 0000000000000000000000000000000000000000..722e52431818d666229c653c443777ca95522cda --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_vector_int.h @@ -0,0 +1,229 @@ +/* vector/gsl_vector_int.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_INT_H__ +#define __GSL_VECTOR_INT_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_block_int.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + int *data; + gsl_block_int *block; + int owner; +} +gsl_vector_int; + +typedef struct +{ + gsl_vector_int vector; +} _gsl_vector_int_view; + +typedef _gsl_vector_int_view gsl_vector_int_view; + +typedef struct +{ + gsl_vector_int vector; +} _gsl_vector_int_const_view; + +typedef const _gsl_vector_int_const_view gsl_vector_int_const_view; + + +/* Allocation */ + +gsl_vector_int *gsl_vector_int_alloc (const size_t n); +gsl_vector_int *gsl_vector_int_calloc (const size_t n); + +gsl_vector_int *gsl_vector_int_alloc_from_block (gsl_block_int * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_int *gsl_vector_int_alloc_from_vector (gsl_vector_int * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_int_free (gsl_vector_int * v); + +/* Views */ + +_gsl_vector_int_view +gsl_vector_int_view_array (int *v, size_t n); + +_gsl_vector_int_view +gsl_vector_int_view_array_with_stride (int *base, + size_t stride, + size_t n); + +_gsl_vector_int_const_view +gsl_vector_int_const_view_array (const int *v, size_t n); + +_gsl_vector_int_const_view +gsl_vector_int_const_view_array_with_stride (const int *base, + size_t stride, + size_t n); + +_gsl_vector_int_view +gsl_vector_int_subvector (gsl_vector_int *v, + size_t i, + size_t n); + +_gsl_vector_int_view +gsl_vector_int_subvector_with_stride (gsl_vector_int *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_int_const_view +gsl_vector_int_const_subvector (const gsl_vector_int *v, + size_t i, + size_t n); + +_gsl_vector_int_const_view +gsl_vector_int_const_subvector_with_stride (const gsl_vector_int *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +int gsl_vector_int_get (const gsl_vector_int * v, const size_t i); +void gsl_vector_int_set (gsl_vector_int * v, const size_t i, int x); + +int *gsl_vector_int_ptr (gsl_vector_int * v, const size_t i); +const int *gsl_vector_int_const_ptr (const gsl_vector_int * v, const size_t i); + +void gsl_vector_int_set_zero (gsl_vector_int * v); +void gsl_vector_int_set_all (gsl_vector_int * v, int x); +int gsl_vector_int_set_basis (gsl_vector_int * v, size_t i); + +int gsl_vector_int_fread (FILE * stream, gsl_vector_int * v); +int gsl_vector_int_fwrite (FILE * stream, const gsl_vector_int * v); +int gsl_vector_int_fscanf (FILE * stream, gsl_vector_int * v); +int gsl_vector_int_fprintf (FILE * stream, const gsl_vector_int * v, + const char *format); + +int gsl_vector_int_memcpy (gsl_vector_int * dest, const gsl_vector_int * src); + +int gsl_vector_int_reverse (gsl_vector_int * v); + +int gsl_vector_int_swap (gsl_vector_int * v, gsl_vector_int * w); +int gsl_vector_int_swap_elements (gsl_vector_int * v, const size_t i, const size_t j); + +int gsl_vector_int_max (const gsl_vector_int * v); +int gsl_vector_int_min (const gsl_vector_int * v); +void gsl_vector_int_minmax (const gsl_vector_int * v, int * min_out, int * max_out); + +size_t gsl_vector_int_max_index (const gsl_vector_int * v); +size_t gsl_vector_int_min_index (const gsl_vector_int * v); +void gsl_vector_int_minmax_index (const gsl_vector_int * v, size_t * imin, size_t * imax); + +int gsl_vector_int_add (gsl_vector_int * a, const gsl_vector_int * b); +int gsl_vector_int_sub (gsl_vector_int * a, const gsl_vector_int * b); +int gsl_vector_int_mul (gsl_vector_int * a, const gsl_vector_int * b); +int gsl_vector_int_div (gsl_vector_int * a, const gsl_vector_int * b); +int gsl_vector_int_scale (gsl_vector_int * a, const double x); +int gsl_vector_int_add_constant (gsl_vector_int * a, const double x); + +int gsl_vector_int_isnull (const gsl_vector_int * v); +int gsl_vector_int_ispos (const gsl_vector_int * v); +int gsl_vector_int_isneg (const gsl_vector_int * v); +int gsl_vector_int_isnonneg (const gsl_vector_int * v); + +#ifdef HAVE_INLINE + +extern inline +int +gsl_vector_int_get (const gsl_vector_int * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +extern inline +void +gsl_vector_int_set (gsl_vector_int * v, const size_t i, int x) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +extern inline +int * +gsl_vector_int_ptr (gsl_vector_int * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (int *) (v->data + i * v->stride); +} + +extern inline +const int * +gsl_vector_int_const_ptr (const gsl_vector_int * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const int *) (v->data + i * v->stride); +} + + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_INT_H__ */ + + diff --git a/dtm_release/local/include/gsl/gsl_vector_long.h b/dtm_release/local/include/gsl/gsl_vector_long.h new file mode 100644 index 0000000000000000000000000000000000000000..fa55cb9d1f40933a1e6b8c2ec23d8703b946ae27 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_vector_long.h @@ -0,0 +1,229 @@ +/* vector/gsl_vector_long.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_LONG_H__ +#define __GSL_VECTOR_LONG_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_block_long.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + long *data; + gsl_block_long *block; + int owner; +} +gsl_vector_long; + +typedef struct +{ + gsl_vector_long vector; +} _gsl_vector_long_view; + +typedef _gsl_vector_long_view gsl_vector_long_view; + +typedef struct +{ + gsl_vector_long vector; +} _gsl_vector_long_const_view; + +typedef const _gsl_vector_long_const_view gsl_vector_long_const_view; + + +/* Allocation */ + +gsl_vector_long *gsl_vector_long_alloc (const size_t n); +gsl_vector_long *gsl_vector_long_calloc (const size_t n); + +gsl_vector_long *gsl_vector_long_alloc_from_block (gsl_block_long * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_long *gsl_vector_long_alloc_from_vector (gsl_vector_long * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_long_free (gsl_vector_long * v); + +/* Views */ + +_gsl_vector_long_view +gsl_vector_long_view_array (long *v, size_t n); + +_gsl_vector_long_view +gsl_vector_long_view_array_with_stride (long *base, + size_t stride, + size_t n); + +_gsl_vector_long_const_view +gsl_vector_long_const_view_array (const long *v, size_t n); + +_gsl_vector_long_const_view +gsl_vector_long_const_view_array_with_stride (const long *base, + size_t stride, + size_t n); + +_gsl_vector_long_view +gsl_vector_long_subvector (gsl_vector_long *v, + size_t i, + size_t n); + +_gsl_vector_long_view +gsl_vector_long_subvector_with_stride (gsl_vector_long *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_long_const_view +gsl_vector_long_const_subvector (const gsl_vector_long *v, + size_t i, + size_t n); + +_gsl_vector_long_const_view +gsl_vector_long_const_subvector_with_stride (const gsl_vector_long *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +long gsl_vector_long_get (const gsl_vector_long * v, const size_t i); +void gsl_vector_long_set (gsl_vector_long * v, const size_t i, long x); + +long *gsl_vector_long_ptr (gsl_vector_long * v, const size_t i); +const long *gsl_vector_long_const_ptr (const gsl_vector_long * v, const size_t i); + +void gsl_vector_long_set_zero (gsl_vector_long * v); +void gsl_vector_long_set_all (gsl_vector_long * v, long x); +int gsl_vector_long_set_basis (gsl_vector_long * v, size_t i); + +int gsl_vector_long_fread (FILE * stream, gsl_vector_long * v); +int gsl_vector_long_fwrite (FILE * stream, const gsl_vector_long * v); +int gsl_vector_long_fscanf (FILE * stream, gsl_vector_long * v); +int gsl_vector_long_fprintf (FILE * stream, const gsl_vector_long * v, + const char *format); + +int gsl_vector_long_memcpy (gsl_vector_long * dest, const gsl_vector_long * src); + +int gsl_vector_long_reverse (gsl_vector_long * v); + +int gsl_vector_long_swap (gsl_vector_long * v, gsl_vector_long * w); +int gsl_vector_long_swap_elements (gsl_vector_long * v, const size_t i, const size_t j); + +long gsl_vector_long_max (const gsl_vector_long * v); +long gsl_vector_long_min (const gsl_vector_long * v); +void gsl_vector_long_minmax (const gsl_vector_long * v, long * min_out, long * max_out); + +size_t gsl_vector_long_max_index (const gsl_vector_long * v); +size_t gsl_vector_long_min_index (const gsl_vector_long * v); +void gsl_vector_long_minmax_index (const gsl_vector_long * v, size_t * imin, size_t * imax); + +int gsl_vector_long_add (gsl_vector_long * a, const gsl_vector_long * b); +int gsl_vector_long_sub (gsl_vector_long * a, const gsl_vector_long * b); +int gsl_vector_long_mul (gsl_vector_long * a, const gsl_vector_long * b); +int gsl_vector_long_div (gsl_vector_long * a, const gsl_vector_long * b); +int gsl_vector_long_scale (gsl_vector_long * a, const double x); +int gsl_vector_long_add_constant (gsl_vector_long * a, const double x); + +int gsl_vector_long_isnull (const gsl_vector_long * v); +int gsl_vector_long_ispos (const gsl_vector_long * v); +int gsl_vector_long_isneg (const gsl_vector_long * v); +int gsl_vector_long_isnonneg (const gsl_vector_long * v); + +#ifdef HAVE_INLINE + +extern inline +long +gsl_vector_long_get (const gsl_vector_long * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +extern inline +void +gsl_vector_long_set (gsl_vector_long * v, const size_t i, long x) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +extern inline +long * +gsl_vector_long_ptr (gsl_vector_long * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (long *) (v->data + i * v->stride); +} + +extern inline +const long * +gsl_vector_long_const_ptr (const gsl_vector_long * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const long *) (v->data + i * v->stride); +} + + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_LONG_H__ */ + + diff --git a/dtm_release/local/include/gsl/gsl_vector_long_double.h b/dtm_release/local/include/gsl/gsl_vector_long_double.h new file mode 100644 index 0000000000000000000000000000000000000000..3662a47ac588f2ef6cc9270adac80013729ca9ec --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_vector_long_double.h @@ -0,0 +1,229 @@ +/* vector/gsl_vector_long_double.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_LONG_DOUBLE_H__ +#define __GSL_VECTOR_LONG_DOUBLE_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_block_long_double.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + long double *data; + gsl_block_long_double *block; + int owner; +} +gsl_vector_long_double; + +typedef struct +{ + gsl_vector_long_double vector; +} _gsl_vector_long_double_view; + +typedef _gsl_vector_long_double_view gsl_vector_long_double_view; + +typedef struct +{ + gsl_vector_long_double vector; +} _gsl_vector_long_double_const_view; + +typedef const _gsl_vector_long_double_const_view gsl_vector_long_double_const_view; + + +/* Allocation */ + +gsl_vector_long_double *gsl_vector_long_double_alloc (const size_t n); +gsl_vector_long_double *gsl_vector_long_double_calloc (const size_t n); + +gsl_vector_long_double *gsl_vector_long_double_alloc_from_block (gsl_block_long_double * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_long_double *gsl_vector_long_double_alloc_from_vector (gsl_vector_long_double * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_long_double_free (gsl_vector_long_double * v); + +/* Views */ + +_gsl_vector_long_double_view +gsl_vector_long_double_view_array (long double *v, size_t n); + +_gsl_vector_long_double_view +gsl_vector_long_double_view_array_with_stride (long double *base, + size_t stride, + size_t n); + +_gsl_vector_long_double_const_view +gsl_vector_long_double_const_view_array (const long double *v, size_t n); + +_gsl_vector_long_double_const_view +gsl_vector_long_double_const_view_array_with_stride (const long double *base, + size_t stride, + size_t n); + +_gsl_vector_long_double_view +gsl_vector_long_double_subvector (gsl_vector_long_double *v, + size_t i, + size_t n); + +_gsl_vector_long_double_view +gsl_vector_long_double_subvector_with_stride (gsl_vector_long_double *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_long_double_const_view +gsl_vector_long_double_const_subvector (const gsl_vector_long_double *v, + size_t i, + size_t n); + +_gsl_vector_long_double_const_view +gsl_vector_long_double_const_subvector_with_stride (const gsl_vector_long_double *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +long double gsl_vector_long_double_get (const gsl_vector_long_double * v, const size_t i); +void gsl_vector_long_double_set (gsl_vector_long_double * v, const size_t i, long double x); + +long double *gsl_vector_long_double_ptr (gsl_vector_long_double * v, const size_t i); +const long double *gsl_vector_long_double_const_ptr (const gsl_vector_long_double * v, const size_t i); + +void gsl_vector_long_double_set_zero (gsl_vector_long_double * v); +void gsl_vector_long_double_set_all (gsl_vector_long_double * v, long double x); +int gsl_vector_long_double_set_basis (gsl_vector_long_double * v, size_t i); + +int gsl_vector_long_double_fread (FILE * stream, gsl_vector_long_double * v); +int gsl_vector_long_double_fwrite (FILE * stream, const gsl_vector_long_double * v); +int gsl_vector_long_double_fscanf (FILE * stream, gsl_vector_long_double * v); +int gsl_vector_long_double_fprintf (FILE * stream, const gsl_vector_long_double * v, + const char *format); + +int gsl_vector_long_double_memcpy (gsl_vector_long_double * dest, const gsl_vector_long_double * src); + +int gsl_vector_long_double_reverse (gsl_vector_long_double * v); + +int gsl_vector_long_double_swap (gsl_vector_long_double * v, gsl_vector_long_double * w); +int gsl_vector_long_double_swap_elements (gsl_vector_long_double * v, const size_t i, const size_t j); + +long double gsl_vector_long_double_max (const gsl_vector_long_double * v); +long double gsl_vector_long_double_min (const gsl_vector_long_double * v); +void gsl_vector_long_double_minmax (const gsl_vector_long_double * v, long double * min_out, long double * max_out); + +size_t gsl_vector_long_double_max_index (const gsl_vector_long_double * v); +size_t gsl_vector_long_double_min_index (const gsl_vector_long_double * v); +void gsl_vector_long_double_minmax_index (const gsl_vector_long_double * v, size_t * imin, size_t * imax); + +int gsl_vector_long_double_add (gsl_vector_long_double * a, const gsl_vector_long_double * b); +int gsl_vector_long_double_sub (gsl_vector_long_double * a, const gsl_vector_long_double * b); +int gsl_vector_long_double_mul (gsl_vector_long_double * a, const gsl_vector_long_double * b); +int gsl_vector_long_double_div (gsl_vector_long_double * a, const gsl_vector_long_double * b); +int gsl_vector_long_double_scale (gsl_vector_long_double * a, const double x); +int gsl_vector_long_double_add_constant (gsl_vector_long_double * a, const double x); + +int gsl_vector_long_double_isnull (const gsl_vector_long_double * v); +int gsl_vector_long_double_ispos (const gsl_vector_long_double * v); +int gsl_vector_long_double_isneg (const gsl_vector_long_double * v); +int gsl_vector_long_double_isnonneg (const gsl_vector_long_double * v); + +#ifdef HAVE_INLINE + +extern inline +long double +gsl_vector_long_double_get (const gsl_vector_long_double * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +extern inline +void +gsl_vector_long_double_set (gsl_vector_long_double * v, const size_t i, long double x) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +extern inline +long double * +gsl_vector_long_double_ptr (gsl_vector_long_double * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (long double *) (v->data + i * v->stride); +} + +extern inline +const long double * +gsl_vector_long_double_const_ptr (const gsl_vector_long_double * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const long double *) (v->data + i * v->stride); +} + + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_LONG_DOUBLE_H__ */ + + diff --git a/dtm_release/local/include/gsl/gsl_vector_short.h b/dtm_release/local/include/gsl/gsl_vector_short.h new file mode 100644 index 0000000000000000000000000000000000000000..ea1cb621d8a1203a13c53716a532328e7169f890 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_vector_short.h @@ -0,0 +1,229 @@ +/* vector/gsl_vector_short.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_SHORT_H__ +#define __GSL_VECTOR_SHORT_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_block_short.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + short *data; + gsl_block_short *block; + int owner; +} +gsl_vector_short; + +typedef struct +{ + gsl_vector_short vector; +} _gsl_vector_short_view; + +typedef _gsl_vector_short_view gsl_vector_short_view; + +typedef struct +{ + gsl_vector_short vector; +} _gsl_vector_short_const_view; + +typedef const _gsl_vector_short_const_view gsl_vector_short_const_view; + + +/* Allocation */ + +gsl_vector_short *gsl_vector_short_alloc (const size_t n); +gsl_vector_short *gsl_vector_short_calloc (const size_t n); + +gsl_vector_short *gsl_vector_short_alloc_from_block (gsl_block_short * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_short *gsl_vector_short_alloc_from_vector (gsl_vector_short * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_short_free (gsl_vector_short * v); + +/* Views */ + +_gsl_vector_short_view +gsl_vector_short_view_array (short *v, size_t n); + +_gsl_vector_short_view +gsl_vector_short_view_array_with_stride (short *base, + size_t stride, + size_t n); + +_gsl_vector_short_const_view +gsl_vector_short_const_view_array (const short *v, size_t n); + +_gsl_vector_short_const_view +gsl_vector_short_const_view_array_with_stride (const short *base, + size_t stride, + size_t n); + +_gsl_vector_short_view +gsl_vector_short_subvector (gsl_vector_short *v, + size_t i, + size_t n); + +_gsl_vector_short_view +gsl_vector_short_subvector_with_stride (gsl_vector_short *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_short_const_view +gsl_vector_short_const_subvector (const gsl_vector_short *v, + size_t i, + size_t n); + +_gsl_vector_short_const_view +gsl_vector_short_const_subvector_with_stride (const gsl_vector_short *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +short gsl_vector_short_get (const gsl_vector_short * v, const size_t i); +void gsl_vector_short_set (gsl_vector_short * v, const size_t i, short x); + +short *gsl_vector_short_ptr (gsl_vector_short * v, const size_t i); +const short *gsl_vector_short_const_ptr (const gsl_vector_short * v, const size_t i); + +void gsl_vector_short_set_zero (gsl_vector_short * v); +void gsl_vector_short_set_all (gsl_vector_short * v, short x); +int gsl_vector_short_set_basis (gsl_vector_short * v, size_t i); + +int gsl_vector_short_fread (FILE * stream, gsl_vector_short * v); +int gsl_vector_short_fwrite (FILE * stream, const gsl_vector_short * v); +int gsl_vector_short_fscanf (FILE * stream, gsl_vector_short * v); +int gsl_vector_short_fprintf (FILE * stream, const gsl_vector_short * v, + const char *format); + +int gsl_vector_short_memcpy (gsl_vector_short * dest, const gsl_vector_short * src); + +int gsl_vector_short_reverse (gsl_vector_short * v); + +int gsl_vector_short_swap (gsl_vector_short * v, gsl_vector_short * w); +int gsl_vector_short_swap_elements (gsl_vector_short * v, const size_t i, const size_t j); + +short gsl_vector_short_max (const gsl_vector_short * v); +short gsl_vector_short_min (const gsl_vector_short * v); +void gsl_vector_short_minmax (const gsl_vector_short * v, short * min_out, short * max_out); + +size_t gsl_vector_short_max_index (const gsl_vector_short * v); +size_t gsl_vector_short_min_index (const gsl_vector_short * v); +void gsl_vector_short_minmax_index (const gsl_vector_short * v, size_t * imin, size_t * imax); + +int gsl_vector_short_add (gsl_vector_short * a, const gsl_vector_short * b); +int gsl_vector_short_sub (gsl_vector_short * a, const gsl_vector_short * b); +int gsl_vector_short_mul (gsl_vector_short * a, const gsl_vector_short * b); +int gsl_vector_short_div (gsl_vector_short * a, const gsl_vector_short * b); +int gsl_vector_short_scale (gsl_vector_short * a, const double x); +int gsl_vector_short_add_constant (gsl_vector_short * a, const double x); + +int gsl_vector_short_isnull (const gsl_vector_short * v); +int gsl_vector_short_ispos (const gsl_vector_short * v); +int gsl_vector_short_isneg (const gsl_vector_short * v); +int gsl_vector_short_isnonneg (const gsl_vector_short * v); + +#ifdef HAVE_INLINE + +extern inline +short +gsl_vector_short_get (const gsl_vector_short * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +extern inline +void +gsl_vector_short_set (gsl_vector_short * v, const size_t i, short x) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +extern inline +short * +gsl_vector_short_ptr (gsl_vector_short * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (short *) (v->data + i * v->stride); +} + +extern inline +const short * +gsl_vector_short_const_ptr (const gsl_vector_short * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const short *) (v->data + i * v->stride); +} + + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_SHORT_H__ */ + + diff --git a/dtm_release/local/include/gsl/gsl_vector_uchar.h b/dtm_release/local/include/gsl/gsl_vector_uchar.h new file mode 100644 index 0000000000000000000000000000000000000000..2f150ba4068d7ef4fe20547b8fd3d00c6db24f9e --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_vector_uchar.h @@ -0,0 +1,229 @@ +/* vector/gsl_vector_uchar.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_UCHAR_H__ +#define __GSL_VECTOR_UCHAR_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_block_uchar.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + unsigned char *data; + gsl_block_uchar *block; + int owner; +} +gsl_vector_uchar; + +typedef struct +{ + gsl_vector_uchar vector; +} _gsl_vector_uchar_view; + +typedef _gsl_vector_uchar_view gsl_vector_uchar_view; + +typedef struct +{ + gsl_vector_uchar vector; +} _gsl_vector_uchar_const_view; + +typedef const _gsl_vector_uchar_const_view gsl_vector_uchar_const_view; + + +/* Allocation */ + +gsl_vector_uchar *gsl_vector_uchar_alloc (const size_t n); +gsl_vector_uchar *gsl_vector_uchar_calloc (const size_t n); + +gsl_vector_uchar *gsl_vector_uchar_alloc_from_block (gsl_block_uchar * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_uchar *gsl_vector_uchar_alloc_from_vector (gsl_vector_uchar * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_uchar_free (gsl_vector_uchar * v); + +/* Views */ + +_gsl_vector_uchar_view +gsl_vector_uchar_view_array (unsigned char *v, size_t n); + +_gsl_vector_uchar_view +gsl_vector_uchar_view_array_with_stride (unsigned char *base, + size_t stride, + size_t n); + +_gsl_vector_uchar_const_view +gsl_vector_uchar_const_view_array (const unsigned char *v, size_t n); + +_gsl_vector_uchar_const_view +gsl_vector_uchar_const_view_array_with_stride (const unsigned char *base, + size_t stride, + size_t n); + +_gsl_vector_uchar_view +gsl_vector_uchar_subvector (gsl_vector_uchar *v, + size_t i, + size_t n); + +_gsl_vector_uchar_view +gsl_vector_uchar_subvector_with_stride (gsl_vector_uchar *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_uchar_const_view +gsl_vector_uchar_const_subvector (const gsl_vector_uchar *v, + size_t i, + size_t n); + +_gsl_vector_uchar_const_view +gsl_vector_uchar_const_subvector_with_stride (const gsl_vector_uchar *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +unsigned char gsl_vector_uchar_get (const gsl_vector_uchar * v, const size_t i); +void gsl_vector_uchar_set (gsl_vector_uchar * v, const size_t i, unsigned char x); + +unsigned char *gsl_vector_uchar_ptr (gsl_vector_uchar * v, const size_t i); +const unsigned char *gsl_vector_uchar_const_ptr (const gsl_vector_uchar * v, const size_t i); + +void gsl_vector_uchar_set_zero (gsl_vector_uchar * v); +void gsl_vector_uchar_set_all (gsl_vector_uchar * v, unsigned char x); +int gsl_vector_uchar_set_basis (gsl_vector_uchar * v, size_t i); + +int gsl_vector_uchar_fread (FILE * stream, gsl_vector_uchar * v); +int gsl_vector_uchar_fwrite (FILE * stream, const gsl_vector_uchar * v); +int gsl_vector_uchar_fscanf (FILE * stream, gsl_vector_uchar * v); +int gsl_vector_uchar_fprintf (FILE * stream, const gsl_vector_uchar * v, + const char *format); + +int gsl_vector_uchar_memcpy (gsl_vector_uchar * dest, const gsl_vector_uchar * src); + +int gsl_vector_uchar_reverse (gsl_vector_uchar * v); + +int gsl_vector_uchar_swap (gsl_vector_uchar * v, gsl_vector_uchar * w); +int gsl_vector_uchar_swap_elements (gsl_vector_uchar * v, const size_t i, const size_t j); + +unsigned char gsl_vector_uchar_max (const gsl_vector_uchar * v); +unsigned char gsl_vector_uchar_min (const gsl_vector_uchar * v); +void gsl_vector_uchar_minmax (const gsl_vector_uchar * v, unsigned char * min_out, unsigned char * max_out); + +size_t gsl_vector_uchar_max_index (const gsl_vector_uchar * v); +size_t gsl_vector_uchar_min_index (const gsl_vector_uchar * v); +void gsl_vector_uchar_minmax_index (const gsl_vector_uchar * v, size_t * imin, size_t * imax); + +int gsl_vector_uchar_add (gsl_vector_uchar * a, const gsl_vector_uchar * b); +int gsl_vector_uchar_sub (gsl_vector_uchar * a, const gsl_vector_uchar * b); +int gsl_vector_uchar_mul (gsl_vector_uchar * a, const gsl_vector_uchar * b); +int gsl_vector_uchar_div (gsl_vector_uchar * a, const gsl_vector_uchar * b); +int gsl_vector_uchar_scale (gsl_vector_uchar * a, const double x); +int gsl_vector_uchar_add_constant (gsl_vector_uchar * a, const double x); + +int gsl_vector_uchar_isnull (const gsl_vector_uchar * v); +int gsl_vector_uchar_ispos (const gsl_vector_uchar * v); +int gsl_vector_uchar_isneg (const gsl_vector_uchar * v); +int gsl_vector_uchar_isnonneg (const gsl_vector_uchar * v); + +#ifdef HAVE_INLINE + +extern inline +unsigned char +gsl_vector_uchar_get (const gsl_vector_uchar * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +extern inline +void +gsl_vector_uchar_set (gsl_vector_uchar * v, const size_t i, unsigned char x) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +extern inline +unsigned char * +gsl_vector_uchar_ptr (gsl_vector_uchar * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (unsigned char *) (v->data + i * v->stride); +} + +extern inline +const unsigned char * +gsl_vector_uchar_const_ptr (const gsl_vector_uchar * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const unsigned char *) (v->data + i * v->stride); +} + + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_UCHAR_H__ */ + + diff --git a/dtm_release/local/include/gsl/gsl_vector_uint.h b/dtm_release/local/include/gsl/gsl_vector_uint.h new file mode 100644 index 0000000000000000000000000000000000000000..71000d8d4d7f11cefb7da1889f33895c93c60506 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_vector_uint.h @@ -0,0 +1,229 @@ +/* vector/gsl_vector_uint.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_UINT_H__ +#define __GSL_VECTOR_UINT_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_block_uint.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + unsigned int *data; + gsl_block_uint *block; + int owner; +} +gsl_vector_uint; + +typedef struct +{ + gsl_vector_uint vector; +} _gsl_vector_uint_view; + +typedef _gsl_vector_uint_view gsl_vector_uint_view; + +typedef struct +{ + gsl_vector_uint vector; +} _gsl_vector_uint_const_view; + +typedef const _gsl_vector_uint_const_view gsl_vector_uint_const_view; + + +/* Allocation */ + +gsl_vector_uint *gsl_vector_uint_alloc (const size_t n); +gsl_vector_uint *gsl_vector_uint_calloc (const size_t n); + +gsl_vector_uint *gsl_vector_uint_alloc_from_block (gsl_block_uint * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_uint *gsl_vector_uint_alloc_from_vector (gsl_vector_uint * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_uint_free (gsl_vector_uint * v); + +/* Views */ + +_gsl_vector_uint_view +gsl_vector_uint_view_array (unsigned int *v, size_t n); + +_gsl_vector_uint_view +gsl_vector_uint_view_array_with_stride (unsigned int *base, + size_t stride, + size_t n); + +_gsl_vector_uint_const_view +gsl_vector_uint_const_view_array (const unsigned int *v, size_t n); + +_gsl_vector_uint_const_view +gsl_vector_uint_const_view_array_with_stride (const unsigned int *base, + size_t stride, + size_t n); + +_gsl_vector_uint_view +gsl_vector_uint_subvector (gsl_vector_uint *v, + size_t i, + size_t n); + +_gsl_vector_uint_view +gsl_vector_uint_subvector_with_stride (gsl_vector_uint *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_uint_const_view +gsl_vector_uint_const_subvector (const gsl_vector_uint *v, + size_t i, + size_t n); + +_gsl_vector_uint_const_view +gsl_vector_uint_const_subvector_with_stride (const gsl_vector_uint *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +unsigned int gsl_vector_uint_get (const gsl_vector_uint * v, const size_t i); +void gsl_vector_uint_set (gsl_vector_uint * v, const size_t i, unsigned int x); + +unsigned int *gsl_vector_uint_ptr (gsl_vector_uint * v, const size_t i); +const unsigned int *gsl_vector_uint_const_ptr (const gsl_vector_uint * v, const size_t i); + +void gsl_vector_uint_set_zero (gsl_vector_uint * v); +void gsl_vector_uint_set_all (gsl_vector_uint * v, unsigned int x); +int gsl_vector_uint_set_basis (gsl_vector_uint * v, size_t i); + +int gsl_vector_uint_fread (FILE * stream, gsl_vector_uint * v); +int gsl_vector_uint_fwrite (FILE * stream, const gsl_vector_uint * v); +int gsl_vector_uint_fscanf (FILE * stream, gsl_vector_uint * v); +int gsl_vector_uint_fprintf (FILE * stream, const gsl_vector_uint * v, + const char *format); + +int gsl_vector_uint_memcpy (gsl_vector_uint * dest, const gsl_vector_uint * src); + +int gsl_vector_uint_reverse (gsl_vector_uint * v); + +int gsl_vector_uint_swap (gsl_vector_uint * v, gsl_vector_uint * w); +int gsl_vector_uint_swap_elements (gsl_vector_uint * v, const size_t i, const size_t j); + +unsigned int gsl_vector_uint_max (const gsl_vector_uint * v); +unsigned int gsl_vector_uint_min (const gsl_vector_uint * v); +void gsl_vector_uint_minmax (const gsl_vector_uint * v, unsigned int * min_out, unsigned int * max_out); + +size_t gsl_vector_uint_max_index (const gsl_vector_uint * v); +size_t gsl_vector_uint_min_index (const gsl_vector_uint * v); +void gsl_vector_uint_minmax_index (const gsl_vector_uint * v, size_t * imin, size_t * imax); + +int gsl_vector_uint_add (gsl_vector_uint * a, const gsl_vector_uint * b); +int gsl_vector_uint_sub (gsl_vector_uint * a, const gsl_vector_uint * b); +int gsl_vector_uint_mul (gsl_vector_uint * a, const gsl_vector_uint * b); +int gsl_vector_uint_div (gsl_vector_uint * a, const gsl_vector_uint * b); +int gsl_vector_uint_scale (gsl_vector_uint * a, const double x); +int gsl_vector_uint_add_constant (gsl_vector_uint * a, const double x); + +int gsl_vector_uint_isnull (const gsl_vector_uint * v); +int gsl_vector_uint_ispos (const gsl_vector_uint * v); +int gsl_vector_uint_isneg (const gsl_vector_uint * v); +int gsl_vector_uint_isnonneg (const gsl_vector_uint * v); + +#ifdef HAVE_INLINE + +extern inline +unsigned int +gsl_vector_uint_get (const gsl_vector_uint * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +extern inline +void +gsl_vector_uint_set (gsl_vector_uint * v, const size_t i, unsigned int x) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +extern inline +unsigned int * +gsl_vector_uint_ptr (gsl_vector_uint * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (unsigned int *) (v->data + i * v->stride); +} + +extern inline +const unsigned int * +gsl_vector_uint_const_ptr (const gsl_vector_uint * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const unsigned int *) (v->data + i * v->stride); +} + + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_UINT_H__ */ + + diff --git a/dtm_release/local/include/gsl/gsl_vector_ulong.h b/dtm_release/local/include/gsl/gsl_vector_ulong.h new file mode 100644 index 0000000000000000000000000000000000000000..a9b12814b55af8133337f31f1e1af65275465d3f --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_vector_ulong.h @@ -0,0 +1,229 @@ +/* vector/gsl_vector_ulong.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_ULONG_H__ +#define __GSL_VECTOR_ULONG_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_block_ulong.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + unsigned long *data; + gsl_block_ulong *block; + int owner; +} +gsl_vector_ulong; + +typedef struct +{ + gsl_vector_ulong vector; +} _gsl_vector_ulong_view; + +typedef _gsl_vector_ulong_view gsl_vector_ulong_view; + +typedef struct +{ + gsl_vector_ulong vector; +} _gsl_vector_ulong_const_view; + +typedef const _gsl_vector_ulong_const_view gsl_vector_ulong_const_view; + + +/* Allocation */ + +gsl_vector_ulong *gsl_vector_ulong_alloc (const size_t n); +gsl_vector_ulong *gsl_vector_ulong_calloc (const size_t n); + +gsl_vector_ulong *gsl_vector_ulong_alloc_from_block (gsl_block_ulong * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_ulong *gsl_vector_ulong_alloc_from_vector (gsl_vector_ulong * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_ulong_free (gsl_vector_ulong * v); + +/* Views */ + +_gsl_vector_ulong_view +gsl_vector_ulong_view_array (unsigned long *v, size_t n); + +_gsl_vector_ulong_view +gsl_vector_ulong_view_array_with_stride (unsigned long *base, + size_t stride, + size_t n); + +_gsl_vector_ulong_const_view +gsl_vector_ulong_const_view_array (const unsigned long *v, size_t n); + +_gsl_vector_ulong_const_view +gsl_vector_ulong_const_view_array_with_stride (const unsigned long *base, + size_t stride, + size_t n); + +_gsl_vector_ulong_view +gsl_vector_ulong_subvector (gsl_vector_ulong *v, + size_t i, + size_t n); + +_gsl_vector_ulong_view +gsl_vector_ulong_subvector_with_stride (gsl_vector_ulong *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_ulong_const_view +gsl_vector_ulong_const_subvector (const gsl_vector_ulong *v, + size_t i, + size_t n); + +_gsl_vector_ulong_const_view +gsl_vector_ulong_const_subvector_with_stride (const gsl_vector_ulong *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +unsigned long gsl_vector_ulong_get (const gsl_vector_ulong * v, const size_t i); +void gsl_vector_ulong_set (gsl_vector_ulong * v, const size_t i, unsigned long x); + +unsigned long *gsl_vector_ulong_ptr (gsl_vector_ulong * v, const size_t i); +const unsigned long *gsl_vector_ulong_const_ptr (const gsl_vector_ulong * v, const size_t i); + +void gsl_vector_ulong_set_zero (gsl_vector_ulong * v); +void gsl_vector_ulong_set_all (gsl_vector_ulong * v, unsigned long x); +int gsl_vector_ulong_set_basis (gsl_vector_ulong * v, size_t i); + +int gsl_vector_ulong_fread (FILE * stream, gsl_vector_ulong * v); +int gsl_vector_ulong_fwrite (FILE * stream, const gsl_vector_ulong * v); +int gsl_vector_ulong_fscanf (FILE * stream, gsl_vector_ulong * v); +int gsl_vector_ulong_fprintf (FILE * stream, const gsl_vector_ulong * v, + const char *format); + +int gsl_vector_ulong_memcpy (gsl_vector_ulong * dest, const gsl_vector_ulong * src); + +int gsl_vector_ulong_reverse (gsl_vector_ulong * v); + +int gsl_vector_ulong_swap (gsl_vector_ulong * v, gsl_vector_ulong * w); +int gsl_vector_ulong_swap_elements (gsl_vector_ulong * v, const size_t i, const size_t j); + +unsigned long gsl_vector_ulong_max (const gsl_vector_ulong * v); +unsigned long gsl_vector_ulong_min (const gsl_vector_ulong * v); +void gsl_vector_ulong_minmax (const gsl_vector_ulong * v, unsigned long * min_out, unsigned long * max_out); + +size_t gsl_vector_ulong_max_index (const gsl_vector_ulong * v); +size_t gsl_vector_ulong_min_index (const gsl_vector_ulong * v); +void gsl_vector_ulong_minmax_index (const gsl_vector_ulong * v, size_t * imin, size_t * imax); + +int gsl_vector_ulong_add (gsl_vector_ulong * a, const gsl_vector_ulong * b); +int gsl_vector_ulong_sub (gsl_vector_ulong * a, const gsl_vector_ulong * b); +int gsl_vector_ulong_mul (gsl_vector_ulong * a, const gsl_vector_ulong * b); +int gsl_vector_ulong_div (gsl_vector_ulong * a, const gsl_vector_ulong * b); +int gsl_vector_ulong_scale (gsl_vector_ulong * a, const double x); +int gsl_vector_ulong_add_constant (gsl_vector_ulong * a, const double x); + +int gsl_vector_ulong_isnull (const gsl_vector_ulong * v); +int gsl_vector_ulong_ispos (const gsl_vector_ulong * v); +int gsl_vector_ulong_isneg (const gsl_vector_ulong * v); +int gsl_vector_ulong_isnonneg (const gsl_vector_ulong * v); + +#ifdef HAVE_INLINE + +extern inline +unsigned long +gsl_vector_ulong_get (const gsl_vector_ulong * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +extern inline +void +gsl_vector_ulong_set (gsl_vector_ulong * v, const size_t i, unsigned long x) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +extern inline +unsigned long * +gsl_vector_ulong_ptr (gsl_vector_ulong * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (unsigned long *) (v->data + i * v->stride); +} + +extern inline +const unsigned long * +gsl_vector_ulong_const_ptr (const gsl_vector_ulong * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const unsigned long *) (v->data + i * v->stride); +} + + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_ULONG_H__ */ + + diff --git a/dtm_release/local/include/gsl/gsl_vector_ushort.h b/dtm_release/local/include/gsl/gsl_vector_ushort.h new file mode 100644 index 0000000000000000000000000000000000000000..ec9da1a0e733bf856da25fdda309b947c63894a9 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_vector_ushort.h @@ -0,0 +1,229 @@ +/* vector/gsl_vector_ushort.h + * + * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_VECTOR_USHORT_H__ +#define __GSL_VECTOR_USHORT_H__ + +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_check_range.h> +#include <gsl/gsl_block_ushort.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +typedef struct +{ + size_t size; + size_t stride; + unsigned short *data; + gsl_block_ushort *block; + int owner; +} +gsl_vector_ushort; + +typedef struct +{ + gsl_vector_ushort vector; +} _gsl_vector_ushort_view; + +typedef _gsl_vector_ushort_view gsl_vector_ushort_view; + +typedef struct +{ + gsl_vector_ushort vector; +} _gsl_vector_ushort_const_view; + +typedef const _gsl_vector_ushort_const_view gsl_vector_ushort_const_view; + + +/* Allocation */ + +gsl_vector_ushort *gsl_vector_ushort_alloc (const size_t n); +gsl_vector_ushort *gsl_vector_ushort_calloc (const size_t n); + +gsl_vector_ushort *gsl_vector_ushort_alloc_from_block (gsl_block_ushort * b, + const size_t offset, + const size_t n, + const size_t stride); + +gsl_vector_ushort *gsl_vector_ushort_alloc_from_vector (gsl_vector_ushort * v, + const size_t offset, + const size_t n, + const size_t stride); + +void gsl_vector_ushort_free (gsl_vector_ushort * v); + +/* Views */ + +_gsl_vector_ushort_view +gsl_vector_ushort_view_array (unsigned short *v, size_t n); + +_gsl_vector_ushort_view +gsl_vector_ushort_view_array_with_stride (unsigned short *base, + size_t stride, + size_t n); + +_gsl_vector_ushort_const_view +gsl_vector_ushort_const_view_array (const unsigned short *v, size_t n); + +_gsl_vector_ushort_const_view +gsl_vector_ushort_const_view_array_with_stride (const unsigned short *base, + size_t stride, + size_t n); + +_gsl_vector_ushort_view +gsl_vector_ushort_subvector (gsl_vector_ushort *v, + size_t i, + size_t n); + +_gsl_vector_ushort_view +gsl_vector_ushort_subvector_with_stride (gsl_vector_ushort *v, + size_t i, + size_t stride, + size_t n); + +_gsl_vector_ushort_const_view +gsl_vector_ushort_const_subvector (const gsl_vector_ushort *v, + size_t i, + size_t n); + +_gsl_vector_ushort_const_view +gsl_vector_ushort_const_subvector_with_stride (const gsl_vector_ushort *v, + size_t i, + size_t stride, + size_t n); + +/* Operations */ + +unsigned short gsl_vector_ushort_get (const gsl_vector_ushort * v, const size_t i); +void gsl_vector_ushort_set (gsl_vector_ushort * v, const size_t i, unsigned short x); + +unsigned short *gsl_vector_ushort_ptr (gsl_vector_ushort * v, const size_t i); +const unsigned short *gsl_vector_ushort_const_ptr (const gsl_vector_ushort * v, const size_t i); + +void gsl_vector_ushort_set_zero (gsl_vector_ushort * v); +void gsl_vector_ushort_set_all (gsl_vector_ushort * v, unsigned short x); +int gsl_vector_ushort_set_basis (gsl_vector_ushort * v, size_t i); + +int gsl_vector_ushort_fread (FILE * stream, gsl_vector_ushort * v); +int gsl_vector_ushort_fwrite (FILE * stream, const gsl_vector_ushort * v); +int gsl_vector_ushort_fscanf (FILE * stream, gsl_vector_ushort * v); +int gsl_vector_ushort_fprintf (FILE * stream, const gsl_vector_ushort * v, + const char *format); + +int gsl_vector_ushort_memcpy (gsl_vector_ushort * dest, const gsl_vector_ushort * src); + +int gsl_vector_ushort_reverse (gsl_vector_ushort * v); + +int gsl_vector_ushort_swap (gsl_vector_ushort * v, gsl_vector_ushort * w); +int gsl_vector_ushort_swap_elements (gsl_vector_ushort * v, const size_t i, const size_t j); + +unsigned short gsl_vector_ushort_max (const gsl_vector_ushort * v); +unsigned short gsl_vector_ushort_min (const gsl_vector_ushort * v); +void gsl_vector_ushort_minmax (const gsl_vector_ushort * v, unsigned short * min_out, unsigned short * max_out); + +size_t gsl_vector_ushort_max_index (const gsl_vector_ushort * v); +size_t gsl_vector_ushort_min_index (const gsl_vector_ushort * v); +void gsl_vector_ushort_minmax_index (const gsl_vector_ushort * v, size_t * imin, size_t * imax); + +int gsl_vector_ushort_add (gsl_vector_ushort * a, const gsl_vector_ushort * b); +int gsl_vector_ushort_sub (gsl_vector_ushort * a, const gsl_vector_ushort * b); +int gsl_vector_ushort_mul (gsl_vector_ushort * a, const gsl_vector_ushort * b); +int gsl_vector_ushort_div (gsl_vector_ushort * a, const gsl_vector_ushort * b); +int gsl_vector_ushort_scale (gsl_vector_ushort * a, const double x); +int gsl_vector_ushort_add_constant (gsl_vector_ushort * a, const double x); + +int gsl_vector_ushort_isnull (const gsl_vector_ushort * v); +int gsl_vector_ushort_ispos (const gsl_vector_ushort * v); +int gsl_vector_ushort_isneg (const gsl_vector_ushort * v); +int gsl_vector_ushort_isnonneg (const gsl_vector_ushort * v); + +#ifdef HAVE_INLINE + +extern inline +unsigned short +gsl_vector_ushort_get (const gsl_vector_ushort * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VAL ("index out of range", GSL_EINVAL, 0); + } +#endif + return v->data[i * v->stride]; +} + +extern inline +void +gsl_vector_ushort_set (gsl_vector_ushort * v, const size_t i, unsigned short x) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_VOID ("index out of range", GSL_EINVAL); + } +#endif + v->data[i * v->stride] = x; +} + +extern inline +unsigned short * +gsl_vector_ushort_ptr (gsl_vector_ushort * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (unsigned short *) (v->data + i * v->stride); +} + +extern inline +const unsigned short * +gsl_vector_ushort_const_ptr (const gsl_vector_ushort * v, const size_t i) +{ +#if GSL_RANGE_CHECK + if (i >= v->size) + { + GSL_ERROR_NULL ("index out of range", GSL_EINVAL); + } +#endif + return (const unsigned short *) (v->data + i * v->stride); +} + + +#endif /* HAVE_INLINE */ + +__END_DECLS + +#endif /* __GSL_VECTOR_USHORT_H__ */ + + diff --git a/dtm_release/local/include/gsl/gsl_version.h b/dtm_release/local/include/gsl/gsl_version.h new file mode 100644 index 0000000000000000000000000000000000000000..15cf2d78b3b3e8fdf6631a8f09446d67f0f3ffa3 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_version.h @@ -0,0 +1,24 @@ +#ifndef __GSL_VERSION_H__ +#define __GSL_VERSION_H__ + +#include <gsl/gsl_types.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif +__BEGIN_DECLS + + +#define GSL_VERSION "1.10" + +GSL_VAR const char * gsl_version; + +__END_DECLS + +#endif /* __GSL_VERSION_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_wavelet.h b/dtm_release/local/include/gsl/gsl_wavelet.h new file mode 100644 index 0000000000000000000000000000000000000000..5261c4874601c6f75e9d06a16a19f3bac5652fe5 --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_wavelet.h @@ -0,0 +1,108 @@ +/* wavelet/gsl_wavelet.h + * + * Copyright (C) 2004 Ivo Alxneit + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_WAVELET_H__ +#define __GSL_WAVELET_H__ +#include <stdlib.h> +#include <gsl/gsl_types.h> +#include <gsl/gsl_errno.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +#ifndef GSL_DISABLE_DEPRECATED +typedef enum { + forward = 1, backward = -1, + gsl_wavelet_forward = 1, gsl_wavelet_backward = -1 +} +gsl_wavelet_direction; +#else +typedef enum { + gsl_wavelet_forward = 1, gsl_wavelet_backward = -1 +} +gsl_wavelet_direction; +#endif + +typedef struct +{ + const char *name; + int (*init) (const double **h1, const double **g1, + const double **h2, const double **g2, size_t * nc, + size_t * offset, size_t member); +} +gsl_wavelet_type; + +typedef struct +{ + const gsl_wavelet_type *type; + const double *h1; + const double *g1; + const double *h2; + const double *g2; + size_t nc; + size_t offset; +} +gsl_wavelet; + +typedef struct +{ + double *scratch; + size_t n; +} +gsl_wavelet_workspace; + +GSL_VAR const gsl_wavelet_type *gsl_wavelet_daubechies; +GSL_VAR const gsl_wavelet_type *gsl_wavelet_daubechies_centered; +GSL_VAR const gsl_wavelet_type *gsl_wavelet_haar; +GSL_VAR const gsl_wavelet_type *gsl_wavelet_haar_centered; +GSL_VAR const gsl_wavelet_type *gsl_wavelet_bspline; +GSL_VAR const gsl_wavelet_type *gsl_wavelet_bspline_centered; + +gsl_wavelet *gsl_wavelet_alloc (const gsl_wavelet_type * T, size_t k); +void gsl_wavelet_free (gsl_wavelet * w); +const char *gsl_wavelet_name (const gsl_wavelet * w); + +gsl_wavelet_workspace *gsl_wavelet_workspace_alloc (size_t n); +void gsl_wavelet_workspace_free (gsl_wavelet_workspace * work); + +int gsl_wavelet_transform (const gsl_wavelet * w, + double *data, size_t stride, size_t n, + gsl_wavelet_direction dir, + gsl_wavelet_workspace * work); + +int gsl_wavelet_transform_forward (const gsl_wavelet * w, + double *data, size_t stride, size_t n, + gsl_wavelet_workspace * work); + +int gsl_wavelet_transform_inverse (const gsl_wavelet * w, + double *data, size_t stride, size_t n, + gsl_wavelet_workspace * work); + +__END_DECLS + +#endif /* __GSL_WAVELET_H__ */ diff --git a/dtm_release/local/include/gsl/gsl_wavelet2d.h b/dtm_release/local/include/gsl/gsl_wavelet2d.h new file mode 100644 index 0000000000000000000000000000000000000000..173f43e2c5f3c6d7807808ec74b1c6f3f24e89ce --- /dev/null +++ b/dtm_release/local/include/gsl/gsl_wavelet2d.h @@ -0,0 +1,107 @@ +/* wavelet/gsl_wavelet.h + * + * Copyright (C) 2004 Ivo Alxneit + * + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __GSL_WAVELET2D_H__ +#define __GSL_WAVELET2D_H__ +#include <stdlib.h> +#include <gsl/gsl_errno.h> +#include <gsl/gsl_vector_double.h> +#include <gsl/gsl_matrix_double.h> +#include <gsl/gsl_wavelet.h> + +#undef __BEGIN_DECLS +#undef __END_DECLS +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS /* empty */ +# define __END_DECLS /* empty */ +#endif + +__BEGIN_DECLS + +int gsl_wavelet2d_transform (const gsl_wavelet * w, + double *data, + size_t tda, size_t size1, size_t size2, + gsl_wavelet_direction dir, + gsl_wavelet_workspace * work); + +int gsl_wavelet2d_transform_forward (const gsl_wavelet * w, + double *data, + size_t tda, size_t size1, size_t size2, + gsl_wavelet_workspace * work); + +int gsl_wavelet2d_transform_inverse (const gsl_wavelet * w, + double *data, + size_t tda, size_t size1, size_t size2, + gsl_wavelet_workspace * work); + +int gsl_wavelet2d_nstransform (const gsl_wavelet * w, + double *data, + size_t tda, size_t size1, size_t size2, + gsl_wavelet_direction dir, + gsl_wavelet_workspace * work); + +int gsl_wavelet2d_nstransform_forward (const gsl_wavelet * w, + double *data, + size_t tda, size_t size1, size_t size2, + gsl_wavelet_workspace * work); + +int gsl_wavelet2d_nstransform_inverse (const gsl_wavelet * w, + double *data, + size_t tda, size_t size1, size_t size2, + gsl_wavelet_workspace * work); + +int +gsl_wavelet2d_transform_matrix (const gsl_wavelet * w, + gsl_matrix * a, + gsl_wavelet_direction dir, + gsl_wavelet_workspace * work); + +int +gsl_wavelet2d_transform_matrix_forward (const gsl_wavelet * w, + gsl_matrix * a, + gsl_wavelet_workspace * work); + +int +gsl_wavelet2d_transform_matrix_inverse (const gsl_wavelet * w, + gsl_matrix * a, + gsl_wavelet_workspace * work); + + +int +gsl_wavelet2d_nstransform_matrix (const gsl_wavelet * w, + gsl_matrix * a, + gsl_wavelet_direction dir, + gsl_wavelet_workspace * work); + +int +gsl_wavelet2d_nstransform_matrix_forward (const gsl_wavelet * w, + gsl_matrix * a, + gsl_wavelet_workspace * work); + +int +gsl_wavelet2d_nstransform_matrix_inverse (const gsl_wavelet * w, + gsl_matrix * a, + gsl_wavelet_workspace * work); + +__END_DECLS + +#endif /* __GSL_WAVELET2D_H__ */ diff --git a/dtm_release/local/include/stl/algo.h b/dtm_release/local/include/stl/algo.h new file mode 100644 index 0000000000000000000000000000000000000000..1707868c7c43bb803c846e422f1f961c54087980 --- /dev/null +++ b/dtm_release/local/include/stl/algo.h @@ -0,0 +1,114 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_ALGO_H +#define __SGI_STL_ALGO_H + +#include <algobase.h> +#include <tempbuf.h> +#include <stl_algo.h> +#include <stl_numeric.h> + +#ifdef __STL_USE_NAMESPACES + +// Names from <stl_algo.h> +using __STD::for_each; +using __STD::find; +using __STD::find_if; +using __STD::adjacent_find; +using __STD::count; +using __STD::count_if; +using __STD::search; +using __STD::search_n; +using __STD::swap_ranges; +using __STD::transform; +using __STD::replace; +using __STD::replace_if; +using __STD::replace_copy; +using __STD::replace_copy_if; +using __STD::generate; +using __STD::generate_n; +using __STD::remove; +using __STD::remove_if; +using __STD::remove_copy; +using __STD::remove_copy_if; +using __STD::unique; +using __STD::unique_copy; +using __STD::reverse; +using __STD::reverse_copy; +using __STD::rotate; +using __STD::rotate_copy; +using __STD::random_shuffle; +using __STD::random_sample; +using __STD::random_sample_n; +using __STD::partition; +using __STD::stable_partition; +using __STD::sort; +using __STD::stable_sort; +using __STD::partial_sort; +using __STD::partial_sort_copy; +using __STD::nth_element; +using __STD::lower_bound; +using __STD::upper_bound; +using __STD::equal_range; +using __STD::binary_search; +using __STD::merge; +using __STD::inplace_merge; +using __STD::includes; +using __STD::set_union; +using __STD::set_intersection; +using __STD::set_difference; +using __STD::set_symmetric_difference; +using __STD::min_element; +using __STD::max_element; +using __STD::next_permutation; +using __STD::prev_permutation; +using __STD::find_first_of; +using __STD::find_end; +using __STD::is_sorted; +using __STD::is_heap; + +// Names from stl_heap.h +using __STD::push_heap; +using __STD::pop_heap; +using __STD::make_heap; +using __STD::sort_heap; + +// Names from <stl_numeric.h> +using __STD::accumulate; +using __STD::inner_product; +using __STD::partial_sum; +using __STD::adjacent_difference; +using __STD::power; +using __STD::iota; + +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_ALGO_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/algobase.h b/dtm_release/local/include/stl/algobase.h new file mode 100644 index 0000000000000000000000000000000000000000..f35e7af4a97648b4c6d349ceb298f1bc06b7a343 --- /dev/null +++ b/dtm_release/local/include/stl/algobase.h @@ -0,0 +1,71 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_ALGOBASE_H +#define __SGI_STL_ALGOBASE_H + +#ifndef __SGI_STL_PAIR_H +#include <pair.h> +#endif +#ifndef __SGI_STL_ITERATOR_H +#include <iterator.h> +#endif +#ifndef __SGI_STL_INTERNAL_ALGOBASE_H +#include <stl_algobase.h> +#endif +#ifndef __SGI_STL_INTERNAL_UNINITIALIZED_H +#include <stl_uninitialized.h> +#endif + +#ifdef __STL_USE_NAMESPACES + +// Names from stl_algobase.h +using __STD::iter_swap; +using __STD::swap; +using __STD::min; +using __STD::max; +using __STD::copy; +using __STD::copy_backward; +using __STD::copy_n; +using __STD::fill; +using __STD::fill_n; +using __STD::mismatch; +using __STD::equal; +using __STD::lexicographical_compare; +using __STD::lexicographical_compare_3way; + +// Names from stl_uninitialized.h +using __STD::uninitialized_copy; +using __STD::uninitialized_copy_n; +using __STD::uninitialized_fill; +using __STD::uninitialized_fill_n; + +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_ALGOBASE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/algorithm b/dtm_release/local/include/stl/algorithm new file mode 100644 index 0000000000000000000000000000000000000000..1ba584f06d4a54895672d0ab5a19576945f1bbff --- /dev/null +++ b/dtm_release/local/include/stl/algorithm @@ -0,0 +1,40 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_ALGORITHM +#define __SGI_STL_ALGORITHM + +#include <stl_algobase.h> +#include <stl_construct.h> +#include <stl_uninitialized.h> +#include <stl_tempbuf.h> +#include <stl_algo.h> + +#endif /* __SGI_STL_ALGORITHM */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/alloc.h b/dtm_release/local/include/stl/alloc.h new file mode 100644 index 0000000000000000000000000000000000000000..f99a862316eeb9dd2fb7ea4bcdb1bcc15d1c3c4a --- /dev/null +++ b/dtm_release/local/include/stl/alloc.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 1996-1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_ALLOC_H +#define __SGI_STL_ALLOC_H + +#ifndef __STL_CONFIG_H +#include <stl_config.h> +#endif +#ifndef __SGI_STL_INTERNAL_ALLOC_H +#include <stl_alloc.h> +#endif + +#ifdef __STL_USE_NAMESPACES + +using __STD::__malloc_alloc_template; +using __STD::malloc_alloc; +using __STD::simple_alloc; +using __STD::debug_alloc; +using __STD::__default_alloc_template; +using __STD::alloc; +using __STD::single_client_alloc; +#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG +using __STD::__malloc_alloc_oom_handler; +#endif /* __STL_STATIC_TEMPLATE_MEMBER_BUG */ +#ifdef __STL_USE_STD_ALLOCATORS +using __STD::allocator; +#endif /* __STL_USE_STD_ALLOCATORS */ + +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_ALLOC_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/bitset b/dtm_release/local/include/stl/bitset new file mode 100644 index 0000000000000000000000000000000000000000..8328b208dbb1316a589c94c1670a3d8c72e76b39 --- /dev/null +++ b/dtm_release/local/include/stl/bitset @@ -0,0 +1,1074 @@ +/* + * Copyright (c) 1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_BITSET +#define __SGI_STL_BITSET + +// A bitset of size N has N % (sizeof(unsigned long) * CHAR_BIT) unused +// bits. (They are the high- order bits in the highest word.) It is +// a class invariant of class bitset<> that those unused bits are +// always zero. + +// Most of the actual code isn't contained in bitset<> itself, but in the +// base class _Base_bitset. The base class works with whole words, not with +// individual bits. This allows us to specialize _Base_bitset for the +// important special case where the bitset is only a single word. + +// The C++ standard does not define the precise semantics of operator[]. +// In this implementation the const version of operator[] is equivalent +// to test(), except that it does no range checking. The non-const version +// returns a reference to a bit, again without doing any range checking. + + +#include <stddef.h> // for size_t +#include <string.h> // for memset +#include <string> +#include <stdexcept> // for invalid_argument, out_of_range, overflow_error + +#ifdef __STL_USE_NEW_IOSTREAMS +#include <iostream> +#else +#include <iostream.h> // for istream, ostream +#endif + +#define __BITS_PER_WORD (CHAR_BIT*sizeof(unsigned long)) +#define __BITSET_WORDS(__n) \ + ((__n) < 1 ? 1 : ((__n) + __BITS_PER_WORD - 1)/__BITS_PER_WORD) + +__STL_BEGIN_NAMESPACE + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1209 +#endif + +// structure to aid in counting bits +template<bool __dummy> +struct _Bit_count { + static unsigned char _S_bit_count[256]; +}; + +// Mapping from 8 bit unsigned integers to the index of the first one +// bit: +template<bool __dummy> +struct _First_one { + static unsigned char _S_first_one[256]; +}; + +// +// Base class: general case. +// + +template<size_t _Nw> +struct _Base_bitset { + typedef unsigned long _WordT; + + _WordT _M_w[_Nw]; // 0 is the least significant word. + + _Base_bitset( void ) { _M_do_reset(); } + _Base_bitset(unsigned long __val) { + _M_do_reset(); + _M_w[0] = __val; + } + + static size_t _S_whichword( size_t __pos ) + { return __pos / __BITS_PER_WORD; } + static size_t _S_whichbyte( size_t __pos ) + { return (__pos % __BITS_PER_WORD) / CHAR_BIT; } + static size_t _S_whichbit( size_t __pos ) + { return __pos % __BITS_PER_WORD; } + static _WordT _S_maskbit( size_t __pos ) + { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } + + _WordT& _M_getword(size_t __pos) { return _M_w[_S_whichword(__pos)]; } + _WordT _M_getword(size_t __pos) const { return _M_w[_S_whichword(__pos)]; } + + _WordT& _M_hiword() { return _M_w[_Nw - 1]; } + _WordT _M_hiword() const { return _M_w[_Nw - 1]; } + + void _M_do_and(const _Base_bitset<_Nw>& __x) { + for ( size_t __i = 0; __i < _Nw; __i++ ) { + _M_w[__i] &= __x._M_w[__i]; + } + } + + void _M_do_or(const _Base_bitset<_Nw>& __x) { + for ( size_t __i = 0; __i < _Nw; __i++ ) { + _M_w[__i] |= __x._M_w[__i]; + } + } + + void _M_do_xor(const _Base_bitset<_Nw>& __x) { + for ( size_t __i = 0; __i < _Nw; __i++ ) { + _M_w[__i] ^= __x._M_w[__i]; + } + } + + void _M_do_left_shift(size_t __shift); + void _M_do_right_shift(size_t __shift); + + void _M_do_flip() { + for ( size_t __i = 0; __i < _Nw; __i++ ) { + _M_w[__i] = ~_M_w[__i]; + } + } + + void _M_do_set() { + for ( size_t __i = 0; __i < _Nw; __i++ ) { + _M_w[__i] = ~static_cast<_WordT>(0); + } + } + + void _M_do_reset() { memset(_M_w, 0, _Nw * sizeof(_WordT)); } + + bool _M_is_equal(const _Base_bitset<_Nw>& __x) const { + for (size_t __i = 0; __i < _Nw; ++__i) { + if (_M_w[__i] != __x._M_w[__i]) + return false; + } + return true; + } + + bool _M_is_any() const { + for ( size_t __i = 0; __i < _Nw; __i++ ) { + if ( _M_w[__i] != static_cast<_WordT>(0) ) + return true; + } + return false; + } + + size_t _M_do_count() const { + size_t __result = 0; + const unsigned char* __byte_ptr = (const unsigned char*)_M_w; + const unsigned char* __end_ptr = (const unsigned char*)(_M_w+_Nw); + + while ( __byte_ptr < __end_ptr ) { + __result += _Bit_count<true>::_S_bit_count[*__byte_ptr]; + __byte_ptr++; + } + return __result; + } + + unsigned long _M_do_to_ulong() const; + + // find first "on" bit + size_t _M_do_find_first(size_t __not_found) const; + + // find the next "on" bit that follows "prev" + size_t _M_do_find_next(size_t __prev, size_t __not_found) const; +}; + +// +// Definitions of non-inline functions from _Base_bitset. +// + +template<size_t _Nw> +void _Base_bitset<_Nw>::_M_do_left_shift(size_t __shift) +{ + if (__shift != 0) { + const size_t __wshift = __shift / __BITS_PER_WORD; + const size_t __offset = __shift % __BITS_PER_WORD; + + if (__offset == 0) + for (size_t __n = _Nw - 1; __n >= __wshift; --__n) + _M_w[__n] = _M_w[__n - __wshift]; + + else { + const size_t __sub_offset = __BITS_PER_WORD - __offset; + for (size_t __n = _Nw - 1; __n > __wshift; --__n) + _M_w[__n] = (_M_w[__n - __wshift] << __offset) | + (_M_w[__n - __wshift - 1] >> __sub_offset); + _M_w[__wshift] = _M_w[0] << __offset; + } + + fill(_M_w + 0, _M_w + __wshift, static_cast<_WordT>(0)); + } +} + +template<size_t _Nw> +void _Base_bitset<_Nw>::_M_do_right_shift(size_t __shift) +{ + if (__shift != 0) { + const size_t __wshift = __shift / __BITS_PER_WORD; + const size_t __offset = __shift % __BITS_PER_WORD; + const size_t __limit = _Nw - __wshift - 1; + + if (__offset == 0) + for (size_t __n = 0; __n <= __limit; ++__n) + _M_w[__n] = _M_w[__n + __wshift]; + + else { + const size_t __sub_offset = __BITS_PER_WORD - __offset; + for (size_t __n = 0; __n < __limit; ++__n) + _M_w[__n] = (_M_w[__n + __wshift] >> __offset) | + (_M_w[__n + __wshift + 1] << __sub_offset); + _M_w[__limit] = _M_w[_Nw-1] >> __offset; + } + + fill(_M_w + __limit + 1, _M_w + _Nw, static_cast<_WordT>(0)); + } +} + +template<size_t _Nw> +unsigned long _Base_bitset<_Nw>::_M_do_to_ulong() const +{ + for (size_t __i = 1; __i < _Nw; ++__i) + if (_M_w[__i]) + __STL_THROW(overflow_error("bitset")); + + return _M_w[0]; +} + +template<size_t _Nw> +size_t _Base_bitset<_Nw>::_M_do_find_first(size_t __not_found) const +{ + for ( size_t __i = 0; __i < _Nw; __i++ ) { + _WordT __thisword = _M_w[__i]; + if ( __thisword != static_cast<_WordT>(0) ) { + // find byte within word + for ( size_t __j = 0; __j < sizeof(_WordT); __j++ ) { + unsigned char __this_byte + = static_cast<unsigned char>(__thisword & (~(unsigned char)0)); + if ( __this_byte ) + return __i*__BITS_PER_WORD + __j*CHAR_BIT + + _First_one<true>::_S_first_one[__this_byte]; + + __thisword >>= CHAR_BIT; + } + } + } + // not found, so return an indication of failure. + return __not_found; +} + +template<size_t _Nw> +size_t +_Base_bitset<_Nw>::_M_do_find_next(size_t __prev, size_t __not_found) const +{ + // make bound inclusive + ++__prev; + + // check out of bounds + if ( __prev >= _Nw * __BITS_PER_WORD ) + return __not_found; + + // search first word + size_t __i = _S_whichword(__prev); + _WordT __thisword = _M_w[__i]; + + // mask off bits below bound + __thisword &= (~static_cast<_WordT>(0)) << _S_whichbit(__prev); + + if ( __thisword != static_cast<_WordT>(0) ) { + // find byte within word + // get first byte into place + __thisword >>= _S_whichbyte(__prev) * CHAR_BIT; + for ( size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); __j++ ) { + unsigned char __this_byte + = static_cast<unsigned char>(__thisword & (~(unsigned char)0)); + if ( __this_byte ) + return __i*__BITS_PER_WORD + __j*CHAR_BIT + + _First_one<true>::_S_first_one[__this_byte]; + + __thisword >>= CHAR_BIT; + } + } + + // check subsequent words + __i++; + for ( ; __i < _Nw; __i++ ) { + _WordT __thisword = _M_w[__i]; + if ( __thisword != static_cast<_WordT>(0) ) { + // find byte within word + for ( size_t __j = 0; __j < sizeof(_WordT); __j++ ) { + unsigned char __this_byte + = static_cast<unsigned char>(__thisword & (~(unsigned char)0)); + if ( __this_byte ) + return __i*__BITS_PER_WORD + __j*CHAR_BIT + + _First_one<true>::_S_first_one[__this_byte]; + + __thisword >>= CHAR_BIT; + } + } + } + + // not found, so return an indication of failure. + return __not_found; +} // end _M_do_find_next + + +// ------------------------------------------------------------ + +// +// Base class: specialization for a single word. +// + +__STL_TEMPLATE_NULL struct _Base_bitset<1> { + typedef unsigned long _WordT; + _WordT _M_w; + + _Base_bitset( void ) : _M_w(0) {} + _Base_bitset(unsigned long __val) : _M_w(__val) {} + + static size_t _S_whichword( size_t __pos ) + { return __pos / __BITS_PER_WORD; } + static size_t _S_whichbyte( size_t __pos ) + { return (__pos % __BITS_PER_WORD) / CHAR_BIT; } + static size_t _S_whichbit( size_t __pos ) + { return __pos % __BITS_PER_WORD; } + static _WordT _S_maskbit( size_t __pos ) + { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } + + _WordT& _M_getword(size_t) { return _M_w; } + _WordT _M_getword(size_t) const { return _M_w; } + + _WordT& _M_hiword() { return _M_w; } + _WordT _M_hiword() const { return _M_w; } + + void _M_do_and(const _Base_bitset<1>& __x) { _M_w &= __x._M_w; } + void _M_do_or(const _Base_bitset<1>& __x) { _M_w |= __x._M_w; } + void _M_do_xor(const _Base_bitset<1>& __x) { _M_w ^= __x._M_w; } + void _M_do_left_shift(size_t __shift) { _M_w <<= __shift; } + void _M_do_right_shift(size_t __shift) { _M_w >>= __shift; } + void _M_do_flip() { _M_w = ~_M_w; } + void _M_do_set() { _M_w = ~static_cast<_WordT>(0); } + void _M_do_reset() { _M_w = 0; } + + bool _M_is_equal(const _Base_bitset<1>& __x) const + { return _M_w == __x._M_w; } + bool _M_is_any() const + { return _M_w != 0; } + + size_t _M_do_count() const { + size_t __result = 0; + const unsigned char* __byte_ptr = (const unsigned char*)&_M_w; + const unsigned char* __end_ptr + = ((const unsigned char*)&_M_w)+sizeof(_M_w); + while ( __byte_ptr < __end_ptr ) { + __result += _Bit_count<true>::_S_bit_count[*__byte_ptr]; + __byte_ptr++; + } + return __result; + } + + unsigned long _M_do_to_ulong() const { return _M_w; } + + size_t _M_do_find_first(size_t __not_found) const; + + // find the next "on" bit that follows "prev" + size_t _M_do_find_next(size_t __prev, size_t __not_found) const; + +}; + +// +// Definitions of non-inline functions from the single-word version of +// _Base_bitset. +// + +size_t _Base_bitset<1>::_M_do_find_first(size_t __not_found) const +{ + _WordT __thisword = _M_w; + + if ( __thisword != static_cast<_WordT>(0) ) { + // find byte within word + for ( size_t __j = 0; __j < sizeof(_WordT); __j++ ) { + unsigned char __this_byte + = static_cast<unsigned char>(__thisword & (~(unsigned char)0)); + if ( __this_byte ) + return __j*CHAR_BIT + _First_one<true>::_S_first_one[__this_byte]; + + __thisword >>= CHAR_BIT; + } + } + // not found, so return a value that indicates failure. + return __not_found; +} + +size_t _Base_bitset<1>::_M_do_find_next(size_t __prev, size_t __not_found ) const +{ + // make bound inclusive + ++__prev; + + // check out of bounds + if ( __prev >= __BITS_PER_WORD ) + return __not_found; + + // search first (and only) word + _WordT __thisword = _M_w; + + // mask off bits below bound + __thisword &= (~static_cast<_WordT>(0)) << _S_whichbit(__prev); + + if ( __thisword != static_cast<_WordT>(0) ) { + // find byte within word + // get first byte into place + __thisword >>= _S_whichbyte(__prev) * CHAR_BIT; + for ( size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); __j++ ) { + unsigned char __this_byte + = static_cast<unsigned char>(__thisword & (~(unsigned char)0)); + if ( __this_byte ) + return __j*CHAR_BIT + _First_one<true>::_S_first_one[__this_byte]; + + __thisword >>= CHAR_BIT; + } + } + + // not found, so return a value that indicates failure. + return __not_found; +} // end _M_do_find_next + + +// ------------------------------------------------------------ +// Helper class to zero out the unused high-order bits in the highest word. + +template <size_t _Extrabits> struct _Sanitize { + static void _M_do_sanitize(unsigned long& __val) + { __val &= ~((~static_cast<unsigned long>(0)) << _Extrabits); } +}; + +__STL_TEMPLATE_NULL struct _Sanitize<0> { + static void _M_do_sanitize(unsigned long) {} +}; + + + +// ------------------------------------------------------------ +// Class bitset. +// _Nb may be any nonzero number of type size_t. + +template<size_t _Nb> +class bitset : private _Base_bitset<__BITSET_WORDS(_Nb)> +{ +private: + typedef _Base_bitset<__BITSET_WORDS(_Nb)> _Base; + typedef unsigned long _WordT; + +private: + void _M_do_sanitize() { + _Sanitize<_Nb%__BITS_PER_WORD>::_M_do_sanitize(this->_M_hiword()); + } + +public: + + // bit reference: + class reference; + friend class reference; + + class reference { + friend class bitset; + + _WordT *_M_wp; + size_t _M_bpos; + + // left undefined + reference(); + + public: + reference( bitset& __b, size_t __pos ) { + _M_wp = &__b._M_getword(__pos); + _M_bpos = _Base::_S_whichbit(__pos); + } + + ~reference() {} + + // for b[i] = __x; + reference& operator=(bool __x) { + if ( __x ) + *_M_wp |= _Base::_S_maskbit(_M_bpos); + else + *_M_wp &= ~_Base::_S_maskbit(_M_bpos); + + return *this; + } + + // for b[i] = b[__j]; + reference& operator=(const reference& __j) { + if ( (*(__j._M_wp) & _Base::_S_maskbit(__j._M_bpos)) ) + *_M_wp |= _Base::_S_maskbit(_M_bpos); + else + *_M_wp &= ~_Base::_S_maskbit(_M_bpos); + + return *this; + } + + // flips the bit + bool operator~() const + { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) == 0; } + + // for __x = b[i]; + operator bool() const + { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) != 0; } + + // for b[i].flip(); + reference& flip() { + *_M_wp ^= _Base::_S_maskbit(_M_bpos); + return *this; + } + }; + + // 23.3.5.1 constructors: + bitset() {} + bitset(unsigned long __val) : _Base_bitset<__BITSET_WORDS(_Nb)>(__val) + { _M_do_sanitize(); } + +#ifdef __STL_MEMBER_TEMPLATES + template<class _CharT, class _Traits, class _Alloc> + explicit bitset(const basic_string<_CharT, _Traits, _Alloc>& __s, + size_t __pos = 0) + : _Base() + { + if (__pos > __s.size()) + __STL_THROW(out_of_range("bitset")); + _M_copy_from_string(__s, __pos, + basic_string<_CharT, _Traits, _Alloc>::npos); + } + template<class _CharT, class _Traits, class _Alloc> + bitset(const basic_string<_CharT, _Traits, _Alloc>& __s, + size_t __pos, + size_t __n) + : _Base() + { + if (__pos > __s.size()) + __STL_THROW(out_of_range("bitset")); + _M_copy_from_string(__s, __pos, __n); + } +#else /* __STL_MEMBER_TEMPLATES */ + explicit bitset(const basic_string<char>& __s, + size_t __pos = 0, + size_t __n = basic_string<char>::npos) + : _Base() + { + if (__pos > __s.size()) + __STL_THROW(out_of_range("bitset")); + _M_copy_from_string(__s, __pos, __n); + } +#endif /* __STL_MEMBER_TEMPLATES */ + + // 23.3.5.2 bitset operations: + bitset<_Nb>& operator&=(const bitset<_Nb>& __rhs) { + this->_M_do_and(__rhs); + return *this; + } + + bitset<_Nb>& operator|=(const bitset<_Nb>& __rhs) { + this->_M_do_or(__rhs); + return *this; + } + + bitset<_Nb>& operator^=(const bitset<_Nb>& __rhs) { + this->_M_do_xor(__rhs); + return *this; + } + + bitset<_Nb>& operator<<=(size_t __pos) { + this->_M_do_left_shift(__pos); + this->_M_do_sanitize(); + return *this; + } + + bitset<_Nb>& operator>>=(size_t __pos) { + this->_M_do_right_shift(__pos); + this->_M_do_sanitize(); + return *this; + } + + // + // Extension: + // Versions of single-bit set, reset, flip, test with no range checking. + // + + bitset<_Nb>& _Unchecked_set(size_t __pos) { + this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); + return *this; + } + + bitset<_Nb>& _Unchecked_set(size_t __pos, int __val) { + if (__val) + this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); + else + this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); + + return *this; + } + + bitset<_Nb>& _Unchecked_reset(size_t __pos) { + this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); + return *this; + } + + bitset<_Nb>& _Unchecked_flip(size_t __pos) { + this->_M_getword(__pos) ^= _Base::_S_maskbit(__pos); + return *this; + } + + bool _Unchecked_test(size_t __pos) const { + return (this->_M_getword(__pos) & _Base::_S_maskbit(__pos)) + != static_cast<_WordT>(0); + } + + // Set, reset, and flip. + + bitset<_Nb>& set() { + this->_M_do_set(); + this->_M_do_sanitize(); + return *this; + } + + bitset<_Nb>& set(size_t __pos) { + if (__pos >= _Nb) + __STL_THROW(out_of_range("bitset")); + + return _Unchecked_set(__pos); + } + + bitset<_Nb>& set(size_t __pos, int __val) { + if (__pos >= _Nb) + __STL_THROW(out_of_range("bitset")); + + return _Unchecked_set(__pos, __val); + } + + bitset<_Nb>& reset() { + this->_M_do_reset(); + return *this; + } + + bitset<_Nb>& reset(size_t __pos) { + if (__pos >= _Nb) + __STL_THROW(out_of_range("bitset")); + + return _Unchecked_reset(__pos); + } + + bitset<_Nb>& flip() { + this->_M_do_flip(); + this->_M_do_sanitize(); + return *this; + } + + bitset<_Nb>& flip(size_t __pos) { + if (__pos >= _Nb) + __STL_THROW(out_of_range("bitset")); + + return _Unchecked_flip(__pos); + } + + bitset<_Nb> operator~() const { + return bitset<_Nb>(*this).flip(); + } + + // element access: + //for b[i]; + reference operator[](size_t __pos) { return reference(*this,__pos); } + bool operator[](size_t __pos) const { return _Unchecked_test(__pos); } + + unsigned long to_ulong() const { return this->_M_do_to_ulong(); } + +#if defined(__STL_MEMBER_TEMPLATES) && \ + defined(__STL_EXPLICIT_FUNCTION_TMPL_ARGS) + template <class _CharT, class _Traits, class _Alloc> + basic_string<_CharT, _Traits, _Alloc> to_string() const { + basic_string<_CharT, _Traits, _Alloc> __result; + _M_copy_to_string(__result); + return __result; + } +#endif /* member templates and explicit function template args */ + + // Helper functions for string operations. +#ifdef __STL_MEMBER_TEMPLATES + template<class _CharT, class _Traits, class _Alloc> + void _M_copy_from_string(const basic_string<_CharT,_Traits,_Alloc>& __s, + size_t, + size_t); + + template<class _CharT, class _Traits, class _Alloc> + void _M_copy_to_string(basic_string<_CharT,_Traits,_Alloc>&) const; +#else /* __STL_MEMBER_TEMPLATES */ + void _M_copy_from_string(const basic_string<char>&, size_t, size_t); + void _M_copy_to_string(basic_string<char>&) const; +#endif /* __STL_MEMBER_TEMPLATES */ + + size_t count() const { return this->_M_do_count(); } + + size_t size() const { return _Nb; } + + bool operator==(const bitset<_Nb>& __rhs) const { + return this->_M_is_equal(__rhs); + } + bool operator!=(const bitset<_Nb>& __rhs) const { + return !this->_M_is_equal(__rhs); + } + + bool test(size_t __pos) const { + if (__pos > _Nb) + __STL_THROW(out_of_range("bitset")); + + return _Unchecked_test(__pos); + } + + bool any() const { return this->_M_is_any(); } + bool none() const { return !this->_M_is_any(); } + + bitset<_Nb> operator<<(size_t __pos) const + { return bitset<_Nb>(*this) <<= __pos; } + bitset<_Nb> operator>>(size_t __pos) const + { return bitset<_Nb>(*this) >>= __pos; } + + // + // EXTENSIONS: bit-find operations. These operations are + // experimental, and are subject to change or removal in future + // versions. + // + + // find the index of the first "on" bit + size_t _Find_first() const + { return this->_M_do_find_first(_Nb); } + + // find the index of the next "on" bit after prev + size_t _Find_next( size_t __prev ) const + { return this->_M_do_find_next(__prev, _Nb); } + +}; + +// +// Definitions of non-inline member functions. +// + +#ifdef __STL_MEMBER_TEMPLATES + +template <size_t _Nb> +template<class _CharT, class _Traits, class _Alloc> +void bitset<_Nb> + ::_M_copy_from_string(const basic_string<_CharT,_Traits,_Alloc>& __s, + size_t __pos, + size_t __n) +{ + reset(); + const size_t __nbits = min(_Nb, min(__n, __s.size() - __pos)); + for (size_t __i = 0; __i < __nbits; ++__i) { + switch(__s[__pos + __nbits - __i - 1]) { + case '0': + break; + case '1': + set(__i); + break; + default: + __STL_THROW(invalid_argument("bitset")); + } + } +} + +template <size_t _Nb> +template <class _CharT, class _Traits, class _Alloc> +void bitset<_Nb> + ::_M_copy_to_string(basic_string<_CharT, _Traits, _Alloc>& __s) const +{ + __s.assign(_Nb, '0'); + + for (size_t __i = 0; __i < _Nb; ++__i) + if (_Unchecked_test(__i)) + __s[_Nb - 1 - __i] = '1'; +} + +#else /* __STL_MEMBER_TEMPLATES */ + +template <size_t _Nb> +void bitset<_Nb>::_M_copy_from_string(const basic_string<char>& __s, + size_t __pos, size_t __n) +{ + reset(); + size_t __tmp = _Nb; + const size_t __nbits = min(__tmp, min(__n, __s.size() - __pos)); + for (size_t __i = 0; __i < __nbits; ++__i) { + switch(__s[__pos + __nbits - __i - 1]) { + case '0': + break; + case '1': + set(__i); + break; + default: + __STL_THROW(invalid_argument("bitset")); + } + } +} + +template <size_t _Nb> +void bitset<_Nb>::_M_copy_to_string(basic_string<char>& __s) const +{ + __s.assign(_Nb, '0'); + + for (size_t __i = 0; __i < _Nb; ++__i) + if (_Unchecked_test(__i)) + __s[_Nb - 1 - __i] = '1'; +} + +#endif /* __STL_MEMBER_TEMPLATES */ + +// ------------------------------------------------------------ + +// +// 23.3.5.3 bitset operations: +// + +template <size_t _Nb> +inline bitset<_Nb> operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) { + bitset<_Nb> __result(__x); + __result &= __y; + return __result; +} + + +template <size_t _Nb> +inline bitset<_Nb> operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y) { + bitset<_Nb> __result(__x); + __result |= __y; + return __result; +} + +template <size_t _Nb> +inline bitset<_Nb> operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y) { + bitset<_Nb> __result(__x); + __result ^= __y; + return __result; +} + +#ifdef __STL_USE_NEW_IOSTREAMS + +template <class _CharT, class _Traits, size_t _Nb> +basic_istream<_CharT, _Traits>& +operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) +{ + basic_string<_CharT, _Traits> __tmp; + __tmp.reserve(_Nb); + + // Skip whitespace + typename basic_istream<_CharT, _Traits>::sentry __sentry(__is); + if (__sentry) { + basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf(); + for (size_t __i = 0; __i < _Nb; ++__i) { + static _Traits::int_type __eof = _Traits::eof(); + + typename _Traits::int_type __c1 = __buf->sbumpc(); + if (_Traits::eq_int_type(__c1, __eof)) { + __is.setstate(ios_base::eofbit); + break; + } + else { + char __c2 = _Traits::to_char_type(__c1); + char __c = __is.narrow(__c2, '*'); + + if (__c == '0' || __c == '1') + __tmp.push_back(__c); + else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) { + __is.setstate(ios_base::failbit); + break; + } + } + } + + if (__tmp.empty()) + __is.setstate(ios_base::failbit); + else + __x._M_copy_from_string(__tmp, static_cast<size_t>(0), _Nb); + } + + return __is; +} + +template <class _CharT, class _Traits, size_t _Nb> +basic_ostream<_CharT, _Traits>& +operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Nb>& __x) +{ + basic_string<_CharT, _Traits> __tmp; + __x._M_copy_to_string(__tmp); + return __os << __tmp; +} + +#else /* __STL_USE_NEW_IOSTREAMS */ + +template <size_t _Nb> +istream& operator>>(istream& __is, bitset<_Nb>& __x) { + string __tmp; + __tmp.reserve(_Nb); + + if (__is.flags() & ios::skipws) { + char __c; + do + __is.get(__c); + while (__is && isspace(__c)); + if (__is) + __is.putback(__c); + } + + for (size_t __i = 0; __i < _Nb; ++__i) { + char __c; + __is.get(__c); + + if (!__is) + break; + else if (__c != '0' && __c != '1') { + __is.putback(__c); + break; + } + else + __tmp.push_back(__c); + } + + if (__tmp.empty()) + __is.clear(__is.rdstate() | ios::failbit); + else + __x._M_copy_from_string(__tmp, static_cast<size_t>(0), _Nb); + + return __is; +} + +template <size_t _Nb> +ostream& operator<<(ostream& __os, const bitset<_Nb>& __x) { + string __tmp; + __x._M_copy_to_string(__tmp); + return __os << __tmp; +} + +#endif /* __STL_USE_NEW_IOSTREAMS */ + +// ------------------------------------------------------------ +// Lookup tables for find and count operations. + +template<bool __dummy> +unsigned char _Bit_count<__dummy>::_S_bit_count[] = { + 0, /* 0 */ 1, /* 1 */ 1, /* 2 */ 2, /* 3 */ 1, /* 4 */ + 2, /* 5 */ 2, /* 6 */ 3, /* 7 */ 1, /* 8 */ 2, /* 9 */ + 2, /* 10 */ 3, /* 11 */ 2, /* 12 */ 3, /* 13 */ 3, /* 14 */ + 4, /* 15 */ 1, /* 16 */ 2, /* 17 */ 2, /* 18 */ 3, /* 19 */ + 2, /* 20 */ 3, /* 21 */ 3, /* 22 */ 4, /* 23 */ 2, /* 24 */ + 3, /* 25 */ 3, /* 26 */ 4, /* 27 */ 3, /* 28 */ 4, /* 29 */ + 4, /* 30 */ 5, /* 31 */ 1, /* 32 */ 2, /* 33 */ 2, /* 34 */ + 3, /* 35 */ 2, /* 36 */ 3, /* 37 */ 3, /* 38 */ 4, /* 39 */ + 2, /* 40 */ 3, /* 41 */ 3, /* 42 */ 4, /* 43 */ 3, /* 44 */ + 4, /* 45 */ 4, /* 46 */ 5, /* 47 */ 2, /* 48 */ 3, /* 49 */ + 3, /* 50 */ 4, /* 51 */ 3, /* 52 */ 4, /* 53 */ 4, /* 54 */ + 5, /* 55 */ 3, /* 56 */ 4, /* 57 */ 4, /* 58 */ 5, /* 59 */ + 4, /* 60 */ 5, /* 61 */ 5, /* 62 */ 6, /* 63 */ 1, /* 64 */ + 2, /* 65 */ 2, /* 66 */ 3, /* 67 */ 2, /* 68 */ 3, /* 69 */ + 3, /* 70 */ 4, /* 71 */ 2, /* 72 */ 3, /* 73 */ 3, /* 74 */ + 4, /* 75 */ 3, /* 76 */ 4, /* 77 */ 4, /* 78 */ 5, /* 79 */ + 2, /* 80 */ 3, /* 81 */ 3, /* 82 */ 4, /* 83 */ 3, /* 84 */ + 4, /* 85 */ 4, /* 86 */ 5, /* 87 */ 3, /* 88 */ 4, /* 89 */ + 4, /* 90 */ 5, /* 91 */ 4, /* 92 */ 5, /* 93 */ 5, /* 94 */ + 6, /* 95 */ 2, /* 96 */ 3, /* 97 */ 3, /* 98 */ 4, /* 99 */ + 3, /* 100 */ 4, /* 101 */ 4, /* 102 */ 5, /* 103 */ 3, /* 104 */ + 4, /* 105 */ 4, /* 106 */ 5, /* 107 */ 4, /* 108 */ 5, /* 109 */ + 5, /* 110 */ 6, /* 111 */ 3, /* 112 */ 4, /* 113 */ 4, /* 114 */ + 5, /* 115 */ 4, /* 116 */ 5, /* 117 */ 5, /* 118 */ 6, /* 119 */ + 4, /* 120 */ 5, /* 121 */ 5, /* 122 */ 6, /* 123 */ 5, /* 124 */ + 6, /* 125 */ 6, /* 126 */ 7, /* 127 */ 1, /* 128 */ 2, /* 129 */ + 2, /* 130 */ 3, /* 131 */ 2, /* 132 */ 3, /* 133 */ 3, /* 134 */ + 4, /* 135 */ 2, /* 136 */ 3, /* 137 */ 3, /* 138 */ 4, /* 139 */ + 3, /* 140 */ 4, /* 141 */ 4, /* 142 */ 5, /* 143 */ 2, /* 144 */ + 3, /* 145 */ 3, /* 146 */ 4, /* 147 */ 3, /* 148 */ 4, /* 149 */ + 4, /* 150 */ 5, /* 151 */ 3, /* 152 */ 4, /* 153 */ 4, /* 154 */ + 5, /* 155 */ 4, /* 156 */ 5, /* 157 */ 5, /* 158 */ 6, /* 159 */ + 2, /* 160 */ 3, /* 161 */ 3, /* 162 */ 4, /* 163 */ 3, /* 164 */ + 4, /* 165 */ 4, /* 166 */ 5, /* 167 */ 3, /* 168 */ 4, /* 169 */ + 4, /* 170 */ 5, /* 171 */ 4, /* 172 */ 5, /* 173 */ 5, /* 174 */ + 6, /* 175 */ 3, /* 176 */ 4, /* 177 */ 4, /* 178 */ 5, /* 179 */ + 4, /* 180 */ 5, /* 181 */ 5, /* 182 */ 6, /* 183 */ 4, /* 184 */ + 5, /* 185 */ 5, /* 186 */ 6, /* 187 */ 5, /* 188 */ 6, /* 189 */ + 6, /* 190 */ 7, /* 191 */ 2, /* 192 */ 3, /* 193 */ 3, /* 194 */ + 4, /* 195 */ 3, /* 196 */ 4, /* 197 */ 4, /* 198 */ 5, /* 199 */ + 3, /* 200 */ 4, /* 201 */ 4, /* 202 */ 5, /* 203 */ 4, /* 204 */ + 5, /* 205 */ 5, /* 206 */ 6, /* 207 */ 3, /* 208 */ 4, /* 209 */ + 4, /* 210 */ 5, /* 211 */ 4, /* 212 */ 5, /* 213 */ 5, /* 214 */ + 6, /* 215 */ 4, /* 216 */ 5, /* 217 */ 5, /* 218 */ 6, /* 219 */ + 5, /* 220 */ 6, /* 221 */ 6, /* 222 */ 7, /* 223 */ 3, /* 224 */ + 4, /* 225 */ 4, /* 226 */ 5, /* 227 */ 4, /* 228 */ 5, /* 229 */ + 5, /* 230 */ 6, /* 231 */ 4, /* 232 */ 5, /* 233 */ 5, /* 234 */ + 6, /* 235 */ 5, /* 236 */ 6, /* 237 */ 6, /* 238 */ 7, /* 239 */ + 4, /* 240 */ 5, /* 241 */ 5, /* 242 */ 6, /* 243 */ 5, /* 244 */ + 6, /* 245 */ 6, /* 246 */ 7, /* 247 */ 5, /* 248 */ 6, /* 249 */ + 6, /* 250 */ 7, /* 251 */ 6, /* 252 */ 7, /* 253 */ 7, /* 254 */ + 8 /* 255 */ +}; // end _Bit_count + +template<bool __dummy> +unsigned char _First_one<__dummy>::_S_first_one[] = { + 0, /* 0 */ 0, /* 1 */ 1, /* 2 */ 0, /* 3 */ 2, /* 4 */ + 0, /* 5 */ 1, /* 6 */ 0, /* 7 */ 3, /* 8 */ 0, /* 9 */ + 1, /* 10 */ 0, /* 11 */ 2, /* 12 */ 0, /* 13 */ 1, /* 14 */ + 0, /* 15 */ 4, /* 16 */ 0, /* 17 */ 1, /* 18 */ 0, /* 19 */ + 2, /* 20 */ 0, /* 21 */ 1, /* 22 */ 0, /* 23 */ 3, /* 24 */ + 0, /* 25 */ 1, /* 26 */ 0, /* 27 */ 2, /* 28 */ 0, /* 29 */ + 1, /* 30 */ 0, /* 31 */ 5, /* 32 */ 0, /* 33 */ 1, /* 34 */ + 0, /* 35 */ 2, /* 36 */ 0, /* 37 */ 1, /* 38 */ 0, /* 39 */ + 3, /* 40 */ 0, /* 41 */ 1, /* 42 */ 0, /* 43 */ 2, /* 44 */ + 0, /* 45 */ 1, /* 46 */ 0, /* 47 */ 4, /* 48 */ 0, /* 49 */ + 1, /* 50 */ 0, /* 51 */ 2, /* 52 */ 0, /* 53 */ 1, /* 54 */ + 0, /* 55 */ 3, /* 56 */ 0, /* 57 */ 1, /* 58 */ 0, /* 59 */ + 2, /* 60 */ 0, /* 61 */ 1, /* 62 */ 0, /* 63 */ 6, /* 64 */ + 0, /* 65 */ 1, /* 66 */ 0, /* 67 */ 2, /* 68 */ 0, /* 69 */ + 1, /* 70 */ 0, /* 71 */ 3, /* 72 */ 0, /* 73 */ 1, /* 74 */ + 0, /* 75 */ 2, /* 76 */ 0, /* 77 */ 1, /* 78 */ 0, /* 79 */ + 4, /* 80 */ 0, /* 81 */ 1, /* 82 */ 0, /* 83 */ 2, /* 84 */ + 0, /* 85 */ 1, /* 86 */ 0, /* 87 */ 3, /* 88 */ 0, /* 89 */ + 1, /* 90 */ 0, /* 91 */ 2, /* 92 */ 0, /* 93 */ 1, /* 94 */ + 0, /* 95 */ 5, /* 96 */ 0, /* 97 */ 1, /* 98 */ 0, /* 99 */ + 2, /* 100 */ 0, /* 101 */ 1, /* 102 */ 0, /* 103 */ 3, /* 104 */ + 0, /* 105 */ 1, /* 106 */ 0, /* 107 */ 2, /* 108 */ 0, /* 109 */ + 1, /* 110 */ 0, /* 111 */ 4, /* 112 */ 0, /* 113 */ 1, /* 114 */ + 0, /* 115 */ 2, /* 116 */ 0, /* 117 */ 1, /* 118 */ 0, /* 119 */ + 3, /* 120 */ 0, /* 121 */ 1, /* 122 */ 0, /* 123 */ 2, /* 124 */ + 0, /* 125 */ 1, /* 126 */ 0, /* 127 */ 7, /* 128 */ 0, /* 129 */ + 1, /* 130 */ 0, /* 131 */ 2, /* 132 */ 0, /* 133 */ 1, /* 134 */ + 0, /* 135 */ 3, /* 136 */ 0, /* 137 */ 1, /* 138 */ 0, /* 139 */ + 2, /* 140 */ 0, /* 141 */ 1, /* 142 */ 0, /* 143 */ 4, /* 144 */ + 0, /* 145 */ 1, /* 146 */ 0, /* 147 */ 2, /* 148 */ 0, /* 149 */ + 1, /* 150 */ 0, /* 151 */ 3, /* 152 */ 0, /* 153 */ 1, /* 154 */ + 0, /* 155 */ 2, /* 156 */ 0, /* 157 */ 1, /* 158 */ 0, /* 159 */ + 5, /* 160 */ 0, /* 161 */ 1, /* 162 */ 0, /* 163 */ 2, /* 164 */ + 0, /* 165 */ 1, /* 166 */ 0, /* 167 */ 3, /* 168 */ 0, /* 169 */ + 1, /* 170 */ 0, /* 171 */ 2, /* 172 */ 0, /* 173 */ 1, /* 174 */ + 0, /* 175 */ 4, /* 176 */ 0, /* 177 */ 1, /* 178 */ 0, /* 179 */ + 2, /* 180 */ 0, /* 181 */ 1, /* 182 */ 0, /* 183 */ 3, /* 184 */ + 0, /* 185 */ 1, /* 186 */ 0, /* 187 */ 2, /* 188 */ 0, /* 189 */ + 1, /* 190 */ 0, /* 191 */ 6, /* 192 */ 0, /* 193 */ 1, /* 194 */ + 0, /* 195 */ 2, /* 196 */ 0, /* 197 */ 1, /* 198 */ 0, /* 199 */ + 3, /* 200 */ 0, /* 201 */ 1, /* 202 */ 0, /* 203 */ 2, /* 204 */ + 0, /* 205 */ 1, /* 206 */ 0, /* 207 */ 4, /* 208 */ 0, /* 209 */ + 1, /* 210 */ 0, /* 211 */ 2, /* 212 */ 0, /* 213 */ 1, /* 214 */ + 0, /* 215 */ 3, /* 216 */ 0, /* 217 */ 1, /* 218 */ 0, /* 219 */ + 2, /* 220 */ 0, /* 221 */ 1, /* 222 */ 0, /* 223 */ 5, /* 224 */ + 0, /* 225 */ 1, /* 226 */ 0, /* 227 */ 2, /* 228 */ 0, /* 229 */ + 1, /* 230 */ 0, /* 231 */ 3, /* 232 */ 0, /* 233 */ 1, /* 234 */ + 0, /* 235 */ 2, /* 236 */ 0, /* 237 */ 1, /* 238 */ 0, /* 239 */ + 4, /* 240 */ 0, /* 241 */ 1, /* 242 */ 0, /* 243 */ 2, /* 244 */ + 0, /* 245 */ 1, /* 246 */ 0, /* 247 */ 3, /* 248 */ 0, /* 249 */ + 1, /* 250 */ 0, /* 251 */ 2, /* 252 */ 0, /* 253 */ 1, /* 254 */ + 0, /* 255 */ +}; // end _First_one + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1209 +#endif + +__STL_END_NAMESPACE + + +#undef __BITS_PER_WORD +#undef __BITSET_WORDS + +#endif /* __SGI_STL_BITSET */ + + +// Local Variables: +// mode:C++ +// End: + diff --git a/dtm_release/local/include/stl/bvector.h b/dtm_release/local/include/stl/bvector.h new file mode 100644 index 0000000000000000000000000000000000000000..af494c5b5d5daa038efda17ad99ae2ae2e099b31 --- /dev/null +++ b/dtm_release/local/include/stl/bvector.h @@ -0,0 +1,52 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_BVECTOR_H +#define __SGI_STL_BVECTOR_H + +#include <stl_range_errors.h> +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION +#include <vector.h> +#else +#include <algobase.h> +#include <alloc.h> +#endif + +#include <stl_bvector.h> + +#ifdef __STL_USE_NAMESPACES + +using __STD::bit_vector; + +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_BVECTOR_H */ + +// Local Variables: +// mode:C++ +// End: + + diff --git a/dtm_release/local/include/stl/char_traits.h b/dtm_release/local/include/stl/char_traits.h new file mode 100644 index 0000000000000000000000000000000000000000..091efc2c1b93bda0e520eb06a8b518db779b5d40 --- /dev/null +++ b/dtm_release/local/include/stl/char_traits.h @@ -0,0 +1,152 @@ +/* + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_CHAR_TRAITS_H +#define __SGI_STL_CHAR_TRAITS_H + +#include <string.h> +#include <wchar.h> + +#if defined(__STL_USE_NEW_IOSTREAMS) && !defined(__SGI_STL_IOSFWD) +#include <iosfwd> +#endif /* use new iostreams */ + +__STL_BEGIN_NAMESPACE + +// Class __char_traits_base. + +template <class _CharT, class _IntT> class __char_traits_base { +public: + typedef _CharT char_type; + typedef _IntT int_type; +#ifdef __STL_USE_NEW_IOSTREAMS + typedef streamoff off_type; + typedef streampos pos_type; + typedef mbstate_t state_type; +#endif /* __STL_USE_NEW_IOSTREAMS */ + + static void assign(char_type& __c1, const char_type& __c2) { __c1 = __c2; } + static bool eq(const _CharT& __c1, const _CharT& __c2) + { return __c1 == __c2; } + static bool lt(const _CharT& __c1, const _CharT& __c2) + { return __c1 < __c2; } + + static int compare(const _CharT* __s1, const _CharT* __s2, size_t __n) { + for (size_t __i = 0; __i < __n; ++__i) + if (!eq(__s1[__i], __s2[__i])) + return __s1[__i] < __s2[__i] ? -1 : 1; + return 0; + } + + static size_t length(const _CharT* __s) { + const _CharT __nullchar = _CharT(); + size_t __i; + for (__i = 0; !eq(__s[__i], __nullchar); ++__i) + {} + return __i; + } + + static const _CharT* find(const _CharT* __s, size_t __n, const _CharT& __c) + { + for ( ; __n > 0 ; ++__s, --__n) + if (eq(*__s, __c)) + return __s; + return 0; + } + + static _CharT* move(_CharT* __s1, const _CharT* __s2, size_t __n) { + memmove(__s1, __s2, __n * sizeof(_CharT)); + return __s1; + } + + static _CharT* copy(_CharT* __s1, const _CharT* __s2, size_t __n) { + memcpy(__s1, __s2, __n * sizeof(_CharT)); + return __s1; + } + + static _CharT* assign(_CharT* __s, size_t __n, _CharT __c) { + for (size_t __i = 0; __i < __n; ++__i) + __s[__i] = __c; + return __s; + } + + static int_type not_eof(const int_type& __c) { + return !eq_int_type(__c, eof()) ? __c : 0; + } + + static char_type to_char_type(const int_type& __c) { + return static_cast<char_type>(__c); + } + + static int_type to_int_type(const char_type& __c) { + return static_cast<int_type>(__c); + } + + static bool eq_int_type(const int_type& __c1, const int_type& __c2) { + return __c1 == __c2; + } + + static int_type eof() { + return static_cast<int_type>(-1); + } +}; + +// Generic char_traits class. Note that this class is provided only +// as a base for explicit specialization; it is unlikely to be useful +// as is for any particular user-defined type. In particular, it +// *will not work* for a non-POD type. + +template <class _CharT> class char_traits + : public __char_traits_base<_CharT, _CharT> +{}; + +// Specialization for char. + +__STL_TEMPLATE_NULL class char_traits<char> + : public __char_traits_base<char, int> +{ +public: + static char_type to_char_type(const int_type& __c) { + return static_cast<char_type>(static_cast<unsigned char>(__c)); + } + + static int_type to_int_type(const char_type& __c) { + return static_cast<unsigned char>(__c); + } + + static int compare(const char* __s1, const char* __s2, size_t __n) + { return memcmp(__s1, __s2, __n); } + + static size_t length(const char* __s) { return strlen(__s); } + + static void assign(char& __c1, const char& __c2) { __c1 = __c2; } + + static char* assign(char* __s, size_t __n, char __c) + { memset(__s, __c, __n); return __s; } +}; + +// Specialization for wchar_t. + +__STL_TEMPLATE_NULL class char_traits<wchar_t> + : public __char_traits_base<wchar_t, wint_t> +{}; + + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_CHAR_TRAITS_H */ + +// Local Variables: +// mode:C++ +// End: + diff --git a/dtm_release/local/include/stl/concept_checks.h b/dtm_release/local/include/stl/concept_checks.h new file mode 100644 index 0000000000000000000000000000000000000000..36df2833286b038800f79c42f89d51db99cc843a --- /dev/null +++ b/dtm_release/local/include/stl/concept_checks.h @@ -0,0 +1,811 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __CONCEPT_CHECKS_H +#define __CONCEPT_CHECKS_H + +/* + Use these macro like assertions, but they assert properties + on types (usually template arguments). In technical terms they + verify whether a type "models" a "concept". + + This set of requirements and the terminology used here is derived + from the book "Generic Programming and the STL" by Matt Austern + (Addison Wesley). For further information please consult that + book. The requirements also are intended to match the ANSI/ISO C++ + standard. + + This file covers the basic concepts and the iterator concepts. + There are several other files that provide the requirements + for the STL containers: + container_concepts.h + sequence_concepts.h + assoc_container_concepts.h + + Jeremy Siek, 1999 + + TO DO: + - some issues with regards to concept classification and mutability + including AssociativeContianer -> ForwardContainer + and SortedAssociativeContainer -> ReversibleContainer + - HashedAssociativeContainer + - Allocator + - Function Object Concepts + + */ + +#ifndef __STL_USE_CONCEPT_CHECKS + +// Some compilers lack the features that are necessary for concept checks. +// On those compilers we define the concept check macros to do nothing. +#define __STL_REQUIRES(__type_var, __concept) do {} while(0) +#define __STL_CLASS_REQUIRES(__type_var, __concept) \ + static int __##__type_var##_##__concept +#define __STL_CONVERTIBLE(__type_x, __type_y) do {} while(0) +#define __STL_REQUIRES_SAME_TYPE(__type_x, __type_y) do {} while(0) +#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \ + static int __##__type_x##__type_y##_require_same_type +#define __STL_GENERATOR_CHECK(__func, __ret) do {} while(0) +#define __STL_CLASS_GENERATOR_CHECK(__func, __ret) \ + static int __##__func##__ret##_generator_check +#define __STL_UNARY_FUNCTION_CHECK(__func, __ret, __arg) do {} while(0) +#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \ + static int __##__func##__ret##__arg##_unary_function_check +#define __STL_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \ + do {} while(0) +#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \ + static int __##__func##__ret##__first##__second##_binary_function_check +#define __STL_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \ + do {} while(0) +#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \ + static int __##__opname##__ret##__first##__second##_require_binary_op + +#else /* __STL_USE_CONCEPT_CHECKS */ + +// This macro tests whether the template argument "__type_var" +// satisfies the requirements of "__concept". Here is a list of concepts +// that we know how to check: +// _Allocator +// _Assignable +// _DefaultConstructible +// _EqualityComparable +// _LessThanComparable +// _TrivialIterator +// _InputIterator +// _OutputIterator +// _ForwardIterator +// _BidirectionalIterator +// _RandomAccessIterator +// _Mutable_TrivialIterator +// _Mutable_ForwardIterator +// _Mutable_BidirectionalIterator +// _Mutable_RandomAccessIterator + +#define __STL_REQUIRES(__type_var, __concept) \ +do { \ + void (*__x)( __type_var ) = __concept##_concept_specification< __type_var >\ + ::__concept##_requirement_violation; __x = __x; } while (0) + +// Use this to check whether type X is convertible to type Y +#define __STL_CONVERTIBLE(__type_x, __type_y) \ +do { \ + void (*__x)( __type_x , __type_y ) = _STL_CONVERT_ERROR< __type_x , \ + __type_y >::__type_X_is_not_convertible_to_type_Y; \ + __x = __x; } while (0) + +// Use this to test whether two template arguments are the same type +#define __STL_REQUIRES_SAME_TYPE(__type_x, __type_y) \ +do { \ + void (*__x)( __type_x , __type_y ) = _STL_SAME_TYPE_ERROR< __type_x, \ + __type_y >::__type_X_not_same_as_type_Y; \ + __x = __x; } while (0) + + +// function object checks +#define __STL_GENERATOR_CHECK(__func, __ret) \ +do { \ + __ret (*__x)( __func&) = \ + _STL_GENERATOR_ERROR< \ + __func, __ret>::__generator_requirement_violation; \ + __x = __x; } while (0) + + +#define __STL_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \ +do { \ + __ret (*__x)( __func&, const __arg& ) = \ + _STL_UNARY_FUNCTION_ERROR< \ + __func, __ret, __arg>::__unary_function_requirement_violation; \ + __x = __x; } while (0) + + +#define __STL_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \ +do { \ + __ret (*__x)( __func&, const __first&, const __second& ) = \ + _STL_BINARY_FUNCTION_ERROR< \ + __func, __ret, __first, __second>::__binary_function_requirement_violation; \ + __x = __x; } while (0) + + +#define __STL_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \ + do { \ + __ret (*__x)( __first&, __second& ) = _STL_BINARY##__opname##_ERROR< \ + __ret, __first, __second>::__binary_operator_requirement_violation; \ + __ret (*__y)( const __first&, const __second& ) = \ + _STL_BINARY##__opname##_ERROR< __ret, __first, __second>:: \ + __const_binary_operator_requirement_violation; \ + __y = __y; __x = __x; } while (0) + + +#ifdef __STL_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE + +#define __STL_CLASS_REQUIRES(__type_var, __concept) +#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) +#define __STL_CLASS_GENERATOR_CHECK(__func, __ret) +#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) +#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) +#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) + +#else + +// Use this macro inside of template classes, where you would +// like to place requirements on the template arguments to the class +// Warning: do not pass pointers and such (e.g. T*) in as the __type_var, +// since the type_var is used to construct identifiers. Instead typedef +// the pointer type, then use the typedef name for the __type_var. +#define __STL_CLASS_REQUIRES(__type_var, __concept) \ + typedef void (* __func##__type_var##__concept)( __type_var ); \ + template <__func##__type_var##__concept _Tp1> \ + struct __dummy_struct_##__type_var##__concept { }; \ + static __dummy_struct_##__type_var##__concept< \ + __concept##_concept_specification< \ + __type_var>::__concept##_requirement_violation> \ + __dummy_ptr_##__type_var##__concept + + +#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \ + typedef void (* __func_##__type_x##__type_y##same_type)( __type_x, \ + __type_y ); \ + template < __func_##__type_x##__type_y##same_type _Tp1> \ + struct __dummy_struct_##__type_x##__type_y##_same_type { }; \ + static __dummy_struct_##__type_x##__type_y##_same_type< \ + _STL_SAME_TYPE_ERROR<__type_x, __type_y>::__type_X_not_same_as_type_Y> \ + __dummy_ptr_##__type_x##__type_y##_same_type + + +#define __STL_CLASS_GENERATOR_CHECK(__func, __ret) \ + typedef __ret (* __f_##__func##__ret##_generator)( __func& ); \ + template <__f_##__func##__ret##_generator _Tp1> \ + struct __dummy_struct_##__func##__ret##_generator { }; \ + static __dummy_struct_##__func##__ret##_generator< \ + _STL_GENERATOR_ERROR< \ + __func, __ret>::__generator_requirement_violation> \ + __dummy_ptr_##__func##__ret##_generator + + +#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \ + typedef __ret (* __f_##__func##__ret##__arg##_unary_check)( __func&, \ + const __arg& ); \ + template <__f_##__func##__ret##__arg##_unary_check _Tp1> \ + struct __dummy_struct_##__func##__ret##__arg##_unary_check { }; \ + static __dummy_struct_##__func##__ret##__arg##_unary_check< \ + _STL_UNARY_FUNCTION_ERROR< \ + __func, __ret, __arg>::__unary_function_requirement_violation> \ + __dummy_ptr_##__func##__ret##__arg##_unary_check + + +#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \ + typedef __ret (* __f_##__func##__ret##__first##__second##_binary_check)( __func&, const __first&,\ + const __second& ); \ + template <__f_##__func##__ret##__first##__second##_binary_check _Tp1> \ + struct __dummy_struct_##__func##__ret##__first##__second##_binary_check { }; \ + static __dummy_struct_##__func##__ret##__first##__second##_binary_check< \ + _STL_BINARY_FUNCTION_ERROR<__func, __ret, __first, __second>:: \ + __binary_function_requirement_violation> \ + __dummy_ptr_##__func##__ret##__first##__second##_binary_check + + +#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \ + typedef __ret (* __f_##__func##__ret##__first##__second##_binary_op)(const __first&, \ + const __second& ); \ + template <__f_##__func##__ret##__first##__second##_binary_op _Tp1> \ + struct __dummy_struct_##__func##__ret##__first##__second##_binary_op { }; \ + static __dummy_struct_##__func##__ret##__first##__second##_binary_op< \ + _STL_BINARY##__opname##_ERROR<__ret, __first, __second>:: \ + __binary_operator_requirement_violation> \ + __dummy_ptr_##__func##__ret##__first##__second##_binary_op + +#endif + +/* helper class for finding non-const version of a type. Need to have + something to assign to etc. when testing constant iterators. */ + +template <class _Tp> +struct _Mutable_trait { + typedef _Tp _Type; +}; +template <class _Tp> +struct _Mutable_trait<const _Tp> { + typedef _Tp _Type; +}; + + +/* helper function for avoiding compiler warnings about unused variables */ +template <class _Type> +void __sink_unused_warning(_Type) { } + +template <class _TypeX, class _TypeY> +struct _STL_CONVERT_ERROR { + static void + __type_X_is_not_convertible_to_type_Y(_TypeX __x, _TypeY) { + _TypeY __y = __x; + __sink_unused_warning(__y); + } +}; + + +template <class _Type> struct __check_equal { }; + +template <class _TypeX, class _TypeY> +struct _STL_SAME_TYPE_ERROR { + static void + __type_X_not_same_as_type_Y(_TypeX , _TypeY ) { + __check_equal<_TypeX> t1 = __check_equal<_TypeY>(); + } +}; + + +// Some Functon Object Checks + +template <class _Func, class _Ret> +struct _STL_GENERATOR_ERROR { + static _Ret __generator_requirement_violation(_Func& __f) { + return __f(); + } +}; + +template <class _Func> +struct _STL_GENERATOR_ERROR<_Func, void> { + static void __generator_requirement_violation(_Func& __f) { + __f(); + } +}; + + +template <class _Func, class _Ret, class _Arg> +struct _STL_UNARY_FUNCTION_ERROR { + static _Ret + __unary_function_requirement_violation(_Func& __f, + const _Arg& __arg) { + return __f(__arg); + } +}; + +template <class _Func, class _Arg> +struct _STL_UNARY_FUNCTION_ERROR<_Func, void, _Arg> { + static void + __unary_function_requirement_violation(_Func& __f, + const _Arg& __arg) { + __f(__arg); + } +}; + +template <class _Func, class _Ret, class _First, class _Second> +struct _STL_BINARY_FUNCTION_ERROR { + static _Ret + __binary_function_requirement_violation(_Func& __f, + const _First& __first, + const _Second& __second) { + return __f(__first, __second); + } +}; + +template <class _Func, class _First, class _Second> +struct _STL_BINARY_FUNCTION_ERROR<_Func, void, _First, _Second> { + static void + __binary_function_requirement_violation(_Func& __f, + const _First& __first, + const _Second& __second) { + __f(__first, __second); + } +}; + + +#define __STL_DEFINE_BINARY_OP_CHECK(_OP, _NAME) \ +template <class _Ret, class _First, class _Second> \ +struct _STL_BINARY##_NAME##_ERROR { \ + static _Ret \ + __const_binary_operator_requirement_violation(const _First& __first, \ + const _Second& __second) { \ + return __first _OP __second; \ + } \ + static _Ret \ + __binary_operator_requirement_violation(_First& __first, \ + _Second& __second) { \ + return __first _OP __second; \ + } \ +} + +__STL_DEFINE_BINARY_OP_CHECK(==, _OP_EQUAL); +__STL_DEFINE_BINARY_OP_CHECK(!=, _OP_NOT_EQUAL); +__STL_DEFINE_BINARY_OP_CHECK(<, _OP_LESS_THAN); +__STL_DEFINE_BINARY_OP_CHECK(<=, _OP_LESS_EQUAL); +__STL_DEFINE_BINARY_OP_CHECK(>, _OP_GREATER_THAN); +__STL_DEFINE_BINARY_OP_CHECK(>=, _OP_GREATER_EQUAL); +__STL_DEFINE_BINARY_OP_CHECK(+, _OP_PLUS); +__STL_DEFINE_BINARY_OP_CHECK(*, _OP_TIMES); +__STL_DEFINE_BINARY_OP_CHECK(/, _OP_DIVIDE); +__STL_DEFINE_BINARY_OP_CHECK(-, _OP_SUBTRACT); +__STL_DEFINE_BINARY_OP_CHECK(%, _OP_MOD); +// ... + +// TODO, add unary operators (prefix and postfix) + +/* + The presence of this class is just to trick EDG into displaying + these error messages before any other errors. Without the + classes, the errors in the functions get reported after + other class errors deep inside the library. The name + choice just makes for an eye catching error message :) + */ +struct _STL_ERROR { + + template <class _Type> + static _Type + __default_constructor_requirement_violation(_Type) { + return _Type(); + } + template <class _Type> + static _Type + __assignment_operator_requirement_violation(_Type __a) { + __a = __a; + return __a; + } + template <class _Type> + static _Type + __copy_constructor_requirement_violation(_Type __a) { + _Type __c(__a); + return __c; + } + template <class _Type> + static _Type + __const_parameter_required_for_copy_constructor(_Type /* __a */, + const _Type& __b) { + _Type __c(__b); + return __c; + } + template <class _Type> + static _Type + __const_parameter_required_for_assignment_operator(_Type __a, + const _Type& __b) { + __a = __b; + return __a; + } + template <class _Type> + static _Type + __less_than_comparable_requirement_violation(_Type __a, _Type __b) { + if (__a < __b || __a > __b || __a <= __b || __a >= __b) return __a; + return __b; + } + template <class _Type> + static _Type + __equality_comparable_requirement_violation(_Type __a, _Type __b) { + if (__a == __b || __a != __b) return __a; + return __b; + } + template <class _Iterator> + static void + __dereference_operator_requirement_violation(_Iterator __i) { + __sink_unused_warning(*__i); + } + template <class _Iterator> + static void + __dereference_operator_and_assignment_requirement_violation(_Iterator __i) { + *__i = *__i; + } + template <class _Iterator> + static void + __preincrement_operator_requirement_violation(_Iterator __i) { + ++__i; + } + template <class _Iterator> + static void + __postincrement_operator_requirement_violation(_Iterator __i) { + __i++; + } + template <class _Iterator> + static void + __predecrement_operator_requirement_violation(_Iterator __i) { + --__i; + } + template <class _Iterator> + static void + __postdecrement_operator_requirement_violation(_Iterator __i) { + __i--; + } + template <class _Iterator, class _Type> + static void + __postincrement_operator_and_assignment_requirement_violation(_Iterator __i, + _Type __t) { + *__i++ = __t; + } + template <class _Iterator, class _Distance> + static _Iterator + __iterator_addition_assignment_requirement_violation(_Iterator __i, + _Distance __n) { + __i += __n; + return __i; + } + template <class _Iterator, class _Distance> + static _Iterator + __iterator_addition_requirement_violation(_Iterator __i, _Distance __n) { + __i = __i + __n; + __i = __n + __i; + return __i; + } + template <class _Iterator, class _Distance> + static _Iterator + __iterator_subtraction_assignment_requirement_violation(_Iterator __i, + _Distance __n) { + __i -= __n; + return __i; + } + template <class _Iterator, class _Distance> + static _Iterator + __iterator_subtraction_requirement_violation(_Iterator __i, _Distance __n) { + __i = __i - __n; + return __i; + } + template <class _Iterator, class _Distance> + static _Distance + __difference_operator_requirement_violation(_Iterator __i, _Iterator __j, + _Distance __n) { + __n = __i - __j; + return __n; + } + template <class _Exp, class _Type, class _Distance> + static _Type + __element_access_operator_requirement_violation(_Exp __x, _Type*, + _Distance __n) { + return __x[__n]; + } + template <class _Exp, class _Type, class _Distance> + static void + __element_assignment_operator_requirement_violation(_Exp __x, + _Type* __t, + _Distance __n) { + __x[__n] = *__t; + } + +}; /* _STL_ERROR */ + +/* Associated Type Requirements */ + +__STL_BEGIN_NAMESPACE +template <class _Iterator> struct iterator_traits; +__STL_END_NAMESPACE + +template <class _Iter> +struct __value_type_type_definition_requirement_violation { + typedef typename __STD::iterator_traits<_Iter>::value_type value_type; +}; + +template <class _Iter> +struct __difference_type_type_definition_requirement_violation { + typedef typename __STD::iterator_traits<_Iter>::difference_type + difference_type; +}; + +template <class _Iter> +struct __reference_type_definition_requirement_violation { + typedef typename __STD::iterator_traits<_Iter>::reference reference; +}; + +template <class _Iter> +struct __pointer_type_definition_requirement_violation { + typedef typename __STD::iterator_traits<_Iter>::pointer pointer; +}; + +template <class _Iter> +struct __iterator_category_type_definition_requirement_violation { + typedef typename __STD::iterator_traits<_Iter>::iterator_category + iterator_category; +}; + +/* Assignable Requirements */ + + +template <class _Type> +struct _Assignable_concept_specification { + static void _Assignable_requirement_violation(_Type __a) { + _STL_ERROR::__assignment_operator_requirement_violation(__a); + _STL_ERROR::__copy_constructor_requirement_violation(__a); + _STL_ERROR::__const_parameter_required_for_copy_constructor(__a,__a); + _STL_ERROR::__const_parameter_required_for_assignment_operator(__a,__a); + } +}; + +/* DefaultConstructible Requirements */ + + +template <class _Type> +struct _DefaultConstructible_concept_specification { + static void _DefaultConstructible_requirement_violation(_Type __a) { + _STL_ERROR::__default_constructor_requirement_violation(__a); + } +}; + +/* EqualityComparable Requirements */ + +template <class _Type> +struct _EqualityComparable_concept_specification { + static void _EqualityComparable_requirement_violation(_Type __a) { + _STL_ERROR::__equality_comparable_requirement_violation(__a, __a); + } +}; + +/* LessThanComparable Requirements */ +template <class _Type> +struct _LessThanComparable_concept_specification { + static void _LessThanComparable_requirement_violation(_Type __a) { + _STL_ERROR::__less_than_comparable_requirement_violation(__a, __a); + } +}; + +/* TrivialIterator Requirements */ + +template <class _TrivialIterator> +struct _TrivialIterator_concept_specification { +static void +_TrivialIterator_requirement_violation(_TrivialIterator __i) { + typedef typename + __value_type_type_definition_requirement_violation<_TrivialIterator>:: + value_type __T; + // Refinement of Assignable + _Assignable_concept_specification<_TrivialIterator>:: + _Assignable_requirement_violation(__i); + // Refinement of DefaultConstructible + _DefaultConstructible_concept_specification<_TrivialIterator>:: + _DefaultConstructible_requirement_violation(__i); + // Refinement of EqualityComparable + _EqualityComparable_concept_specification<_TrivialIterator>:: + _EqualityComparable_requirement_violation(__i); + // Valid Expressions + _STL_ERROR::__dereference_operator_requirement_violation(__i); +} +}; + +template <class _TrivialIterator> +struct _Mutable_TrivialIterator_concept_specification { +static void +_Mutable_TrivialIterator_requirement_violation(_TrivialIterator __i) { + _TrivialIterator_concept_specification<_TrivialIterator>:: + _TrivialIterator_requirement_violation(__i); + // Valid Expressions + _STL_ERROR::__dereference_operator_and_assignment_requirement_violation(__i); +} +}; + +/* InputIterator Requirements */ + +template <class _InputIterator> +struct _InputIterator_concept_specification { +static void +_InputIterator_requirement_violation(_InputIterator __i) { + // Refinement of TrivialIterator + _TrivialIterator_concept_specification<_InputIterator>:: + _TrivialIterator_requirement_violation(__i); + // Associated Types + __difference_type_type_definition_requirement_violation<_InputIterator>(); + __reference_type_definition_requirement_violation<_InputIterator>(); + __pointer_type_definition_requirement_violation<_InputIterator>(); + __iterator_category_type_definition_requirement_violation<_InputIterator>(); + // Valid Expressions + _STL_ERROR::__preincrement_operator_requirement_violation(__i); + _STL_ERROR::__postincrement_operator_requirement_violation(__i); +} +}; + +/* OutputIterator Requirements */ + +template <class _OutputIterator> +struct _OutputIterator_concept_specification { +static void +_OutputIterator_requirement_violation(_OutputIterator __i) { + // Refinement of Assignable + _Assignable_concept_specification<_OutputIterator>:: + _Assignable_requirement_violation(__i); + // Associated Types + __iterator_category_type_definition_requirement_violation<_OutputIterator>(); + // Valid Expressions + _STL_ERROR::__dereference_operator_requirement_violation(__i); + _STL_ERROR::__preincrement_operator_requirement_violation(__i); + _STL_ERROR::__postincrement_operator_requirement_violation(__i); + _STL_ERROR:: + __postincrement_operator_and_assignment_requirement_violation(__i, *__i); +} +}; + +/* ForwardIterator Requirements */ + +template <class _ForwardIterator> +struct _ForwardIterator_concept_specification { +static void +_ForwardIterator_requirement_violation(_ForwardIterator __i) { + // Refinement of InputIterator + _InputIterator_concept_specification<_ForwardIterator>:: + _InputIterator_requirement_violation(__i); +} +}; + +template <class _ForwardIterator> +struct _Mutable_ForwardIterator_concept_specification { +static void +_Mutable_ForwardIterator_requirement_violation(_ForwardIterator __i) { + _ForwardIterator_concept_specification<_ForwardIterator>:: + _ForwardIterator_requirement_violation(__i); + // Refinement of OutputIterator + _OutputIterator_concept_specification<_ForwardIterator>:: + _OutputIterator_requirement_violation(__i); +} +}; + +/* BidirectionalIterator Requirements */ + +template <class _BidirectionalIterator> +struct _BidirectionalIterator_concept_specification { +static void +_BidirectionalIterator_requirement_violation(_BidirectionalIterator __i) { + // Refinement of ForwardIterator + _ForwardIterator_concept_specification<_BidirectionalIterator>:: + _ForwardIterator_requirement_violation(__i); + // Valid Expressions + _STL_ERROR::__predecrement_operator_requirement_violation(__i); + _STL_ERROR::__postdecrement_operator_requirement_violation(__i); +} +}; + +template <class _BidirectionalIterator> +struct _Mutable_BidirectionalIterator_concept_specification { +static void +_Mutable_BidirectionalIterator_requirement_violation( + _BidirectionalIterator __i) +{ + _BidirectionalIterator_concept_specification<_BidirectionalIterator>:: + _BidirectionalIterator_requirement_violation(__i); + // Refinement of mutable_ForwardIterator + _Mutable_ForwardIterator_concept_specification<_BidirectionalIterator>:: + _Mutable_ForwardIterator_requirement_violation(__i); + typedef typename + __value_type_type_definition_requirement_violation< + _BidirectionalIterator>::value_type __T; + typename _Mutable_trait<__T>::_Type* __tmp_ptr = 0; + // Valid Expressions + _STL_ERROR:: + __postincrement_operator_and_assignment_requirement_violation(__i, + *__tmp_ptr); +} +}; + +/* RandomAccessIterator Requirements */ + +template <class _RandAccIter> +struct _RandomAccessIterator_concept_specification { +static void +_RandomAccessIterator_requirement_violation(_RandAccIter __i) { + // Refinement of BidirectionalIterator + _BidirectionalIterator_concept_specification<_RandAccIter>:: + _BidirectionalIterator_requirement_violation(__i); + // Refinement of LessThanComparable + _LessThanComparable_concept_specification<_RandAccIter>:: + _LessThanComparable_requirement_violation(__i); + typedef typename + __value_type_type_definition_requirement_violation<_RandAccIter> + ::value_type + value_type; + typedef typename + __difference_type_type_definition_requirement_violation<_RandAccIter> + ::difference_type + _Dist; + typedef typename _Mutable_trait<_Dist>::_Type _MutDist; + + // Valid Expressions + _STL_ERROR::__iterator_addition_assignment_requirement_violation(__i, + _MutDist()); + _STL_ERROR::__iterator_addition_requirement_violation(__i, + _MutDist()); + _STL_ERROR:: + __iterator_subtraction_assignment_requirement_violation(__i, + _MutDist()); + _STL_ERROR::__iterator_subtraction_requirement_violation(__i, + _MutDist()); + _STL_ERROR::__difference_operator_requirement_violation(__i, __i, + _MutDist()); + typename _Mutable_trait<value_type>::_Type* __dummy_ptr = 0; + _STL_ERROR::__element_access_operator_requirement_violation(__i, + __dummy_ptr, + _MutDist()); +} +}; + +template <class _RandAccIter> +struct _Mutable_RandomAccessIterator_concept_specification { +static void +_Mutable_RandomAccessIterator_requirement_violation(_RandAccIter __i) +{ + _RandomAccessIterator_concept_specification<_RandAccIter>:: + _RandomAccessIterator_requirement_violation(__i); + // Refinement of mutable_BidirectionalIterator + _Mutable_BidirectionalIterator_concept_specification<_RandAccIter>:: + _Mutable_BidirectionalIterator_requirement_violation(__i); + typedef typename + __value_type_type_definition_requirement_violation<_RandAccIter> + ::value_type + value_type; + typedef typename + __difference_type_type_definition_requirement_violation<_RandAccIter> + ::difference_type + _Dist; + + typename _Mutable_trait<value_type>::_Type* __tmp_ptr = 0; + // Valid Expressions + _STL_ERROR::__element_assignment_operator_requirement_violation(__i, + __tmp_ptr, _Dist()); +} +}; + +#define __STL_TYPEDEF_REQUIREMENT(__REQUIREMENT) \ +template <class Type> \ +struct __##__REQUIREMENT##__typedef_requirement_violation { \ + typedef typename Type::__REQUIREMENT __REQUIREMENT; \ +} + +__STL_TYPEDEF_REQUIREMENT(value_type); +__STL_TYPEDEF_REQUIREMENT(difference_type); +__STL_TYPEDEF_REQUIREMENT(size_type); +__STL_TYPEDEF_REQUIREMENT(reference); +__STL_TYPEDEF_REQUIREMENT(const_reference); +__STL_TYPEDEF_REQUIREMENT(pointer); +__STL_TYPEDEF_REQUIREMENT(const_pointer); + + +template <class _Alloc> +struct _Allocator_concept_specification { +static void +_Allocator_requirement_violation(_Alloc __a) { + // Refinement of DefaultConstructible + _DefaultConstructible_concept_specification<_Alloc>:: + _DefaultConstructible_requirement_violation(__a); + // Refinement of EqualityComparable + _EqualityComparable_concept_specification<_Alloc>:: + _EqualityComparable_requirement_violation(__a); + // Associated Types + __value_type__typedef_requirement_violation<_Alloc>(); + __difference_type__typedef_requirement_violation<_Alloc>(); + __size_type__typedef_requirement_violation<_Alloc>(); + __reference__typedef_requirement_violation<_Alloc>(); + __const_reference__typedef_requirement_violation<_Alloc>(); + __pointer__typedef_requirement_violation<_Alloc>(); + __const_pointer__typedef_requirement_violation<_Alloc>(); + typedef typename _Alloc::value_type _Tp; + //__STL_REQUIRES_SAME_TYPE(typename _Alloc::__STL_TEMPLATE rebind<_Tp>::other, + // _Alloc); +} +}; + +#endif /* __STL_USE_CONCEPT_CHECKS */ + +#endif /* __CONCEPT_CHECKS_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/container_concepts.h b/dtm_release/local/include/stl/container_concepts.h new file mode 100644 index 0000000000000000000000000000000000000000..10db8de4f700ad1ad42d053921aeda7aff3b7848 --- /dev/null +++ b/dtm_release/local/include/stl/container_concepts.h @@ -0,0 +1,247 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __STL_CONTAINER_CONCEPTS_H +#define __STL_CONTAINER_CONCEPTS_H + + +#include <concept_checks.h> + +#ifdef __STL_USE_CONCEPT_CHECKS + + +// This file covers the following concepts: +// _Container +// _ForwardContainer +// _ReversibleContainer +// _const_ReversibleContainer +// _RandomAccessContainer +// + +struct _ERROR_IN_STL_CONTAINER { + + /* Container expresssions */ + + template <class _Container> + static void + __begin_iterator_accessor_requirement_violation(_Container __c) { + __c.begin(); + } + template <class _Container> + static void + __const_begin_iterator_accessor_requirement_violation(const _Container& __c) { + __c.begin(); + } + template <class _Container> + static void + __end_iterator_accessor_requirement_violation(_Container __c) { + __c.end(); + } + template <class _Container> + static void + __const_end_iterator_accessor_requirement_violation(const _Container& __c) { + __c.end(); + } + + template <class _Container> + static void + __rbegin_iterator_accessor_requirement_violation(_Container __c) { + __c.rbegin(); + } + template <class _Container> + static void + __const_rbegin_iterator_accessor_requirement_violation(const _Container& __c) { + __c.rbegin(); + } + template <class _Container> + static void + __rend_iterator_accessor_requirement_violation(_Container __c) { + __c.rend(); + } + template <class _Container> + static void + __const_rend_iterator_accessor_requirement_violation(const _Container& __c) { + __c.rend(); + } + template <class _Container> + static void + __size_function_must_be_const(const _Container& __c) { + __c.size(); + } + template <class _Container> + static void + __size_function_requirement_violation(_Container& __c) { + __c.size(); + __size_function_must_be_const(__c); + } + template <class _Container> + static void + __max_size_function_must_be_const(const _Container& __c) { + __c.max_size(); + } + template <class _Container> + static void + __max_size_function_requirement_violation(_Container& __c) { + __c.max_size(); + __max_size_function_must_be_const(__c); + } + template <class _Container> + static void + __empty_function_must_be_const(const _Container& __c) { + __c.empty(); + } + template <class _Container> + static void + __empty_function_requirement_violation(_Container& __c) { + __c.empty(); + __empty_function_must_be_const(__c); + } + template <class _Container> + static void + __swap_function_requirement_violation(_Container& __c) { + __c.swap(__c); + } + +}; + + +__STL_TYPEDEF_REQUIREMENT(iterator); +__STL_TYPEDEF_REQUIREMENT(const_iterator); + +/* Containers */ + +template <class _Container> +struct _Container_concept_specification { +static void +_Container_requirement_violation(_Container __c) { + // Refinement of Assignable + _Assignable_concept_specification<_Container>::_Assignable_requirement_violation(__c); + // Associated Types + __value_type__typedef_requirement_violation<_Container>(); + __difference_type__typedef_requirement_violation<_Container>(); + __size_type__typedef_requirement_violation<_Container>(); + __reference__typedef_requirement_violation<_Container>(); + __const_reference__typedef_requirement_violation<_Container>(); + __pointer__typedef_requirement_violation<_Container>(); + __const_pointer__typedef_requirement_violation<_Container>(); + __iterator__typedef_requirement_violation<_Container>(); + __const_iterator__typedef_requirement_violation<_Container>(); + // Valid Expressions + _ERROR_IN_STL_CONTAINER::__const_begin_iterator_accessor_requirement_violation(__c); + _ERROR_IN_STL_CONTAINER::__const_end_iterator_accessor_requirement_violation(__c); + _ERROR_IN_STL_CONTAINER::__begin_iterator_accessor_requirement_violation(__c); + _ERROR_IN_STL_CONTAINER::__end_iterator_accessor_requirement_violation(__c); + _ERROR_IN_STL_CONTAINER::__size_function_requirement_violation(__c); + _ERROR_IN_STL_CONTAINER::__max_size_function_requirement_violation(__c); + _ERROR_IN_STL_CONTAINER::__empty_function_requirement_violation(__c); + _ERROR_IN_STL_CONTAINER::__swap_function_requirement_violation(__c); + // Requirements on Iterators + typedef typename _Container::iterator iter; + typedef typename _Container::const_iterator const_iter; + _InputIterator_concept_specification<const_iter>::_InputIterator_requirement_violation(const_iter()); + _InputIterator_concept_specification<iter>::_InputIterator_requirement_violation(iter()); +} +}; + +template <class _ForwardContainer> +struct _ForwardContainer_concept_specification { +static void +_ForwardContainer_requirement_violation(_ForwardContainer __c) { + // Refinement of Container + _Container_concept_specification<_ForwardContainer>::_Container_requirement_violation(__c); + // Requirements on Iterators + typedef typename _ForwardContainer::iterator iter; + typedef typename _ForwardContainer::const_iterator const_iter; + _ForwardIterator_concept_specification<const_iter>::_ForwardIterator_requirement_violation(const_iter()); + _Mutable_ForwardIterator_concept_specification<iter>::_Mutable_ForwardIterator_requirement_violation(iter()); +} +}; + + +__STL_TYPEDEF_REQUIREMENT(reverse_iterator); +__STL_TYPEDEF_REQUIREMENT(const_reverse_iterator); + +template <class _ReversibleContainer> +struct _ReversibleContainer_concept_specification { +static void +_ReversibleContainer_requirement_violation(_ReversibleContainer __c) { + // Refinement of ForwardContainer + _ForwardContainer_concept_specification<_ReversibleContainer>::_ForwardContainer_requirement_violation(__c); + // Associated types + __reverse_iterator__typedef_requirement_violation<_ReversibleContainer>(); + __const_reverse_iterator__typedef_requirement_violation<_ReversibleContainer>(); + // Valid Expressions + _ERROR_IN_STL_CONTAINER::__const_rbegin_iterator_accessor_requirement_violation(__c); + _ERROR_IN_STL_CONTAINER::__const_rend_iterator_accessor_requirement_violation(__c); + _ERROR_IN_STL_CONTAINER::__rbegin_iterator_accessor_requirement_violation(__c); + _ERROR_IN_STL_CONTAINER::__rend_iterator_accessor_requirement_violation(__c); + // Requirements on Iterators + typedef typename _ReversibleContainer::iterator iter; + typedef typename _ReversibleContainer::const_iterator const_iter; + _BidirectionalIterator_concept_specification<const_iter>::_BidirectionalIterator_requirement_violation(const_iter()); + _Mutable_BidirectionalIterator_concept_specification<iter>::_Mutable_BidirectionalIterator_requirement_violation(iter()); +} +}; + +template <class _ReversibleContainer> +struct _const_ReversibleContainer_concept_specification { +static void +_const_ReversibleContainer_requirement_violation(_ReversibleContainer __c) { + // Refinement of Container (JGS, not ForwardContainer) + _Container_concept_specification<_ReversibleContainer>::_Container_requirement_violation(__c); + // Associated types + __reverse_iterator__typedef_requirement_violation<_ReversibleContainer>(); + __const_reverse_iterator__typedef_requirement_violation<_ReversibleContainer>(); + // Valid Expressions + _ERROR_IN_STL_CONTAINER::__const_rbegin_iterator_accessor_requirement_violation(__c); + _ERROR_IN_STL_CONTAINER::__const_rend_iterator_accessor_requirement_violation(__c); + _ERROR_IN_STL_CONTAINER::__rbegin_iterator_accessor_requirement_violation(__c); + _ERROR_IN_STL_CONTAINER::__rend_iterator_accessor_requirement_violation(__c); + // Requirements on Iterators + typedef typename _ReversibleContainer::iterator iter; + typedef typename _ReversibleContainer::const_iterator const_iter; + + // This line won't compile on gcc 2.91 due to a compiler bug. +#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 91) + __BidirectionalIterator_concept_specification<const_iter>::_BidirectionalIterator_requirement_violation(const_iter()); +#endif +} +}; + + +template <class _RandomAccessContainer> +struct _RandomAccessContainer_concept_specification { +static void +_RandomAccessContainer_requirement_violation(_RandomAccessContainer __c) { + // Refinement of ReversibleContainer + _ReversibleContainer_concept_specification<_RandomAccessContainer>::_ReversibleContainer_requirement_violation(__c); + // Valid Expressions + typedef typename _RandomAccessContainer::value_type __T; + typedef typename _RandomAccessContainer::difference_type _Dist; + typedef typename _Mutable_trait<__T>::_Type Type; + typedef Type* _TypePtr; + typedef typename _Mutable_trait<_Dist>::_Type Dist; + _STL_ERROR::__element_access_operator_requirement_violation(__c, + _TypePtr(), + Dist()); + // Requirements on Iterators + typedef typename _RandomAccessContainer::iterator iter; + typedef typename _RandomAccessContainer::const_iterator const_iter; + _RandomAccessIterator_concept_specification<const_iter>::_RandomAccessIterator_requirement_violation(const_iter()); + _Mutable_RandomAccessIterator_concept_specification<iter>::_Mutable_RandomAccessIterator_requirement_violation(iter()); +} +}; + +#endif /* if __STL_USE_CONCEPT_CHECKS */ + +#endif /* __STL_CONTAINER_CONCEPTS_H */ diff --git a/dtm_release/local/include/stl/defalloc.h b/dtm_release/local/include/stl/defalloc.h new file mode 100644 index 0000000000000000000000000000000000000000..0bfcc2c20a51d42f3e6ba252925c4c14799d1218 --- /dev/null +++ b/dtm_release/local/include/stl/defalloc.h @@ -0,0 +1,87 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +// Inclusion of this file is DEPRECATED. This is the original HP +// default allocator. It is provided only for backward compatibility. +// This file WILL BE REMOVED in a future release. +// +// DO NOT USE THIS FILE unless you have an old container implementation +// that requires an allocator with the HP-style interface. +// +// Standard-conforming allocators have a very different interface. The +// standard default allocator is declared in the header <memory>. + +#ifndef DEFALLOC_H +#define DEFALLOC_H + +#include <new.h> +#include <stddef.h> +#include <stdlib.h> +#include <limits.h> +#include <iostream.h> +#include <algobase.h> + + +template <class T> +inline T* allocate(ptrdiff_t size, T*) { + set_new_handler(0); + T* tmp = (T*)(::operator new((size_t)(size * sizeof(T)))); + if (tmp == 0) { + cerr << "out of memory" << endl; + exit(1); + } + return tmp; +} + + +template <class T> +inline void deallocate(T* buffer) { + ::operator delete(buffer); +} + +template <class T> +class allocator { +public: + typedef T value_type; + typedef T* pointer; + typedef const T* const_pointer; + typedef T& reference; + typedef const T& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + pointer allocate(size_type n) { + return ::allocate((difference_type)n, (pointer)0); + } + void deallocate(pointer p) { ::deallocate(p); } + pointer address(reference x) { return (pointer)&x; } + const_pointer const_address(const_reference x) { + return (const_pointer)&x; + } + size_type init_page_size() { + return max(size_type(1), size_type(4096/sizeof(T))); + } + size_type max_size() const { + return max(size_type(1), size_type(UINT_MAX/sizeof(T))); + } +}; + +class allocator<void> { +public: + typedef void* pointer; +}; + + + +#endif diff --git a/dtm_release/local/include/stl/deque b/dtm_release/local/include/stl/deque new file mode 100644 index 0000000000000000000000000000000000000000..b823fa4c5feaa0507029d1c95b005f47a3ef4e93 --- /dev/null +++ b/dtm_release/local/include/stl/deque @@ -0,0 +1,41 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_DEQUE +#define __SGI_STL_DEQUE + +#include <stl_range_errors.h> +#include <stl_algobase.h> +#include <stl_alloc.h> +#include <stl_construct.h> +#include <stl_uninitialized.h> +#include <stl_deque.h> + +#endif /* __SGI_STL_DEQUE */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/deque.h b/dtm_release/local/include/stl/deque.h new file mode 100644 index 0000000000000000000000000000000000000000..2ffeba2e853b6313252cc063c1e4208836b72ff3 --- /dev/null +++ b/dtm_release/local/include/stl/deque.h @@ -0,0 +1,43 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_DEQUE_H +#define __SGI_STL_DEQUE_H + +#include <stl_range_errors.h> +#include <algobase.h> +#include <alloc.h> +#include <stl_deque.h> + +#ifdef __STL_USE_NAMESPACES +using __STD::deque; +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_DEQUE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/function.h b/dtm_release/local/include/stl/function.h new file mode 100644 index 0000000000000000000000000000000000000000..6474dd99fa2e0546c5bcf730389e653914b19949 --- /dev/null +++ b/dtm_release/local/include/stl/function.h @@ -0,0 +1,118 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_FUNCTION_H +#define __SGI_STL_FUNCTION_H + +#ifndef __STL_CONFIG_H +#include <stl_config.h> +#endif +#ifndef __SGI_STL_INTERNAL_RELOPS +#include <stl_relops.h> +#endif +#include <stddef.h> +#ifndef __SGI_STL_INTERNAL_FUNCTION_H +#include <stl_function.h> +#endif + +#ifdef __STL_USE_NAMESPACE_FOR_RELOPS + +// Names from stl_relops.h +using __STD_RELOPS::operator!=; +using __STD_RELOPS::operator>; +using __STD_RELOPS::operator<=; +using __STD_RELOPS::operator>=; + +#endif /* __STL_USE_NAMESPACE_FOR_RELOPS */ + +#ifdef __STL_USE_NAMESPACES + +// Names from stl_function.h +using __STD::unary_function; +using __STD::binary_function; +using __STD::plus; +using __STD::minus; +using __STD::multiplies; +using __STD::divides; +using __STD::identity_element; +using __STD::modulus; +using __STD::negate; +using __STD::equal_to; +using __STD::not_equal_to; +using __STD::greater; +using __STD::less; +using __STD::greater_equal; +using __STD::less_equal; +using __STD::logical_and; +using __STD::logical_or; +using __STD::logical_not; +using __STD::unary_negate; +using __STD::binary_negate; +using __STD::not1; +using __STD::not2; +using __STD::binder1st; +using __STD::binder2nd; +using __STD::bind1st; +using __STD::bind2nd; +using __STD::unary_compose; +using __STD::binary_compose; +using __STD::compose1; +using __STD::compose2; +using __STD::pointer_to_unary_function; +using __STD::pointer_to_binary_function; +using __STD::ptr_fun; +using __STD::identity; +using __STD::select1st; +using __STD::select2nd; +using __STD::project1st; +using __STD::project2nd; +using __STD::constant_void_fun; +using __STD::constant_unary_fun; +using __STD::constant_binary_fun; +using __STD::constant0; +using __STD::constant1; +using __STD::constant2; +using __STD::subtractive_rng; +using __STD::mem_fun_t; +using __STD::const_mem_fun_t; +using __STD::mem_fun_ref_t; +using __STD::const_mem_fun_ref_t; +using __STD::mem_fun1_t; +using __STD::const_mem_fun1_t; +using __STD::mem_fun1_ref_t; +using __STD::const_mem_fun1_ref_t; +using __STD::mem_fun; +using __STD::mem_fun_ref; +using __STD::mem_fun1; +using __STD::mem_fun1_ref; + +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_FUNCTION_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/functional b/dtm_release/local/include/stl/functional new file mode 100644 index 0000000000000000000000000000000000000000..d046dbb036d67c6667976640a11c73beb26ac471 --- /dev/null +++ b/dtm_release/local/include/stl/functional @@ -0,0 +1,26 @@ +/* + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +#ifndef __SGI_STL_FUNCTIONAL +#define __SGI_STL_FUNCTIONAL + +#include <stl_config.h> +#include <stddef.h> +#include <stl_function.h> + +#endif /* __SGI_STL_FUNCTIONAL */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/hash_map b/dtm_release/local/include/stl/hash_map new file mode 100644 index 0000000000000000000000000000000000000000..f7421e026fab01b342cf2f347543e23a7cb9c5c5 --- /dev/null +++ b/dtm_release/local/include/stl/hash_map @@ -0,0 +1,40 @@ +/* + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +#ifndef __SGI_STL_HASH_MAP +#define __SGI_STL_HASH_MAP + +#ifndef __SGI_STL_INTERNAL_HASHTABLE_H +#include <stl_hashtable.h> +#endif + +#include <stl_hash_map.h> + +#endif /* __SGI_STL_HASH_MAP */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/hash_map.h b/dtm_release/local/include/stl/hash_map.h new file mode 100644 index 0000000000000000000000000000000000000000..f3471627044cf80fd32601ff989d71dc959fd147 --- /dev/null +++ b/dtm_release/local/include/stl/hash_map.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +#ifndef __SGI_STL_HASH_MAP_H +#define __SGI_STL_HASH_MAP_H + +#ifndef __SGI_STL_INTERNAL_HASHTABLE_H +#include <stl_hashtable.h> +#endif + +#include <algobase.h> +#include <stl_hash_map.h> + +#ifdef __STL_USE_NAMESPACES +using __STD::hash; +using __STD::hashtable; +using __STD::hash_map; +using __STD::hash_multimap; +#endif /* __STL_USE_NAMESPACES */ + + +#endif /* __SGI_STL_HASH_MAP_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/hash_set b/dtm_release/local/include/stl/hash_set new file mode 100644 index 0000000000000000000000000000000000000000..2244f47cfa01a796e121212ecaa645e95453d3b7 --- /dev/null +++ b/dtm_release/local/include/stl/hash_set @@ -0,0 +1,40 @@ +/* + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +#ifndef __SGI_STL_HASH_SET +#define __SGI_STL_HASH_SET + +#ifndef __SGI_STL_INTERNAL_HASHTABLE_H +#include <stl_hashtable.h> +#endif + +#include <stl_hash_set.h> + +#endif /* __SGI_STL_HASH_SET */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/hash_set.h b/dtm_release/local/include/stl/hash_set.h new file mode 100644 index 0000000000000000000000000000000000000000..d3e93c0c26bed5fa5301fdcab5b6f0f1c1731180 --- /dev/null +++ b/dtm_release/local/include/stl/hash_set.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +#ifndef __SGI_STL_HASH_SET_H +#define __SGI_STL_HASH_SET_H + +#ifndef __SGI_STL_INTERNAL_HASHTABLE_H +#include <stl_hashtable.h> +#endif + +#include <algobase.h> +#include <stl_hash_set.h> + +#ifdef __STL_USE_NAMESPACES +using __STD::hash; +using __STD::hashtable; +using __STD::hash_set; +using __STD::hash_multiset; +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_HASH_SET_H */ diff --git a/dtm_release/local/include/stl/hashtable.h b/dtm_release/local/include/stl/hashtable.h new file mode 100644 index 0000000000000000000000000000000000000000..15dbfc91644100934cd601b4115a85f72a084903 --- /dev/null +++ b/dtm_release/local/include/stl/hashtable.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_HASHTABLE_H +#define __SGI_STL_HASHTABLE_H + +#include <stl_hashtable.h> +#include <algo.h> +#include <alloc.h> +#include <vector.h> + +#ifdef __STL_USE_NAMESPACES +using __STD::hash; +using __STD::hashtable; +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_HASHTABLE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/heap.h b/dtm_release/local/include/stl/heap.h new file mode 100644 index 0000000000000000000000000000000000000000..2ec93c07b765b826496466042ce9f49a19ee5bda --- /dev/null +++ b/dtm_release/local/include/stl/heap.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_HEAP_H +#define __SGI_STL_HEAP_H + +#include <stl_config.h> +#include <stl_heap.h> + +#ifdef __STL_USE_NAMESPACES + +using __STD::push_heap; +using __STD::pop_heap; +using __STD::make_heap; +using __STD::sort_heap; + +#endif /* __STL_USE_NAMESPACES */ + + +#endif /* __SGI_STL_HEAP_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/iterator b/dtm_release/local/include/stl/iterator new file mode 100644 index 0000000000000000000000000000000000000000..fe2b8e898900ff4ede11634144c57be4ecd6d787 --- /dev/null +++ b/dtm_release/local/include/stl/iterator @@ -0,0 +1,47 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_ITERATOR +#define __SGI_STL_ITERATOR + +#include <stl_config.h> +#include <stl_relops.h> +#include <stddef.h> + +#ifdef __STL_USE_NEW_IOSTREAMS +#include <iosfwd> +#else /* __STL_USE_NEW_IOSTREAMS */ +#include <iostream.h> +#endif /* __STL_USE_NEW_IOSTREAMS */ + +#include <stl_iterator_base.h> +#include <stl_iterator.h> + +#endif /* __SGI_STL_ITERATOR */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/iterator.h b/dtm_release/local/include/stl/iterator.h new file mode 100644 index 0000000000000000000000000000000000000000..197278ba260274fcec511b9d12c1d5ac6ba0d7ea --- /dev/null +++ b/dtm_release/local/include/stl/iterator.h @@ -0,0 +1,113 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_ITERATOR_H +#define __SGI_STL_ITERATOR_H + +#ifndef __SGI_STL_FUNCTION_H +#include <function.h> +#endif +#include <stddef.h> + +#ifdef __STL_USE_NEW_IOSTREAMS +#include <iosfwd> +#else /* __STL_USE_NEW_IOSTREAMS */ +#include <iostream.h> +#endif /* __STL_USE_NEW_IOSTREAMS */ + +#ifndef __SGI_STL_INTERNAL_ITERATOR_BASE_H +#include <stl_iterator_base.h> +#endif +#ifndef __SGI_STL_INTERNAL_ITERATOR_H +#include <stl_iterator.h> +#endif +#ifndef __TYPE_TRAITS_H +#include <type_traits.h> +#endif +#ifndef __SGI_STL_INTERNAL_CONSTRUCT_H +#include <stl_construct.h> +#endif +#ifndef __SGI_STL_INTERNAL_RAW_STORAGE_ITERATOR_H +#include <stl_raw_storage_iter.h> +#endif + +#ifdef __STL_USE_NAMESPACES + +// Names from stl_iterator.h + +using __STD::input_iterator_tag; +using __STD::output_iterator_tag; +using __STD::forward_iterator_tag; +using __STD::bidirectional_iterator_tag; +using __STD::random_access_iterator_tag; + +#if 0 +using __STD::iterator; +#endif +using __STD::input_iterator; +using __STD::output_iterator; +using __STD::forward_iterator; +using __STD::bidirectional_iterator; +using __STD::random_access_iterator; + +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION +using __STD::iterator_traits; +#endif + +using __STD::iterator_category; +using __STD::distance_type; +using __STD::value_type; + +using __STD::distance; +using __STD::advance; + +using __STD::insert_iterator; +using __STD::front_insert_iterator; +using __STD::back_insert_iterator; +using __STD::inserter; +using __STD::front_inserter; +using __STD::back_inserter; + +using __STD::reverse_iterator; +using __STD::reverse_bidirectional_iterator; + +using __STD::istream_iterator; +using __STD::ostream_iterator; + +// Names from stl_construct.h +using __STD::construct; +using __STD::destroy; + +// Names from stl_raw_storage_iter.h +using __STD::raw_storage_iterator; + +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_ITERATOR_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/limits b/dtm_release/local/include/stl/limits new file mode 100644 index 0000000000000000000000000000000000000000..f1a9a094cbdf5836e71f1c6b48ee5786c6d3b888 --- /dev/null +++ b/dtm_release/local/include/stl/limits @@ -0,0 +1,537 @@ +/* + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is not portable code. Parts of numeric_limits<> are + * inherently machine-dependent. At present this file is suitable + * for the MIPS and ia32 architectures. + */ + +#ifndef __SGI_CPP_LIMITS +#define __SGI_CPP_LIMITS + +#include <limits.h> +#include <float.h> +#include <stl_config.h> + +__STL_BEGIN_NAMESPACE + +enum float_round_style { + round_indeterminate = -1, + round_toward_zero = 0, + round_to_nearest = 1, + round_toward_infinity = 2, + round_toward_neg_infinity = 3 +}; + +enum float_denorm_style { + denorm_indeterminate = -1, + denorm_absent = 0, + denorm_present = 1 +}; + +// The C++ standard (section 18.2.1) requires that some of the members of +// numeric_limits be static const data members that are given constant- +// initializers within the class declaration. On compilers where the +// __STL_STATIC_CONST_INIT_BUG macro is defined, it is impossible to write +// a standard-conforming numeric_limits class. +// +// There are two possible workarounds: either initialize the data +// members outside the class, or change them from data members to +// enums. Neither workaround is satisfactory: the former makes it +// impossible to use the data members in constant-expressions, and the +// latter means they have the wrong type and that it is impossible to +// take their addresses. We choose the former workaround. + +#ifdef __STL_STATIC_CONST_INIT_BUG +# define __STL_DECLARE_LIMITS_MEMBER(__mem_type, __mem_name, __mem_value) \ + enum { __mem_name = __mem_value } +#else /* __STL_STATIC_CONST_INIT_BUG */ +# define __STL_DECLARE_LIMITS_MEMBER(__mem_type, __mem_name, __mem_value) \ + static const __mem_type __mem_name = __mem_value +#endif /* __STL_STATIC_CONST_INIT_BUG */ + +// Base class for all specializations of numeric_limits. + +template <class __number> +class _Numeric_limits_base { +public: + __STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, false); + + static __number min() __STL_NOTHROW { return __number(); } + static __number max() __STL_NOTHROW { return __number(); } + + __STL_DECLARE_LIMITS_MEMBER(int, digits, 0); + __STL_DECLARE_LIMITS_MEMBER(int, digits10, 0); + + __STL_DECLARE_LIMITS_MEMBER(bool, is_signed, false); + __STL_DECLARE_LIMITS_MEMBER(bool, is_integer, false); + __STL_DECLARE_LIMITS_MEMBER(bool, is_exact, false); + + __STL_DECLARE_LIMITS_MEMBER(int, radix, 0); + + static __number epsilon() __STL_NOTHROW { return __number(); } + static __number round_error() __STL_NOTHROW { return __number(); } + + __STL_DECLARE_LIMITS_MEMBER(int, min_exponent, 0); + __STL_DECLARE_LIMITS_MEMBER(int, min_exponent10, 0); + __STL_DECLARE_LIMITS_MEMBER(int, max_exponent, 0); + __STL_DECLARE_LIMITS_MEMBER(int, max_exponent10, 0); + + __STL_DECLARE_LIMITS_MEMBER(bool, has_infinity, false); + __STL_DECLARE_LIMITS_MEMBER(bool, has_quiet_NaN, false); + __STL_DECLARE_LIMITS_MEMBER(bool, has_signaling_NaN, false); + __STL_DECLARE_LIMITS_MEMBER(float_denorm_style, + has_denorm, + denorm_absent); + __STL_DECLARE_LIMITS_MEMBER(bool, has_denorm_loss, false); + + static __number infinity() __STL_NOTHROW { return __number(); } + static __number quiet_NaN() __STL_NOTHROW { return __number(); } + static __number signaling_NaN() __STL_NOTHROW { return __number(); } + static __number denorm_min() __STL_NOTHROW { return __number(); } + + __STL_DECLARE_LIMITS_MEMBER(bool, is_iec559, false); + __STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, false); + __STL_DECLARE_LIMITS_MEMBER(bool, is_modulo, false); + + __STL_DECLARE_LIMITS_MEMBER(bool, traps, false); + __STL_DECLARE_LIMITS_MEMBER(bool, tinyness_before, false); + __STL_DECLARE_LIMITS_MEMBER(float_round_style, + round_style, + round_toward_zero); +}; + +#ifdef __STL_STATIC_CONST_INIT_BUG +# define __STL_DEFINE_NUMERIC_BASE_MEMBER(__type, __mem) +#else /* __STL_STATIC_CONST_INIT_BUG */ +# define __STL_DEFINE_NUMERIC_BASE_MEMBER(__type, __mem) \ + template <class __number> \ + const __type _Numeric_limits_base<__number>:: __mem +#endif /* __STL_STATIC_CONST_INIT_BUG */ + +__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, is_specialized); +__STL_DEFINE_NUMERIC_BASE_MEMBER(int, digits); +__STL_DEFINE_NUMERIC_BASE_MEMBER(int, digits10); +__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, is_signed); +__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, is_integer); +__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, is_exact); +__STL_DEFINE_NUMERIC_BASE_MEMBER(int, radix); +__STL_DEFINE_NUMERIC_BASE_MEMBER(int, min_exponent); +__STL_DEFINE_NUMERIC_BASE_MEMBER(int, max_exponent); +__STL_DEFINE_NUMERIC_BASE_MEMBER(int, min_exponent10); +__STL_DEFINE_NUMERIC_BASE_MEMBER(int, max_exponent10); +__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, has_infinity); +__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, has_quiet_NaN); +__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, has_signaling_NaN); +__STL_DEFINE_NUMERIC_BASE_MEMBER(float_denorm_style, has_denorm); +__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, has_denorm_loss); +__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, is_iec559); +__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, is_bounded); +__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, is_modulo); +__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, traps); +__STL_DEFINE_NUMERIC_BASE_MEMBER(bool, tinyness_before); +__STL_DEFINE_NUMERIC_BASE_MEMBER(float_round_style, round_style); + + +// Base class for integers. + +template <class _Int, + _Int __imin, _Int __imax, + int __idigits = -1, bool __ismod = true> +class _Integer_limits : public _Numeric_limits_base<_Int> +{ +public: + __STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, true); + + static _Int min() __STL_NOTHROW { return __imin; } + static _Int max() __STL_NOTHROW { return __imax; } + + __STL_DECLARE_LIMITS_MEMBER(int, + digits, + (__idigits < 0) ? (int)(sizeof(_Int) * CHAR_BIT) + - (__imin == 0 ? 0 : 1) + : __idigits); + __STL_DECLARE_LIMITS_MEMBER(int, digits10, (digits * 301) / 1000); + // log 2 = 0.301029995664... + + __STL_DECLARE_LIMITS_MEMBER(bool, is_signed, __imin != 0); + __STL_DECLARE_LIMITS_MEMBER(bool, is_integer, true); + __STL_DECLARE_LIMITS_MEMBER(bool, is_exact, true); + __STL_DECLARE_LIMITS_MEMBER(int, radix, 2); + + __STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, true); + __STL_DECLARE_LIMITS_MEMBER(bool, is_modulo, __ismod); +}; + +#ifdef __STL_STATIC_CONST_INIT_BUG +# define __STL_DEFINE_INTEGER_LIMITS_MEMBER(__type, __mem) +#else /* __STL_STATIC_CONST_INIT_BUG */ +# define __STL_DEFINE_INTEGER_LIMITS_MEMBER(__type, __mem) \ + template <class _Int, _Int __imin, _Int __imax, int __idig, bool __ismod> \ + const __type _Integer_limits<_Int, __imin, __imax, __idig, __ismod>::__mem +#endif /* __STL_STATIC_CONST_INIT_BUG */ + +__STL_DEFINE_INTEGER_LIMITS_MEMBER(bool, is_specialized); +__STL_DEFINE_INTEGER_LIMITS_MEMBER(int, digits); +__STL_DEFINE_INTEGER_LIMITS_MEMBER(int, digits10); +__STL_DEFINE_INTEGER_LIMITS_MEMBER(bool, is_signed); +__STL_DEFINE_INTEGER_LIMITS_MEMBER(bool, is_integer); +__STL_DEFINE_INTEGER_LIMITS_MEMBER(bool, is_exact); +__STL_DEFINE_INTEGER_LIMITS_MEMBER(int, radix); +__STL_DEFINE_INTEGER_LIMITS_MEMBER(bool, is_bounded); +__STL_DEFINE_INTEGER_LIMITS_MEMBER(bool, is_modulo); + + +// Base class for floating-point numbers. +template <class __number, + int __Digits, int __Digits10, + int __MinExp, int __MaxExp, + int __MinExp10, int __MaxExp10, + bool __IsIEC559, + float_round_style __RoundStyle> +class _Floating_limits : public _Numeric_limits_base<__number> +{ +public: + __STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, true); + + __STL_DECLARE_LIMITS_MEMBER(int, digits, __Digits); + __STL_DECLARE_LIMITS_MEMBER(int, digits10, __Digits10); + + __STL_DECLARE_LIMITS_MEMBER(bool, is_signed, true); + + __STL_DECLARE_LIMITS_MEMBER(int, radix, 2); + + __STL_DECLARE_LIMITS_MEMBER(int, min_exponent, __MinExp); + __STL_DECLARE_LIMITS_MEMBER(int, max_exponent, __MaxExp); + __STL_DECLARE_LIMITS_MEMBER(int, min_exponent10, __MinExp10); + __STL_DECLARE_LIMITS_MEMBER(int, max_exponent10, __MaxExp10); + + __STL_DECLARE_LIMITS_MEMBER(bool, has_infinity, true); + __STL_DECLARE_LIMITS_MEMBER(bool, has_quiet_NaN, true); + __STL_DECLARE_LIMITS_MEMBER(bool, has_signaling_NaN, true); + __STL_DECLARE_LIMITS_MEMBER(float_denorm_style, + has_denorm, + denorm_indeterminate); + __STL_DECLARE_LIMITS_MEMBER(bool, has_denorm_loss, false); + + __STL_DECLARE_LIMITS_MEMBER(bool, is_iec559, __IsIEC559); + __STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, true); + __STL_DECLARE_LIMITS_MEMBER(bool, traps, true); + __STL_DECLARE_LIMITS_MEMBER(bool, tinyness_before, false); + + __STL_DECLARE_LIMITS_MEMBER(float_round_style, round_style, __RoundStyle); +}; + +#ifdef __STL_STATIC_CONST_INIT_BUG +# define __STL_DEFINE_FLOAT_LIMITS_MEMBER(__type, __mem) +#else /* __STL_STATIC_CONST_INIT_BUG */ +# define __STL_DEFINE_FLOAT_LIMITS_MEMBER(__type, __mem) \ + template <class __Num, int __Dig, int __Dig10, \ + int __MnX, int __MxX, int __MnX10, int __MxX10, \ + bool __IsIEEE, float_round_style __Sty> \ + const __type _Floating_limits<__Num, __Dig, __Dig10, \ + __MnX, __MxX, __MnX10, __MxX10, \ + __IsIEEE, __Sty>:: __mem +#endif /* __STL_STATIC_CONST_INIT_BUG */ + +__STL_DEFINE_FLOAT_LIMITS_MEMBER(bool, is_specialized); +__STL_DEFINE_FLOAT_LIMITS_MEMBER(int, digits); +__STL_DEFINE_FLOAT_LIMITS_MEMBER(int, digits10); +__STL_DEFINE_FLOAT_LIMITS_MEMBER(bool, is_signed); +__STL_DEFINE_FLOAT_LIMITS_MEMBER(int, radix); +__STL_DEFINE_FLOAT_LIMITS_MEMBER(int, min_exponent); +__STL_DEFINE_FLOAT_LIMITS_MEMBER(int, max_exponent); +__STL_DEFINE_FLOAT_LIMITS_MEMBER(int, min_exponent10); +__STL_DEFINE_FLOAT_LIMITS_MEMBER(int, max_exponent10); +__STL_DEFINE_FLOAT_LIMITS_MEMBER(bool, has_infinity); +__STL_DEFINE_FLOAT_LIMITS_MEMBER(bool, has_quiet_NaN); +__STL_DEFINE_FLOAT_LIMITS_MEMBER(bool, has_signaling_NaN); +__STL_DEFINE_FLOAT_LIMITS_MEMBER(float_denorm_style, has_denorm); +__STL_DEFINE_FLOAT_LIMITS_MEMBER(bool, has_denorm_loss); +__STL_DEFINE_FLOAT_LIMITS_MEMBER(bool, is_iec559); +__STL_DEFINE_FLOAT_LIMITS_MEMBER(bool, is_bounded); +__STL_DEFINE_FLOAT_LIMITS_MEMBER(bool, traps); +__STL_DEFINE_FLOAT_LIMITS_MEMBER(bool, tinyness_before); +__STL_DEFINE_FLOAT_LIMITS_MEMBER(float_round_style, round_style); + + +#undef __STL_DECLARE_NUMERIC_LIMITS_MEMBER +#undef __STL_DEFINE_NUMERIC_BASE_MEMBER +#undef __STL_DEFINE_INTEGER_LIMITS_MEMBER +#undef __STL_DEFINE_FLOAT_LIMITS_MEMBER + +// Class numeric_limits + +// The unspecialized class. + +template<class _Tp> +class numeric_limits : public _Numeric_limits_base<_Tp> {}; + +// Specializations for all built-in integral types. + +#ifndef __STL_NO_BOOL + +__STL_TEMPLATE_NULL +class numeric_limits<bool> + : public _Integer_limits<bool, false, true, 1, false> +{}; + +#endif /* __STL_NO_BOOL */ + +__STL_TEMPLATE_NULL +class numeric_limits<char> + : public _Integer_limits<char, CHAR_MIN, CHAR_MAX> +{}; + +__STL_TEMPLATE_NULL +class numeric_limits<signed char> + : public _Integer_limits<signed char, SCHAR_MIN, SCHAR_MAX> +{}; + +__STL_TEMPLATE_NULL +class numeric_limits<unsigned char> + : public _Integer_limits<unsigned char, 0, UCHAR_MAX> +{}; + +#ifdef __STL_HAS_WCHAR_T + +__STL_TEMPLATE_NULL +class numeric_limits<wchar_t> + : public _Integer_limits<wchar_t, INT_MIN, INT_MAX> +{}; + +#endif + +__STL_TEMPLATE_NULL +class numeric_limits<short> + : public _Integer_limits<short, SHRT_MIN, SHRT_MAX> +{}; + +__STL_TEMPLATE_NULL +class numeric_limits<unsigned short> + : public _Integer_limits<unsigned short, 0, USHRT_MAX> +{}; + +__STL_TEMPLATE_NULL +class numeric_limits<int> + : public _Integer_limits<int, INT_MIN, INT_MAX> +{}; + +__STL_TEMPLATE_NULL +class numeric_limits<unsigned int> + : public _Integer_limits<unsigned int, 0, UINT_MAX> +{}; + +__STL_TEMPLATE_NULL +class numeric_limits<long> + : public _Integer_limits<long, LONG_MIN, LONG_MAX> +{}; + +__STL_TEMPLATE_NULL +class numeric_limits<unsigned long> + : public _Integer_limits<unsigned long, 0, ULONG_MAX> +{}; + +#ifdef __STL_LONG_LONG + +// Some compilers have long long, but don't define the +// LONGLONG_MIN and LONGLONG_MAX macros in limits.h. This +// assumes that long long is 64 bits. +#if !defined(LONGLONG_MIN) && !defined(LONGLONG_MAX) \ + && !defined(ULONGLONG_MAX) + +#define ULONGLONG_MAX 0xffffffffffffffffLLU +#define LONGLONG_MAX 0x7fffffffffffffffLL +#define LONGLONG_MIN (-LONGLONG_MAX - 1LL) + +#endif + +__STL_TEMPLATE_NULL +class numeric_limits<long long> + : public _Integer_limits<long long, LONGLONG_MIN, LONGLONG_MAX> +{}; + +__STL_TEMPLATE_NULL +class numeric_limits<unsigned long long> + : public _Integer_limits<unsigned long long, 0, ULONGLONG_MAX> +{}; + +#endif /* __STL_LONG_LONG */ + +// Specializations for all built-in floating-point type. + +__STL_TEMPLATE_NULL class numeric_limits<float> + : public _Floating_limits<float, + FLT_MANT_DIG, // Binary digits of precision + FLT_DIG, // Decimal digits of precision + FLT_MIN_EXP, // Minimum exponent + FLT_MAX_EXP, // Maximum exponent + FLT_MIN_10_EXP, // Minimum base 10 exponent + FLT_MAX_10_EXP, // Maximum base 10 exponent + true, // conforms to iec559 + round_to_nearest> +{ +public: + static float min() __STL_NOTHROW { return FLT_MIN; } + static float denorm_min() __STL_NOTHROW { return FLT_MIN; } + static float max() __STL_NOTHROW { return FLT_MAX; } + static float epsilon() __STL_NOTHROW { return FLT_EPSILON; } + static float round_error() __STL_NOTHROW { return 0.5f; } // Units: ulps. + static float infinity() __STL_NOTHROW; + static float quiet_NaN() __STL_NOTHROW; + static float signaling_NaN() __STL_NOTHROW; +}; + +__STL_TEMPLATE_NULL class numeric_limits<double> + : public _Floating_limits<double, + DBL_MANT_DIG, // Binary digits of precision + DBL_DIG, // Decimal digits of precision + DBL_MIN_EXP, // Minimum exponent + DBL_MAX_EXP, // Maximum exponent + DBL_MIN_10_EXP, // Minimum base 10 exponent + DBL_MAX_10_EXP, // Maximum base 10 exponent + true, // conforms to iec559 + round_to_nearest> +{ +public: + static double min() __STL_NOTHROW { return DBL_MIN; } + static double denorm_min() __STL_NOTHROW { return DBL_MIN; } + static double max() __STL_NOTHROW { return DBL_MAX; } + static double epsilon() __STL_NOTHROW { return DBL_EPSILON; } + static double round_error() __STL_NOTHROW { return 0.5; } // Units: ulps. + static double infinity() __STL_NOTHROW; + static double quiet_NaN() __STL_NOTHROW; + static double signaling_NaN() __STL_NOTHROW; +}; + +__STL_TEMPLATE_NULL class numeric_limits<long double> + : public _Floating_limits<long double, + LDBL_MANT_DIG, // Binary digits of precision + LDBL_DIG, // Decimal digits of precision + LDBL_MIN_EXP, // Minimum exponent + LDBL_MAX_EXP, // Maximum exponent + LDBL_MIN_10_EXP,// Minimum base 10 exponent + LDBL_MAX_10_EXP,// Maximum base 10 exponent + false, // Doesn't conform to iec559 + round_to_nearest> +{ +public: + static long double min() __STL_NOTHROW { return LDBL_MIN; } + static long double denorm_min() __STL_NOTHROW { return LDBL_MIN; } + static long double max() __STL_NOTHROW { return LDBL_MAX; } + static long double epsilon() __STL_NOTHROW { return LDBL_EPSILON; } + static long double round_error() __STL_NOTHROW { return 4; } // Units: ulps. + static long double infinity() __STL_NOTHROW; + static long double quiet_NaN() __STL_NOTHROW; + static long double signaling_NaN() __STL_NOTHROW; +}; + +// We write special values (Inf and NaN) as bit patterns and +// cast the the appropriate floating-point types. + +#if defined(_MIPSEB) +// Big-endian MIPS. float is 32 bits, double 64, long double 128. + +#define _Define_float(__f, __h, __l) \ + inline float numeric_limits<float>::__f() __STL_NOTHROW { \ + static const unsigned short __x[2] = { __h, __l }; \ + return *reinterpret_cast<const float*>(__x); } +#define _Define_double(__f, __h, __l) \ + inline double numeric_limits<double>::__f() __STL_NOTHROW { \ + static const unsigned short __x[4] = { __h, __l }; \ + return *reinterpret_cast<const double*>(__x); } +#define _Define_ldouble(__f, __h, __l) \ + inline long double numeric_limits<long double>::__f() __STL_NOTHROW { \ + static const unsigned short __x[8] = { __h, __l }; \ + return *reinterpret_cast<const long double*>(__x); } + +_Define_float(infinity, 0x7f80, 0) +_Define_float(quiet_NaN, 0x7f81, 0) +_Define_float(signaling_NaN, 0x7fc1, 0) + +_Define_double(infinity, 0x7ff0, 0) +_Define_double(quiet_NaN, 0x7ff1, 0) +_Define_double(signaling_NaN, 0x7ff9, 0) + +_Define_ldouble(infinity, 0x7ff0, 0) +_Define_ldouble(quiet_NaN, 0x7ff1, 0) +_Define_ldouble(signaling_NaN, 0x7ff9, 0) + +#elif defined(__i386) || defined(_M_IX86) +// Little-endian ia32. float is 32 bits, double 64, long double 80. + +#define _Define_float(__f, __h, __l) \ + inline float numeric_limits<float>::__f() __STL_NOTHROW { \ + static const unsigned short __x[2] = { __l, __h }; \ + return *reinterpret_cast<const float*>(__x); } +#define _Define_double(__f, __h, __l) \ + inline double numeric_limits<double>::__f() __STL_NOTHROW { \ + static const unsigned short __x[4] = { 0, 0, __l, __h }; \ + return *reinterpret_cast<const double*>(__x); } +#define _Define_ldouble(__f, __h, __l) \ + inline long double numeric_limits<long double>::__f() __STL_NOTHROW { \ + static const unsigned short __x[5] = { 0, 0, 0, __l, __h }; \ + return *reinterpret_cast<const long double*>(__x); } + +_Define_float(infinity, 0x7f80, 0) +_Define_float(quiet_NaN, 0x7fa0, 0) +_Define_float(signaling_NaN, 0x7fc0, 0) + +_Define_double(infinity, 0x7ff0, 0) +_Define_double(quiet_NaN, 0x7ff4, 0) +_Define_double(signaling_NaN, 0x7ff8, 0) + +_Define_ldouble(infinity, 0x7fff, 0x8000) +_Define_ldouble(quiet_NaN, 0x7fff, 0xa000) +_Define_ldouble(signaling_NaN, 0x7fff, 0xc000) + +#else + +/* This is an architecture we don't know how to handle. Return some + obviously wrong values. */ + +#define _Define_float(__f) \ + inline float numeric_limits<float>::__f() __STL_NOTHROW { \ + return 0; } +#define _Define_double(__f) \ + inline double numeric_limits<double>::__f() __STL_NOTHROW { \ + return 0; } +#define _Define_ldouble(__f) \ + inline long double numeric_limits<long double>::__f() __STL_NOTHROW { \ + return 0; } + +_Define_float(infinity) +_Define_float(quiet_NaN) +_Define_float(signaling_NaN) + +_Define_double(infinity) +_Define_double(quiet_NaN) +_Define_double(signaling_NaN) + +_Define_ldouble(infinity) +_Define_ldouble(quiet_NaN) +_Define_ldouble(signaling_NaN) + +#endif + +#undef _Define_float +#undef _Define_double +#undef _Define_ldouble + +__STL_END_NAMESPACE + +#endif /* __SGI_CPP_LIMITS */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/list b/dtm_release/local/include/stl/list new file mode 100644 index 0000000000000000000000000000000000000000..5294f39fea69f21431adaa99d40ed9e91c8db4e6 --- /dev/null +++ b/dtm_release/local/include/stl/list @@ -0,0 +1,40 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_LIST +#define __SGI_STL_LIST + +#include <stl_algobase.h> +#include <stl_alloc.h> +#include <stl_construct.h> +#include <stl_uninitialized.h> +#include <stl_list.h> + +#endif /* __SGI_STL_LIST */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/list.h b/dtm_release/local/include/stl/list.h new file mode 100644 index 0000000000000000000000000000000000000000..4e6ee0b4113b29adea95ed99844373e4d4f2d259 --- /dev/null +++ b/dtm_release/local/include/stl/list.h @@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_LIST_H +#define __SGI_STL_LIST_H + +#include <algobase.h> +#include <alloc.h> +#include <stl_list.h> + +#ifdef __STL_USE_NAMESPACES +using __STD::list; +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_LIST_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/map b/dtm_release/local/include/stl/map new file mode 100644 index 0000000000000000000000000000000000000000..4cfb7652c54551d8f7152f88bfe17d16b564a78a --- /dev/null +++ b/dtm_release/local/include/stl/map @@ -0,0 +1,40 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_MAP +#define __SGI_STL_MAP + +#ifndef __SGI_STL_INTERNAL_TREE_H +#include <stl_tree.h> +#endif +#include <stl_map.h> +#include <stl_multimap.h> + +#endif /* __SGI_STL_MAP */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/map.h b/dtm_release/local/include/stl/map.h new file mode 100644 index 0000000000000000000000000000000000000000..902f66e544afc70d414c82dcaf552801c3aa90b3 --- /dev/null +++ b/dtm_release/local/include/stl/map.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_MAP_H +#define __SGI_STL_MAP_H + +#ifndef __SGI_STL_INTERNAL_TREE_H +#include <stl_tree.h> +#endif +#include <algobase.h> +#include <alloc.h> +#include <stl_map.h> + +#ifdef __STL_USE_NAMESPACES +using __STD::rb_tree; +using __STD::map; +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_MAP_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/memory b/dtm_release/local/include/stl/memory new file mode 100644 index 0000000000000000000000000000000000000000..a1b096ce21b227b2882e253c3cdf303a54d2a619 --- /dev/null +++ b/dtm_release/local/include/stl/memory @@ -0,0 +1,134 @@ +/* + * Copyright (c) 1997-1999 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +#ifndef __SGI_STL_MEMORY +#define __SGI_STL_MEMORY + +#include <stl_algobase.h> +#include <stl_alloc.h> +#include <stl_construct.h> +#include <stl_tempbuf.h> +#include <stl_uninitialized.h> +#include <stl_raw_storage_iter.h> + + +__STL_BEGIN_NAMESPACE + +#if defined(__SGI_STL_USE_AUTO_PTR_CONVERSIONS) && \ + defined(__STL_MEMBER_TEMPLATES) + +template<class _Tp1> struct auto_ptr_ref { + _Tp1* _M_ptr; + auto_ptr_ref(_Tp1* __p) : _M_ptr(__p) {} +}; + +#endif + +template <class _Tp> class auto_ptr { +private: + _Tp* _M_ptr; + +public: + typedef _Tp element_type; + + explicit auto_ptr(_Tp* __p = 0) __STL_NOTHROW : _M_ptr(__p) {} + auto_ptr(auto_ptr& __a) __STL_NOTHROW : _M_ptr(__a.release()) {} + +#ifdef __STL_MEMBER_TEMPLATES + template <class _Tp1> auto_ptr(auto_ptr<_Tp1>& __a) __STL_NOTHROW + : _M_ptr(__a.release()) {} +#endif /* __STL_MEMBER_TEMPLATES */ + + auto_ptr& operator=(auto_ptr& __a) __STL_NOTHROW { + if (&__a != this) { + delete _M_ptr; + _M_ptr = __a.release(); + } + return *this; + } + +#ifdef __STL_MEMBER_TEMPLATES + template <class _Tp1> + auto_ptr& operator=(auto_ptr<_Tp1>& __a) __STL_NOTHROW { + if (__a.get() != this->get()) { + delete _M_ptr; + _M_ptr = __a.release(); + } + return *this; + } +#endif /* __STL_MEMBER_TEMPLATES */ + + // Note: The C++ standard says there is supposed to be an empty throw + // specification here, but omitting it is standard conforming. Its + // presence can be detected only if _Tp::~_Tp() throws, but (17.4.3.6/2) + // this is prohibited. + ~auto_ptr() { delete _M_ptr; } + + _Tp& operator*() const __STL_NOTHROW { + return *_M_ptr; + } + _Tp* operator->() const __STL_NOTHROW { + return _M_ptr; + } + _Tp* get() const __STL_NOTHROW { + return _M_ptr; + } + _Tp* release() __STL_NOTHROW { + _Tp* __tmp = _M_ptr; + _M_ptr = 0; + return __tmp; + } + void reset(_Tp* __p = 0) __STL_NOTHROW { + if (__p != _M_ptr) { + delete _M_ptr; + _M_ptr = __p; + } + } + + // According to the C++ standard, these conversions are required. Most + // present-day compilers, however, do not enforce that requirement---and, + // in fact, most present-day compilers do not support the language + // features that these conversions rely on. + +#if defined(__SGI_STL_USE_AUTO_PTR_CONVERSIONS) && \ + defined(__STL_MEMBER_TEMPLATES) + +public: + auto_ptr(auto_ptr_ref<_Tp> __ref) __STL_NOTHROW + : _M_ptr(__ref._M_ptr) {} + + auto_ptr& operator=(auto_ptr_ref<_Tp> __ref) __STL_NOTHROW { + if (__ref._M_ptr != this->get()) { + delete _M_ptr; + _M_ptr = __ref._M_ptr; + } + return *this; + } + + template <class _Tp1> operator auto_ptr_ref<_Tp1>() __STL_NOTHROW + { return auto_ptr_ref<_Tp1>(this->release()); } + template <class _Tp1> operator auto_ptr<_Tp1>() __STL_NOTHROW + { return auto_ptr<_Tp1>(this->release()); } + +#endif /* auto ptr conversions && member templates */ +}; + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_MEMORY */ + + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/multimap.h b/dtm_release/local/include/stl/multimap.h new file mode 100644 index 0000000000000000000000000000000000000000..44b26bee549066047a5968a3a32607de4a43a0e0 --- /dev/null +++ b/dtm_release/local/include/stl/multimap.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_MULTIMAP_H +#define __SGI_STL_MULTIMAP_H + +#ifndef __SGI_STL_INTERNAL_TREE_H +#include <stl_tree.h> +#endif +#include <algobase.h> +#include <alloc.h> +#include <stl_multimap.h> + +#ifdef __STL_USE_NAMESPACES +using __STD::rb_tree; +using __STD::multimap; +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_MULTIMAP_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/multiset.h b/dtm_release/local/include/stl/multiset.h new file mode 100644 index 0000000000000000000000000000000000000000..91f0379d1779a02eb1e84b4f9657f4c902ad4da4 --- /dev/null +++ b/dtm_release/local/include/stl/multiset.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_MULTISET_H +#define __SGI_STL_MULTISET_H + +#ifndef __SGI_STL_INTERNAL_TREE_H +#include <stl_tree.h> +#endif +#include <algobase.h> +#include <alloc.h> +#include <stl_multiset.h> + +#ifdef __STL_USE_NAMESPACES +using __STD::rb_tree; +using __STD::multiset; +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_MULTISET_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/numeric b/dtm_release/local/include/stl/numeric new file mode 100644 index 0000000000000000000000000000000000000000..98e3237defc88aca50d3ec898a910c35a9b3dca0 --- /dev/null +++ b/dtm_release/local/include/stl/numeric @@ -0,0 +1,49 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_NUMERIC +#define __SGI_STL_NUMERIC + +#include <stl_config.h> +#include <stl_relops.h> +#include <stddef.h> + +#ifdef __STL_USE_NEW_IOSTREAMS +#include <iostream> +#else /* __STL_USE_NEW_IOSTREAMS */ +#include <iostream.h> +#endif /* __STL_USE_NEW_IOSTREAMS */ + +#include <stl_iterator_base.h> +#include <stl_iterator.h> +#include <stl_function.h> +#include <stl_numeric.h> + +#endif /* __SGI_STL_NUMERIC */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/pair.h b/dtm_release/local/include/stl/pair.h new file mode 100644 index 0000000000000000000000000000000000000000..00f5caddb61418b8f93bf2c0e34d27e23c6efe35 --- /dev/null +++ b/dtm_release/local/include/stl/pair.h @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_PAIR_H +#define __SGI_STL_PAIR_H + +#ifndef __STL_CONFIG_H +#include <stl_config.h> +#endif +#ifndef __SGI_STL_INTERNAL_RELOPS +#include <stl_relops.h> +#endif +#ifndef __SGI_STL_INTERNAL_PAIR_H +#include <stl_pair.h> +#endif + +#ifdef __STL_USE_NAMESPACES + +using __STD::pair; +using __STD::make_pair; + +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_PAIR_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/pthread_alloc b/dtm_release/local/include/stl/pthread_alloc new file mode 100644 index 0000000000000000000000000000000000000000..33073da580689ca8fac2f42d7103c35df09e5fe9 --- /dev/null +++ b/dtm_release/local/include/stl/pthread_alloc @@ -0,0 +1,495 @@ +/* + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_PTHREAD_ALLOC +#define __SGI_STL_PTHREAD_ALLOC + +// Pthread-specific node allocator. +// This is similar to the default allocator, except that free-list +// information is kept separately for each thread, avoiding locking. +// This should be reasonably fast even in the presence of threads. +// The down side is that storage may not be well-utilized. +// It is not an error to allocate memory in thread A and deallocate +// it in thread B. But this effectively transfers ownership of the memory, +// so that it can only be reallocated by thread B. Thus this can effectively +// result in a storage leak if it's done on a regular basis. +// It can also result in frequent sharing of +// cache lines among processors, with potentially serious performance +// consequences. + +#include <errno.h> +#include <stl_config.h> +#include <stl_alloc.h> +#ifndef __RESTRICT +# define __RESTRICT +#endif + +#ifndef __STL_NO_BAD_ALLOC +# include <new> +#endif + +__STL_BEGIN_NAMESPACE + +#define __STL_DATA_ALIGNMENT 8 + +union _Pthread_alloc_obj { + union _Pthread_alloc_obj * __free_list_link; + char __client_data[__STL_DATA_ALIGNMENT]; /* The client sees this. */ +}; + +// Pthread allocators don't appear to the client to have meaningful +// instances. We do in fact need to associate some state with each +// thread. That state is represented by +// _Pthread_alloc_per_thread_state<_Max_size>. + +template<size_t _Max_size> +struct _Pthread_alloc_per_thread_state { + typedef _Pthread_alloc_obj __obj; + enum { _S_NFREELISTS = _Max_size/__STL_DATA_ALIGNMENT }; + _Pthread_alloc_obj* volatile __free_list[_S_NFREELISTS]; + _Pthread_alloc_per_thread_state<_Max_size> * __next; + // Free list link for list of available per thread structures. + // When one of these becomes available for reuse due to thread + // termination, any objects in its free list remain associated + // with it. The whole structure may then be used by a newly + // created thread. + _Pthread_alloc_per_thread_state() : __next(0) + { + memset((void *)__free_list, 0, (size_t) _S_NFREELISTS * sizeof(__obj *)); + } + // Returns an object of size __n, and possibly adds to size n free list. + void *_M_refill(size_t __n); +}; + +// Pthread-specific allocator. +// The argument specifies the largest object size allocated from per-thread +// free lists. Larger objects are allocated using malloc_alloc. +// Max_size must be a power of 2. +template <size_t _Max_size = 128> +class _Pthread_alloc_template { + +public: // but only for internal use: + + typedef _Pthread_alloc_obj __obj; + + // Allocates a chunk for nobjs of size size. nobjs may be reduced + // if it is inconvenient to allocate the requested number. + static char *_S_chunk_alloc(size_t __size, int &__nobjs); + + enum {_S_ALIGN = __STL_DATA_ALIGNMENT}; + + static size_t _S_round_up(size_t __bytes) { + return (((__bytes) + (int) _S_ALIGN-1) & ~((int) _S_ALIGN - 1)); + } + static size_t _S_freelist_index(size_t __bytes) { + return (((__bytes) + (int) _S_ALIGN-1)/(int)_S_ALIGN - 1); + } + +private: + // Chunk allocation state. And other shared state. + // Protected by _S_chunk_allocator_lock. + static pthread_mutex_t _S_chunk_allocator_lock; + static char *_S_start_free; + static char *_S_end_free; + static size_t _S_heap_size; + static _Pthread_alloc_per_thread_state<_Max_size>* _S_free_per_thread_states; + static pthread_key_t _S_key; + static bool _S_key_initialized; + // Pthread key under which per thread state is stored. + // Allocator instances that are currently unclaimed by any thread. + static void _S_destructor(void *instance); + // Function to be called on thread exit to reclaim per thread + // state. + static _Pthread_alloc_per_thread_state<_Max_size> *_S_new_per_thread_state(); + // Return a recycled or new per thread state. + static _Pthread_alloc_per_thread_state<_Max_size> *_S_get_per_thread_state(); + // ensure that the current thread has an associated + // per thread state. + class _M_lock; + friend class _M_lock; + class _M_lock { + public: + _M_lock () { pthread_mutex_lock(&_S_chunk_allocator_lock); } + ~_M_lock () { pthread_mutex_unlock(&_S_chunk_allocator_lock); } + }; + +public: + + /* n must be > 0 */ + static void * allocate(size_t __n) + { + __obj * volatile * __my_free_list; + __obj * __RESTRICT __result; + _Pthread_alloc_per_thread_state<_Max_size>* __a; + + if (__n > _Max_size) { + return(malloc_alloc::allocate(__n)); + } + if (!_S_key_initialized || + !(__a = (_Pthread_alloc_per_thread_state<_Max_size>*) + pthread_getspecific(_S_key))) { + __a = _S_get_per_thread_state(); + } + __my_free_list = __a -> __free_list + _S_freelist_index(__n); + __result = *__my_free_list; + if (__result == 0) { + void *__r = __a -> _M_refill(_S_round_up(__n)); + return __r; + } + *__my_free_list = __result -> __free_list_link; + return (__result); + }; + + /* p may not be 0 */ + static void deallocate(void *__p, size_t __n) + { + __obj *__q = (__obj *)__p; + __obj * volatile * __my_free_list; + _Pthread_alloc_per_thread_state<_Max_size>* __a; + + if (__n > _Max_size) { + malloc_alloc::deallocate(__p, __n); + return; + } + if (!_S_key_initialized || + !(__a = (_Pthread_alloc_per_thread_state<_Max_size> *) + pthread_getspecific(_S_key))) { + __a = _S_get_per_thread_state(); + } + __my_free_list = __a->__free_list + _S_freelist_index(__n); + __q -> __free_list_link = *__my_free_list; + *__my_free_list = __q; + } + + static void * reallocate(void *__p, size_t __old_sz, size_t __new_sz); + +} ; + +typedef _Pthread_alloc_template<> pthread_alloc; + + +template <size_t _Max_size> +void _Pthread_alloc_template<_Max_size>::_S_destructor(void * __instance) +{ + _M_lock __lock_instance; // Need to acquire lock here. + _Pthread_alloc_per_thread_state<_Max_size>* __s = + (_Pthread_alloc_per_thread_state<_Max_size> *)__instance; + __s -> __next = _S_free_per_thread_states; + _S_free_per_thread_states = __s; +} + +template <size_t _Max_size> +_Pthread_alloc_per_thread_state<_Max_size> * +_Pthread_alloc_template<_Max_size>::_S_new_per_thread_state() +{ + /* lock already held here. */ + if (0 != _S_free_per_thread_states) { + _Pthread_alloc_per_thread_state<_Max_size> *__result = + _S_free_per_thread_states; + _S_free_per_thread_states = _S_free_per_thread_states -> __next; + return __result; + } else { + return new _Pthread_alloc_per_thread_state<_Max_size>; + } +} + +template <size_t _Max_size> +_Pthread_alloc_per_thread_state<_Max_size> * +_Pthread_alloc_template<_Max_size>::_S_get_per_thread_state() +{ + /*REFERENCED*/ + _M_lock __lock_instance; // Need to acquire lock here. + int __ret_code; + _Pthread_alloc_per_thread_state<_Max_size> * __result; + if (!_S_key_initialized) { + if (pthread_key_create(&_S_key, _S_destructor)) { + __THROW_BAD_ALLOC; // defined in stl_alloc.h + } + _S_key_initialized = true; + } + __result = _S_new_per_thread_state(); + __ret_code = pthread_setspecific(_S_key, __result); + if (__ret_code) { + if (__ret_code == ENOMEM) { + __THROW_BAD_ALLOC; + } else { + // EINVAL + abort(); + } + } + return __result; +} + +/* We allocate memory in large chunks in order to avoid fragmenting */ +/* the malloc heap too much. */ +/* We assume that size is properly aligned. */ +template <size_t _Max_size> +char *_Pthread_alloc_template<_Max_size> +::_S_chunk_alloc(size_t __size, int &__nobjs) +{ + { + char * __result; + size_t __total_bytes; + size_t __bytes_left; + /*REFERENCED*/ + _M_lock __lock_instance; // Acquire lock for this routine + + __total_bytes = __size * __nobjs; + __bytes_left = _S_end_free - _S_start_free; + if (__bytes_left >= __total_bytes) { + __result = _S_start_free; + _S_start_free += __total_bytes; + return(__result); + } else if (__bytes_left >= __size) { + __nobjs = __bytes_left/__size; + __total_bytes = __size * __nobjs; + __result = _S_start_free; + _S_start_free += __total_bytes; + return(__result); + } else { + size_t __bytes_to_get = + 2 * __total_bytes + _S_round_up(_S_heap_size >> 4); + // Try to make use of the left-over piece. + if (__bytes_left > 0) { + _Pthread_alloc_per_thread_state<_Max_size>* __a = + (_Pthread_alloc_per_thread_state<_Max_size>*) + pthread_getspecific(_S_key); + __obj * volatile * __my_free_list = + __a->__free_list + _S_freelist_index(__bytes_left); + + ((__obj *)_S_start_free) -> __free_list_link = *__my_free_list; + *__my_free_list = (__obj *)_S_start_free; + } +# ifdef _SGI_SOURCE + // Try to get memory that's aligned on something like a + // cache line boundary, so as to avoid parceling out + // parts of the same line to different threads and thus + // possibly different processors. + { + const int __cache_line_size = 128; // probable upper bound + __bytes_to_get &= ~(__cache_line_size-1); + _S_start_free = (char *)memalign(__cache_line_size, __bytes_to_get); + if (0 == _S_start_free) { + _S_start_free = (char *)malloc_alloc::allocate(__bytes_to_get); + } + } +# else /* !SGI_SOURCE */ + _S_start_free = (char *)malloc_alloc::allocate(__bytes_to_get); +# endif + _S_heap_size += __bytes_to_get; + _S_end_free = _S_start_free + __bytes_to_get; + } + } + // lock is released here + return(_S_chunk_alloc(__size, __nobjs)); +} + + +/* Returns an object of size n, and optionally adds to size n free list.*/ +/* We assume that n is properly aligned. */ +/* We hold the allocation lock. */ +template <size_t _Max_size> +void *_Pthread_alloc_per_thread_state<_Max_size> +::_M_refill(size_t __n) +{ + int __nobjs = 128; + char * __chunk = + _Pthread_alloc_template<_Max_size>::_S_chunk_alloc(__n, __nobjs); + __obj * volatile * __my_free_list; + __obj * __result; + __obj * __current_obj, * __next_obj; + int __i; + + if (1 == __nobjs) { + return(__chunk); + } + __my_free_list = __free_list + + _Pthread_alloc_template<_Max_size>::_S_freelist_index(__n); + + /* Build free list in chunk */ + __result = (__obj *)__chunk; + *__my_free_list = __next_obj = (__obj *)(__chunk + __n); + for (__i = 1; ; __i++) { + __current_obj = __next_obj; + __next_obj = (__obj *)((char *)__next_obj + __n); + if (__nobjs - 1 == __i) { + __current_obj -> __free_list_link = 0; + break; + } else { + __current_obj -> __free_list_link = __next_obj; + } + } + return(__result); +} + +template <size_t _Max_size> +void *_Pthread_alloc_template<_Max_size> +::reallocate(void *__p, size_t __old_sz, size_t __new_sz) +{ + void * __result; + size_t __copy_sz; + + if (__old_sz > _Max_size + && __new_sz > _Max_size) { + return(realloc(__p, __new_sz)); + } + if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return(__p); + __result = allocate(__new_sz); + __copy_sz = __new_sz > __old_sz? __old_sz : __new_sz; + memcpy(__result, __p, __copy_sz); + deallocate(__p, __old_sz); + return(__result); +} + +template <size_t _Max_size> +_Pthread_alloc_per_thread_state<_Max_size> * +_Pthread_alloc_template<_Max_size>::_S_free_per_thread_states = 0; + +template <size_t _Max_size> +pthread_key_t _Pthread_alloc_template<_Max_size>::_S_key; + +template <size_t _Max_size> +bool _Pthread_alloc_template<_Max_size>::_S_key_initialized = false; + +template <size_t _Max_size> +pthread_mutex_t _Pthread_alloc_template<_Max_size>::_S_chunk_allocator_lock += PTHREAD_MUTEX_INITIALIZER; + +template <size_t _Max_size> +char *_Pthread_alloc_template<_Max_size> +::_S_start_free = 0; + +template <size_t _Max_size> +char *_Pthread_alloc_template<_Max_size> +::_S_end_free = 0; + +template <size_t _Max_size> +size_t _Pthread_alloc_template<_Max_size> +::_S_heap_size = 0; + +#ifdef __STL_USE_STD_ALLOCATORS + +template <class _Tp> +class pthread_allocator { + typedef pthread_alloc _S_Alloc; // The underlying allocator. +public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Tp* pointer; + typedef const _Tp* const_pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + typedef _Tp value_type; + + template <class _NewType> struct rebind { + typedef pthread_allocator<_NewType> other; + }; + + pthread_allocator() __STL_NOTHROW {} + pthread_allocator(const pthread_allocator& a) __STL_NOTHROW {} + template <class _OtherType> + pthread_allocator(const pthread_allocator<_OtherType>&) + __STL_NOTHROW {} + ~pthread_allocator() __STL_NOTHROW {} + + pointer address(reference __x) const { return &__x; } + const_pointer address(const_reference __x) const { return &__x; } + + // __n is permitted to be 0. The C++ standard says nothing about what + // the return value is when __n == 0. + _Tp* allocate(size_type __n, const void* = 0) { + return __n != 0 ? static_cast<_Tp*>(_S_Alloc::allocate(__n * sizeof(_Tp))) + : 0; + } + + // p is not permitted to be a null pointer. + void deallocate(pointer __p, size_type __n) + { _S_Alloc::deallocate(__p, __n * sizeof(_Tp)); } + + size_type max_size() const __STL_NOTHROW + { return size_t(-1) / sizeof(_Tp); } + + void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); } + void destroy(pointer _p) { _p->~_Tp(); } +}; + +template<> +class pthread_allocator<void> { +public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef void* pointer; + typedef const void* const_pointer; + typedef void value_type; + + template <class _NewType> struct rebind { + typedef pthread_allocator<_NewType> other; + }; +}; + +template <size_t _Max_size> +inline bool operator==(const _Pthread_alloc_template<_Max_size>&, + const _Pthread_alloc_template<_Max_size>&) +{ + return true; +} + +template <class _T1, class _T2> +inline bool operator==(const pthread_allocator<_T1>&, + const pthread_allocator<_T2>& a2) +{ + return true; +} + +template <class _T1, class _T2> +inline bool operator!=(const pthread_allocator<_T1>&, + const pthread_allocator<_T2>&) +{ + return false; +} + +template <class _Tp, size_t _Max_size> +struct _Alloc_traits<_Tp, _Pthread_alloc_template<_Max_size> > +{ + static const bool _S_instanceless = true; + typedef simple_alloc<_Tp, _Pthread_alloc_template<_Max_size> > _Alloc_type; + typedef __allocator<_Tp, _Pthread_alloc_template<_Max_size> > + allocator_type; +}; + +template <class _Tp, class _Atype, size_t _Max> +struct _Alloc_traits<_Tp, __allocator<_Atype, _Pthread_alloc_template<_Max> > > +{ + static const bool _S_instanceless = true; + typedef simple_alloc<_Tp, _Pthread_alloc_template<_Max> > _Alloc_type; + typedef __allocator<_Tp, _Pthread_alloc_template<_Max> > allocator_type; +}; + +template <class _Tp, class _Atype> +struct _Alloc_traits<_Tp, pthread_allocator<_Atype> > +{ + static const bool _S_instanceless = true; + typedef simple_alloc<_Tp, _Pthread_alloc_template<> > _Alloc_type; + typedef pthread_allocator<_Tp> allocator_type; +}; + + +#endif /* __STL_USE_STD_ALLOCATORS */ + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_PTHREAD_ALLOC */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/pthread_alloc.h b/dtm_release/local/include/stl/pthread_alloc.h new file mode 100644 index 0000000000000000000000000000000000000000..774ef04edc828c3cb32a9e240d1552be85d7eee2 --- /dev/null +++ b/dtm_release/local/include/stl/pthread_alloc.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 1996-1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_PTHREAD_ALLOC_H +#define __SGI_STL_PTHREAD_ALLOC_H + +#include <pthread_alloc> + +#ifdef __STL_USE_NAMESPACES + +using __STD::_Pthread_alloc_template; +using __STD::pthread_alloc; + +#endif /* __STL_USE_NAMESPACES */ + + +#endif /* __SGI_STL_PTHREAD_ALLOC_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/queue b/dtm_release/local/include/stl/queue new file mode 100644 index 0000000000000000000000000000000000000000..f9417fb1fbb6231b5a665193c3bdb97994473341 --- /dev/null +++ b/dtm_release/local/include/stl/queue @@ -0,0 +1,45 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_QUEUE +#define __SGI_STL_QUEUE + +#include <stl_algobase.h> +#include <stl_alloc.h> +#include <stl_construct.h> +#include <stl_uninitialized.h> +#include <stl_vector.h> +#include <stl_bvector.h> +#include <stl_heap.h> +#include <stl_deque.h> +#include <stl_function.h> +#include <stl_queue.h> + +#endif /* __SGI_STL_QUEUE */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/rope b/dtm_release/local/include/stl/rope new file mode 100644 index 0000000000000000000000000000000000000000..f861500000b571c6b19d10d1119a2e61446ba661 --- /dev/null +++ b/dtm_release/local/include/stl/rope @@ -0,0 +1,32 @@ +/* + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_ROPE +#define __SGI_STL_ROPE + +#include <stl_algobase.h> +#include <stl_tempbuf.h> +#include <stl_algo.h> +#include <stl_function.h> +#include <stl_numeric.h> +#include <stl_alloc.h> +#include <stl_construct.h> +#include <stl_uninitialized.h> +#include <stl_hash_fun.h> +#include <stl_rope.h> + +#endif /* __SGI_STL_ROPE */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/rope.h b/dtm_release/local/include/stl/rope.h new file mode 100644 index 0000000000000000000000000000000000000000..d767fa32e7a2e69027a9e9aab6260bbbd32c55fa --- /dev/null +++ b/dtm_release/local/include/stl/rope.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_ROPE_H +#define __SGI_STL_ROPE_H + +#include <hashtable.h> +#include <stl_rope.h> + +#ifdef __STL_USE_NAMESPACES + +using __STD::char_producer; +using __STD::sequence_buffer; +using __STD::rope; +using __STD::crope; +using __STD::wrope; + +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_ROPE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/ropeimpl.h b/dtm_release/local/include/stl/ropeimpl.h new file mode 100644 index 0000000000000000000000000000000000000000..e847ecdb4ac93b8d1b0b87d66760bc3efd3c1d8d --- /dev/null +++ b/dtm_release/local/include/stl/ropeimpl.h @@ -0,0 +1,1587 @@ +/* + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +# include <stdio.h> + +#ifdef __STL_USE_NEW_IOSTREAMS +# include <iostream> +#else /* __STL_USE_NEW_IOSTREAMS */ +# include <iostream.h> +#endif /* __STL_USE_NEW_IOSTREAMS */ + +#ifdef __STL_USE_EXCEPTIONS +# include <stdexcept> +#endif + +__STL_BEGIN_NAMESPACE + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1174 +#endif + +// Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf +// if necessary. Assumes _M_path_end[leaf_index] and leaf_pos are correct. +// Results in a valid buf_ptr if the iterator can be legitimately +// dereferenced. +template <class _CharT, class _Alloc> +void _Rope_iterator_base<_CharT,_Alloc>::_S_setbuf( + _Rope_iterator_base<_CharT,_Alloc>& __x) +{ + const _RopeRep* __leaf = __x._M_path_end[__x._M_leaf_index]; + size_t __leaf_pos = __x._M_leaf_pos; + size_t __pos = __x._M_current_pos; + + switch(__leaf->_M_tag) { + case _RopeRep::_S_leaf: + __x._M_buf_start = + ((_Rope_RopeLeaf<_CharT,_Alloc>*)__leaf)->_M_data; + __x._M_buf_ptr = __x._M_buf_start + (__pos - __leaf_pos); + __x._M_buf_end = __x._M_buf_start + __leaf->_M_size; + break; + case _RopeRep::_S_function: + case _RopeRep::_S_substringfn: + { + size_t __len = _S_iterator_buf_len; + size_t __buf_start_pos = __leaf_pos; + size_t __leaf_end = __leaf_pos + __leaf->_M_size; + char_producer<_CharT>* __fn = + ((_Rope_RopeFunction<_CharT,_Alloc>*)__leaf)->_M_fn; + + if (__buf_start_pos + __len <= __pos) { + __buf_start_pos = __pos - __len/4; + if (__buf_start_pos + __len > __leaf_end) { + __buf_start_pos = __leaf_end - __len; + } + } + if (__buf_start_pos + __len > __leaf_end) { + __len = __leaf_end - __buf_start_pos; + } + (*__fn)(__buf_start_pos - __leaf_pos, __len, __x._M_tmp_buf); + __x._M_buf_ptr = __x._M_tmp_buf + (__pos - __buf_start_pos); + __x._M_buf_start = __x._M_tmp_buf; + __x._M_buf_end = __x._M_tmp_buf + __len; + } + break; + default: + __stl_assert(0); + } +} + +// Set path and buffer inside a rope iterator. We assume that +// pos and root are already set. +template <class _CharT, class _Alloc> +void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache +(_Rope_iterator_base<_CharT,_Alloc>& __x) +{ + const _RopeRep* __path[_RopeRep::_S_max_rope_depth+1]; + const _RopeRep* __curr_rope; + int __curr_depth = -1; /* index into path */ + size_t __curr_start_pos = 0; + size_t __pos = __x._M_current_pos; + unsigned char __dirns = 0; // Bit vector marking right turns in the path + + __stl_assert(__pos <= __x._M_root->_M_size); + if (__pos >= __x._M_root->_M_size) { + __x._M_buf_ptr = 0; + return; + } + __curr_rope = __x._M_root; + if (0 != __curr_rope->_M_c_string) { + /* Treat the root as a leaf. */ + __x._M_buf_start = __curr_rope->_M_c_string; + __x._M_buf_end = __curr_rope->_M_c_string + __curr_rope->_M_size; + __x._M_buf_ptr = __curr_rope->_M_c_string + __pos; + __x._M_path_end[0] = __curr_rope; + __x._M_leaf_index = 0; + __x._M_leaf_pos = 0; + return; + } + for(;;) { + ++__curr_depth; + __stl_assert(__curr_depth <= _RopeRep::_S_max_rope_depth); + __path[__curr_depth] = __curr_rope; + switch(__curr_rope->_M_tag) { + case _RopeRep::_S_leaf: + case _RopeRep::_S_function: + case _RopeRep::_S_substringfn: + __x._M_leaf_pos = __curr_start_pos; + goto done; + case _RopeRep::_S_concat: + { + _Rope_RopeConcatenation<_CharT,_Alloc>* __c = + (_Rope_RopeConcatenation<_CharT,_Alloc>*)__curr_rope; + _RopeRep* __left = __c->_M_left; + size_t __left_len = __left->_M_size; + + __dirns <<= 1; + if (__pos >= __curr_start_pos + __left_len) { + __dirns |= 1; + __curr_rope = __c->_M_right; + __curr_start_pos += __left_len; + } else { + __curr_rope = __left; + } + } + break; + } + } + done: + // Copy last section of path into _M_path_end. + { + int __i = -1; + int __j = __curr_depth + 1 - _S_path_cache_len; + + if (__j < 0) __j = 0; + while (__j <= __curr_depth) { + __x._M_path_end[++__i] = __path[__j++]; + } + __x._M_leaf_index = __i; + } + __x._M_path_directions = __dirns; + _S_setbuf(__x); +} + +// Specialized version of the above. Assumes that +// the path cache is valid for the previous position. +template <class _CharT, class _Alloc> +void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache_for_incr +(_Rope_iterator_base<_CharT,_Alloc>& __x) +{ + int __current_index = __x._M_leaf_index; + const _RopeRep* __current_node = __x._M_path_end[__current_index]; + size_t __len = __current_node->_M_size; + size_t __node_start_pos = __x._M_leaf_pos; + unsigned char __dirns = __x._M_path_directions; + _Rope_RopeConcatenation<_CharT,_Alloc>* __c; + + __stl_assert(__x._M_current_pos <= __x._M_root->_M_size); + if (__x._M_current_pos - __node_start_pos < __len) { + /* More stuff in this leaf, we just didn't cache it. */ + _S_setbuf(__x); + return; + } + __stl_assert(__node_start_pos + __len == __x._M_current_pos); + // node_start_pos is starting position of last_node. + while (--__current_index >= 0) { + if (!(__dirns & 1) /* Path turned left */) + break; + __current_node = __x._M_path_end[__current_index]; + __c = (_Rope_RopeConcatenation<_CharT,_Alloc>*)__current_node; + // Otherwise we were in the right child. Thus we should pop + // the concatenation node. + __node_start_pos -= __c->_M_left->_M_size; + __dirns >>= 1; + } + if (__current_index < 0) { + // We underflowed the cache. Punt. + _S_setcache(__x); + return; + } + __current_node = __x._M_path_end[__current_index]; + __c = (_Rope_RopeConcatenation<_CharT,_Alloc>*)__current_node; + // current_node is a concatenation node. We are positioned on the first + // character in its right child. + // node_start_pos is starting position of current_node. + __node_start_pos += __c->_M_left->_M_size; + __current_node = __c->_M_right; + __x._M_path_end[++__current_index] = __current_node; + __dirns |= 1; + while (_RopeRep::_S_concat == __current_node->_M_tag) { + ++__current_index; + if (_S_path_cache_len == __current_index) { + int __i; + for (__i = 0; __i < _S_path_cache_len-1; __i++) { + __x._M_path_end[__i] = __x._M_path_end[__i+1]; + } + --__current_index; + } + __current_node = + ((_Rope_RopeConcatenation<_CharT,_Alloc>*)__current_node)->_M_left; + __x._M_path_end[__current_index] = __current_node; + __dirns <<= 1; + // node_start_pos is unchanged. + } + __x._M_leaf_index = __current_index; + __x._M_leaf_pos = __node_start_pos; + __x._M_path_directions = __dirns; + _S_setbuf(__x); +} + +template <class _CharT, class _Alloc> +void _Rope_iterator_base<_CharT,_Alloc>::_M_incr(size_t __n) { + _M_current_pos += __n; + if (0 != _M_buf_ptr) { + size_t __chars_left = _M_buf_end - _M_buf_ptr; + if (__chars_left > __n) { + _M_buf_ptr += __n; + } else if (__chars_left == __n) { + _M_buf_ptr += __n; + _S_setcache_for_incr(*this); + } else { + _M_buf_ptr = 0; + } + } +} + +template <class _CharT, class _Alloc> +void _Rope_iterator_base<_CharT,_Alloc>::_M_decr(size_t __n) { + if (0 != _M_buf_ptr) { + size_t __chars_left = _M_buf_ptr - _M_buf_start; + if (__chars_left >= __n) { + _M_buf_ptr -= __n; + } else { + _M_buf_ptr = 0; + } + } + _M_current_pos -= __n; +} + +template <class _CharT, class _Alloc> +void _Rope_iterator<_CharT,_Alloc>::_M_check() { + if (_M_root_rope->_M_tree_ptr != _M_root) { + // _Rope was modified. Get things fixed up. + _RopeRep::_S_unref(_M_root); + _M_root = _M_root_rope->_M_tree_ptr; + _RopeRep::_S_ref(_M_root); + _M_buf_ptr = 0; + } +} + +template <class _CharT, class _Alloc> +inline +_Rope_const_iterator<_CharT, _Alloc>::_Rope_const_iterator( + const _Rope_iterator<_CharT,_Alloc>& __x) +: _Rope_iterator_base<_CharT,_Alloc>(__x) +{ } + +template <class _CharT, class _Alloc> +inline _Rope_iterator<_CharT,_Alloc>::_Rope_iterator( + rope<_CharT,_Alloc>& __r, size_t __pos) +: _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos), + _M_root_rope(&__r) +{ + _RopeRep::_S_ref(_M_root); +} + +template <class _CharT, class _Alloc> +inline size_t +rope<_CharT,_Alloc>::_S_char_ptr_len(const _CharT* __s) +{ + const _CharT* __p = __s; + + while (!_S_is0(*__p)) { ++__p; } + return (__p - __s); +} + + +#ifndef __GC + +template <class _CharT, class _Alloc> +inline void _Rope_RopeRep<_CharT,_Alloc>::_M_free_c_string() +{ + _CharT* __cstr = _M_c_string; + if (0 != __cstr) { + size_t __size = _M_size + 1; + destroy(__cstr, __cstr + __size); + _Data_deallocate(__cstr, __size); + } +} + + +template <class _CharT, class _Alloc> +#ifdef __STL_USE_STD_ALLOCATORS + inline void _Rope_RopeRep<_CharT,_Alloc>::_S_free_string(_CharT* __s, + size_t __n, + allocator_type __a) +#else + inline void _Rope_RopeRep<_CharT,_Alloc>::_S_free_string(_CharT* __s, + size_t __n) +#endif +{ + if (!_S_is_basic_char_type((_CharT*)0)) { + destroy(__s, __s + __n); + } +// This has to be a static member, so this gets a bit messy +# ifdef __STL_USE_STD_ALLOCATORS + __a.deallocate( + __s, _Rope_RopeLeaf<_CharT,_Alloc>::_S_rounded_up_size(__n)); +# else + _Data_deallocate( + __s, _Rope_RopeLeaf<_CharT,_Alloc>::_S_rounded_up_size(__n)); +# endif +} + + +// There are several reasons for not doing this with virtual destructors +// and a class specific delete operator: +// - A class specific delete operator can't easily get access to +// allocator instances if we need them. +// - Any virtual function would need a 4 or byte vtable pointer; +// this only requires a one byte tag per object. +template <class _CharT, class _Alloc> +void _Rope_RopeRep<_CharT,_Alloc>::_M_free_tree() +{ + switch(_M_tag) { + case _S_leaf: + { + _Rope_RopeLeaf<_CharT,_Alloc>* __l + = (_Rope_RopeLeaf<_CharT,_Alloc>*)this; + __l->_Rope_RopeLeaf<_CharT,_Alloc>::~_Rope_RopeLeaf(); + _L_deallocate(__l, 1); + break; + } + case _S_concat: + { + _Rope_RopeConcatenation<_CharT,_Alloc>* __c + = (_Rope_RopeConcatenation<_CharT,_Alloc>*)this; + __c->_Rope_RopeConcatenation<_CharT,_Alloc>:: + ~_Rope_RopeConcatenation(); + _C_deallocate(__c, 1); + break; + } + case _S_function: + { + _Rope_RopeFunction<_CharT,_Alloc>* __f + = (_Rope_RopeFunction<_CharT,_Alloc>*)this; + __f->_Rope_RopeFunction<_CharT,_Alloc>::~_Rope_RopeFunction(); + _F_deallocate(__f, 1); + break; + } + case _S_substringfn: + { + _Rope_RopeSubstring<_CharT,_Alloc>* __ss = + (_Rope_RopeSubstring<_CharT,_Alloc>*)this; + __ss->_Rope_RopeSubstring<_CharT,_Alloc>:: + ~_Rope_RopeSubstring(); + _S_deallocate(__ss, 1); + break; + } + } +} +#else + +template <class _CharT, class _Alloc> +#ifdef __STL_USE_STD_ALLOCATORS + inline void _Rope_RopeRep<_CharT,_Alloc>::_S_free_string + (const _CharT*, size_t, allocator_type) +#else + inline void _Rope_RopeRep<_CharT,_Alloc>::_S_free_string + (const _CharT*, size_t) +#endif +{} + +#endif + + +// Concatenate a C string onto a leaf rope by copying the rope data. +// Used for short ropes. +template <class _CharT, class _Alloc> +rope<_CharT,_Alloc>::_RopeLeaf* +rope<_CharT,_Alloc>::_S_leaf_concat_char_iter + (_RopeLeaf* __r, const _CharT* __iter, size_t __len) +{ + size_t __old_len = __r->_M_size; + _CharT* __new_data = (_CharT*) + _Data_allocate(_S_rounded_up_size(__old_len + __len)); + _RopeLeaf* __result; + + uninitialized_copy_n(__r->_M_data, __old_len, __new_data); + uninitialized_copy_n(__iter, __len, __new_data + __old_len); + _S_cond_store_eos(__new_data[__old_len + __len]); + __STL_TRY { + __result = _S_new_RopeLeaf(__new_data, __old_len + __len, + __r->get_allocator()); + } + __STL_UNWIND(_RopeRep::__STL_FREE_STRING(__new_data, __old_len + __len, + __r->get_allocator())); + return __result; +} + +#ifndef __GC +// As above, but it's OK to clobber original if refcount is 1 +template <class _CharT, class _Alloc> +rope<_CharT,_Alloc>::_RopeLeaf* +rope<_CharT,_Alloc>::_S_destr_leaf_concat_char_iter + (_RopeLeaf* __r, const _CharT* __iter, size_t __len) +{ + __stl_assert(__r->_M_ref_count >= 1); + if (__r->_M_ref_count > 1) + return _S_leaf_concat_char_iter(__r, __iter, __len); + size_t __old_len = __r->_M_size; + if (_S_allocated_capacity(__old_len) >= __old_len + __len) { + // The space has been partially initialized for the standard + // character types. But that doesn't matter for those types. + uninitialized_copy_n(__iter, __len, __r->_M_data + __old_len); + if (_S_is_basic_char_type((_CharT*)0)) { + _S_cond_store_eos(__r->_M_data[__old_len + __len]); + __stl_assert(__r->_M_c_string == __r->_M_data); + } else if (__r->_M_c_string != __r->_M_data && 0 != __r->_M_c_string) { + __r->_M_free_c_string(); + __r->_M_c_string = 0; + } + __r->_M_size = __old_len + __len; + __stl_assert(__r->_M_ref_count == 1); + __r->_M_ref_count = 2; + return __r; + } else { + _RopeLeaf* __result = _S_leaf_concat_char_iter(__r, __iter, __len); + __stl_assert(__result->_M_ref_count == 1); + return __result; + } +} +#endif + +// Assumes left and right are not 0. +// Does not increment (nor decrement on exception) child reference counts. +// Result has ref count 1. +template <class _CharT, class _Alloc> +rope<_CharT,_Alloc>::_RopeRep* +rope<_CharT,_Alloc>::_S_tree_concat (_RopeRep* __left, _RopeRep* __right) +{ + _RopeConcatenation* __result = + _S_new_RopeConcatenation(__left, __right, __left->get_allocator()); + size_t __depth = __result->_M_depth; + +# ifdef __STL_USE_STD_ALLOCATORS + __stl_assert(__left->get_allocator() == __right->get_allocator()); +# endif + if (__depth > 20 && (__result->_M_size < 1000 || + __depth > _RopeRep::_S_max_rope_depth)) { + _RopeRep* __balanced; + + __STL_TRY { + __balanced = _S_balance(__result); +# ifndef __GC + if (__result != __balanced) { + __stl_assert(1 == __result->_M_ref_count + && 1 == __balanced->_M_ref_count); + } +# endif + __result->_M_unref_nonnil(); + } + __STL_UNWIND((_C_deallocate(__result,1))); + // In case of exception, we need to deallocate + // otherwise dangling result node. But caller + // still owns its children. Thus unref is + // inappropriate. + return __balanced; + } else { + return __result; + } +} + +template <class _CharT, class _Alloc> +rope<_CharT,_Alloc>::_RopeRep* rope<_CharT,_Alloc>::_S_concat_char_iter + (_RopeRep* __r, const _CharT*__s, size_t __slen) +{ + _RopeRep* __result; + if (0 == __slen) { + _S_ref(__r); + return __r; + } + if (0 == __r) + return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, + __r->get_allocator()); + if (_RopeRep::_S_leaf == __r->_M_tag && + __r->_M_size + __slen <= _S_copy_max) { + __result = _S_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen); +# ifndef __GC + __stl_assert(1 == __result->_M_ref_count); +# endif + return __result; + } + if (_RopeRep::_S_concat == __r->_M_tag + && _RopeRep::_S_leaf == ((_RopeConcatenation*)__r)->_M_right->_M_tag) { + _RopeLeaf* __right = + (_RopeLeaf* )(((_RopeConcatenation* )__r)->_M_right); + if (__right->_M_size + __slen <= _S_copy_max) { + _RopeRep* __left = ((_RopeConcatenation*)__r)->_M_left; + _RopeRep* __nright = + _S_leaf_concat_char_iter((_RopeLeaf*)__right, __s, __slen); + __left->_M_ref_nonnil(); + __STL_TRY { + __result = _S_tree_concat(__left, __nright); + } + __STL_UNWIND(_S_unref(__left); _S_unref(__nright)); +# ifndef __GC + __stl_assert(1 == __result->_M_ref_count); +# endif + return __result; + } + } + _RopeRep* __nright = + __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->get_allocator()); + __STL_TRY { + __r->_M_ref_nonnil(); + __result = _S_tree_concat(__r, __nright); + } + __STL_UNWIND(_S_unref(__r); _S_unref(__nright)); +# ifndef __GC + __stl_assert(1 == __result->_M_ref_count); +# endif + return __result; +} + +#ifndef __GC +template <class _CharT, class _Alloc> +rope<_CharT,_Alloc>::_RopeRep* +rope<_CharT,_Alloc>::_S_destr_concat_char_iter( + _RopeRep* __r, const _CharT* __s, size_t __slen) +{ + _RopeRep* __result; + if (0 == __r) + return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, + __r->get_allocator()); + size_t __count = __r->_M_ref_count; + size_t __orig_size = __r->_M_size; + __stl_assert(__count >= 1); + if (__count > 1) return _S_concat_char_iter(__r, __s, __slen); + if (0 == __slen) { + __r->_M_ref_count = 2; // One more than before + return __r; + } + if (__orig_size + __slen <= _S_copy_max && + _RopeRep::_S_leaf == __r->_M_tag) { + __result = _S_destr_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen); + return __result; + } + if (_RopeRep::_S_concat == __r->_M_tag) { + _RopeLeaf* __right = (_RopeLeaf*)(((_RopeConcatenation*)__r)->_M_right); + if (_RopeRep::_S_leaf == __right->_M_tag + && __right->_M_size + __slen <= _S_copy_max) { + _RopeRep* __new_right = + _S_destr_leaf_concat_char_iter(__right, __s, __slen); + if (__right == __new_right) { + __stl_assert(__new_right->_M_ref_count == 2); + __new_right->_M_ref_count = 1; + } else { + __stl_assert(__new_right->_M_ref_count >= 1); + __right->_M_unref_nonnil(); + } + __stl_assert(__r->_M_ref_count == 1); + __r->_M_ref_count = 2; // One more than before. + ((_RopeConcatenation*)__r)->_M_right = __new_right; + __r->_M_size = __orig_size + __slen; + if (0 != __r->_M_c_string) { + __r->_M_free_c_string(); + __r->_M_c_string = 0; + } + return __r; + } + } + _RopeRep* __right = + __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->get_allocator()); + __r->_M_ref_nonnil(); + __STL_TRY { + __result = _S_tree_concat(__r, __right); + } + __STL_UNWIND(_S_unref(__r); _S_unref(__right)) + __stl_assert(1 == __result->_M_ref_count); + return __result; +} +#endif /* !__GC */ + +template <class _CharT, class _Alloc> +rope<_CharT,_Alloc>::_RopeRep* +rope<_CharT,_Alloc>::_S_concat(_RopeRep* __left, _RopeRep* __right) +{ + if (0 == __left) { + _S_ref(__right); + return __right; + } + if (0 == __right) { + __left->_M_ref_nonnil(); + return __left; + } + if (_RopeRep::_S_leaf == __right->_M_tag) { + if (_RopeRep::_S_leaf == __left->_M_tag) { + if (__right->_M_size + __left->_M_size <= _S_copy_max) { + return _S_leaf_concat_char_iter((_RopeLeaf*)__left, + ((_RopeLeaf*)__right)->_M_data, + __right->_M_size); + } + } else if (_RopeRep::_S_concat == __left->_M_tag + && _RopeRep::_S_leaf == + ((_RopeConcatenation*)__left)->_M_right->_M_tag) { + _RopeLeaf* __leftright = + (_RopeLeaf*)(((_RopeConcatenation*)__left)->_M_right); + if (__leftright->_M_size + __right->_M_size <= _S_copy_max) { + _RopeRep* __leftleft = ((_RopeConcatenation*)__left)->_M_left; + _RopeRep* __rest = _S_leaf_concat_char_iter(__leftright, + ((_RopeLeaf*)__right)->_M_data, + __right->_M_size); + __leftleft->_M_ref_nonnil(); + __STL_TRY { + return(_S_tree_concat(__leftleft, __rest)); + } + __STL_UNWIND(_S_unref(__leftleft); _S_unref(__rest)) + } + } + } + __left->_M_ref_nonnil(); + __right->_M_ref_nonnil(); + __STL_TRY { + return(_S_tree_concat(__left, __right)); + } + __STL_UNWIND(_S_unref(__left); _S_unref(__right)); +} + +template <class _CharT, class _Alloc> +rope<_CharT,_Alloc>::_RopeRep* +rope<_CharT,_Alloc>::_S_substring(_RopeRep* __base, + size_t __start, size_t __endp1) +{ + if (0 == __base) return 0; + size_t __len = __base->_M_size; + size_t __adj_endp1; + const size_t __lazy_threshold = 128; + + if (__endp1 >= __len) { + if (0 == __start) { + __base->_M_ref_nonnil(); + return __base; + } else { + __adj_endp1 = __len; + } + } else { + __adj_endp1 = __endp1; + } + switch(__base->_M_tag) { + case _RopeRep::_S_concat: + { + _RopeConcatenation* __c = (_RopeConcatenation*)__base; + _RopeRep* __left = __c->_M_left; + _RopeRep* __right = __c->_M_right; + size_t __left_len = __left->_M_size; + _RopeRep* __result; + + if (__adj_endp1 <= __left_len) { + return _S_substring(__left, __start, __endp1); + } else if (__start >= __left_len) { + return _S_substring(__right, __start - __left_len, + __adj_endp1 - __left_len); + } + _Self_destruct_ptr __left_result( + _S_substring(__left, __start, __left_len)); + _Self_destruct_ptr __right_result( + _S_substring(__right, 0, __endp1 - __left_len)); + __result = _S_concat(__left_result, __right_result); +# ifndef __GC + __stl_assert(1 == __result->_M_ref_count); +# endif + return __result; + } + case _RopeRep::_S_leaf: + { + _RopeLeaf* __l = (_RopeLeaf*)__base; + _RopeLeaf* __result; + size_t __result_len; + if (__start >= __adj_endp1) return 0; + __result_len = __adj_endp1 - __start; + if (__result_len > __lazy_threshold) goto lazy; +# ifdef __GC + const _CharT* __section = __l->_M_data + __start; + __result = _S_new_RopeLeaf(__section, __result_len, + __base->get_allocator()); + __result->_M_c_string = 0; // Not eos terminated. +# else + // We should sometimes create substring node instead. + __result = __STL_ROPE_FROM_UNOWNED_CHAR_PTR( + __l->_M_data + __start, __result_len, + __base->get_allocator()); +# endif + return __result; + } + case _RopeRep::_S_substringfn: + // Avoid introducing multiple layers of substring nodes. + { + _RopeSubstring* __old = (_RopeSubstring*)__base; + size_t __result_len; + if (__start >= __adj_endp1) return 0; + __result_len = __adj_endp1 - __start; + if (__result_len > __lazy_threshold) { + _RopeSubstring* __result = + _S_new_RopeSubstring(__old->_M_base, + __start + __old->_M_start, + __adj_endp1 - __start, + __base->get_allocator()); + return __result; + + } // *** else fall through: *** + } + case _RopeRep::_S_function: + { + _RopeFunction* __f = (_RopeFunction*)__base; + _CharT* __section; + size_t __result_len; + if (__start >= __adj_endp1) return 0; + __result_len = __adj_endp1 - __start; + + if (__result_len > __lazy_threshold) goto lazy; + __section = (_CharT*) + _Data_allocate(_S_rounded_up_size(__result_len)); + __STL_TRY { + (*(__f->_M_fn))(__start, __result_len, __section); + } + __STL_UNWIND(_RopeRep::__STL_FREE_STRING( + __section, __result_len, __base->get_allocator())); + _S_cond_store_eos(__section[__result_len]); + return _S_new_RopeLeaf(__section, __result_len, + __base->get_allocator()); + } + } + /*NOTREACHED*/ + __stl_assert(false); + lazy: + { + // Create substring node. + return _S_new_RopeSubstring(__base, __start, __adj_endp1 - __start, + __base->get_allocator()); + } +} + +template<class _CharT> +class _Rope_flatten_char_consumer : public _Rope_char_consumer<_CharT> { + private: + _CharT* _M_buf_ptr; + public: + + _Rope_flatten_char_consumer(_CharT* __buffer) { + _M_buf_ptr = __buffer; + }; + ~_Rope_flatten_char_consumer() {} + bool operator() (const _CharT* __leaf, size_t __n) { + uninitialized_copy_n(__leaf, __n, _M_buf_ptr); + _M_buf_ptr += __n; + return true; + } +}; + +template<class _CharT> +class _Rope_find_char_char_consumer : public _Rope_char_consumer<_CharT> { + private: + _CharT _M_pattern; + public: + size_t _M_count; // Number of nonmatching characters + _Rope_find_char_char_consumer(_CharT __p) + : _M_pattern(__p), _M_count(0) {} + ~_Rope_find_char_char_consumer() {} + bool operator() (const _CharT* __leaf, size_t __n) { + size_t __i; + for (__i = 0; __i < __n; __i++) { + if (__leaf[__i] == _M_pattern) { + _M_count += __i; return false; + } + } + _M_count += __n; return true; + } +}; + +#ifdef __STL_USE_NEW_IOSTREAMS + template<class _CharT, class _Traits> + // Here _CharT is both the stream and rope character type. +#else + template<class _CharT> + // Here _CharT is the rope character type. Unlike in the + // above case, we somewhat handle the case in which it doesn't + // match the stream character type, i.e. char. +#endif +class _Rope_insert_char_consumer : public _Rope_char_consumer<_CharT> { + private: +# ifdef __STL_USE_NEW_IOSTREAMS + typedef basic_ostream<_CharT,_Traits> _Insert_ostream; +# else + typedef ostream _Insert_ostream; +# endif + _Insert_ostream& _M_o; + public: + _Rope_insert_char_consumer(_Insert_ostream& __writer) + : _M_o(__writer) {}; + ~_Rope_insert_char_consumer() { }; + // Caller is presumed to own the ostream + bool operator() (const _CharT* __leaf, size_t __n); + // Returns true to continue traversal. +}; + +#ifdef __STL_USE_NEW_IOSTREAMS + template<class _CharT, class _Traits> + bool _Rope_insert_char_consumer<_CharT, _Traits>::operator() + (const _CharT* __leaf, size_t __n) + { + size_t __i; + // We assume that formatting is set up correctly for each element. + for (__i = 0; __i < __n; __i++) _M_o.put(__leaf[__i]); + return true; + } + +#else + template<class _CharT> + bool _Rope_insert_char_consumer<_CharT>::operator() + (const _CharT* __leaf, size_t __n) + { + size_t __i; + // We assume that formatting is set up correctly for each element. + for (__i = 0; __i < __n; __i++) _M_o << __leaf[__i]; + return true; + } + + + __STL_TEMPLATE_NULL + inline bool _Rope_insert_char_consumer<char>::operator() + (const char* __leaf, size_t __n) + { + size_t __i; + for (__i = 0; __i < __n; __i++) _M_o.put(__leaf[__i]); + return true; + } +#endif + +template <class _CharT, class _Alloc> +bool rope<_CharT, _Alloc>::_S_apply_to_pieces( + _Rope_char_consumer<_CharT>& __c, + const _RopeRep* __r, + size_t __begin, size_t __end) +{ + if (0 == __r) return true; + switch(__r->_M_tag) { + case _RopeRep::_S_concat: + { + _RopeConcatenation* __conc = (_RopeConcatenation*)__r; + _RopeRep* __left = __conc->_M_left; + size_t __left_len = __left->_M_size; + if (__begin < __left_len) { + size_t __left_end = min(__left_len, __end); + if (!_S_apply_to_pieces(__c, __left, __begin, __left_end)) + return false; + } + if (__end > __left_len) { + _RopeRep* __right = __conc->_M_right; + size_t __right_start = max(__left_len, __begin); + if (!_S_apply_to_pieces(__c, __right, + __right_start - __left_len, + __end - __left_len)) { + return false; + } + } + } + return true; + case _RopeRep::_S_leaf: + { + _RopeLeaf* __l = (_RopeLeaf*)__r; + return __c(__l->_M_data + __begin, __end - __begin); + } + case _RopeRep::_S_function: + case _RopeRep::_S_substringfn: + { + _RopeFunction* __f = (_RopeFunction*)__r; + size_t __len = __end - __begin; + bool __result; + _CharT* __buffer = + (_CharT*)alloc::allocate(__len * sizeof(_CharT)); + __STL_TRY { + (*(__f->_M_fn))(__begin, __len, __buffer); + __result = __c(__buffer, __len); + alloc::deallocate(__buffer, __len * sizeof(_CharT)); + } + __STL_UNWIND((alloc::deallocate(__buffer, + __len * sizeof(_CharT)))) + return __result; + } + default: + __stl_assert(false); + /*NOTREACHED*/ + return false; + } +} + +#ifdef __STL_USE_NEW_IOSTREAMS + template<class _CharT, class _Traits> + inline void _Rope_fill(basic_ostream<_CharT, _Traits>& __o, size_t __n) +#else + inline void _Rope_fill(ostream& __o, size_t __n) +#endif +{ + char __f = __o.fill(); + size_t __i; + + for (__i = 0; __i < __n; __i++) __o.put(__f); +} + + +template <class _CharT> inline bool _Rope_is_simple(_CharT*) { return false; } +inline bool _Rope_is_simple(char*) { return true; } +inline bool _Rope_is_simple(wchar_t*) { return true; } + +#ifdef __STL_USE_NEW_IOSTREAMS + template<class _CharT, class _Traits, class _Alloc> + basic_ostream<_CharT, _Traits>& operator<< + (basic_ostream<_CharT, _Traits>& __o, + const rope<_CharT, _Alloc>& __r) +#else + template<class _CharT, class _Alloc> + ostream& operator<< (ostream& __o, const rope<_CharT, _Alloc>& __r) +#endif +{ + size_t __w = __o.width(); + bool __left = bool(__o.flags() & ios::left); + size_t __pad_len; + size_t __rope_len = __r.size(); +# ifdef __STL_USE_NEW_IOSTREAMS + _Rope_insert_char_consumer<_CharT, _Traits> __c(__o); +# else + _Rope_insert_char_consumer<_CharT> __c(__o); +# endif + bool __is_simple = _Rope_is_simple((_CharT*)0); + + if (__rope_len < __w) { + __pad_len = __w - __rope_len; + } else { + __pad_len = 0; + } + if (!__is_simple) __o.width(__w/__rope_len); + __STL_TRY { + if (__is_simple && !__left && __pad_len > 0) { + _Rope_fill(__o, __pad_len); + } + __r.apply_to_pieces(0, __r.size(), __c); + if (__is_simple && __left && __pad_len > 0) { + _Rope_fill(__o, __pad_len); + } + if (!__is_simple) + __o.width(__w); + } + __STL_UNWIND(if (!__is_simple) __o.width(__w)) + return __o; +} + +template <class _CharT, class _Alloc> +_CharT* +rope<_CharT,_Alloc>::_S_flatten(_RopeRep* __r, + size_t __start, size_t __len, + _CharT* __buffer) +{ + _Rope_flatten_char_consumer<_CharT> __c(__buffer); + _S_apply_to_pieces(__c, __r, __start, __start + __len); + return(__buffer + __len); +} + +template <class _CharT, class _Alloc> +size_t +rope<_CharT,_Alloc>::find(_CharT __pattern, size_t __start) const +{ + _Rope_find_char_char_consumer<_CharT> __c(__pattern); + _S_apply_to_pieces(__c, _M_tree_ptr, __start, size()); + size_type __result_pos = __start + __c._M_count; +# ifndef __STL_OLD_ROPE_SEMANTICS + if (__result_pos == size()) __result_pos = npos; +# endif + return __result_pos; +} + +template <class _CharT, class _Alloc> +_CharT* +rope<_CharT,_Alloc>::_S_flatten(_RopeRep* __r, _CharT* __buffer) +{ + if (0 == __r) return __buffer; + switch(__r->_M_tag) { + case _RopeRep::_S_concat: + { + _RopeConcatenation* __c = (_RopeConcatenation*)__r; + _RopeRep* __left = __c->_M_left; + _RopeRep* __right = __c->_M_right; + _CharT* __rest = _S_flatten(__left, __buffer); + return _S_flatten(__right, __rest); + } + case _RopeRep::_S_leaf: + { + _RopeLeaf* __l = (_RopeLeaf*)__r; + return copy_n(__l->_M_data, __l->_M_size, __buffer).second; + } + case _RopeRep::_S_function: + case _RopeRep::_S_substringfn: + // We dont yet do anything with substring nodes. + // This needs to be fixed before ropefiles will work well. + { + _RopeFunction* __f = (_RopeFunction*)__r; + (*(__f->_M_fn))(0, __f->_M_size, __buffer); + return __buffer + __f->_M_size; + } + default: + __stl_assert(false); + /*NOTREACHED*/ + return 0; + } +} + + +// This needs work for _CharT != char +template <class _CharT, class _Alloc> +void +rope<_CharT,_Alloc>::_S_dump(_RopeRep* __r, int __indent) +{ + for (int __i = 0; __i < __indent; __i++) putchar(' '); + if (0 == __r) { + printf("NULL\n"); return; + } + if (_RopeRep::_S_concat == __r->_M_tag) { + _RopeConcatenation* __c = (_RopeConcatenation*)__r; + _RopeRep* __left = __c->_M_left; + _RopeRep* __right = __c->_M_right; + +# ifdef __GC + printf("Concatenation %p (depth = %d, len = %ld, %s balanced)\n", + __r, __r->_M_depth, __r->_M_size, __r->_M_is_balanced? "" : "not"); +# else + printf("Concatenation %p (rc = %ld, depth = %d, " + "len = %ld, %s balanced)\n", + __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size, + __r->_M_is_balanced? "" : "not"); +# endif + _S_dump(__left, __indent + 2); + _S_dump(__right, __indent + 2); + return; + } else { + char* __kind; + + switch (__r->_M_tag) { + case _RopeRep::_S_leaf: + __kind = "Leaf"; + break; + case _RopeRep::_S_function: + __kind = "Function"; + break; + case _RopeRep::_S_substringfn: + __kind = "Function representing substring"; + break; + default: + __kind = "(corrupted kind field!)"; + } +# ifdef __GC + printf("%s %p (depth = %d, len = %ld) ", + __kind, __r, __r->_M_depth, __r->_M_size); +# else + printf("%s %p (rc = %ld, depth = %d, len = %ld) ", + __kind, __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size); +# endif + if (_S_is_one_byte_char_type((_CharT*)0)) { + const int __max_len = 40; + _Self_destruct_ptr __prefix(_S_substring(__r, 0, __max_len)); + _CharT __buffer[__max_len + 1]; + bool __too_big = __r->_M_size > __prefix->_M_size; + + _S_flatten(__prefix, __buffer); + __buffer[__prefix->_M_size] = _S_eos((_CharT*)0); + printf("%s%s\n", + (char*)__buffer, __too_big? "...\n" : "\n"); + } else { + printf("\n"); + } + } +} + +template <class _CharT, class _Alloc> +const unsigned long +rope<_CharT,_Alloc>::_S_min_len[ + _Rope_RopeRep<_CharT,_Alloc>::_S_max_rope_depth + 1] = { +/* 0 */1, /* 1 */2, /* 2 */3, /* 3 */5, /* 4 */8, /* 5 */13, /* 6 */21, +/* 7 */34, /* 8 */55, /* 9 */89, /* 10 */144, /* 11 */233, /* 12 */377, +/* 13 */610, /* 14 */987, /* 15 */1597, /* 16 */2584, /* 17 */4181, +/* 18 */6765, /* 19 */10946, /* 20 */17711, /* 21 */28657, /* 22 */46368, +/* 23 */75025, /* 24 */121393, /* 25 */196418, /* 26 */317811, +/* 27 */514229, /* 28 */832040, /* 29 */1346269, /* 30 */2178309, +/* 31 */3524578, /* 32 */5702887, /* 33 */9227465, /* 34 */14930352, +/* 35 */24157817, /* 36 */39088169, /* 37 */63245986, /* 38 */102334155, +/* 39 */165580141, /* 40 */267914296, /* 41 */433494437, +/* 42 */701408733, /* 43 */1134903170, /* 44 */1836311903, +/* 45 */2971215073u }; +// These are Fibonacci numbers < 2**32. + +template <class _CharT, class _Alloc> +rope<_CharT,_Alloc>::_RopeRep* +rope<_CharT,_Alloc>::_S_balance(_RopeRep* __r) +{ + _RopeRep* __forest[_RopeRep::_S_max_rope_depth + 1]; + _RopeRep* __result = 0; + int __i; + // Invariant: + // The concatenation of forest in descending order is equal to __r. + // __forest[__i]._M_size >= _S_min_len[__i] + // __forest[__i]._M_depth = __i + // References from forest are included in refcount. + + for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i) + __forest[__i] = 0; + __STL_TRY { + _S_add_to_forest(__r, __forest); + for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i) + if (0 != __forest[__i]) { +# ifndef __GC + _Self_destruct_ptr __old(__result); +# endif + __result = _S_concat(__forest[__i], __result); + __forest[__i]->_M_unref_nonnil(); +# if !defined(__GC) && defined(__STL_USE_EXCEPTIONS) + __forest[__i] = 0; +# endif + } + } + __STL_UNWIND(for(__i = 0; __i <= _RopeRep::_S_max_rope_depth; __i++) + _S_unref(__forest[__i])) + if (__result->_M_depth > _RopeRep::_S_max_rope_depth) { +# ifdef __STL_USE_EXCEPTIONS + __STL_THROW(length_error("rope too long")); +# else + abort(); +# endif + } + return(__result); +} + + +template <class _CharT, class _Alloc> +void +rope<_CharT,_Alloc>::_S_add_to_forest(_RopeRep* __r, _RopeRep** __forest) +{ + if (__r->_M_is_balanced) { + _S_add_leaf_to_forest(__r, __forest); + return; + } + __stl_assert(__r->_M_tag == _RopeRep::_S_concat); + { + _RopeConcatenation* __c = (_RopeConcatenation*)__r; + + _S_add_to_forest(__c->_M_left, __forest); + _S_add_to_forest(__c->_M_right, __forest); + } +} + + +template <class _CharT, class _Alloc> +void +rope<_CharT,_Alloc>::_S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest) +{ + _RopeRep* __insertee; // included in refcount + _RopeRep* __too_tiny = 0; // included in refcount + int __i; // forest[0..__i-1] is empty + size_t __s = __r->_M_size; + + for (__i = 0; __s >= _S_min_len[__i+1]/* not this bucket */; ++__i) { + if (0 != __forest[__i]) { +# ifndef __GC + _Self_destruct_ptr __old(__too_tiny); +# endif + __too_tiny = _S_concat_and_set_balanced(__forest[__i], __too_tiny); + __forest[__i]->_M_unref_nonnil(); + __forest[__i] = 0; + } + } + { +# ifndef __GC + _Self_destruct_ptr __old(__too_tiny); +# endif + __insertee = _S_concat_and_set_balanced(__too_tiny, __r); + } + // Too_tiny dead, and no longer included in refcount. + // Insertee is live and included. + __stl_assert(_S_is_almost_balanced(__insertee)); + __stl_assert(__insertee->_M_depth <= __r->_M_depth + 1); + for (;; ++__i) { + if (0 != __forest[__i]) { +# ifndef __GC + _Self_destruct_ptr __old(__insertee); +# endif + __insertee = _S_concat_and_set_balanced(__forest[__i], __insertee); + __forest[__i]->_M_unref_nonnil(); + __forest[__i] = 0; + __stl_assert(_S_is_almost_balanced(__insertee)); + } + __stl_assert(_S_min_len[__i] <= __insertee->_M_size); + __stl_assert(__forest[__i] == 0); + if (__i == _RopeRep::_S_max_rope_depth || + __insertee->_M_size < _S_min_len[__i+1]) { + __forest[__i] = __insertee; + // refcount is OK since __insertee is now dead. + return; + } + } +} + +template <class _CharT, class _Alloc> +_CharT +rope<_CharT,_Alloc>::_S_fetch(_RopeRep* __r, size_type __i) +{ + __GC_CONST _CharT* __cstr = __r->_M_c_string; + + __stl_assert(__i < __r->_M_size); + if (0 != __cstr) return __cstr[__i]; + for(;;) { + switch(__r->_M_tag) { + case _RopeRep::_S_concat: + { + _RopeConcatenation* __c = (_RopeConcatenation*)__r; + _RopeRep* __left = __c->_M_left; + size_t __left_len = __left->_M_size; + + if (__i >= __left_len) { + __i -= __left_len; + __r = __c->_M_right; + } else { + __r = __left; + } + } + break; + case _RopeRep::_S_leaf: + { + _RopeLeaf* __l = (_RopeLeaf*)__r; + return __l->_M_data[__i]; + } + case _RopeRep::_S_function: + case _RopeRep::_S_substringfn: + { + _RopeFunction* __f = (_RopeFunction*)__r; + _CharT __result; + + (*(__f->_M_fn))(__i, 1, &__result); + return __result; + } + } + } +} + +# ifndef __GC +// Return a uniquely referenced character slot for the given +// position, or 0 if that's not possible. +template <class _CharT, class _Alloc> +_CharT* +rope<_CharT,_Alloc>::_S_fetch_ptr(_RopeRep* __r, size_type __i) +{ + _RopeRep* __clrstack[_RopeRep::_S_max_rope_depth]; + size_t __csptr = 0; + + for(;;) { + if (__r->_M_ref_count > 1) return 0; + switch(__r->_M_tag) { + case _RopeRep::_S_concat: + { + _RopeConcatenation* __c = (_RopeConcatenation*)__r; + _RopeRep* __left = __c->_M_left; + size_t __left_len = __left->_M_size; + + if (__c->_M_c_string != 0) __clrstack[__csptr++] = __c; + if (__i >= __left_len) { + __i -= __left_len; + __r = __c->_M_right; + } else { + __r = __left; + } + } + break; + case _RopeRep::_S_leaf: + { + _RopeLeaf* __l = (_RopeLeaf*)__r; + if (__l->_M_c_string != __l->_M_data && __l->_M_c_string != 0) + __clrstack[__csptr++] = __l; + while (__csptr > 0) { + -- __csptr; + _RopeRep* __d = __clrstack[__csptr]; + __d->_M_free_c_string(); + __d->_M_c_string = 0; + } + return __l->_M_data + __i; + } + case _RopeRep::_S_function: + case _RopeRep::_S_substringfn: + return 0; + } + } +} +# endif /* __GC */ + +// The following could be implemented trivially using +// lexicographical_compare_3way. +// We do a little more work to avoid dealing with rope iterators for +// flat strings. +template <class _CharT, class _Alloc> +int +rope<_CharT,_Alloc>::_S_compare (const _RopeRep* __left, + const _RopeRep* __right) +{ + size_t __left_len; + size_t __right_len; + + if (0 == __right) return 0 != __left; + if (0 == __left) return -1; + __left_len = __left->_M_size; + __right_len = __right->_M_size; + if (_RopeRep::_S_leaf == __left->_M_tag) { + _RopeLeaf* __l = (_RopeLeaf*) __left; + if (_RopeRep::_S_leaf == __right->_M_tag) { + _RopeLeaf* __r = (_RopeLeaf*) __right; + return lexicographical_compare_3way( + __l->_M_data, __l->_M_data + __left_len, + __r->_M_data, __r->_M_data + __right_len); + } else { + const_iterator __rstart(__right, 0); + const_iterator __rend(__right, __right_len); + return lexicographical_compare_3way( + __l->_M_data, __l->_M_data + __left_len, + __rstart, __rend); + } + } else { + const_iterator __lstart(__left, 0); + const_iterator __lend(__left, __left_len); + if (_RopeRep::_S_leaf == __right->_M_tag) { + _RopeLeaf* __r = (_RopeLeaf*) __right; + return lexicographical_compare_3way( + __lstart, __lend, + __r->_M_data, __r->_M_data + __right_len); + } else { + const_iterator __rstart(__right, 0); + const_iterator __rend(__right, __right_len); + return lexicographical_compare_3way( + __lstart, __lend, + __rstart, __rend); + } + } +} + +// Assignment to reference proxies. +template <class _CharT, class _Alloc> +_Rope_char_ref_proxy<_CharT, _Alloc>& +_Rope_char_ref_proxy<_CharT, _Alloc>::operator= (_CharT __c) { + _RopeRep* __old = _M_root->_M_tree_ptr; +# ifndef __GC + // First check for the case in which everything is uniquely + // referenced. In that case we can do this destructively. + _CharT* __ptr = _My_rope::_S_fetch_ptr(__old, _M_pos); + if (0 != __ptr) { + *__ptr = __c; + return *this; + } +# endif + _Self_destruct_ptr __left( + _My_rope::_S_substring(__old, 0, _M_pos)); + _Self_destruct_ptr __right( + _My_rope::_S_substring(__old, _M_pos+1, __old->_M_size)); + _Self_destruct_ptr __result_left( + _My_rope::_S_destr_concat_char_iter(__left, &__c, 1)); + +# ifndef __GC + __stl_assert(__left == __result_left || 1 == __result_left->_M_ref_count); +# endif + _RopeRep* __result = + _My_rope::_S_concat(__result_left, __right); +# ifndef __GC + __stl_assert(1 <= __result->_M_ref_count); + _RopeRep::_S_unref(__old); +# endif + _M_root->_M_tree_ptr = __result; + return *this; +} + +template <class _CharT, class _Alloc> +inline _Rope_char_ref_proxy<_CharT, _Alloc>::operator _CharT () const +{ + if (_M_current_valid) { + return _M_current; + } else { + return _My_rope::_S_fetch(_M_root->_M_tree_ptr, _M_pos); + } +} +template <class _CharT, class _Alloc> +_Rope_char_ptr_proxy<_CharT, _Alloc> +_Rope_char_ref_proxy<_CharT, _Alloc>::operator& () const { + return _Rope_char_ptr_proxy<_CharT, _Alloc>(*this); +} + +template <class _CharT, class _Alloc> +rope<_CharT, _Alloc>::rope(size_t __n, _CharT __c, + const allocator_type& __a) +: _Base(__a) +{ + rope<_CharT,_Alloc> __result; + const size_t __exponentiate_threshold = 32; + size_t __exponent; + size_t __rest; + _CharT* __rest_buffer; + _RopeRep* __remainder; + rope<_CharT,_Alloc> __remainder_rope; + + if (0 == __n) + return; + + __exponent = __n / __exponentiate_threshold; + __rest = __n % __exponentiate_threshold; + if (0 == __rest) { + __remainder = 0; + } else { + __rest_buffer = _Data_allocate(_S_rounded_up_size(__rest)); + uninitialized_fill_n(__rest_buffer, __rest, __c); + _S_cond_store_eos(__rest_buffer[__rest]); + __STL_TRY { + __remainder = _S_new_RopeLeaf(__rest_buffer, __rest, __a); + } + __STL_UNWIND(_RopeRep::__STL_FREE_STRING(__rest_buffer, __rest, __a)) + } + __remainder_rope._M_tree_ptr = __remainder; + if (__exponent != 0) { + _CharT* __base_buffer = + _Data_allocate(_S_rounded_up_size(__exponentiate_threshold)); + _RopeLeaf* __base_leaf; + rope __base_rope; + uninitialized_fill_n(__base_buffer, __exponentiate_threshold, __c); + _S_cond_store_eos(__base_buffer[__exponentiate_threshold]); + __STL_TRY { + __base_leaf = _S_new_RopeLeaf(__base_buffer, + __exponentiate_threshold, __a); + } + __STL_UNWIND(_RopeRep::__STL_FREE_STRING(__base_buffer, + __exponentiate_threshold, __a)) + __base_rope._M_tree_ptr = __base_leaf; + if (1 == __exponent) { + __result = __base_rope; +# ifndef __GC + __stl_assert(2 == __result._M_tree_ptr->_M_ref_count); + // One each for base_rope and __result +# endif + } else { + __result = power(__base_rope, __exponent, + _Rope_Concat_fn<_CharT,_Alloc>()); + } + if (0 != __remainder) { + __result += __remainder_rope; + } + } else { + __result = __remainder_rope; + } + _M_tree_ptr = __result._M_tree_ptr; + _M_tree_ptr->_M_ref_nonnil(); +} + +template<class _CharT, class _Alloc> + _CharT rope<_CharT,_Alloc>::_S_empty_c_str[1]; + +template<class _CharT, class _Alloc> +const _CharT* rope<_CharT,_Alloc>::c_str() const { + if (0 == _M_tree_ptr) { + _S_empty_c_str[0] = _S_eos((_CharT*)0); // Possibly redundant, + // but probably fast. + return _S_empty_c_str; + } + __GC_CONST _CharT* __old_c_string = _M_tree_ptr->_M_c_string; + if (0 != __old_c_string) return(__old_c_string); + size_t __s = size(); + _CharT* __result = _Data_allocate(__s + 1); + _S_flatten(_M_tree_ptr, __result); + __result[__s] = _S_eos((_CharT*)0); +# ifdef __GC + _M_tree_ptr->_M_c_string = __result; +# else + if ((__old_c_string = (__GC_CONST _CharT*) + _Atomic_swap((unsigned long *)(&(_M_tree_ptr->_M_c_string)), + (unsigned long)__result)) != 0) { + // It must have been added in the interim. Hence it had to have been + // separately allocated. Deallocate the old copy, since we just + // replaced it. + destroy(__old_c_string, __old_c_string + __s + 1); + _Data_deallocate(__old_c_string, __s + 1); + } +# endif + return(__result); +} + +template<class _CharT, class _Alloc> +const _CharT* rope<_CharT,_Alloc>::replace_with_c_str() { + if (0 == _M_tree_ptr) { + _S_empty_c_str[0] = _S_eos((_CharT*)0); + return _S_empty_c_str; + } + __GC_CONST _CharT* __old_c_string = _M_tree_ptr->_M_c_string; + if (_RopeRep::_S_leaf == _M_tree_ptr->_M_tag && 0 != __old_c_string) { + return(__old_c_string); + } + size_t __s = size(); + _CharT* __result = _Data_allocate(_S_rounded_up_size(__s)); + _S_flatten(_M_tree_ptr, __result); + __result[__s] = _S_eos((_CharT*)0); + _M_tree_ptr->_M_unref_nonnil(); + _M_tree_ptr = _S_new_RopeLeaf(__result, __s, get_allocator()); + return(__result); +} + +// Algorithm specializations. More should be added. + +template<class _Rope_iterator> // was templated on CharT and Alloc +void // VC++ workaround +_Rope_rotate(_Rope_iterator __first, + _Rope_iterator __middle, + _Rope_iterator __last) +{ + typedef typename _Rope_iterator::value_type _CharT; + typedef typename _Rope_iterator::_allocator_type _Alloc; + + __stl_assert(__first.container() == __middle.container() + && __middle.container() == __last.container()); + rope<_CharT,_Alloc>& __r(__first.container()); + rope<_CharT,_Alloc> __prefix = __r.substr(0, __first.index()); + rope<_CharT,_Alloc> __suffix = + __r.substr(__last.index(), __r.size() - __last.index()); + rope<_CharT,_Alloc> __part1 = + __r.substr(__middle.index(), __last.index() - __middle.index()); + rope<_CharT,_Alloc> __part2 = + __r.substr(__first.index(), __middle.index() - __first.index()); + __r = __prefix; + __r += __part1; + __r += __part2; + __r += __suffix; +} + +#if !defined(__GNUC__) +// Appears to confuse g++ +inline void rotate(_Rope_iterator<char,__STL_DEFAULT_ALLOCATOR(char)> __first, + _Rope_iterator<char,__STL_DEFAULT_ALLOCATOR(char)> __middle, + _Rope_iterator<char,__STL_DEFAULT_ALLOCATOR(char)> __last) { + _Rope_rotate(__first, __middle, __last); +} +#endif + +# if 0 +// Probably not useful for several reasons: +// - for SGIs 7.1 compiler and probably some others, +// this forces lots of rope<wchar_t, ...> instantiations, creating a +// code bloat and compile time problem. (Fixed in 7.2.) +// - wchar_t is 4 bytes wide on most UNIX platforms, making it unattractive +// for unicode strings. Unsigned short may be a better character +// type. +inline void rotate( + _Rope_iterator<wchar_t,__STL_DEFAULT_ALLOCATOR(char)> __first, + _Rope_iterator<wchar_t,__STL_DEFAULT_ALLOCATOR(char)> __middle, + _Rope_iterator<wchar_t,__STL_DEFAULT_ALLOCATOR(char)> __last) { + _Rope_rotate(__first, __middle, __last); +} +# endif + + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1174 +#endif + +__STL_END_NAMESPACE + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/sequence_concepts.h b/dtm_release/local/include/stl/sequence_concepts.h new file mode 100644 index 0000000000000000000000000000000000000000..bf8f37333537536f8f397f5291bd02763298a720 --- /dev/null +++ b/dtm_release/local/include/stl/sequence_concepts.h @@ -0,0 +1,204 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef STL_SEQUENCE_CONCEPTS_H +#define STL_SEQUENCE_CONCEPTS_H + +#include <container_concepts.h> + +#ifdef __STL_USE_CONCEPT_CHECKS + +// This file covers the following concepts: +// _Sequence +// _FrontInsertionSequence +// _BackInsertionSequence + +struct _ERROR_IN_STL_SEQ { + + template <class _XX> + static void + __fill_constructor_requirement_violation(_XX& __s) { + typename _XX::value_type __t = typename _XX::value_type(); + typename _XX::difference_type __n = typename _XX::difference_type(); + _XX __x(__n, __t); + __sink_unused_warning(__x); + } + template <class _XX> + static void + __fill_default_constructor_requirement_violation(_XX& __s) { + _STL_ERROR::__default_constructor_requirement_violation(*__s.begin()); + typename _XX::difference_type __n = typename _XX::difference_type(); + _XX __x(__n); + __sink_unused_warning(__x); + } + template <class _XX> + static void + __range_constructor_requirement_violation(_XX& __s) { + _XX __x(__s.begin(), __s.end()); + __sink_unused_warning(__x); + } + template <class _XX> + static void + __insert_function_requirement_violation(_XX& __s) { + typename _XX::value_type __t = typename _XX::value_type(); + typename _XX::iterator __p = typename _XX::iterator(); + __p = __s.insert(__p, __t); + } + template <class _XX> + static void + __fill_insert_function_requirement_violation(_XX& __s) { + typename _XX::value_type __t = typename _XX::value_type(); + typename _XX::iterator __p = typename _XX::iterator(); + typename _XX::difference_type __n = typename _XX::difference_type(); + __s.insert(__p, __n, __t); + } + template <class _XX> + static void + __range_insert_function_requirement_violation(_XX& __s) { + typename _XX::iterator __p = typename _XX::iterator(); + typename _XX::iterator __i = typename _XX::iterator(); + typename _XX::iterator __j = typename _XX::iterator(); + __s.insert(__p, __i, __j); + } + template <class _XX> + static void + __insert_element_function_requirement_violation(_XX& __s) { + typename _XX::value_type __t = typename _XX::value_type(); + std::pair<typename _XX::iterator, bool> __r; + __r = __s.insert(__t); + __sink_unused_warning(__r); + } + template <class _XX> + static void + __unconditional_insert_element_function_requirement_violation(_XX& __s) { + typename _XX::value_type __t = typename _XX::value_type(); + typename _XX::iterator __p; + __p = __s.insert(__t); + __sink_unused_warning(__p); + } + template <class _XX> + static void + __erase_function_requirement_violation(_XX& __s) { + typename _XX::iterator __p = typename _XX::iterator(); + __p = __s.erase(__p); + } + template <class _XX> + static void + __range_erase_function_requirement_violation(_XX& __s) { + typename _XX::iterator __p = typename _XX::iterator(); + typename _XX::iterator __q = typename _XX::iterator(); + __p = __s.erase(__p, __q); + } + template <class _XX> + static void + __const_front_function_requirement_violation(const _XX& __s) { + typename _XX::const_reference __t = __s.front(); + __sink_unused_warning(__t); + } + template <class _XX> + static void + __front_function_requirement_violation(_XX& __s) { + typename _XX::reference __t = __s.front(); + __const_front_function_requirement_violation(__s); + __sink_unused_warning(__t); + } + template <class _XX> + static void + __const_back_function_requirement_violation(const _XX& __s) { + typename _XX::const_reference __t = __s.back(); + __sink_unused_warning(__t); + } + template <class _XX> + static void + __back_function_requirement_violation(_XX& __s) { + typename _XX::reference __t = __s.back(); + __const_back_function_requirement_violation(__s); + __sink_unused_warning(__t); + } + template <class _XX> + static void + __push_front_function_requirement_violation(_XX& __s) { + typename _XX::value_type __t = typename _XX::value_type(); + __s.push_front(__t); + } + template <class _XX> + static void + __pop_front_function_requirement_violation(_XX& __s) { + __s.pop_front(); + } + template <class _XX> + static void + __push_back_function_requirement_violation(_XX& __s) { + typename _XX::value_type __t = typename _XX::value_type(); + __s.push_back(__t); + } + template <class _XX> + static void + __pop_back_function_requirement_violation(_XX& __s) { + __s.pop_back(); + } + +}; + +/* Sequence Containers */ + +template <class _Sequence> +struct _Sequence_concept_specification { +static void +_Sequence_requirement_violation(_Sequence __s) { + // Refinement of ForwardContainer + _ForwardContainer_concept_specification<_Sequence>::_ForwardContainer_requirement_violation(__s); + // Refinement of DefaultConstructible + _DefaultConstructible_concept_specification<_Sequence>::_DefaultConstructible_requirement_violation(__s); + // Valid Expressions + _ERROR_IN_STL_SEQ::__fill_constructor_requirement_violation(__s); + _ERROR_IN_STL_SEQ::__fill_default_constructor_requirement_violation(__s); + _ERROR_IN_STL_SEQ::__range_constructor_requirement_violation(__s); + _ERROR_IN_STL_SEQ::__insert_function_requirement_violation(__s); + _ERROR_IN_STL_SEQ::__fill_insert_function_requirement_violation(__s); + _ERROR_IN_STL_SEQ::__range_insert_function_requirement_violation(__s); + _ERROR_IN_STL_SEQ::__erase_function_requirement_violation(__s); + _ERROR_IN_STL_SEQ::__range_erase_function_requirement_violation(__s); + _ERROR_IN_STL_SEQ::__front_function_requirement_violation(__s); +} +}; + +template <class _FrontInsertionSequence> +struct _FrontInsertionSequence_concept_specification { +static void +_FrontInsertionSequence_requirement_violation(_FrontInsertionSequence __s) { + // Refinement of Sequence + _Sequence_concept_specification<_FrontInsertionSequence>::_Sequence_requirement_violation(__s); + // Valid Expressions + _ERROR_IN_STL_SEQ::__push_front_function_requirement_violation(__s); + _ERROR_IN_STL_SEQ::__pop_front_function_requirement_violation(__s); +} +}; + +template <class _BackInsertionSequence> +struct _BackInsertionSequence_concept_specification { +static void +_BackInsertionSequence_requirement_violation(_BackInsertionSequence __s) { + // Refinement of Sequence + _Sequence_concept_specification<_BackInsertionSequence>::_Sequence_requirement_violation(__s); + // Valid Expressions + _ERROR_IN_STL_SEQ::__back_function_requirement_violation(__s); + _ERROR_IN_STL_SEQ::__push_back_function_requirement_violation(__s); + _ERROR_IN_STL_SEQ::__pop_back_function_requirement_violation(__s); +} +}; + +#endif /* if __STL_USE_CONCEPT_CHECKS */ + + +#endif /* STL_SEQUENCE_CONCEPTS_H */ diff --git a/dtm_release/local/include/stl/set b/dtm_release/local/include/stl/set new file mode 100644 index 0000000000000000000000000000000000000000..c836c4596d28f0cedb1215d29025675e2c5e2255 --- /dev/null +++ b/dtm_release/local/include/stl/set @@ -0,0 +1,40 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_SET +#define __SGI_STL_SET + +#ifndef __SGI_STL_INTERNAL_TREE_H +#include <stl_tree.h> +#endif +#include <stl_set.h> +#include <stl_multiset.h> + +#endif /* __SGI_STL_SET */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/set.h b/dtm_release/local/include/stl/set.h new file mode 100644 index 0000000000000000000000000000000000000000..779f395c1a402c866897b67d402a061f1667641d --- /dev/null +++ b/dtm_release/local/include/stl/set.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_SET_H +#define __SGI_STL_SET_H + +#ifndef __SGI_STL_INTERNAL_TREE_H +#include <stl_tree.h> +#endif +#include <algobase.h> +#include <alloc.h> +#include <stl_set.h> + +#ifdef __STL_USE_NAMESPACES +using __STD::rb_tree; +using __STD::set; +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_SET_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/slist b/dtm_release/local/include/stl/slist new file mode 100644 index 0000000000000000000000000000000000000000..c3ec74204c55d073b6fd48b536dd6325d1f63347 --- /dev/null +++ b/dtm_release/local/include/stl/slist @@ -0,0 +1,28 @@ +/* + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +#ifndef __SGI_STL_SLIST +#define __SGI_STL_SLIST + +#include <stl_algobase.h> +#include <stl_alloc.h> +#include <stl_construct.h> +#include <stl_uninitialized.h> +#include <stl_slist.h> + +#endif /* __SGI_STL_SLIST */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/slist.h b/dtm_release/local/include/stl/slist.h new file mode 100644 index 0000000000000000000000000000000000000000..d2377b0cf5aef6b8e9446349316f3fdd7f346cca --- /dev/null +++ b/dtm_release/local/include/stl/slist.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +#ifndef __SGI_STL_SLIST_H +#define __SGI_STL_SLIST_H + +#include <algobase.h> +#include <alloc.h> +#include <stl_slist.h> + +#ifdef __STL_USE_NAMESPACES +using __STD::slist; +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_SLIST_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stack b/dtm_release/local/include/stl/stack new file mode 100644 index 0000000000000000000000000000000000000000..36461d95b8c46373cd1f59f3f2c9160d89e985d2 --- /dev/null +++ b/dtm_release/local/include/stl/stack @@ -0,0 +1,41 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_STACK +#define __SGI_STL_STACK + +#include <stl_algobase.h> +#include <stl_alloc.h> +#include <stl_construct.h> +#include <stl_uninitialized.h> +#include <stl_deque.h> +#include <stl_stack.h> + +#endif /* __SGI_STL_STACK */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stack.h b/dtm_release/local/include/stl/stack.h new file mode 100644 index 0000000000000000000000000000000000000000..89beca82f1288e35fa4b9c1149f837c76d85ce38 --- /dev/null +++ b/dtm_release/local/include/stl/stack.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_STACK_H +#define __SGI_STL_STACK_H + +#include <vector.h> +#include <deque.h> +#include <heap.h> +#include <stl_stack.h> +#include <stl_queue.h> + +#ifdef __STL_USE_NAMESPACES +using __STD::stack; +using __STD::queue; +using __STD::priority_queue; +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_STACK_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stdexcept b/dtm_release/local/include/stl/stdexcept new file mode 100644 index 0000000000000000000000000000000000000000..ca99369cbe5890b2b559f3080849323b82aa3f72 --- /dev/null +++ b/dtm_release/local/include/stl/stdexcept @@ -0,0 +1,96 @@ +/* + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STDEXCEPT +#define __SGI_STDEXCEPT + +#include <stl_exception.h> + +#if defined(__STL_USE_EXCEPTIONS) || \ + !(defined(_MIPS_SIM) && defined(_ABIO32) && _MIPS_SIM == _ABIO32) + +#include <stl_string_fwd.h> + +__STL_BEGIN_NAMESPACE + +class __Named_exception : public __STL_EXCEPTION_BASE { +public: + __Named_exception(const string& __str) { + strncpy(_M_name, __get_c_string(__str), _S_bufsize); + _M_name[_S_bufsize - 1] = '\0'; + } + virtual const char* what() const __STL_NOTHROW { return _M_name; } + +private: + enum { _S_bufsize = 256 }; + char _M_name[_S_bufsize]; +}; + +class logic_error : public __Named_exception { +public: + logic_error(const string& __s) : __Named_exception(__s) {} +}; + +class runtime_error : public __Named_exception { +public: + runtime_error(const string& __s) : __Named_exception(__s) {} +}; + +class domain_error : public logic_error { +public: + domain_error(const string& __arg) : logic_error(__arg) {} +}; + +class invalid_argument : public logic_error { +public: + invalid_argument(const string& __arg) : logic_error(__arg) {} +}; + +class length_error : public logic_error { +public: + length_error(const string& __arg) : logic_error(__arg) {} +}; + +class out_of_range : public logic_error { +public: + out_of_range(const string& __arg) : logic_error(__arg) {} +}; + +class range_error : public runtime_error { +public: + range_error(const string& __arg) : runtime_error(__arg) {} +}; + +class overflow_error : public runtime_error { +public: + overflow_error(const string& __arg) : runtime_error(__arg) {} +}; + +class underflow_error : public runtime_error { +public: + underflow_error(const string& __arg) : runtime_error(__arg) {} +}; + +__STL_END_NAMESPACE + +#ifndef __SGI_STL_STRING +#include <string> +#endif + +#endif /* Not o32, and no exceptions */ + +#endif /* __SGI_STDEXCEPT */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_algo.h b/dtm_release/local/include/stl/stl_algo.h new file mode 100644 index 0000000000000000000000000000000000000000..37dbf4ab745e4df9c7221e9beacea3c5dac68f0a --- /dev/null +++ b/dtm_release/local/include/stl/stl_algo.h @@ -0,0 +1,3297 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_ALGO_H +#define __SGI_STL_INTERNAL_ALGO_H + +#include <stl_heap.h> + +// See concept_checks.h for the concept-checking macros +// __STL_REQUIRES, __STL_CONVERTIBLE, etc. + + +__STL_BEGIN_NAMESPACE + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1209 +#endif + +// __median (an extension, not present in the C++ standard). + +template <class _Tp> +inline const _Tp& __median(const _Tp& __a, const _Tp& __b, const _Tp& __c) { + __STL_REQUIRES(_Tp, _LessThanComparable); + if (__a < __b) + if (__b < __c) + return __b; + else if (__a < __c) + return __c; + else + return __a; + else if (__a < __c) + return __a; + else if (__b < __c) + return __c; + else + return __b; +} + +template <class _Tp, class _Compare> +inline const _Tp& +__median(const _Tp& __a, const _Tp& __b, const _Tp& __c, _Compare __comp) { + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, _Tp, _Tp); + if (__comp(__a, __b)) + if (__comp(__b, __c)) + return __b; + else if (__comp(__a, __c)) + return __c; + else + return __a; + else if (__comp(__a, __c)) + return __a; + else if (__comp(__b, __c)) + return __c; + else + return __b; +} + +// for_each. Apply a function to every element of a range. +template <class _InputIter, class _Function> +_Function for_each(_InputIter __first, _InputIter __last, _Function __f) { + __STL_REQUIRES(_InputIter, _InputIterator); + for ( ; __first != __last; ++__first) + __f(*__first); + return __f; +} + +// find and find_if. + +template <class _InputIter, class _Tp> +inline _InputIter find(_InputIter __first, _InputIter __last, + const _Tp& __val, + input_iterator_tag) +{ + while (__first != __last && !(*__first == __val)) + ++__first; + return __first; +} + +template <class _InputIter, class _Predicate> +inline _InputIter find_if(_InputIter __first, _InputIter __last, + _Predicate __pred, + input_iterator_tag) +{ + while (__first != __last && !__pred(*__first)) + ++__first; + return __first; +} + +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + +template <class _RandomAccessIter, class _Tp> +_RandomAccessIter find(_RandomAccessIter __first, _RandomAccessIter __last, + const _Tp& __val, + random_access_iterator_tag) +{ + typename iterator_traits<_RandomAccessIter>::difference_type __trip_count + = (__last - __first) >> 2; + + for ( ; __trip_count > 0 ; --__trip_count) { + if (*__first == __val) return __first; + ++__first; + + if (*__first == __val) return __first; + ++__first; + + if (*__first == __val) return __first; + ++__first; + + if (*__first == __val) return __first; + ++__first; + } + + switch(__last - __first) { + case 3: + if (*__first == __val) return __first; + ++__first; + case 2: + if (*__first == __val) return __first; + ++__first; + case 1: + if (*__first == __val) return __first; + ++__first; + case 0: + default: + return __last; + } +} + +template <class _RandomAccessIter, class _Predicate> +_RandomAccessIter find_if(_RandomAccessIter __first, _RandomAccessIter __last, + _Predicate __pred, + random_access_iterator_tag) +{ + typename iterator_traits<_RandomAccessIter>::difference_type __trip_count + = (__last - __first) >> 2; + + for ( ; __trip_count > 0 ; --__trip_count) { + if (__pred(*__first)) return __first; + ++__first; + + if (__pred(*__first)) return __first; + ++__first; + + if (__pred(*__first)) return __first; + ++__first; + + if (__pred(*__first)) return __first; + ++__first; + } + + switch(__last - __first) { + case 3: + if (__pred(*__first)) return __first; + ++__first; + case 2: + if (__pred(*__first)) return __first; + ++__first; + case 1: + if (__pred(*__first)) return __first; + ++__first; + case 0: + default: + return __last; + } +} + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +template <class _InputIter, class _Tp> +inline _InputIter find(_InputIter __first, _InputIter __last, + const _Tp& __val) +{ + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_REQUIRES_BINARY_OP(_OP_EQUAL, bool, + typename iterator_traits<_InputIter>::value_type, _Tp); + return find(__first, __last, __val, __ITERATOR_CATEGORY(__first)); +} + +template <class _InputIter, class _Predicate> +inline _InputIter find_if(_InputIter __first, _InputIter __last, + _Predicate __pred) { + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_UNARY_FUNCTION_CHECK(_Predicate, bool, + typename iterator_traits<_InputIter>::value_type); + return find_if(__first, __last, __pred, __ITERATOR_CATEGORY(__first)); +} + +// adjacent_find. + +template <class _ForwardIter> +_ForwardIter adjacent_find(_ForwardIter __first, _ForwardIter __last) { + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_REQUIRES(typename iterator_traits<_ForwardIter>::value_type, + _EqualityComparable); + if (__first == __last) + return __last; + _ForwardIter __next = __first; + while(++__next != __last) { + if (*__first == *__next) + return __first; + __first = __next; + } + return __last; +} + +template <class _ForwardIter, class _BinaryPredicate> +_ForwardIter adjacent_find(_ForwardIter __first, _ForwardIter __last, + _BinaryPredicate __binary_pred) { + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_BINARY_FUNCTION_CHECK(_BinaryPredicate, bool, + typename iterator_traits<_ForwardIter>::value_type, + typename iterator_traits<_ForwardIter>::value_type); + if (__first == __last) + return __last; + _ForwardIter __next = __first; + while(++__next != __last) { + if (__binary_pred(*__first, *__next)) + return __first; + __first = __next; + } + return __last; +} + +// count and count_if. There are two version of each, one whose return type +// type is void and one (present only if we have partial specialization) +// whose return type is iterator_traits<_InputIter>::difference_type. The +// C++ standard only has the latter version, but the former, which was present +// in the HP STL, is retained for backward compatibility. + +template <class _InputIter, class _Tp, class _Size> +void count(_InputIter __first, _InputIter __last, const _Tp& __value, + _Size& __n) { + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_REQUIRES(typename iterator_traits<_InputIter>::value_type, + _EqualityComparable); + __STL_REQUIRES(_Tp, _EqualityComparable); + for ( ; __first != __last; ++__first) + if (*__first == __value) + ++__n; +} + +template <class _InputIter, class _Predicate, class _Size> +void count_if(_InputIter __first, _InputIter __last, _Predicate __pred, + _Size& __n) { + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_UNARY_FUNCTION_CHECK(_Predicate, bool, + typename iterator_traits<_InputIter>::value_type); + for ( ; __first != __last; ++__first) + if (__pred(*__first)) + ++__n; +} + +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + +template <class _InputIter, class _Tp> +typename iterator_traits<_InputIter>::difference_type +count(_InputIter __first, _InputIter __last, const _Tp& __value) { + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_REQUIRES(typename iterator_traits<_InputIter>::value_type, + _EqualityComparable); + __STL_REQUIRES(_Tp, _EqualityComparable); + typename iterator_traits<_InputIter>::difference_type __n = 0; + for ( ; __first != __last; ++__first) + if (*__first == __value) + ++__n; + return __n; +} + +template <class _InputIter, class _Predicate> +typename iterator_traits<_InputIter>::difference_type +count_if(_InputIter __first, _InputIter __last, _Predicate __pred) { + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_UNARY_FUNCTION_CHECK(_Predicate, bool, + typename iterator_traits<_InputIter>::value_type); + typename iterator_traits<_InputIter>::difference_type __n = 0; + for ( ; __first != __last; ++__first) + if (__pred(*__first)) + ++__n; + return __n; +} + + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +// search. + +template <class _ForwardIter1, class _ForwardIter2> +_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1, + _ForwardIter2 __first2, _ForwardIter2 __last2) +{ + __STL_REQUIRES(_ForwardIter1, _ForwardIterator); + __STL_REQUIRES(_ForwardIter2, _ForwardIterator); + __STL_REQUIRES_BINARY_OP(_OP_EQUAL, bool, + typename iterator_traits<_ForwardIter1>::value_type, + typename iterator_traits<_ForwardIter2>::value_type); + + // Test for empty ranges + if (__first1 == __last1 || __first2 == __last2) + return __first1; + + // Test for a pattern of length 1. + _ForwardIter2 __tmp(__first2); + ++__tmp; + if (__tmp == __last2) + return find(__first1, __last1, *__first2); + + // General case. + + _ForwardIter2 __p1, __p; + + __p1 = __first2; ++__p1; + + _ForwardIter1 __current = __first1; + + while (__first1 != __last1) { + __first1 = find(__first1, __last1, *__first2); + if (__first1 == __last1) + return __last1; + + __p = __p1; + __current = __first1; + if (++__current == __last1) + return __last1; + + while (*__current == *__p) { + if (++__p == __last2) + return __first1; + if (++__current == __last1) + return __last1; + } + + ++__first1; + } + return __first1; +} + +template <class _ForwardIter1, class _ForwardIter2, class _BinaryPred> +_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1, + _ForwardIter2 __first2, _ForwardIter2 __last2, + _BinaryPred __predicate) +{ + __STL_REQUIRES(_ForwardIter1, _ForwardIterator); + __STL_REQUIRES(_ForwardIter2, _ForwardIterator); + __STL_BINARY_FUNCTION_CHECK(_BinaryPred, bool, + typename iterator_traits<_ForwardIter1>::value_type, + typename iterator_traits<_ForwardIter2>::value_type); + + // Test for empty ranges + if (__first1 == __last1 || __first2 == __last2) + return __first1; + + // Test for a pattern of length 1. + _ForwardIter2 __tmp(__first2); + ++__tmp; + if (__tmp == __last2) { + while (__first1 != __last1 && !__predicate(*__first1, *__first2)) + ++__first1; + return __first1; + } + + // General case. + + _ForwardIter2 __p1, __p; + + __p1 = __first2; ++__p1; + + _ForwardIter1 __current = __first1; + + while (__first1 != __last1) { + while (__first1 != __last1) { + if (__predicate(*__first1, *__first2)) + break; + ++__first1; + } + while (__first1 != __last1 && !__predicate(*__first1, *__first2)) + ++__first1; + if (__first1 == __last1) + return __last1; + + __p = __p1; + __current = __first1; + if (++__current == __last1) return __last1; + + while (__predicate(*__current, *__p)) { + if (++__p == __last2) + return __first1; + if (++__current == __last1) + return __last1; + } + + ++__first1; + } + return __first1; +} + +// search_n. Search for __count consecutive copies of __val. + +template <class _ForwardIter, class _Integer, class _Tp> +_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last, + _Integer __count, const _Tp& __val) { + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_REQUIRES(typename iterator_traits<_ForwardIter>::value_type, + _EqualityComparable); + __STL_REQUIRES(_Tp, _EqualityComparable); + + if (__count <= 0) + return __first; + else { + __first = find(__first, __last, __val); + while (__first != __last) { + _Integer __n = __count - 1; + _ForwardIter __i = __first; + ++__i; + while (__i != __last && __n != 0 && *__i == __val) { + ++__i; + --__n; + } + if (__n == 0) + return __first; + else + __first = find(__i, __last, __val); + } + return __last; + } +} + +template <class _ForwardIter, class _Integer, class _Tp, class _BinaryPred> +_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last, + _Integer __count, const _Tp& __val, + _BinaryPred __binary_pred) { + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_BINARY_FUNCTION_CHECK(_BinaryPred, bool, + typename iterator_traits<_ForwardIter>::value_type, _Tp); + if (__count <= 0) + return __first; + else { + while (__first != __last) { + if (__binary_pred(*__first, __val)) + break; + ++__first; + } + while (__first != __last) { + _Integer __n = __count - 1; + _ForwardIter __i = __first; + ++__i; + while (__i != __last && __n != 0 && __binary_pred(*__i, __val)) { + ++__i; + --__n; + } + if (__n == 0) + return __first; + else { + while (__i != __last) { + if (__binary_pred(*__i, __val)) + break; + ++__i; + } + __first = __i; + } + } + return __last; + } +} + +// swap_ranges + +template <class _ForwardIter1, class _ForwardIter2> +_ForwardIter2 swap_ranges(_ForwardIter1 __first1, _ForwardIter1 __last1, + _ForwardIter2 __first2) { + __STL_REQUIRES(_ForwardIter1, _Mutable_ForwardIterator); + __STL_REQUIRES(_ForwardIter2, _Mutable_ForwardIterator); + __STL_CONVERTIBLE(typename iterator_traits<_ForwardIter1>::value_type, + typename iterator_traits<_ForwardIter2>::value_type); + __STL_CONVERTIBLE(typename iterator_traits<_ForwardIter2>::value_type, + typename iterator_traits<_ForwardIter1>::value_type); + for ( ; __first1 != __last1; ++__first1, ++__first2) + iter_swap(__first1, __first2); + return __first2; +} + +// transform + +template <class _InputIter, class _OutputIter, class _UnaryOperation> +_OutputIter transform(_InputIter __first, _InputIter __last, + _OutputIter __result, _UnaryOperation __opr) { + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + + for ( ; __first != __last; ++__first, ++__result) + *__result = __opr(*__first); + return __result; +} + +template <class _InputIter1, class _InputIter2, class _OutputIter, + class _BinaryOperation> +_OutputIter transform(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _OutputIter __result, + _BinaryOperation __binary_op) { + __STL_REQUIRES(_InputIter1, _InputIterator); + __STL_REQUIRES(_InputIter2, _InputIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + for ( ; __first1 != __last1; ++__first1, ++__first2, ++__result) + *__result = __binary_op(*__first1, *__first2); + return __result; +} + +// replace, replace_if, replace_copy, replace_copy_if + +template <class _ForwardIter, class _Tp> +void replace(_ForwardIter __first, _ForwardIter __last, + const _Tp& __old_value, const _Tp& __new_value) { + __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); + __STL_REQUIRES_BINARY_OP(_OP_EQUAL, bool, + typename iterator_traits<_ForwardIter>::value_type, _Tp); + __STL_CONVERTIBLE(_Tp, typename iterator_traits<_ForwardIter>::value_type); + for ( ; __first != __last; ++__first) + if (*__first == __old_value) + *__first = __new_value; +} + +template <class _ForwardIter, class _Predicate, class _Tp> +void replace_if(_ForwardIter __first, _ForwardIter __last, + _Predicate __pred, const _Tp& __new_value) { + __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); + __STL_CONVERTIBLE(_Tp, typename iterator_traits<_ForwardIter>::value_type); + __STL_UNARY_FUNCTION_CHECK(_Predicate, bool, + typename iterator_traits<_ForwardIter>::value_type); + for ( ; __first != __last; ++__first) + if (__pred(*__first)) + *__first = __new_value; +} + +template <class _InputIter, class _OutputIter, class _Tp> +_OutputIter replace_copy(_InputIter __first, _InputIter __last, + _OutputIter __result, + const _Tp& __old_value, const _Tp& __new_value) { + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + __STL_REQUIRES_BINARY_OP(_OP_EQUAL, bool, + typename iterator_traits<_InputIter>::value_type, _Tp); + for ( ; __first != __last; ++__first, ++__result) + *__result = *__first == __old_value ? __new_value : *__first; + return __result; +} + +template <class _InputIter, class _OutputIter, class _Predicate, class _Tp> +_OutputIter replace_copy_if(_InputIter __first, _InputIter __last, + _OutputIter __result, + _Predicate __pred, const _Tp& __new_value) { + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + __STL_UNARY_FUNCTION_CHECK(_Predicate, bool, + typename iterator_traits<_InputIter>::value_type); + for ( ; __first != __last; ++__first, ++__result) + *__result = __pred(*__first) ? __new_value : *__first; + return __result; +} + +// generate and generate_n + +template <class _ForwardIter, class _Generator> +void generate(_ForwardIter __first, _ForwardIter __last, _Generator __gen) { + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_GENERATOR_CHECK(_Generator, + typename iterator_traits<_ForwardIter>::value_type); + for ( ; __first != __last; ++__first) + *__first = __gen(); +} + +template <class _OutputIter, class _Size, class _Generator> +_OutputIter generate_n(_OutputIter __first, _Size __n, _Generator __gen) { + __STL_REQUIRES(_OutputIter, _OutputIterator); + for ( ; __n > 0; --__n, ++__first) + *__first = __gen(); + return __first; +} + +// remove, remove_if, remove_copy, remove_copy_if + +template <class _InputIter, class _OutputIter, class _Tp> +_OutputIter remove_copy(_InputIter __first, _InputIter __last, + _OutputIter __result, const _Tp& __value) { + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + __STL_REQUIRES_BINARY_OP(_OP_EQUAL, bool, + typename iterator_traits<_InputIter>::value_type, _Tp); + for ( ; __first != __last; ++__first) + if (!(*__first == __value)) { + *__result = *__first; + ++__result; + } + return __result; +} + +template <class _InputIter, class _OutputIter, class _Predicate> +_OutputIter remove_copy_if(_InputIter __first, _InputIter __last, + _OutputIter __result, _Predicate __pred) { + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + __STL_UNARY_FUNCTION_CHECK(_Predicate, bool, + typename iterator_traits<_InputIter>::value_type); + for ( ; __first != __last; ++__first) + if (!__pred(*__first)) { + *__result = *__first; + ++__result; + } + return __result; +} + +template <class _ForwardIter, class _Tp> +_ForwardIter remove(_ForwardIter __first, _ForwardIter __last, + const _Tp& __value) { + __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); + __STL_REQUIRES_BINARY_OP(_OP_EQUAL, bool, + typename iterator_traits<_ForwardIter>::value_type, _Tp); + __STL_CONVERTIBLE(_Tp, typename iterator_traits<_ForwardIter>::value_type); + __first = find(__first, __last, __value); + _ForwardIter __i = __first; + return __first == __last ? __first + : remove_copy(++__i, __last, __first, __value); +} + +template <class _ForwardIter, class _Predicate> +_ForwardIter remove_if(_ForwardIter __first, _ForwardIter __last, + _Predicate __pred) { + __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); + __STL_UNARY_FUNCTION_CHECK(_Predicate, bool, + typename iterator_traits<_ForwardIter>::value_type); + __first = find_if(__first, __last, __pred); + _ForwardIter __i = __first; + return __first == __last ? __first + : remove_copy_if(++__i, __last, __first, __pred); +} + +// unique and unique_copy + +template <class _InputIter, class _OutputIter, class _Tp> +_OutputIter __unique_copy(_InputIter __first, _InputIter __last, + _OutputIter __result, _Tp*) { + _Tp __value = *__first; + *__result = __value; + while (++__first != __last) + if (!(__value == *__first)) { + __value = *__first; + *++__result = __value; + } + return ++__result; +} + +template <class _InputIter, class _OutputIter> +inline _OutputIter __unique_copy(_InputIter __first, _InputIter __last, + _OutputIter __result, + output_iterator_tag) { + return __unique_copy(__first, __last, __result, __VALUE_TYPE(__first)); +} + +template <class _InputIter, class _ForwardIter> +_ForwardIter __unique_copy(_InputIter __first, _InputIter __last, + _ForwardIter __result, forward_iterator_tag) { + *__result = *__first; + while (++__first != __last) + if (!(*__result == *__first)) + *++__result = *__first; + return ++__result; +} + +template <class _InputIter, class _OutputIter> +inline _OutputIter unique_copy(_InputIter __first, _InputIter __last, + _OutputIter __result) { + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + __STL_REQUIRES(typename iterator_traits<_InputIter>::value_type, + _EqualityComparable); + if (__first == __last) return __result; + return __unique_copy(__first, __last, __result, + __ITERATOR_CATEGORY(__result)); +} + +template <class _InputIter, class _OutputIter, class _BinaryPredicate, + class _Tp> +_OutputIter __unique_copy(_InputIter __first, _InputIter __last, + _OutputIter __result, + _BinaryPredicate __binary_pred, _Tp*) { + __STL_BINARY_FUNCTION_CHECK(_BinaryPredicate, bool, _Tp, _Tp); + _Tp __value = *__first; + *__result = __value; + while (++__first != __last) + if (!__binary_pred(__value, *__first)) { + __value = *__first; + *++__result = __value; + } + return ++__result; +} + +template <class _InputIter, class _OutputIter, class _BinaryPredicate> +inline _OutputIter __unique_copy(_InputIter __first, _InputIter __last, + _OutputIter __result, + _BinaryPredicate __binary_pred, + output_iterator_tag) { + return __unique_copy(__first, __last, __result, __binary_pred, + __VALUE_TYPE(__first)); +} + +template <class _InputIter, class _ForwardIter, class _BinaryPredicate> +_ForwardIter __unique_copy(_InputIter __first, _InputIter __last, + _ForwardIter __result, + _BinaryPredicate __binary_pred, + forward_iterator_tag) { + __STL_BINARY_FUNCTION_CHECK(_BinaryPredicate, bool, + typename iterator_traits<_ForwardIter>::value_type, + typename iterator_traits<_InputIter>::value_type); + *__result = *__first; + while (++__first != __last) + if (!__binary_pred(*__result, *__first)) *++__result = *__first; + return ++__result; +} + +template <class _InputIter, class _OutputIter, class _BinaryPredicate> +inline _OutputIter unique_copy(_InputIter __first, _InputIter __last, + _OutputIter __result, + _BinaryPredicate __binary_pred) { + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + if (__first == __last) return __result; + return __unique_copy(__first, __last, __result, __binary_pred, + __ITERATOR_CATEGORY(__result)); +} + +template <class _ForwardIter> +_ForwardIter unique(_ForwardIter __first, _ForwardIter __last) { + __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); + __STL_REQUIRES(typename iterator_traits<_ForwardIter>::value_type, + _EqualityComparable); + __first = adjacent_find(__first, __last); + return unique_copy(__first, __last, __first); +} + +template <class _ForwardIter, class _BinaryPredicate> +_ForwardIter unique(_ForwardIter __first, _ForwardIter __last, + _BinaryPredicate __binary_pred) { + __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); + __STL_BINARY_FUNCTION_CHECK(_BinaryPredicate, bool, + typename iterator_traits<_ForwardIter>::value_type, + typename iterator_traits<_ForwardIter>::value_type); + __first = adjacent_find(__first, __last, __binary_pred); + return unique_copy(__first, __last, __first, __binary_pred); +} + +// reverse and reverse_copy, and their auxiliary functions + +template <class _BidirectionalIter> +void __reverse(_BidirectionalIter __first, _BidirectionalIter __last, + bidirectional_iterator_tag) { + while (true) + if (__first == __last || __first == --__last) + return; + else + iter_swap(__first++, __last); +} + +template <class _RandomAccessIter> +void __reverse(_RandomAccessIter __first, _RandomAccessIter __last, + random_access_iterator_tag) { + while (__first < __last) + iter_swap(__first++, --__last); +} + +template <class _BidirectionalIter> +inline void reverse(_BidirectionalIter __first, _BidirectionalIter __last) { + __STL_REQUIRES(_BidirectionalIter, _Mutable_BidirectionalIterator); + __reverse(__first, __last, __ITERATOR_CATEGORY(__first)); +} + +template <class _BidirectionalIter, class _OutputIter> +_OutputIter reverse_copy(_BidirectionalIter __first, + _BidirectionalIter __last, + _OutputIter __result) { + __STL_REQUIRES(_BidirectionalIter, _BidirectionalIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + while (__first != __last) { + --__last; + *__result = *__last; + ++__result; + } + return __result; +} + +// rotate and rotate_copy, and their auxiliary functions + +template <class _EuclideanRingElement> +_EuclideanRingElement __gcd(_EuclideanRingElement __m, + _EuclideanRingElement __n) +{ + while (__n != 0) { + _EuclideanRingElement __t = __m % __n; + __m = __n; + __n = __t; + } + return __m; +} + +template <class _ForwardIter, class _Distance> +_ForwardIter __rotate(_ForwardIter __first, + _ForwardIter __middle, + _ForwardIter __last, + _Distance*, + forward_iterator_tag) { + if (__first == __middle) + return __last; + if (__last == __middle) + return __first; + + _ForwardIter __first2 = __middle; + do { + swap(*__first++, *__first2++); + if (__first == __middle) + __middle = __first2; + } while (__first2 != __last); + + _ForwardIter __new_middle = __first; + + __first2 = __middle; + + while (__first2 != __last) { + swap (*__first++, *__first2++); + if (__first == __middle) + __middle = __first2; + else if (__first2 == __last) + __first2 = __middle; + } + + return __new_middle; +} + + +template <class _BidirectionalIter, class _Distance> +_BidirectionalIter __rotate(_BidirectionalIter __first, + _BidirectionalIter __middle, + _BidirectionalIter __last, + _Distance*, + bidirectional_iterator_tag) { + __STL_REQUIRES(_BidirectionalIter, _Mutable_BidirectionalIterator); + if (__first == __middle) + return __last; + if (__last == __middle) + return __first; + + __reverse(__first, __middle, bidirectional_iterator_tag()); + __reverse(__middle, __last, bidirectional_iterator_tag()); + + while (__first != __middle && __middle != __last) + swap (*__first++, *--__last); + + if (__first == __middle) { + __reverse(__middle, __last, bidirectional_iterator_tag()); + return __last; + } + else { + __reverse(__first, __middle, bidirectional_iterator_tag()); + return __first; + } +} + +template <class _RandomAccessIter, class _Distance, class _Tp> +_RandomAccessIter __rotate(_RandomAccessIter __first, + _RandomAccessIter __middle, + _RandomAccessIter __last, + _Distance *, _Tp *) { + __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); + _Distance __n = __last - __first; + _Distance __k = __middle - __first; + _Distance __l = __n - __k; + _RandomAccessIter __result = __first + (__last - __middle); + + if (__k == 0) + return __last; + + else if (__k == __l) { + swap_ranges(__first, __middle, __middle); + return __result; + } + + _Distance __d = __gcd(__n, __k); + + for (_Distance __i = 0; __i < __d; __i++) { + _Tp __tmp = *__first; + _RandomAccessIter __p = __first; + + if (__k < __l) { + for (_Distance __j = 0; __j < __l/__d; __j++) { + if (__p > __first + __l) { + *__p = *(__p - __l); + __p -= __l; + } + + *__p = *(__p + __k); + __p += __k; + } + } + + else { + for (_Distance __j = 0; __j < __k/__d - 1; __j ++) { + if (__p < __last - __k) { + *__p = *(__p + __k); + __p += __k; + } + + *__p = * (__p - __l); + __p -= __l; + } + } + + *__p = __tmp; + ++__first; + } + + return __result; +} + +template <class _ForwardIter> +inline _ForwardIter rotate(_ForwardIter __first, _ForwardIter __middle, + _ForwardIter __last) { + __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); + return __rotate(__first, __middle, __last, + __DISTANCE_TYPE(__first), + __ITERATOR_CATEGORY(__first)); +} + +template <class _ForwardIter, class _OutputIter> +_OutputIter rotate_copy(_ForwardIter __first, _ForwardIter __middle, + _ForwardIter __last, _OutputIter __result) { + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + return copy(__first, __middle, copy(__middle, __last, __result)); +} + +// Return a random number in the range [0, __n). This function encapsulates +// whether we're using rand (part of the standard C library) or lrand48 +// (not standard, but a much better choice whenever it's available). + +template <class _Distance> +inline _Distance __random_number(_Distance __n) { +#ifdef __STL_NO_DRAND48 + return rand() % __n; +#else + return lrand48() % __n; +#endif +} + +// random_shuffle + +template <class _RandomAccessIter> +inline void random_shuffle(_RandomAccessIter __first, + _RandomAccessIter __last) { + __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); + if (__first == __last) return; + for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i) + iter_swap(__i, __first + __random_number((__i - __first) + 1)); +} + +template <class _RandomAccessIter, class _RandomNumberGenerator> +void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last, + _RandomNumberGenerator& __rand) { + __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); + if (__first == __last) return; + for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i) + iter_swap(__i, __first + __rand((__i - __first) + 1)); +} + +// random_sample and random_sample_n (extensions, not part of the standard). + +template <class _ForwardIter, class _OutputIter, class _Distance> +_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last, + _OutputIter __out, const _Distance __n) +{ + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + _Distance __remaining = 0; + distance(__first, __last, __remaining); + _Distance __m = min(__n, __remaining); + + while (__m > 0) { + if (__random_number(__remaining) < __m) { + *__out = *__first; + ++__out; + --__m; + } + + --__remaining; + ++__first; + } + return __out; +} + +template <class _ForwardIter, class _OutputIter, class _Distance, + class _RandomNumberGenerator> +_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last, + _OutputIter __out, const _Distance __n, + _RandomNumberGenerator& __rand) +{ + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + __STL_UNARY_FUNCTION_CHECK(_RandomNumberGenerator, _Distance, _Distance); + _Distance __remaining = 0; + distance(__first, __last, __remaining); + _Distance __m = min(__n, __remaining); + + while (__m > 0) { + if (__rand(__remaining) < __m) { + *__out = *__first; + ++__out; + --__m; + } + + --__remaining; + ++__first; + } + return __out; +} + +template <class _InputIter, class _RandomAccessIter, class _Distance> +_RandomAccessIter __random_sample(_InputIter __first, _InputIter __last, + _RandomAccessIter __out, + const _Distance __n) +{ + _Distance __m = 0; + _Distance __t = __n; + for ( ; __first != __last && __m < __n; ++__m, ++__first) + __out[__m] = *__first; + + while (__first != __last) { + ++__t; + _Distance __M = __random_number(__t); + if (__M < __n) + __out[__M] = *__first; + ++__first; + } + + return __out + __m; +} + +template <class _InputIter, class _RandomAccessIter, + class _RandomNumberGenerator, class _Distance> +_RandomAccessIter __random_sample(_InputIter __first, _InputIter __last, + _RandomAccessIter __out, + _RandomNumberGenerator& __rand, + const _Distance __n) +{ + __STL_UNARY_FUNCTION_CHECK(_RandomNumberGenerator, _Distance, _Distance); + _Distance __m = 0; + _Distance __t = __n; + for ( ; __first != __last && __m < __n; ++__m, ++__first) + __out[__m] = *__first; + + while (__first != __last) { + ++__t; + _Distance __M = __rand(__t); + if (__M < __n) + __out[__M] = *__first; + ++__first; + } + + return __out + __m; +} + +template <class _InputIter, class _RandomAccessIter> +inline _RandomAccessIter +random_sample(_InputIter __first, _InputIter __last, + _RandomAccessIter __out_first, _RandomAccessIter __out_last) +{ + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); + return __random_sample(__first, __last, + __out_first, __out_last - __out_first); +} + + +template <class _InputIter, class _RandomAccessIter, + class _RandomNumberGenerator> +inline _RandomAccessIter +random_sample(_InputIter __first, _InputIter __last, + _RandomAccessIter __out_first, _RandomAccessIter __out_last, + _RandomNumberGenerator& __rand) +{ + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); + return __random_sample(__first, __last, + __out_first, __rand, + __out_last - __out_first); +} + +// partition, stable_partition, and their auxiliary functions + +template <class _ForwardIter, class _Predicate> +_ForwardIter __partition(_ForwardIter __first, + _ForwardIter __last, + _Predicate __pred, + forward_iterator_tag) { + if (__first == __last) return __first; + + while (__pred(*__first)) + if (++__first == __last) return __first; + + _ForwardIter __next = __first; + + while (++__next != __last) + if (__pred(*__next)) { + swap(*__first, *__next); + ++__first; + } + + return __first; +} + +template <class _BidirectionalIter, class _Predicate> +_BidirectionalIter __partition(_BidirectionalIter __first, + _BidirectionalIter __last, + _Predicate __pred, + bidirectional_iterator_tag) { + while (true) { + while (true) + if (__first == __last) + return __first; + else if (__pred(*__first)) + ++__first; + else + break; + --__last; + while (true) + if (__first == __last) + return __first; + else if (!__pred(*__last)) + --__last; + else + break; + iter_swap(__first, __last); + ++__first; + } +} + +template <class _ForwardIter, class _Predicate> +inline _ForwardIter partition(_ForwardIter __first, + _ForwardIter __last, + _Predicate __pred) { + __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); + __STL_UNARY_FUNCTION_CHECK(_Predicate, bool, + typename iterator_traits<_ForwardIter>::value_type); + return __partition(__first, __last, __pred, __ITERATOR_CATEGORY(__first)); +} + + +template <class _ForwardIter, class _Predicate, class _Distance> +_ForwardIter __inplace_stable_partition(_ForwardIter __first, + _ForwardIter __last, + _Predicate __pred, _Distance __len) { + if (__len == 1) + return __pred(*__first) ? __last : __first; + _ForwardIter __middle = __first; + advance(__middle, __len / 2); + return rotate(__inplace_stable_partition(__first, __middle, __pred, + __len / 2), + __middle, + __inplace_stable_partition(__middle, __last, __pred, + __len - __len / 2)); +} + +template <class _ForwardIter, class _Pointer, class _Predicate, + class _Distance> +_ForwardIter __stable_partition_adaptive(_ForwardIter __first, + _ForwardIter __last, + _Predicate __pred, _Distance __len, + _Pointer __buffer, + _Distance __buffer_size) +{ + if (__len <= __buffer_size) { + _ForwardIter __result1 = __first; + _Pointer __result2 = __buffer; + for ( ; __first != __last ; ++__first) + if (__pred(*__first)) { + *__result1 = *__first; + ++__result1; + } + else { + *__result2 = *__first; + ++__result2; + } + copy(__buffer, __result2, __result1); + return __result1; + } + else { + _ForwardIter __middle = __first; + advance(__middle, __len / 2); + return rotate(__stable_partition_adaptive( + __first, __middle, __pred, + __len / 2, __buffer, __buffer_size), + __middle, + __stable_partition_adaptive( + __middle, __last, __pred, + __len - __len / 2, __buffer, __buffer_size)); + } +} + +template <class _ForwardIter, class _Predicate, class _Tp, class _Distance> +inline _ForwardIter +__stable_partition_aux(_ForwardIter __first, _ForwardIter __last, + _Predicate __pred, _Tp*, _Distance*) +{ + _Temporary_buffer<_ForwardIter, _Tp> __buf(__first, __last); + if (__buf.size() > 0) + return __stable_partition_adaptive(__first, __last, __pred, + _Distance(__buf.requested_size()), + __buf.begin(), __buf.size()); + else + return __inplace_stable_partition(__first, __last, __pred, + _Distance(__buf.requested_size())); +} + +template <class _ForwardIter, class _Predicate> +inline _ForwardIter stable_partition(_ForwardIter __first, + _ForwardIter __last, + _Predicate __pred) { + __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); + __STL_UNARY_FUNCTION_CHECK(_Predicate, bool, + typename iterator_traits<_ForwardIter>::value_type); + if (__first == __last) + return __first; + else + return __stable_partition_aux(__first, __last, __pred, + __VALUE_TYPE(__first), + __DISTANCE_TYPE(__first)); +} + +template <class _RandomAccessIter, class _Tp> +_RandomAccessIter __unguarded_partition(_RandomAccessIter __first, + _RandomAccessIter __last, + _Tp __pivot) +{ + while (true) { + while (*__first < __pivot) + ++__first; + --__last; + while (__pivot < *__last) + --__last; + if (!(__first < __last)) + return __first; + iter_swap(__first, __last); + ++__first; + } +} + +template <class _RandomAccessIter, class _Tp, class _Compare> +_RandomAccessIter __unguarded_partition(_RandomAccessIter __first, + _RandomAccessIter __last, + _Tp __pivot, _Compare __comp) +{ + while (true) { + while (__comp(*__first, __pivot)) + ++__first; + --__last; + while (__comp(__pivot, *__last)) + --__last; + if (!(__first < __last)) + return __first; + iter_swap(__first, __last); + ++__first; + } +} + +const int __stl_threshold = 16; + +// sort() and its auxiliary functions. + +template <class _RandomAccessIter, class _Tp> +void __unguarded_linear_insert(_RandomAccessIter __last, _Tp __val) { + _RandomAccessIter __next = __last; + --__next; + while (__val < *__next) { + *__last = *__next; + __last = __next; + --__next; + } + *__last = __val; +} + +template <class _RandomAccessIter, class _Tp, class _Compare> +void __unguarded_linear_insert(_RandomAccessIter __last, _Tp __val, + _Compare __comp) { + _RandomAccessIter __next = __last; + --__next; + while (__comp(__val, *__next)) { + *__last = *__next; + __last = __next; + --__next; + } + *__last = __val; +} + +template <class _RandomAccessIter, class _Tp> +inline void __linear_insert(_RandomAccessIter __first, + _RandomAccessIter __last, _Tp*) { + _Tp __val = *__last; + if (__val < *__first) { + copy_backward(__first, __last, __last + 1); + *__first = __val; + } + else + __unguarded_linear_insert(__last, __val); +} + +template <class _RandomAccessIter, class _Tp, class _Compare> +inline void __linear_insert(_RandomAccessIter __first, + _RandomAccessIter __last, _Tp*, _Compare __comp) { + _Tp __val = *__last; + if (__comp(__val, *__first)) { + copy_backward(__first, __last, __last + 1); + *__first = __val; + } + else + __unguarded_linear_insert(__last, __val, __comp); +} + +template <class _RandomAccessIter> +void __insertion_sort(_RandomAccessIter __first, _RandomAccessIter __last) { + if (__first == __last) return; + for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i) + __linear_insert(__first, __i, __VALUE_TYPE(__first)); +} + +template <class _RandomAccessIter, class _Compare> +void __insertion_sort(_RandomAccessIter __first, + _RandomAccessIter __last, _Compare __comp) { + if (__first == __last) return; + for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i) + __linear_insert(__first, __i, __VALUE_TYPE(__first), __comp); +} + +template <class _RandomAccessIter, class _Tp> +void __unguarded_insertion_sort_aux(_RandomAccessIter __first, + _RandomAccessIter __last, _Tp*) { + for (_RandomAccessIter __i = __first; __i != __last; ++__i) + __unguarded_linear_insert(__i, _Tp(*__i)); +} + +template <class _RandomAccessIter> +inline void __unguarded_insertion_sort(_RandomAccessIter __first, + _RandomAccessIter __last) { + __unguarded_insertion_sort_aux(__first, __last, __VALUE_TYPE(__first)); +} + +template <class _RandomAccessIter, class _Tp, class _Compare> +void __unguarded_insertion_sort_aux(_RandomAccessIter __first, + _RandomAccessIter __last, + _Tp*, _Compare __comp) { + for (_RandomAccessIter __i = __first; __i != __last; ++__i) + __unguarded_linear_insert(__i, _Tp(*__i), __comp); +} + +template <class _RandomAccessIter, class _Compare> +inline void __unguarded_insertion_sort(_RandomAccessIter __first, + _RandomAccessIter __last, + _Compare __comp) { + __unguarded_insertion_sort_aux(__first, __last, __VALUE_TYPE(__first), + __comp); +} + +template <class _RandomAccessIter> +void __final_insertion_sort(_RandomAccessIter __first, + _RandomAccessIter __last) { + if (__last - __first > __stl_threshold) { + __insertion_sort(__first, __first + __stl_threshold); + __unguarded_insertion_sort(__first + __stl_threshold, __last); + } + else + __insertion_sort(__first, __last); +} + +template <class _RandomAccessIter, class _Compare> +void __final_insertion_sort(_RandomAccessIter __first, + _RandomAccessIter __last, _Compare __comp) { + if (__last - __first > __stl_threshold) { + __insertion_sort(__first, __first + __stl_threshold, __comp); + __unguarded_insertion_sort(__first + __stl_threshold, __last, __comp); + } + else + __insertion_sort(__first, __last, __comp); +} + +template <class _Size> +inline _Size __lg(_Size __n) { + _Size __k; + for (__k = 0; __n != 1; __n >>= 1) ++__k; + return __k; +} + +template <class _RandomAccessIter, class _Tp, class _Size> +void __introsort_loop(_RandomAccessIter __first, + _RandomAccessIter __last, _Tp*, + _Size __depth_limit) +{ + while (__last - __first > __stl_threshold) { + if (__depth_limit == 0) { + partial_sort(__first, __last, __last); + return; + } + --__depth_limit; + _RandomAccessIter __cut = + __unguarded_partition(__first, __last, + _Tp(__median(*__first, + *(__first + (__last - __first)/2), + *(__last - 1)))); + __introsort_loop(__cut, __last, (_Tp*) 0, __depth_limit); + __last = __cut; + } +} + +template <class _RandomAccessIter, class _Tp, class _Size, class _Compare> +void __introsort_loop(_RandomAccessIter __first, + _RandomAccessIter __last, _Tp*, + _Size __depth_limit, _Compare __comp) +{ + while (__last - __first > __stl_threshold) { + if (__depth_limit == 0) { + partial_sort(__first, __last, __last, __comp); + return; + } + --__depth_limit; + _RandomAccessIter __cut = + __unguarded_partition(__first, __last, + _Tp(__median(*__first, + *(__first + (__last - __first)/2), + *(__last - 1), __comp)), + __comp); + __introsort_loop(__cut, __last, (_Tp*) 0, __depth_limit, __comp); + __last = __cut; + } +} + +template <class _RandomAccessIter> +inline void sort(_RandomAccessIter __first, _RandomAccessIter __last) { + __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); + __STL_REQUIRES(typename iterator_traits<_RandomAccessIter>::value_type, + _LessThanComparable); + if (__first != __last) { + __introsort_loop(__first, __last, + __VALUE_TYPE(__first), + __lg(__last - __first) * 2); + __final_insertion_sort(__first, __last); + } +} + +template <class _RandomAccessIter, class _Compare> +inline void sort(_RandomAccessIter __first, _RandomAccessIter __last, + _Compare __comp) { + __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, + typename iterator_traits<_RandomAccessIter>::value_type, + typename iterator_traits<_RandomAccessIter>::value_type); + if (__first != __last) { + __introsort_loop(__first, __last, + __VALUE_TYPE(__first), + __lg(__last - __first) * 2, + __comp); + __final_insertion_sort(__first, __last, __comp); + } +} + +// stable_sort() and its auxiliary functions. + +template <class _RandomAccessIter> +void __inplace_stable_sort(_RandomAccessIter __first, + _RandomAccessIter __last) { + if (__last - __first < 15) { + __insertion_sort(__first, __last); + return; + } + _RandomAccessIter __middle = __first + (__last - __first) / 2; + __inplace_stable_sort(__first, __middle); + __inplace_stable_sort(__middle, __last); + __merge_without_buffer(__first, __middle, __last, + __middle - __first, + __last - __middle); +} + +template <class _RandomAccessIter, class _Compare> +void __inplace_stable_sort(_RandomAccessIter __first, + _RandomAccessIter __last, _Compare __comp) { + if (__last - __first < 15) { + __insertion_sort(__first, __last, __comp); + return; + } + _RandomAccessIter __middle = __first + (__last - __first) / 2; + __inplace_stable_sort(__first, __middle, __comp); + __inplace_stable_sort(__middle, __last, __comp); + __merge_without_buffer(__first, __middle, __last, + __middle - __first, + __last - __middle, + __comp); +} + +template <class _RandomAccessIter1, class _RandomAccessIter2, + class _Distance> +void __merge_sort_loop(_RandomAccessIter1 __first, + _RandomAccessIter1 __last, + _RandomAccessIter2 __result, _Distance __step_size) { + _Distance __two_step = 2 * __step_size; + + while (__last - __first >= __two_step) { + __result = merge(__first, __first + __step_size, + __first + __step_size, __first + __two_step, + __result); + __first += __two_step; + } + + __step_size = min(_Distance(__last - __first), __step_size); + merge(__first, __first + __step_size, __first + __step_size, __last, + __result); +} + +template <class _RandomAccessIter1, class _RandomAccessIter2, + class _Distance, class _Compare> +void __merge_sort_loop(_RandomAccessIter1 __first, + _RandomAccessIter1 __last, + _RandomAccessIter2 __result, _Distance __step_size, + _Compare __comp) { + _Distance __two_step = 2 * __step_size; + + while (__last - __first >= __two_step) { + __result = merge(__first, __first + __step_size, + __first + __step_size, __first + __two_step, + __result, + __comp); + __first += __two_step; + } + __step_size = min(_Distance(__last - __first), __step_size); + + merge(__first, __first + __step_size, + __first + __step_size, __last, + __result, + __comp); +} + +const int __stl_chunk_size = 7; + +template <class _RandomAccessIter, class _Distance> +void __chunk_insertion_sort(_RandomAccessIter __first, + _RandomAccessIter __last, _Distance __chunk_size) +{ + while (__last - __first >= __chunk_size) { + __insertion_sort(__first, __first + __chunk_size); + __first += __chunk_size; + } + __insertion_sort(__first, __last); +} + +template <class _RandomAccessIter, class _Distance, class _Compare> +void __chunk_insertion_sort(_RandomAccessIter __first, + _RandomAccessIter __last, + _Distance __chunk_size, _Compare __comp) +{ + while (__last - __first >= __chunk_size) { + __insertion_sort(__first, __first + __chunk_size, __comp); + __first += __chunk_size; + } + __insertion_sort(__first, __last, __comp); +} + +template <class _RandomAccessIter, class _Pointer, class _Distance> +void __merge_sort_with_buffer(_RandomAccessIter __first, + _RandomAccessIter __last, + _Pointer __buffer, _Distance*) { + _Distance __len = __last - __first; + _Pointer __buffer_last = __buffer + __len; + + _Distance __step_size = __stl_chunk_size; + __chunk_insertion_sort(__first, __last, __step_size); + + while (__step_size < __len) { + __merge_sort_loop(__first, __last, __buffer, __step_size); + __step_size *= 2; + __merge_sort_loop(__buffer, __buffer_last, __first, __step_size); + __step_size *= 2; + } +} + +template <class _RandomAccessIter, class _Pointer, class _Distance, + class _Compare> +void __merge_sort_with_buffer(_RandomAccessIter __first, + _RandomAccessIter __last, _Pointer __buffer, + _Distance*, _Compare __comp) { + _Distance __len = __last - __first; + _Pointer __buffer_last = __buffer + __len; + + _Distance __step_size = __stl_chunk_size; + __chunk_insertion_sort(__first, __last, __step_size, __comp); + + while (__step_size < __len) { + __merge_sort_loop(__first, __last, __buffer, __step_size, __comp); + __step_size *= 2; + __merge_sort_loop(__buffer, __buffer_last, __first, __step_size, __comp); + __step_size *= 2; + } +} + +template <class _RandomAccessIter, class _Pointer, class _Distance> +void __stable_sort_adaptive(_RandomAccessIter __first, + _RandomAccessIter __last, _Pointer __buffer, + _Distance __buffer_size) { + _Distance __len = (__last - __first + 1) / 2; + _RandomAccessIter __middle = __first + __len; + if (__len > __buffer_size) { + __stable_sort_adaptive(__first, __middle, __buffer, __buffer_size); + __stable_sort_adaptive(__middle, __last, __buffer, __buffer_size); + } + else { + __merge_sort_with_buffer(__first, __middle, __buffer, (_Distance*)0); + __merge_sort_with_buffer(__middle, __last, __buffer, (_Distance*)0); + } + __merge_adaptive(__first, __middle, __last, _Distance(__middle - __first), + _Distance(__last - __middle), __buffer, __buffer_size); +} + +template <class _RandomAccessIter, class _Pointer, class _Distance, + class _Compare> +void __stable_sort_adaptive(_RandomAccessIter __first, + _RandomAccessIter __last, _Pointer __buffer, + _Distance __buffer_size, _Compare __comp) { + _Distance __len = (__last - __first + 1) / 2; + _RandomAccessIter __middle = __first + __len; + if (__len > __buffer_size) { + __stable_sort_adaptive(__first, __middle, __buffer, __buffer_size, + __comp); + __stable_sort_adaptive(__middle, __last, __buffer, __buffer_size, + __comp); + } + else { + __merge_sort_with_buffer(__first, __middle, __buffer, (_Distance*)0, + __comp); + __merge_sort_with_buffer(__middle, __last, __buffer, (_Distance*)0, + __comp); + } + __merge_adaptive(__first, __middle, __last, _Distance(__middle - __first), + _Distance(__last - __middle), __buffer, __buffer_size, + __comp); +} + +template <class _RandomAccessIter, class _Tp, class _Distance> +inline void __stable_sort_aux(_RandomAccessIter __first, + _RandomAccessIter __last, _Tp*, _Distance*) { + _Temporary_buffer<_RandomAccessIter, _Tp> buf(__first, __last); + if (buf.begin() == 0) + __inplace_stable_sort(__first, __last); + else + __stable_sort_adaptive(__first, __last, buf.begin(), + _Distance(buf.size())); +} + +template <class _RandomAccessIter, class _Tp, class _Distance, class _Compare> +inline void __stable_sort_aux(_RandomAccessIter __first, + _RandomAccessIter __last, _Tp*, _Distance*, + _Compare __comp) { + _Temporary_buffer<_RandomAccessIter, _Tp> buf(__first, __last); + if (buf.begin() == 0) + __inplace_stable_sort(__first, __last, __comp); + else + __stable_sort_adaptive(__first, __last, buf.begin(), + _Distance(buf.size()), + __comp); +} + +template <class _RandomAccessIter> +inline void stable_sort(_RandomAccessIter __first, + _RandomAccessIter __last) { + __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); + __STL_REQUIRES(typename iterator_traits<_RandomAccessIter>::value_type, + _LessThanComparable); + __stable_sort_aux(__first, __last, + __VALUE_TYPE(__first), + __DISTANCE_TYPE(__first)); +} + +template <class _RandomAccessIter, class _Compare> +inline void stable_sort(_RandomAccessIter __first, + _RandomAccessIter __last, _Compare __comp) { + __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, + typename iterator_traits<_RandomAccessIter>::value_type, + typename iterator_traits<_RandomAccessIter>::value_type); + __stable_sort_aux(__first, __last, + __VALUE_TYPE(__first), + __DISTANCE_TYPE(__first), + __comp); +} + +// partial_sort, partial_sort_copy, and auxiliary functions. + +template <class _RandomAccessIter, class _Tp> +void __partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle, + _RandomAccessIter __last, _Tp*) { + make_heap(__first, __middle); + for (_RandomAccessIter __i = __middle; __i < __last; ++__i) + if (*__i < *__first) + __pop_heap(__first, __middle, __i, _Tp(*__i), + __DISTANCE_TYPE(__first)); + sort_heap(__first, __middle); +} + +template <class _RandomAccessIter> +inline void partial_sort(_RandomAccessIter __first, + _RandomAccessIter __middle, + _RandomAccessIter __last) { + __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); + __STL_REQUIRES(typename iterator_traits<_RandomAccessIter>::value_type, + _LessThanComparable); + __partial_sort(__first, __middle, __last, __VALUE_TYPE(__first)); +} + +template <class _RandomAccessIter, class _Tp, class _Compare> +void __partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle, + _RandomAccessIter __last, _Tp*, _Compare __comp) { + make_heap(__first, __middle, __comp); + for (_RandomAccessIter __i = __middle; __i < __last; ++__i) + if (__comp(*__i, *__first)) + __pop_heap(__first, __middle, __i, _Tp(*__i), __comp, + __DISTANCE_TYPE(__first)); + sort_heap(__first, __middle, __comp); +} + +template <class _RandomAccessIter, class _Compare> +inline void partial_sort(_RandomAccessIter __first, + _RandomAccessIter __middle, + _RandomAccessIter __last, _Compare __comp) { + __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, + typename iterator_traits<_RandomAccessIter>::value_type, + typename iterator_traits<_RandomAccessIter>::value_type); + __partial_sort(__first, __middle, __last, __VALUE_TYPE(__first), __comp); +} + +template <class _InputIter, class _RandomAccessIter, class _Distance, + class _Tp> +_RandomAccessIter __partial_sort_copy(_InputIter __first, + _InputIter __last, + _RandomAccessIter __result_first, + _RandomAccessIter __result_last, + _Distance*, _Tp*) { + if (__result_first == __result_last) return __result_last; + _RandomAccessIter __result_real_last = __result_first; + while(__first != __last && __result_real_last != __result_last) { + *__result_real_last = *__first; + ++__result_real_last; + ++__first; + } + make_heap(__result_first, __result_real_last); + while (__first != __last) { + if (*__first < *__result_first) + __adjust_heap(__result_first, _Distance(0), + _Distance(__result_real_last - __result_first), + _Tp(*__first)); + ++__first; + } + sort_heap(__result_first, __result_real_last); + return __result_real_last; +} + +template <class _InputIter, class _RandomAccessIter> +inline _RandomAccessIter +partial_sort_copy(_InputIter __first, _InputIter __last, + _RandomAccessIter __result_first, + _RandomAccessIter __result_last) { + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); + __STL_CONVERTIBLE(typename iterator_traits<_InputIter>::value_type, + typename iterator_traits<_RandomAccessIter>::value_type); + __STL_REQUIRES(typename iterator_traits<_RandomAccessIter>::value_type, + _LessThanComparable); + __STL_REQUIRES(typename iterator_traits<_InputIter>::value_type, + _LessThanComparable); + return __partial_sort_copy(__first, __last, __result_first, __result_last, + __DISTANCE_TYPE(__result_first), + __VALUE_TYPE(__first)); +} + +template <class _InputIter, class _RandomAccessIter, class _Compare, + class _Distance, class _Tp> +_RandomAccessIter __partial_sort_copy(_InputIter __first, + _InputIter __last, + _RandomAccessIter __result_first, + _RandomAccessIter __result_last, + _Compare __comp, _Distance*, _Tp*) { + if (__result_first == __result_last) return __result_last; + _RandomAccessIter __result_real_last = __result_first; + while(__first != __last && __result_real_last != __result_last) { + *__result_real_last = *__first; + ++__result_real_last; + ++__first; + } + make_heap(__result_first, __result_real_last, __comp); + while (__first != __last) { + if (__comp(*__first, *__result_first)) + __adjust_heap(__result_first, _Distance(0), + _Distance(__result_real_last - __result_first), + _Tp(*__first), + __comp); + ++__first; + } + sort_heap(__result_first, __result_real_last, __comp); + return __result_real_last; +} + +template <class _InputIter, class _RandomAccessIter, class _Compare> +inline _RandomAccessIter +partial_sort_copy(_InputIter __first, _InputIter __last, + _RandomAccessIter __result_first, + _RandomAccessIter __result_last, _Compare __comp) { + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); + __STL_CONVERTIBLE(typename iterator_traits<_InputIter>::value_type, + typename iterator_traits<_RandomAccessIter>::value_type); + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, + typename iterator_traits<_RandomAccessIter>::value_type, + typename iterator_traits<_RandomAccessIter>::value_type); + return __partial_sort_copy(__first, __last, __result_first, __result_last, + __comp, + __DISTANCE_TYPE(__result_first), + __VALUE_TYPE(__first)); +} + +// nth_element() and its auxiliary functions. + +template <class _RandomAccessIter, class _Tp> +void __nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, + _RandomAccessIter __last, _Tp*) { + while (__last - __first > 3) { + _RandomAccessIter __cut = + __unguarded_partition(__first, __last, + _Tp(__median(*__first, + *(__first + (__last - __first)/2), + *(__last - 1)))); + if (__cut <= __nth) + __first = __cut; + else + __last = __cut; + } + __insertion_sort(__first, __last); +} + +template <class _RandomAccessIter> +inline void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, + _RandomAccessIter __last) { + __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); + __STL_REQUIRES(typename iterator_traits<_RandomAccessIter>::value_type, + _LessThanComparable); + __nth_element(__first, __nth, __last, __VALUE_TYPE(__first)); +} + +template <class _RandomAccessIter, class _Tp, class _Compare> +void __nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, + _RandomAccessIter __last, _Tp*, _Compare __comp) { + while (__last - __first > 3) { + _RandomAccessIter __cut = + __unguarded_partition(__first, __last, + _Tp(__median(*__first, + *(__first + (__last - __first)/2), + *(__last - 1), + __comp)), + __comp); + if (__cut <= __nth) + __first = __cut; + else + __last = __cut; + } + __insertion_sort(__first, __last, __comp); +} + +template <class _RandomAccessIter, class _Compare> +inline void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, + _RandomAccessIter __last, _Compare __comp) { + __STL_REQUIRES(_RandomAccessIter, _Mutable_RandomAccessIterator); + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, + typename iterator_traits<_RandomAccessIter>::value_type, + typename iterator_traits<_RandomAccessIter>::value_type); + __nth_element(__first, __nth, __last, __VALUE_TYPE(__first), __comp); +} + + +// Binary search (lower_bound, upper_bound, equal_range, binary_search). + +template <class _ForwardIter, class _Tp, class _Distance> +_ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last, + const _Tp& __val, _Distance*) +{ + _Distance __len = 0; + distance(__first, __last, __len); + _Distance __half; + _ForwardIter __middle; + + while (__len > 0) { + __half = __len >> 1; + __middle = __first; + advance(__middle, __half); + if (*__middle < __val) { + __first = __middle; + ++__first; + __len = __len - __half - 1; + } + else + __len = __half; + } + return __first; +} + +template <class _ForwardIter, class _Tp> +inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last, + const _Tp& __val) { + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_REQUIRES_SAME_TYPE(_Tp, + typename iterator_traits<_ForwardIter>::value_type); + __STL_REQUIRES(_Tp, _LessThanComparable); + return __lower_bound(__first, __last, __val, + __DISTANCE_TYPE(__first)); +} + +template <class _ForwardIter, class _Tp, class _Compare, class _Distance> +_ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last, + const _Tp& __val, _Compare __comp, _Distance*) +{ + _Distance __len = 0; + distance(__first, __last, __len); + _Distance __half; + _ForwardIter __middle; + + while (__len > 0) { + __half = __len >> 1; + __middle = __first; + advance(__middle, __half); + if (__comp(*__middle, __val)) { + __first = __middle; + ++__first; + __len = __len - __half - 1; + } + else + __len = __half; + } + return __first; +} + +template <class _ForwardIter, class _Tp, class _Compare> +inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last, + const _Tp& __val, _Compare __comp) { + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_REQUIRES_SAME_TYPE(_Tp, + typename iterator_traits<_ForwardIter>::value_type); + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, _Tp, _Tp); + return __lower_bound(__first, __last, __val, __comp, + __DISTANCE_TYPE(__first)); +} + +template <class _ForwardIter, class _Tp, class _Distance> +_ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last, + const _Tp& __val, _Distance*) +{ + _Distance __len = 0; + distance(__first, __last, __len); + _Distance __half; + _ForwardIter __middle; + + while (__len > 0) { + __half = __len >> 1; + __middle = __first; + advance(__middle, __half); + if (__val < *__middle) + __len = __half; + else { + __first = __middle; + ++__first; + __len = __len - __half - 1; + } + } + return __first; +} + +template <class _ForwardIter, class _Tp> +inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last, + const _Tp& __val) { + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_REQUIRES_SAME_TYPE(_Tp, + typename iterator_traits<_ForwardIter>::value_type); + __STL_REQUIRES(_Tp, _LessThanComparable); + return __upper_bound(__first, __last, __val, + __DISTANCE_TYPE(__first)); +} + +template <class _ForwardIter, class _Tp, class _Compare, class _Distance> +_ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last, + const _Tp& __val, _Compare __comp, _Distance*) +{ + _Distance __len = 0; + distance(__first, __last, __len); + _Distance __half; + _ForwardIter __middle; + + while (__len > 0) { + __half = __len >> 1; + __middle = __first; + advance(__middle, __half); + if (__comp(__val, *__middle)) + __len = __half; + else { + __first = __middle; + ++__first; + __len = __len - __half - 1; + } + } + return __first; +} + +template <class _ForwardIter, class _Tp, class _Compare> +inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last, + const _Tp& __val, _Compare __comp) { + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_REQUIRES_SAME_TYPE(_Tp, + typename iterator_traits<_ForwardIter>::value_type); + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, _Tp, _Tp); + return __upper_bound(__first, __last, __val, __comp, + __DISTANCE_TYPE(__first)); +} + +template <class _ForwardIter, class _Tp, class _Distance> +pair<_ForwardIter, _ForwardIter> +__equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, + _Distance*) +{ + _Distance __len = 0; + distance(__first, __last, __len); + _Distance __half; + _ForwardIter __middle, __left, __right; + + while (__len > 0) { + __half = __len >> 1; + __middle = __first; + advance(__middle, __half); + if (*__middle < __val) { + __first = __middle; + ++__first; + __len = __len - __half - 1; + } + else if (__val < *__middle) + __len = __half; + else { + __left = lower_bound(__first, __middle, __val); + advance(__first, __len); + __right = upper_bound(++__middle, __first, __val); + return pair<_ForwardIter, _ForwardIter>(__left, __right); + } + } + return pair<_ForwardIter, _ForwardIter>(__first, __first); +} + +template <class _ForwardIter, class _Tp> +inline pair<_ForwardIter, _ForwardIter> +equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) { + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_REQUIRES_SAME_TYPE(_Tp, + typename iterator_traits<_ForwardIter>::value_type); + __STL_REQUIRES(_Tp, _LessThanComparable); + return __equal_range(__first, __last, __val, + __DISTANCE_TYPE(__first)); +} + +template <class _ForwardIter, class _Tp, class _Compare, class _Distance> +pair<_ForwardIter, _ForwardIter> +__equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, + _Compare __comp, _Distance*) +{ + _Distance __len = 0; + distance(__first, __last, __len); + _Distance __half; + _ForwardIter __middle, __left, __right; + + while (__len > 0) { + __half = __len >> 1; + __middle = __first; + advance(__middle, __half); + if (__comp(*__middle, __val)) { + __first = __middle; + ++__first; + __len = __len - __half - 1; + } + else if (__comp(__val, *__middle)) + __len = __half; + else { + __left = lower_bound(__first, __middle, __val, __comp); + advance(__first, __len); + __right = upper_bound(++__middle, __first, __val, __comp); + return pair<_ForwardIter, _ForwardIter>(__left, __right); + } + } + return pair<_ForwardIter, _ForwardIter>(__first, __first); +} + +template <class _ForwardIter, class _Tp, class _Compare> +inline pair<_ForwardIter, _ForwardIter> +equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, + _Compare __comp) { + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_REQUIRES_SAME_TYPE(_Tp, + typename iterator_traits<_ForwardIter>::value_type); + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, _Tp, _Tp); + return __equal_range(__first, __last, __val, __comp, + __DISTANCE_TYPE(__first)); +} + +template <class _ForwardIter, class _Tp> +bool binary_search(_ForwardIter __first, _ForwardIter __last, + const _Tp& __val) { + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_REQUIRES_SAME_TYPE(_Tp, + typename iterator_traits<_ForwardIter>::value_type); + __STL_REQUIRES(_Tp, _LessThanComparable); + _ForwardIter __i = lower_bound(__first, __last, __val); + return __i != __last && !(__val < *__i); +} + +template <class _ForwardIter, class _Tp, class _Compare> +bool binary_search(_ForwardIter __first, _ForwardIter __last, + const _Tp& __val, + _Compare __comp) { + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_REQUIRES_SAME_TYPE(_Tp, + typename iterator_traits<_ForwardIter>::value_type); + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, _Tp, _Tp); + _ForwardIter __i = lower_bound(__first, __last, __val, __comp); + return __i != __last && !__comp(__val, *__i); +} + +// merge, with and without an explicitly supplied comparison function. + +template <class _InputIter1, class _InputIter2, class _OutputIter> +_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result) { + __STL_REQUIRES(_InputIter1, _InputIterator); + __STL_REQUIRES(_InputIter2, _InputIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + __STL_REQUIRES_SAME_TYPE( + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type); + __STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, + _LessThanComparable); + while (__first1 != __last1 && __first2 != __last2) { + if (*__first2 < *__first1) { + *__result = *__first2; + ++__first2; + } + else { + *__result = *__first1; + ++__first1; + } + ++__result; + } + return copy(__first2, __last2, copy(__first1, __last1, __result)); +} + +template <class _InputIter1, class _InputIter2, class _OutputIter, + class _Compare> +_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result, _Compare __comp) { + __STL_REQUIRES(_InputIter1, _InputIterator); + __STL_REQUIRES(_InputIter2, _InputIterator); + __STL_REQUIRES_SAME_TYPE( + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type); + __STL_REQUIRES(_OutputIter, _OutputIterator); + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter1>::value_type); + while (__first1 != __last1 && __first2 != __last2) { + if (__comp(*__first2, *__first1)) { + *__result = *__first2; + ++__first2; + } + else { + *__result = *__first1; + ++__first1; + } + ++__result; + } + return copy(__first2, __last2, copy(__first1, __last1, __result)); +} + +// inplace_merge and its auxiliary functions. + +template <class _BidirectionalIter, class _Distance> +void __merge_without_buffer(_BidirectionalIter __first, + _BidirectionalIter __middle, + _BidirectionalIter __last, + _Distance __len1, _Distance __len2) { + if (__len1 == 0 || __len2 == 0) + return; + if (__len1 + __len2 == 2) { + if (*__middle < *__first) + iter_swap(__first, __middle); + return; + } + _BidirectionalIter __first_cut = __first; + _BidirectionalIter __second_cut = __middle; + _Distance __len11 = 0; + _Distance __len22 = 0; + if (__len1 > __len2) { + __len11 = __len1 / 2; + advance(__first_cut, __len11); + __second_cut = lower_bound(__middle, __last, *__first_cut); + distance(__middle, __second_cut, __len22); + } + else { + __len22 = __len2 / 2; + advance(__second_cut, __len22); + __first_cut = upper_bound(__first, __middle, *__second_cut); + distance(__first, __first_cut, __len11); + } + _BidirectionalIter __new_middle + = rotate(__first_cut, __middle, __second_cut); + __merge_without_buffer(__first, __first_cut, __new_middle, + __len11, __len22); + __merge_without_buffer(__new_middle, __second_cut, __last, __len1 - __len11, + __len2 - __len22); +} + +template <class _BidirectionalIter, class _Distance, class _Compare> +void __merge_without_buffer(_BidirectionalIter __first, + _BidirectionalIter __middle, + _BidirectionalIter __last, + _Distance __len1, _Distance __len2, + _Compare __comp) { + if (__len1 == 0 || __len2 == 0) + return; + if (__len1 + __len2 == 2) { + if (__comp(*__middle, *__first)) + iter_swap(__first, __middle); + return; + } + _BidirectionalIter __first_cut = __first; + _BidirectionalIter __second_cut = __middle; + _Distance __len11 = 0; + _Distance __len22 = 0; + if (__len1 > __len2) { + __len11 = __len1 / 2; + advance(__first_cut, __len11); + __second_cut = lower_bound(__middle, __last, *__first_cut, __comp); + distance(__middle, __second_cut, __len22); + } + else { + __len22 = __len2 / 2; + advance(__second_cut, __len22); + __first_cut = upper_bound(__first, __middle, *__second_cut, __comp); + distance(__first, __first_cut, __len11); + } + _BidirectionalIter __new_middle + = rotate(__first_cut, __middle, __second_cut); + __merge_without_buffer(__first, __first_cut, __new_middle, __len11, __len22, + __comp); + __merge_without_buffer(__new_middle, __second_cut, __last, __len1 - __len11, + __len2 - __len22, __comp); +} + +template <class _BidirectionalIter1, class _BidirectionalIter2, + class _Distance> +_BidirectionalIter1 __rotate_adaptive(_BidirectionalIter1 __first, + _BidirectionalIter1 __middle, + _BidirectionalIter1 __last, + _Distance __len1, _Distance __len2, + _BidirectionalIter2 __buffer, + _Distance __buffer_size) { + _BidirectionalIter2 __buffer_end; + if (__len1 > __len2 && __len2 <= __buffer_size) { + __buffer_end = copy(__middle, __last, __buffer); + copy_backward(__first, __middle, __last); + return copy(__buffer, __buffer_end, __first); + } + else if (__len1 <= __buffer_size) { + __buffer_end = copy(__first, __middle, __buffer); + copy(__middle, __last, __first); + return copy_backward(__buffer, __buffer_end, __last); + } + else + return rotate(__first, __middle, __last); +} + +template <class _BidirectionalIter1, class _BidirectionalIter2, + class _BidirectionalIter3> +_BidirectionalIter3 __merge_backward(_BidirectionalIter1 __first1, + _BidirectionalIter1 __last1, + _BidirectionalIter2 __first2, + _BidirectionalIter2 __last2, + _BidirectionalIter3 __result) { + if (__first1 == __last1) + return copy_backward(__first2, __last2, __result); + if (__first2 == __last2) + return copy_backward(__first1, __last1, __result); + --__last1; + --__last2; + while (true) { + if (*__last2 < *__last1) { + *--__result = *__last1; + if (__first1 == __last1) + return copy_backward(__first2, ++__last2, __result); + --__last1; + } + else { + *--__result = *__last2; + if (__first2 == __last2) + return copy_backward(__first1, ++__last1, __result); + --__last2; + } + } +} + +template <class _BidirectionalIter1, class _BidirectionalIter2, + class _BidirectionalIter3, class _Compare> +_BidirectionalIter3 __merge_backward(_BidirectionalIter1 __first1, + _BidirectionalIter1 __last1, + _BidirectionalIter2 __first2, + _BidirectionalIter2 __last2, + _BidirectionalIter3 __result, + _Compare __comp) { + if (__first1 == __last1) + return copy_backward(__first2, __last2, __result); + if (__first2 == __last2) + return copy_backward(__first1, __last1, __result); + --__last1; + --__last2; + while (true) { + if (__comp(*__last2, *__last1)) { + *--__result = *__last1; + if (__first1 == __last1) + return copy_backward(__first2, ++__last2, __result); + --__last1; + } + else { + *--__result = *__last2; + if (__first2 == __last2) + return copy_backward(__first1, ++__last1, __result); + --__last2; + } + } +} + +template <class _BidirectionalIter, class _Distance, class _Pointer> +void __merge_adaptive(_BidirectionalIter __first, + _BidirectionalIter __middle, + _BidirectionalIter __last, + _Distance __len1, _Distance __len2, + _Pointer __buffer, _Distance __buffer_size) { + if (__len1 <= __len2 && __len1 <= __buffer_size) { + _Pointer __buffer_end = copy(__first, __middle, __buffer); + merge(__buffer, __buffer_end, __middle, __last, __first); + } + else if (__len2 <= __buffer_size) { + _Pointer __buffer_end = copy(__middle, __last, __buffer); + __merge_backward(__first, __middle, __buffer, __buffer_end, __last); + } + else { + _BidirectionalIter __first_cut = __first; + _BidirectionalIter __second_cut = __middle; + _Distance __len11 = 0; + _Distance __len22 = 0; + if (__len1 > __len2) { + __len11 = __len1 / 2; + advance(__first_cut, __len11); + __second_cut = lower_bound(__middle, __last, *__first_cut); + distance(__middle, __second_cut, __len22); + } + else { + __len22 = __len2 / 2; + advance(__second_cut, __len22); + __first_cut = upper_bound(__first, __middle, *__second_cut); + distance(__first, __first_cut, __len11); + } + _BidirectionalIter __new_middle = + __rotate_adaptive(__first_cut, __middle, __second_cut, __len1 - __len11, + __len22, __buffer, __buffer_size); + __merge_adaptive(__first, __first_cut, __new_middle, __len11, + __len22, __buffer, __buffer_size); + __merge_adaptive(__new_middle, __second_cut, __last, __len1 - __len11, + __len2 - __len22, __buffer, __buffer_size); + } +} + +template <class _BidirectionalIter, class _Distance, class _Pointer, + class _Compare> +void __merge_adaptive(_BidirectionalIter __first, + _BidirectionalIter __middle, + _BidirectionalIter __last, + _Distance __len1, _Distance __len2, + _Pointer __buffer, _Distance __buffer_size, + _Compare __comp) { + if (__len1 <= __len2 && __len1 <= __buffer_size) { + _Pointer __buffer_end = copy(__first, __middle, __buffer); + merge(__buffer, __buffer_end, __middle, __last, __first, __comp); + } + else if (__len2 <= __buffer_size) { + _Pointer __buffer_end = copy(__middle, __last, __buffer); + __merge_backward(__first, __middle, __buffer, __buffer_end, __last, + __comp); + } + else { + _BidirectionalIter __first_cut = __first; + _BidirectionalIter __second_cut = __middle; + _Distance __len11 = 0; + _Distance __len22 = 0; + if (__len1 > __len2) { + __len11 = __len1 / 2; + advance(__first_cut, __len11); + __second_cut = lower_bound(__middle, __last, *__first_cut, __comp); + distance(__middle, __second_cut, __len22); + } + else { + __len22 = __len2 / 2; + advance(__second_cut, __len22); + __first_cut = upper_bound(__first, __middle, *__second_cut, __comp); + distance(__first, __first_cut, __len11); + } + _BidirectionalIter __new_middle = + __rotate_adaptive(__first_cut, __middle, __second_cut, __len1 - __len11, + __len22, __buffer, __buffer_size); + __merge_adaptive(__first, __first_cut, __new_middle, __len11, + __len22, __buffer, __buffer_size, __comp); + __merge_adaptive(__new_middle, __second_cut, __last, __len1 - __len11, + __len2 - __len22, __buffer, __buffer_size, __comp); + } +} + +template <class _BidirectionalIter, class _Tp, class _Distance> +inline void __inplace_merge_aux(_BidirectionalIter __first, + _BidirectionalIter __middle, + _BidirectionalIter __last, _Tp*, _Distance*) { + _Distance __len1 = 0; + distance(__first, __middle, __len1); + _Distance __len2 = 0; + distance(__middle, __last, __len2); + + _Temporary_buffer<_BidirectionalIter, _Tp> __buf(__first, __last); + if (__buf.begin() == 0) + __merge_without_buffer(__first, __middle, __last, __len1, __len2); + else + __merge_adaptive(__first, __middle, __last, __len1, __len2, + __buf.begin(), _Distance(__buf.size())); +} + +template <class _BidirectionalIter, class _Tp, + class _Distance, class _Compare> +inline void __inplace_merge_aux(_BidirectionalIter __first, + _BidirectionalIter __middle, + _BidirectionalIter __last, _Tp*, _Distance*, + _Compare __comp) { + _Distance __len1 = 0; + distance(__first, __middle, __len1); + _Distance __len2 = 0; + distance(__middle, __last, __len2); + + _Temporary_buffer<_BidirectionalIter, _Tp> __buf(__first, __last); + if (__buf.begin() == 0) + __merge_without_buffer(__first, __middle, __last, __len1, __len2, __comp); + else + __merge_adaptive(__first, __middle, __last, __len1, __len2, + __buf.begin(), _Distance(__buf.size()), + __comp); +} + +template <class _BidirectionalIter> +inline void inplace_merge(_BidirectionalIter __first, + _BidirectionalIter __middle, + _BidirectionalIter __last) { + __STL_REQUIRES(_BidirectionalIter, _Mutable_BidirectionalIterator); + __STL_REQUIRES(typename iterator_traits<_BidirectionalIter>::value_type, + _LessThanComparable); + if (__first == __middle || __middle == __last) + return; + __inplace_merge_aux(__first, __middle, __last, + __VALUE_TYPE(__first), __DISTANCE_TYPE(__first)); +} + +template <class _BidirectionalIter, class _Compare> +inline void inplace_merge(_BidirectionalIter __first, + _BidirectionalIter __middle, + _BidirectionalIter __last, _Compare __comp) { + __STL_REQUIRES(_BidirectionalIter, _Mutable_BidirectionalIterator); + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, + typename iterator_traits<_BidirectionalIter>::value_type, + typename iterator_traits<_BidirectionalIter>::value_type); + if (__first == __middle || __middle == __last) + return; + __inplace_merge_aux(__first, __middle, __last, + __VALUE_TYPE(__first), __DISTANCE_TYPE(__first), + __comp); +} + +// Set algorithms: includes, set_union, set_intersection, set_difference, +// set_symmetric_difference. All of these algorithms have the precondition +// that their input ranges are sorted and the postcondition that their output +// ranges are sorted. + +template <class _InputIter1, class _InputIter2> +bool includes(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2) { + __STL_REQUIRES(_InputIter1, _InputIterator); + __STL_REQUIRES(_InputIter2, _InputIterator); + __STL_REQUIRES_SAME_TYPE( + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type); + __STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, + _LessThanComparable); + while (__first1 != __last1 && __first2 != __last2) + if (*__first2 < *__first1) + return false; + else if(*__first1 < *__first2) + ++__first1; + else + ++__first1, ++__first2; + + return __first2 == __last2; +} + +template <class _InputIter1, class _InputIter2, class _Compare> +bool includes(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, _Compare __comp) { + __STL_REQUIRES(_InputIter1, _InputIterator); + __STL_REQUIRES(_InputIter2, _InputIterator); + __STL_REQUIRES_SAME_TYPE( + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type); + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type); + while (__first1 != __last1 && __first2 != __last2) + if (__comp(*__first2, *__first1)) + return false; + else if(__comp(*__first1, *__first2)) + ++__first1; + else + ++__first1, ++__first2; + + return __first2 == __last2; +} + +template <class _InputIter1, class _InputIter2, class _OutputIter> +_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result) { + __STL_REQUIRES(_InputIter1, _InputIterator); + __STL_REQUIRES(_InputIter2, _InputIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + __STL_REQUIRES_SAME_TYPE( + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type); + __STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, + _LessThanComparable); + while (__first1 != __last1 && __first2 != __last2) { + if (*__first1 < *__first2) { + *__result = *__first1; + ++__first1; + } + else if (*__first2 < *__first1) { + *__result = *__first2; + ++__first2; + } + else { + *__result = *__first1; + ++__first1; + ++__first2; + } + ++__result; + } + return copy(__first2, __last2, copy(__first1, __last1, __result)); +} + +template <class _InputIter1, class _InputIter2, class _OutputIter, + class _Compare> +_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result, _Compare __comp) { + __STL_REQUIRES(_InputIter1, _InputIterator); + __STL_REQUIRES(_InputIter2, _InputIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + __STL_REQUIRES_SAME_TYPE( + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type); + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type); + while (__first1 != __last1 && __first2 != __last2) { + if (__comp(*__first1, *__first2)) { + *__result = *__first1; + ++__first1; + } + else if (__comp(*__first2, *__first1)) { + *__result = *__first2; + ++__first2; + } + else { + *__result = *__first1; + ++__first1; + ++__first2; + } + ++__result; + } + return copy(__first2, __last2, copy(__first1, __last1, __result)); +} + +template <class _InputIter1, class _InputIter2, class _OutputIter> +_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result) { + __STL_REQUIRES(_InputIter1, _InputIterator); + __STL_REQUIRES(_InputIter2, _InputIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + __STL_REQUIRES_SAME_TYPE( + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type); + __STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, + _LessThanComparable); + while (__first1 != __last1 && __first2 != __last2) + if (*__first1 < *__first2) + ++__first1; + else if (*__first2 < *__first1) + ++__first2; + else { + *__result = *__first1; + ++__first1; + ++__first2; + ++__result; + } + return __result; +} + +template <class _InputIter1, class _InputIter2, class _OutputIter, + class _Compare> +_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result, _Compare __comp) { + __STL_REQUIRES(_InputIter1, _InputIterator); + __STL_REQUIRES(_InputIter2, _InputIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + __STL_REQUIRES_SAME_TYPE( + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type); + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type); + + while (__first1 != __last1 && __first2 != __last2) + if (__comp(*__first1, *__first2)) + ++__first1; + else if (__comp(*__first2, *__first1)) + ++__first2; + else { + *__result = *__first1; + ++__first1; + ++__first2; + ++__result; + } + return __result; +} + +template <class _InputIter1, class _InputIter2, class _OutputIter> +_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result) { + __STL_REQUIRES(_InputIter1, _InputIterator); + __STL_REQUIRES(_InputIter2, _InputIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + __STL_REQUIRES_SAME_TYPE( + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type); + __STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, + _LessThanComparable); + while (__first1 != __last1 && __first2 != __last2) + if (*__first1 < *__first2) { + *__result = *__first1; + ++__first1; + ++__result; + } + else if (*__first2 < *__first1) + ++__first2; + else { + ++__first1; + ++__first2; + } + return copy(__first1, __last1, __result); +} + +template <class _InputIter1, class _InputIter2, class _OutputIter, + class _Compare> +_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result, _Compare __comp) { + __STL_REQUIRES(_InputIter1, _InputIterator); + __STL_REQUIRES(_InputIter2, _InputIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + __STL_REQUIRES_SAME_TYPE( + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type); + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type); + + while (__first1 != __last1 && __first2 != __last2) + if (__comp(*__first1, *__first2)) { + *__result = *__first1; + ++__first1; + ++__result; + } + else if (__comp(*__first2, *__first1)) + ++__first2; + else { + ++__first1; + ++__first2; + } + return copy(__first1, __last1, __result); +} + +template <class _InputIter1, class _InputIter2, class _OutputIter> +_OutputIter +set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result) { + __STL_REQUIRES(_InputIter1, _InputIterator); + __STL_REQUIRES(_InputIter2, _InputIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + __STL_REQUIRES_SAME_TYPE( + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type); + __STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, + _LessThanComparable); + while (__first1 != __last1 && __first2 != __last2) + if (*__first1 < *__first2) { + *__result = *__first1; + ++__first1; + ++__result; + } + else if (*__first2 < *__first1) { + *__result = *__first2; + ++__first2; + ++__result; + } + else { + ++__first1; + ++__first2; + } + return copy(__first2, __last2, copy(__first1, __last1, __result)); +} + +template <class _InputIter1, class _InputIter2, class _OutputIter, + class _Compare> +_OutputIter +set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result, + _Compare __comp) { + __STL_REQUIRES(_InputIter1, _InputIterator); + __STL_REQUIRES(_InputIter2, _InputIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + __STL_REQUIRES_SAME_TYPE( + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type); + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, + typename iterator_traits<_InputIter1>::value_type, + typename iterator_traits<_InputIter2>::value_type); + while (__first1 != __last1 && __first2 != __last2) + if (__comp(*__first1, *__first2)) { + *__result = *__first1; + ++__first1; + ++__result; + } + else if (__comp(*__first2, *__first1)) { + *__result = *__first2; + ++__first2; + ++__result; + } + else { + ++__first1; + ++__first2; + } + return copy(__first2, __last2, copy(__first1, __last1, __result)); +} + +// min_element and max_element, with and without an explicitly supplied +// comparison function. + +template <class _ForwardIter> +_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last) { + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_REQUIRES(typename iterator_traits<_ForwardIter>::value_type, + _LessThanComparable); + if (__first == __last) return __first; + _ForwardIter __result = __first; + while (++__first != __last) + if (*__result < *__first) + __result = __first; + return __result; +} + +template <class _ForwardIter, class _Compare> +_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last, + _Compare __comp) { + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, + typename iterator_traits<_ForwardIter>::value_type, + typename iterator_traits<_ForwardIter>::value_type); + if (__first == __last) return __first; + _ForwardIter __result = __first; + while (++__first != __last) + if (__comp(*__result, *__first)) __result = __first; + return __result; +} + +template <class _ForwardIter> +_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last) { + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_REQUIRES(typename iterator_traits<_ForwardIter>::value_type, + _LessThanComparable); + if (__first == __last) return __first; + _ForwardIter __result = __first; + while (++__first != __last) + if (*__first < *__result) + __result = __first; + return __result; +} + +template <class _ForwardIter, class _Compare> +_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last, + _Compare __comp) { + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, + typename iterator_traits<_ForwardIter>::value_type, + typename iterator_traits<_ForwardIter>::value_type); + if (__first == __last) return __first; + _ForwardIter __result = __first; + while (++__first != __last) + if (__comp(*__first, *__result)) + __result = __first; + return __result; +} + +// next_permutation and prev_permutation, with and without an explicitly +// supplied comparison function. + +template <class _BidirectionalIter> +bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last) { + __STL_REQUIRES(_BidirectionalIter, _BidirectionalIterator); + __STL_REQUIRES(typename iterator_traits<_BidirectionalIter>::value_type, + _LessThanComparable); + if (__first == __last) + return false; + _BidirectionalIter __i = __first; + ++__i; + if (__i == __last) + return false; + __i = __last; + --__i; + + for(;;) { + _BidirectionalIter __ii = __i; + --__i; + if (*__i < *__ii) { + _BidirectionalIter __j = __last; + while (!(*__i < *--__j)) + {} + iter_swap(__i, __j); + reverse(__ii, __last); + return true; + } + if (__i == __first) { + reverse(__first, __last); + return false; + } + } +} + +template <class _BidirectionalIter, class _Compare> +bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last, + _Compare __comp) { + __STL_REQUIRES(_BidirectionalIter, _BidirectionalIterator); + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, + typename iterator_traits<_BidirectionalIter>::value_type, + typename iterator_traits<_BidirectionalIter>::value_type); + if (__first == __last) + return false; + _BidirectionalIter __i = __first; + ++__i; + if (__i == __last) + return false; + __i = __last; + --__i; + + for(;;) { + _BidirectionalIter __ii = __i; + --__i; + if (__comp(*__i, *__ii)) { + _BidirectionalIter __j = __last; + while (!__comp(*__i, *--__j)) + {} + iter_swap(__i, __j); + reverse(__ii, __last); + return true; + } + if (__i == __first) { + reverse(__first, __last); + return false; + } + } +} + +template <class _BidirectionalIter> +bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last) { + __STL_REQUIRES(_BidirectionalIter, _BidirectionalIterator); + __STL_REQUIRES(typename iterator_traits<_BidirectionalIter>::value_type, + _LessThanComparable); + if (__first == __last) + return false; + _BidirectionalIter __i = __first; + ++__i; + if (__i == __last) + return false; + __i = __last; + --__i; + + for(;;) { + _BidirectionalIter __ii = __i; + --__i; + if (*__ii < *__i) { + _BidirectionalIter __j = __last; + while (!(*--__j < *__i)) + {} + iter_swap(__i, __j); + reverse(__ii, __last); + return true; + } + if (__i == __first) { + reverse(__first, __last); + return false; + } + } +} + +template <class _BidirectionalIter, class _Compare> +bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last, + _Compare __comp) { + __STL_REQUIRES(_BidirectionalIter, _BidirectionalIterator); + __STL_BINARY_FUNCTION_CHECK(_Compare, bool, + typename iterator_traits<_BidirectionalIter>::value_type, + typename iterator_traits<_BidirectionalIter>::value_type); + if (__first == __last) + return false; + _BidirectionalIter __i = __first; + ++__i; + if (__i == __last) + return false; + __i = __last; + --__i; + + for(;;) { + _BidirectionalIter __ii = __i; + --__i; + if (__comp(*__ii, *__i)) { + _BidirectionalIter __j = __last; + while (!__comp(*--__j, *__i)) + {} + iter_swap(__i, __j); + reverse(__ii, __last); + return true; + } + if (__i == __first) { + reverse(__first, __last); + return false; + } + } +} + +// find_first_of, with and without an explicitly supplied comparison function. + +template <class _InputIter, class _ForwardIter> +_InputIter find_first_of(_InputIter __first1, _InputIter __last1, + _ForwardIter __first2, _ForwardIter __last2) +{ + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_REQUIRES_BINARY_OP(_OP_EQUAL, bool, + typename iterator_traits<_InputIter>::value_type, + typename iterator_traits<_ForwardIter>::value_type); + + for ( ; __first1 != __last1; ++__first1) + for (_ForwardIter __iter = __first2; __iter != __last2; ++__iter) + if (*__first1 == *__iter) + return __first1; + return __last1; +} + +template <class _InputIter, class _ForwardIter, class _BinaryPredicate> +_InputIter find_first_of(_InputIter __first1, _InputIter __last1, + _ForwardIter __first2, _ForwardIter __last2, + _BinaryPredicate __comp) +{ + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_BINARY_FUNCTION_CHECK(_BinaryPredicate, bool, + typename iterator_traits<_InputIter>::value_type, + typename iterator_traits<_ForwardIter>::value_type); + + for ( ; __first1 != __last1; ++__first1) + for (_ForwardIter __iter = __first2; __iter != __last2; ++__iter) + if (__comp(*__first1, *__iter)) + return __first1; + return __last1; +} + + +// find_end, with and without an explicitly supplied comparison function. +// Search [first2, last2) as a subsequence in [first1, last1), and return +// the *last* possible match. Note that find_end for bidirectional iterators +// is much faster than for forward iterators. + +// find_end for forward iterators. +template <class _ForwardIter1, class _ForwardIter2> +_ForwardIter1 __find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, + _ForwardIter2 __first2, _ForwardIter2 __last2, + forward_iterator_tag, forward_iterator_tag) +{ + if (__first2 == __last2) + return __last1; + else { + _ForwardIter1 __result = __last1; + while (1) { + _ForwardIter1 __new_result + = search(__first1, __last1, __first2, __last2); + if (__new_result == __last1) + return __result; + else { + __result = __new_result; + __first1 = __new_result; + ++__first1; + } + } + } +} + +template <class _ForwardIter1, class _ForwardIter2, + class _BinaryPredicate> +_ForwardIter1 __find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, + _ForwardIter2 __first2, _ForwardIter2 __last2, + forward_iterator_tag, forward_iterator_tag, + _BinaryPredicate __comp) +{ + if (__first2 == __last2) + return __last1; + else { + _ForwardIter1 __result = __last1; + while (1) { + _ForwardIter1 __new_result + = search(__first1, __last1, __first2, __last2, __comp); + if (__new_result == __last1) + return __result; + else { + __result = __new_result; + __first1 = __new_result; + ++__first1; + } + } + } +} + +// find_end for bidirectional iterators. Requires partial specialization. +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + +template <class _BidirectionalIter1, class _BidirectionalIter2> +_BidirectionalIter1 +__find_end(_BidirectionalIter1 __first1, _BidirectionalIter1 __last1, + _BidirectionalIter2 __first2, _BidirectionalIter2 __last2, + bidirectional_iterator_tag, bidirectional_iterator_tag) +{ + __STL_REQUIRES(_BidirectionalIter1, _BidirectionalIterator); + __STL_REQUIRES(_BidirectionalIter2, _BidirectionalIterator); + typedef reverse_iterator<_BidirectionalIter1> _RevIter1; + typedef reverse_iterator<_BidirectionalIter2> _RevIter2; + + _RevIter1 __rlast1(__first1); + _RevIter2 __rlast2(__first2); + _RevIter1 __rresult = search(_RevIter1(__last1), __rlast1, + _RevIter2(__last2), __rlast2); + + if (__rresult == __rlast1) + return __last1; + else { + _BidirectionalIter1 __result = __rresult.base(); + advance(__result, -distance(__first2, __last2)); + return __result; + } +} + +template <class _BidirectionalIter1, class _BidirectionalIter2, + class _BinaryPredicate> +_BidirectionalIter1 +__find_end(_BidirectionalIter1 __first1, _BidirectionalIter1 __last1, + _BidirectionalIter2 __first2, _BidirectionalIter2 __last2, + bidirectional_iterator_tag, bidirectional_iterator_tag, + _BinaryPredicate __comp) +{ + __STL_REQUIRES(_BidirectionalIter1, _BidirectionalIterator); + __STL_REQUIRES(_BidirectionalIter2, _BidirectionalIterator); + typedef reverse_iterator<_BidirectionalIter1> _RevIter1; + typedef reverse_iterator<_BidirectionalIter2> _RevIter2; + + _RevIter1 __rlast1(__first1); + _RevIter2 __rlast2(__first2); + _RevIter1 __rresult = search(_RevIter1(__last1), __rlast1, + _RevIter2(__last2), __rlast2, + __comp); + + if (__rresult == __rlast1) + return __last1; + else { + _BidirectionalIter1 __result = __rresult.base(); + advance(__result, -distance(__first2, __last2)); + return __result; + } +} +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +// Dispatching functions for find_end. + +template <class _ForwardIter1, class _ForwardIter2> +inline _ForwardIter1 +find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, + _ForwardIter2 __first2, _ForwardIter2 __last2) +{ + __STL_REQUIRES(_ForwardIter1, _ForwardIterator); + __STL_REQUIRES(_ForwardIter2, _ForwardIterator); + __STL_REQUIRES_BINARY_OP(_OP_EQUAL, bool, + typename iterator_traits<_ForwardIter1>::value_type, + typename iterator_traits<_ForwardIter2>::value_type); + return __find_end(__first1, __last1, __first2, __last2, + __ITERATOR_CATEGORY(__first1), + __ITERATOR_CATEGORY(__first2)); +} + +template <class _ForwardIter1, class _ForwardIter2, + class _BinaryPredicate> +inline _ForwardIter1 +find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, + _ForwardIter2 __first2, _ForwardIter2 __last2, + _BinaryPredicate __comp) +{ + __STL_REQUIRES(_ForwardIter1, _ForwardIterator); + __STL_REQUIRES(_ForwardIter2, _ForwardIterator); + __STL_BINARY_FUNCTION_CHECK(_BinaryPredicate, bool, + typename iterator_traits<_ForwardIter1>::value_type, + typename iterator_traits<_ForwardIter2>::value_type); + + return __find_end(__first1, __last1, __first2, __last2, + __ITERATOR_CATEGORY(__first1), + __ITERATOR_CATEGORY(__first2), + __comp); +} + +// is_heap, a predicate testing whether or not a range is +// a heap. This function is an extension, not part of the C++ +// standard. + +template <class _RandomAccessIter, class _Distance> +bool __is_heap(_RandomAccessIter __first, _Distance __n) +{ + _Distance __parent = 0; + for (_Distance __child = 1; __child < __n; ++__child) { + if (__first[__parent] < __first[__child]) + return false; + if ((__child & 1) == 0) + ++__parent; + } + return true; +} + +template <class _RandomAccessIter, class _Distance, class _StrictWeakOrdering> +bool __is_heap(_RandomAccessIter __first, _StrictWeakOrdering __comp, + _Distance __n) +{ + _Distance __parent = 0; + for (_Distance __child = 1; __child < __n; ++__child) { + if (__comp(__first[__parent], __first[__child])) + return false; + if ((__child & 1) == 0) + ++__parent; + } + return true; +} + +template <class _RandomAccessIter> +inline bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last) +{ + __STL_REQUIRES(_RandomAccessIter, _RandomAccessIterator); + __STL_REQUIRES(typename iterator_traits<_RandomAccessIter>::value_type, + _LessThanComparable); + return __is_heap(__first, __last - __first); +} + + +template <class _RandomAccessIter, class _StrictWeakOrdering> +inline bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last, + _StrictWeakOrdering __comp) +{ + __STL_REQUIRES(_RandomAccessIter, _RandomAccessIterator); + __STL_BINARY_FUNCTION_CHECK(_StrictWeakOrdering, bool, + typename iterator_traits<_RandomAccessIter>::value_type, + typename iterator_traits<_RandomAccessIter>::value_type); + return __is_heap(__first, __comp, __last - __first); +} + +// is_sorted, a predicated testing whether a range is sorted in +// nondescending order. This is an extension, not part of the C++ +// standard. + +template <class _ForwardIter> +bool is_sorted(_ForwardIter __first, _ForwardIter __last) +{ + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_REQUIRES(typename iterator_traits<_ForwardIter>::value_type, + _LessThanComparable); + if (__first == __last) + return true; + + _ForwardIter __next = __first; + for (++__next; __next != __last; __first = __next, ++__next) { + if (*__next < *__first) + return false; + } + + return true; +} + +template <class _ForwardIter, class _StrictWeakOrdering> +bool is_sorted(_ForwardIter __first, _ForwardIter __last, + _StrictWeakOrdering __comp) +{ + __STL_REQUIRES(_ForwardIter, _ForwardIterator); + __STL_BINARY_FUNCTION_CHECK(_StrictWeakOrdering, bool, + typename iterator_traits<_ForwardIter>::value_type, + typename iterator_traits<_ForwardIter>::value_type); + if (__first == __last) + return true; + + _ForwardIter __next = __first; + for (++__next; __next != __last; __first = __next, ++__next) { + if (__comp(*__next, *__first)) + return false; + } + + return true; +} + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1209 +#endif + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_ALGO_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_algobase.h b/dtm_release/local/include/stl/stl_algobase.h new file mode 100644 index 0000000000000000000000000000000000000000..35ed7ecdca9c30d66b73197a1d4f1799f1c9a8c3 --- /dev/null +++ b/dtm_release/local/include/stl/stl_algobase.h @@ -0,0 +1,696 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + + +#ifndef __SGI_STL_INTERNAL_ALGOBASE_H +#define __SGI_STL_INTERNAL_ALGOBASE_H + +#ifndef __STL_CONFIG_H +#include <stl_config.h> +#endif +#ifndef __SGI_STL_INTERNAL_RELOPS +#include <stl_relops.h> +#endif +#ifndef __SGI_STL_INTERNAL_PAIR_H +#include <stl_pair.h> +#endif +#ifndef __TYPE_TRAITS_H +#include <type_traits.h> +#endif + +#include <string.h> +#include <limits.h> +#include <stdlib.h> +#include <stddef.h> +#include <new.h> + +#ifdef __STL_USE_NEW_IOSTREAMS +#include <iosfwd> +#else /* __STL_USE_NEW_IOSTREAMS */ +#include <iostream.h> +#endif /* __STL_USE_NEW_IOSTREAMS */ + +#ifndef __SGI_STL_INTERNAL_ITERATOR_H +#include <stl_iterator_base.h> +#include <stl_iterator.h> +#endif + +// We pick up concept_checks.h from stl_iterator_base.h. + +__STL_BEGIN_NAMESPACE + +// swap and iter_swap + +template <class _ForwardIter1, class _ForwardIter2, class _Tp> +inline void __iter_swap(_ForwardIter1 __a, _ForwardIter2 __b, _Tp*) { + _Tp __tmp = *__a; + *__a = *__b; + *__b = __tmp; +} + +template <class _ForwardIter1, class _ForwardIter2> +inline void iter_swap(_ForwardIter1 __a, _ForwardIter2 __b) { + __STL_REQUIRES(_ForwardIter1, _Mutable_ForwardIterator); + __STL_REQUIRES(_ForwardIter2, _Mutable_ForwardIterator); + __STL_CONVERTIBLE(typename iterator_traits<_ForwardIter1>::value_type, + typename iterator_traits<_ForwardIter2>::value_type); + __STL_CONVERTIBLE(typename iterator_traits<_ForwardIter2>::value_type, + typename iterator_traits<_ForwardIter1>::value_type); + __iter_swap(__a, __b, __VALUE_TYPE(__a)); +} + +template <class _Tp> +inline void swap(_Tp& __a, _Tp& __b) { + __STL_REQUIRES(_Tp, _Assignable); + _Tp __tmp = __a; + __a = __b; + __b = __tmp; +} + +//-------------------------------------------------- +// min and max + +#if !defined(__BORLANDC__) || __BORLANDC__ >= 0x540 /* C++ Builder 4.0 */ + +#undef min +#undef max + +template <class _Tp> +inline const _Tp& min(const _Tp& __a, const _Tp& __b) { + __STL_REQUIRES(_Tp, _LessThanComparable); + return __b < __a ? __b : __a; +} + +template <class _Tp> +inline const _Tp& max(const _Tp& __a, const _Tp& __b) { + __STL_REQUIRES(_Tp, _LessThanComparable); + return __a < __b ? __b : __a; +} + +#endif /* __BORLANDC__ */ + +template <class _Tp, class _Compare> +inline const _Tp& min(const _Tp& __a, const _Tp& __b, _Compare __comp) { + return __comp(__b, __a) ? __b : __a; +} + +template <class _Tp, class _Compare> +inline const _Tp& max(const _Tp& __a, const _Tp& __b, _Compare __comp) { + return __comp(__a, __b) ? __b : __a; +} + +//-------------------------------------------------- +// copy + +// All of these auxiliary functions serve two purposes. (1) Replace +// calls to copy with memmove whenever possible. (Memmove, not memcpy, +// because the input and output ranges are permitted to overlap.) +// (2) If we're using random access iterators, then write the loop as +// a for loop with an explicit count. + +template <class _InputIter, class _OutputIter, class _Distance> +inline _OutputIter __copy(_InputIter __first, _InputIter __last, + _OutputIter __result, + input_iterator_tag, _Distance*) +{ + for ( ; __first != __last; ++__result, ++__first) + *__result = *__first; + return __result; +} + +template <class _RandomAccessIter, class _OutputIter, class _Distance> +inline _OutputIter +__copy(_RandomAccessIter __first, _RandomAccessIter __last, + _OutputIter __result, random_access_iterator_tag, _Distance*) +{ + for (_Distance __n = __last - __first; __n > 0; --__n) { + *__result = *__first; + ++__first; + ++__result; + } + return __result; +} + +template <class _Tp> +inline _Tp* +__copy_trivial(const _Tp* __first, const _Tp* __last, _Tp* __result) { + memmove(__result, __first, sizeof(_Tp) * (__last - __first)); + return __result + (__last - __first); +} + +#if defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER) + +template <class _InputIter, class _OutputIter> +inline _OutputIter __copy_aux2(_InputIter __first, _InputIter __last, + _OutputIter __result, __false_type) { + return __copy(__first, __last, __result, + __ITERATOR_CATEGORY(__first), + __DISTANCE_TYPE(__first)); +} + +template <class _InputIter, class _OutputIter> +inline _OutputIter __copy_aux2(_InputIter __first, _InputIter __last, + _OutputIter __result, __true_type) { + return __copy(__first, __last, __result, + __ITERATOR_CATEGORY(__first), + __DISTANCE_TYPE(__first)); +} + +#ifndef __USLC__ + +template <class _Tp> +inline _Tp* __copy_aux2(_Tp* __first, _Tp* __last, _Tp* __result, + __true_type) { + return __copy_trivial(__first, __last, __result); +} + +#endif /* __USLC__ */ + +template <class _Tp> +inline _Tp* __copy_aux2(const _Tp* __first, const _Tp* __last, _Tp* __result, + __true_type) { + return __copy_trivial(__first, __last, __result); +} + + +template <class _InputIter, class _OutputIter, class _Tp> +inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last, + _OutputIter __result, _Tp*) { + typedef typename __type_traits<_Tp>::has_trivial_assignment_operator + _Trivial; + return __copy_aux2(__first, __last, __result, _Trivial()); +} + +template <class _InputIter, class _OutputIter> +inline _OutputIter copy(_InputIter __first, _InputIter __last, + _OutputIter __result) { + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + return __copy_aux(__first, __last, __result, __VALUE_TYPE(__first)); +} + +// Hack for compilers that don't have partial ordering of function templates +// but do have partial specialization of class templates. +#elif defined(__STL_CLASS_PARTIAL_SPECIALIZATION) + +template <class _InputIter, class _OutputIter, class _BoolType> +struct __copy_dispatch { + static _OutputIter copy(_InputIter __first, _InputIter __last, + _OutputIter __result) { + typedef typename iterator_traits<_InputIter>::iterator_category _Category; + typedef typename iterator_traits<_InputIter>::difference_type _Distance; + return __copy(__first, __last, __result, _Category(), (_Distance*) 0); + } +}; + +template <class _Tp> +struct __copy_dispatch<_Tp*, _Tp*, __true_type> +{ + static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) { + return __copy_trivial(__first, __last, __result); + } +}; + +template <class _Tp> +struct __copy_dispatch<const _Tp*, _Tp*, __true_type> +{ + static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) { + return __copy_trivial(__first, __last, __result); + } +}; + +template <class _InputIter, class _OutputIter> +inline _OutputIter copy(_InputIter __first, _InputIter __last, + _OutputIter __result) { + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + typedef typename iterator_traits<_InputIter>::value_type _Tp; + typedef typename __type_traits<_Tp>::has_trivial_assignment_operator + _Trivial; + return __copy_dispatch<_InputIter, _OutputIter, _Trivial> + ::copy(__first, __last, __result); +} + +// Fallback for compilers with neither partial ordering nor partial +// specialization. Define the faster version for the basic builtin +// types. +#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +template <class _InputIter, class _OutputIter> +inline _OutputIter copy(_InputIter __first, _InputIter __last, + _OutputIter __result) +{ + return __copy(__first, __last, __result, + __ITERATOR_CATEGORY(__first), + __DISTANCE_TYPE(__first)); +} + +#define __SGI_STL_DECLARE_COPY_TRIVIAL(_Tp) \ + inline _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) { \ + memmove(__result, __first, sizeof(_Tp) * (__last - __first)); \ + return __result + (__last - __first); \ + } + +__SGI_STL_DECLARE_COPY_TRIVIAL(char) +__SGI_STL_DECLARE_COPY_TRIVIAL(signed char) +__SGI_STL_DECLARE_COPY_TRIVIAL(unsigned char) +__SGI_STL_DECLARE_COPY_TRIVIAL(short) +__SGI_STL_DECLARE_COPY_TRIVIAL(unsigned short) +__SGI_STL_DECLARE_COPY_TRIVIAL(int) +__SGI_STL_DECLARE_COPY_TRIVIAL(unsigned int) +__SGI_STL_DECLARE_COPY_TRIVIAL(long) +__SGI_STL_DECLARE_COPY_TRIVIAL(unsigned long) +#ifdef __STL_HAS_WCHAR_T +__SGI_STL_DECLARE_COPY_TRIVIAL(wchar_t) +#endif +#ifdef _STL_LONG_LONG +__SGI_STL_DECLARE_COPY_TRIVIAL(long long) +__SGI_STL_DECLARE_COPY_TRIVIAL(unsigned long long) +#endif +__SGI_STL_DECLARE_COPY_TRIVIAL(float) +__SGI_STL_DECLARE_COPY_TRIVIAL(double) +__SGI_STL_DECLARE_COPY_TRIVIAL(long double) + +#undef __SGI_STL_DECLARE_COPY_TRIVIAL +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +//-------------------------------------------------- +// copy_backward + +template <class _BidirectionalIter1, class _BidirectionalIter2, + class _Distance> +inline _BidirectionalIter2 __copy_backward(_BidirectionalIter1 __first, + _BidirectionalIter1 __last, + _BidirectionalIter2 __result, + bidirectional_iterator_tag, + _Distance*) +{ + while (__first != __last) + *--__result = *--__last; + return __result; +} + +template <class _RandomAccessIter, class _BidirectionalIter, class _Distance> +inline _BidirectionalIter __copy_backward(_RandomAccessIter __first, + _RandomAccessIter __last, + _BidirectionalIter __result, + random_access_iterator_tag, + _Distance*) +{ + for (_Distance __n = __last - __first; __n > 0; --__n) + *--__result = *--__last; + return __result; +} + +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + +// This dispatch class is a workaround for compilers that do not +// have partial ordering of function templates. All we're doing is +// creating a specialization so that we can turn a call to copy_backward +// into a memmove whenever possible. + +template <class _BidirectionalIter1, class _BidirectionalIter2, + class _BoolType> +struct __copy_backward_dispatch +{ + typedef typename iterator_traits<_BidirectionalIter1>::iterator_category + _Cat; + typedef typename iterator_traits<_BidirectionalIter1>::difference_type + _Distance; + + static _BidirectionalIter2 copy(_BidirectionalIter1 __first, + _BidirectionalIter1 __last, + _BidirectionalIter2 __result) { + return __copy_backward(__first, __last, __result, _Cat(), (_Distance*) 0); + } +}; + +template <class _Tp> +struct __copy_backward_dispatch<_Tp*, _Tp*, __true_type> +{ + static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) { + const ptrdiff_t _Num = __last - __first; + memmove(__result - _Num, __first, sizeof(_Tp) * _Num); + return __result - _Num; + } +}; + +template <class _Tp> +struct __copy_backward_dispatch<const _Tp*, _Tp*, __true_type> +{ + static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) { + return __copy_backward_dispatch<_Tp*, _Tp*, __true_type> + ::copy(__first, __last, __result); + } +}; + +template <class _BI1, class _BI2> +inline _BI2 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) { + __STL_REQUIRES(_BI1, _BidirectionalIterator); + __STL_REQUIRES(_BI2, _Mutable_BidirectionalIterator); + __STL_CONVERTIBLE(typename iterator_traits<_BI1>::value_type, + typename iterator_traits<_BI2>::value_type); + typedef typename __type_traits<typename iterator_traits<_BI2>::value_type> + ::has_trivial_assignment_operator + _Trivial; + return __copy_backward_dispatch<_BI1, _BI2, _Trivial> + ::copy(__first, __last, __result); +} + +#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +template <class _BI1, class _BI2> +inline _BI2 copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) { + return __copy_backward(__first, __last, __result, + __ITERATOR_CATEGORY(__first), + __DISTANCE_TYPE(__first)); +} + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +//-------------------------------------------------- +// copy_n (not part of the C++ standard) + +template <class _InputIter, class _Size, class _OutputIter> +pair<_InputIter, _OutputIter> __copy_n(_InputIter __first, _Size __count, + _OutputIter __result, + input_iterator_tag) { + for ( ; __count > 0; --__count) { + *__result = *__first; + ++__first; + ++__result; + } + return pair<_InputIter, _OutputIter>(__first, __result); +} + +template <class _RAIter, class _Size, class _OutputIter> +inline pair<_RAIter, _OutputIter> +__copy_n(_RAIter __first, _Size __count, + _OutputIter __result, + random_access_iterator_tag) { + _RAIter __last = __first + __count; + return pair<_RAIter, _OutputIter>(__last, copy(__first, __last, __result)); +} + +template <class _InputIter, class _Size, class _OutputIter> +inline pair<_InputIter, _OutputIter> +__copy_n(_InputIter __first, _Size __count, _OutputIter __result) { + return __copy_n(__first, __count, __result, + __ITERATOR_CATEGORY(__first)); +} + +template <class _InputIter, class _Size, class _OutputIter> +inline pair<_InputIter, _OutputIter> +copy_n(_InputIter __first, _Size __count, _OutputIter __result) { + __STL_REQUIRES(_InputIter, _InputIterator); + __STL_REQUIRES(_OutputIter, _OutputIterator); + return __copy_n(__first, __count, __result); +} + +//-------------------------------------------------- +// fill and fill_n + + +template <class _ForwardIter, class _Tp> +void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __value) { + __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); + for ( ; __first != __last; ++__first) + *__first = __value; +} + +template <class _OutputIter, class _Size, class _Tp> +_OutputIter fill_n(_OutputIter __first, _Size __n, const _Tp& __value) { + __STL_REQUIRES(_OutputIter, _OutputIterator); + for ( ; __n > 0; --__n, ++__first) + *__first = __value; + return __first; +} + +// Specialization: for one-byte types we can use memset. + +inline void fill(unsigned char* __first, unsigned char* __last, + const unsigned char& __c) { + unsigned char __tmp = __c; + memset(__first, __tmp, __last - __first); +} + +inline void fill(signed char* __first, signed char* __last, + const signed char& __c) { + signed char __tmp = __c; + memset(__first, static_cast<unsigned char>(__tmp), __last - __first); +} + +inline void fill(char* __first, char* __last, const char& __c) { + char __tmp = __c; + memset(__first, static_cast<unsigned char>(__tmp), __last - __first); +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Size> +inline unsigned char* fill_n(unsigned char* __first, _Size __n, + const unsigned char& __c) { + fill(__first, __first + __n, __c); + return __first + __n; +} + +template <class _Size> +inline signed char* fill_n(char* __first, _Size __n, + const signed char& __c) { + fill(__first, __first + __n, __c); + return __first + __n; +} + +template <class _Size> +inline char* fill_n(char* __first, _Size __n, const char& __c) { + fill(__first, __first + __n, __c); + return __first + __n; +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +//-------------------------------------------------- +// equal and mismatch + +template <class _InputIter1, class _InputIter2> +pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1, + _InputIter1 __last1, + _InputIter2 __first2) { + __STL_REQUIRES(_InputIter1, _InputIterator); + __STL_REQUIRES(_InputIter2, _InputIterator); + __STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, + _EqualityComparable); + __STL_REQUIRES(typename iterator_traits<_InputIter2>::value_type, + _EqualityComparable); + while (__first1 != __last1 && *__first1 == *__first2) { + ++__first1; + ++__first2; + } + return pair<_InputIter1, _InputIter2>(__first1, __first2); +} + +template <class _InputIter1, class _InputIter2, class _BinaryPredicate> +pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1, + _InputIter1 __last1, + _InputIter2 __first2, + _BinaryPredicate __binary_pred) { + __STL_REQUIRES(_InputIter1, _InputIterator); + __STL_REQUIRES(_InputIter2, _InputIterator); + while (__first1 != __last1 && __binary_pred(*__first1, *__first2)) { + ++__first1; + ++__first2; + } + return pair<_InputIter1, _InputIter2>(__first1, __first2); +} + +template <class _InputIter1, class _InputIter2> +inline bool equal(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2) { + __STL_REQUIRES(_InputIter1, _InputIterator); + __STL_REQUIRES(_InputIter2, _InputIterator); + __STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, + _EqualityComparable); + __STL_REQUIRES(typename iterator_traits<_InputIter2>::value_type, + _EqualityComparable); + for ( ; __first1 != __last1; ++__first1, ++__first2) + if (*__first1 != *__first2) + return false; + return true; +} + +template <class _InputIter1, class _InputIter2, class _BinaryPredicate> +inline bool equal(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _BinaryPredicate __binary_pred) { + __STL_REQUIRES(_InputIter1, _InputIterator); + __STL_REQUIRES(_InputIter2, _InputIterator); + for ( ; __first1 != __last1; ++__first1, ++__first2) + if (!__binary_pred(*__first1, *__first2)) + return false; + return true; +} + +//-------------------------------------------------- +// lexicographical_compare and lexicographical_compare_3way. +// (the latter is not part of the C++ standard.) + +template <class _InputIter1, class _InputIter2> +bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2) { + __STL_REQUIRES(_InputIter1, _InputIterator); + __STL_REQUIRES(_InputIter2, _InputIterator); + __STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, + _LessThanComparable); + __STL_REQUIRES(typename iterator_traits<_InputIter2>::value_type, + _LessThanComparable); + for ( ; __first1 != __last1 && __first2 != __last2 + ; ++__first1, ++__first2) { + if (*__first1 < *__first2) + return true; + if (*__first2 < *__first1) + return false; + } + return __first1 == __last1 && __first2 != __last2; +} + +template <class _InputIter1, class _InputIter2, class _Compare> +bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _Compare __comp) { + __STL_REQUIRES(_InputIter1, _InputIterator); + __STL_REQUIRES(_InputIter2, _InputIterator); + for ( ; __first1 != __last1 && __first2 != __last2 + ; ++__first1, ++__first2) { + if (__comp(*__first1, *__first2)) + return true; + if (__comp(*__first2, *__first1)) + return false; + } + return __first1 == __last1 && __first2 != __last2; +} + +inline bool +lexicographical_compare(const unsigned char* __first1, + const unsigned char* __last1, + const unsigned char* __first2, + const unsigned char* __last2) +{ + const size_t __len1 = __last1 - __first1; + const size_t __len2 = __last2 - __first2; + const int __result = memcmp(__first1, __first2, min(__len1, __len2)); + return __result != 0 ? __result < 0 : __len1 < __len2; +} + +inline bool lexicographical_compare(const char* __first1, const char* __last1, + const char* __first2, const char* __last2) +{ +#if CHAR_MAX == SCHAR_MAX + return lexicographical_compare((const signed char*) __first1, + (const signed char*) __last1, + (const signed char*) __first2, + (const signed char*) __last2); +#else /* CHAR_MAX == SCHAR_MAX */ + return lexicographical_compare((const unsigned char*) __first1, + (const unsigned char*) __last1, + (const unsigned char*) __first2, + (const unsigned char*) __last2); +#endif /* CHAR_MAX == SCHAR_MAX */ +} + +template <class _InputIter1, class _InputIter2> +int __lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2) +{ + while (__first1 != __last1 && __first2 != __last2) { + if (*__first1 < *__first2) + return -1; + if (*__first2 < *__first1) + return 1; + ++__first1; + ++__first2; + } + if (__first2 == __last2) { + return !(__first1 == __last1); + } + else { + return -1; + } +} + +inline int +__lexicographical_compare_3way(const unsigned char* __first1, + const unsigned char* __last1, + const unsigned char* __first2, + const unsigned char* __last2) +{ + const ptrdiff_t __len1 = __last1 - __first1; + const ptrdiff_t __len2 = __last2 - __first2; + const int __result = memcmp(__first1, __first2, min(__len1, __len2)); + return __result != 0 ? __result + : (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1)); +} + +inline int +__lexicographical_compare_3way(const char* __first1, const char* __last1, + const char* __first2, const char* __last2) +{ +#if CHAR_MAX == SCHAR_MAX + return __lexicographical_compare_3way( + (const signed char*) __first1, + (const signed char*) __last1, + (const signed char*) __first2, + (const signed char*) __last2); +#else + return __lexicographical_compare_3way((const unsigned char*) __first1, + (const unsigned char*) __last1, + (const unsigned char*) __first2, + (const unsigned char*) __last2); +#endif +} + +template <class _InputIter1, class _InputIter2> +int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2) +{ + __STL_REQUIRES(_InputIter1, _InputIterator); + __STL_REQUIRES(_InputIter2, _InputIterator); + __STL_REQUIRES(typename iterator_traits<_InputIter1>::value_type, + _LessThanComparable); + __STL_REQUIRES(typename iterator_traits<_InputIter2>::value_type, + _LessThanComparable); + return __lexicographical_compare_3way(__first1, __last1, __first2, __last2); +} + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_ALGOBASE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_alloc.h b/dtm_release/local/include/stl/stl_alloc.h new file mode 100644 index 0000000000000000000000000000000000000000..e96122a9d5a905d14cbd96b62f1177df2b5b6c28 --- /dev/null +++ b/dtm_release/local/include/stl/stl_alloc.h @@ -0,0 +1,897 @@ +/* + * Copyright (c) 1996-1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_ALLOC_H +#define __SGI_STL_INTERNAL_ALLOC_H + +#ifdef __SUNPRO_CC +# define __PRIVATE public + // Extra access restrictions prevent us from really making some things + // private. +#else +# define __PRIVATE private +#endif + +#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG +# define __USE_MALLOC +#endif + + +// This implements some standard node allocators. These are +// NOT the same as the allocators in the C++ draft standard or in +// in the original STL. They do not encapsulate different pointer +// types; indeed we assume that there is only one pointer type. +// The allocation primitives are intended to allocate individual objects, +// not larger arenas as with the original STL allocators. + +#ifndef __THROW_BAD_ALLOC +# if defined(__STL_NO_BAD_ALLOC) || !defined(__STL_USE_EXCEPTIONS) +# include <stdio.h> +# include <stdlib.h> +# define __THROW_BAD_ALLOC fprintf(stderr, "out of memory\n"); exit(1) +# else /* Standard conforming out-of-memory handling */ +# include <new> +# define __THROW_BAD_ALLOC throw std::bad_alloc() +# endif +#endif + +#include <stddef.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#ifndef __RESTRICT +# define __RESTRICT +#endif + +#ifdef __STL_THREADS +# include <stl_threads.h> +# define __NODE_ALLOCATOR_THREADS true +# ifdef __STL_SGI_THREADS + // We test whether threads are in use before locking. + // Perhaps this should be moved into stl_threads.h, but that + // probably makes it harder to avoid the procedure call when + // it isn't needed. + extern "C" { + extern int __us_rsthread_malloc; + } + // The above is copied from malloc.h. Including <malloc.h> + // would be cleaner but fails with certain levels of standard + // conformance. +# define __NODE_ALLOCATOR_LOCK if (threads && __us_rsthread_malloc) \ + { _S_node_allocator_lock._M_acquire_lock(); } +# define __NODE_ALLOCATOR_UNLOCK if (threads && __us_rsthread_malloc) \ + { _S_node_allocator_lock._M_release_lock(); } +# else /* !__STL_SGI_THREADS */ +# define __NODE_ALLOCATOR_LOCK \ + { if (threads) _S_node_allocator_lock._M_acquire_lock(); } +# define __NODE_ALLOCATOR_UNLOCK \ + { if (threads) _S_node_allocator_lock._M_release_lock(); } +# endif +#else +// Thread-unsafe +# define __NODE_ALLOCATOR_LOCK +# define __NODE_ALLOCATOR_UNLOCK +# define __NODE_ALLOCATOR_THREADS false +#endif + +__STL_BEGIN_NAMESPACE + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1174 +#endif + +// Malloc-based allocator. Typically slower than default alloc below. +// Typically thread-safe and more storage efficient. +#ifdef __STL_STATIC_TEMPLATE_MEMBER_BUG +# ifdef __DECLARE_GLOBALS_HERE + void (* __malloc_alloc_oom_handler)() = 0; + // g++ 2.7.2 does not handle static template data members. +# else + extern void (* __malloc_alloc_oom_handler)(); +# endif +#endif + +template <int __inst> +class __malloc_alloc_template { + +private: + + static void* _S_oom_malloc(size_t); + static void* _S_oom_realloc(void*, size_t); + +#ifndef __STL_STATIC_TEMPLATE_MEMBER_BUG + static void (* __malloc_alloc_oom_handler)(); +#endif + +public: + + static void* allocate(size_t __n) + { + void* __result = malloc(__n); + if (0 == __result) __result = _S_oom_malloc(__n); + return __result; + } + + static void deallocate(void* __p, size_t /* __n */) + { + free(__p); + } + + static void* reallocate(void* __p, size_t /* old_sz */, size_t __new_sz) + { + void* __result = realloc(__p, __new_sz); + if (0 == __result) __result = _S_oom_realloc(__p, __new_sz); + return __result; + } + + static void (* __set_malloc_handler(void (*__f)()))() + { + void (* __old)() = __malloc_alloc_oom_handler; + __malloc_alloc_oom_handler = __f; + return(__old); + } + +}; + +// malloc_alloc out-of-memory handling + +#ifndef __STL_STATIC_TEMPLATE_MEMBER_BUG +template <int __inst> +void (* __malloc_alloc_template<__inst>::__malloc_alloc_oom_handler)() = 0; +#endif + +template <int __inst> +void* +__malloc_alloc_template<__inst>::_S_oom_malloc(size_t __n) +{ + void (* __my_malloc_handler)(); + void* __result; + + for (;;) { + __my_malloc_handler = __malloc_alloc_oom_handler; + if (0 == __my_malloc_handler) { __THROW_BAD_ALLOC; } + (*__my_malloc_handler)(); + __result = malloc(__n); + if (__result) return(__result); + } +} + +template <int __inst> +void* __malloc_alloc_template<__inst>::_S_oom_realloc(void* __p, size_t __n) +{ + void (* __my_malloc_handler)(); + void* __result; + + for (;;) { + __my_malloc_handler = __malloc_alloc_oom_handler; + if (0 == __my_malloc_handler) { __THROW_BAD_ALLOC; } + (*__my_malloc_handler)(); + __result = realloc(__p, __n); + if (__result) return(__result); + } +} + +typedef __malloc_alloc_template<0> malloc_alloc; + +template<class _Tp, class _Alloc> +class simple_alloc { + +public: + static _Tp* allocate(size_t __n) + { return 0 == __n ? 0 : (_Tp*) _Alloc::allocate(__n * sizeof (_Tp)); } + static _Tp* allocate(void) + { return (_Tp*) _Alloc::allocate(sizeof (_Tp)); } + static void deallocate(_Tp* __p, size_t __n) + { if (0 != __n) _Alloc::deallocate(__p, __n * sizeof (_Tp)); } + static void deallocate(_Tp* __p) + { _Alloc::deallocate(__p, sizeof (_Tp)); } +}; + +// Allocator adaptor to check size arguments for debugging. +// Reports errors using assert. Checking can be disabled with +// NDEBUG, but it's far better to just use the underlying allocator +// instead when no checking is desired. +// There is some evidence that this can confuse Purify. +template <class _Alloc> +class debug_alloc { + +private: + + enum {_S_extra = 8}; // Size of space used to store size. Note + // that this must be large enough to preserve + // alignment. + +public: + + static void* allocate(size_t __n) + { + char* __result = (char*)_Alloc::allocate(__n + (int) _S_extra); + *(size_t*)__result = __n; + return __result + (int) _S_extra; + } + + static void deallocate(void* __p, size_t __n) + { + char* __real_p = (char*)__p - (int) _S_extra; + assert(*(size_t*)__real_p == __n); + _Alloc::deallocate(__real_p, __n + (int) _S_extra); + } + + static void* reallocate(void* __p, size_t __old_sz, size_t __new_sz) + { + char* __real_p = (char*)__p - (int) _S_extra; + assert(*(size_t*)__real_p == __old_sz); + char* __result = (char*) + _Alloc::reallocate(__real_p, __old_sz + (int) _S_extra, + __new_sz + (int) _S_extra); + *(size_t*)__result = __new_sz; + return __result + (int) _S_extra; + } + +}; + + +# ifdef __USE_MALLOC + +typedef malloc_alloc alloc; +typedef malloc_alloc single_client_alloc; + +# else + + +// Default node allocator. +// With a reasonable compiler, this should be roughly as fast as the +// original STL class-specific allocators, but with less fragmentation. +// Default_alloc_template parameters are experimental and MAY +// DISAPPEAR in the future. Clients should just use alloc for now. +// +// Important implementation properties: +// 1. If the client request an object of size > _MAX_BYTES, the resulting +// object will be obtained directly from malloc. +// 2. In all other cases, we allocate an object of size exactly +// _S_round_up(requested_size). Thus the client has enough size +// information that we can return the object to the proper free list +// without permanently losing part of the object. +// + +// The first template parameter specifies whether more than one thread +// may use this allocator. It is safe to allocate an object from +// one instance of a default_alloc and deallocate it with another +// one. This effectively transfers its ownership to the second one. +// This may have undesirable effects on reference locality. +// The second parameter is unreferenced and serves only to allow the +// creation of multiple default_alloc instances. +// Node that containers built on different allocator instances have +// different types, limiting the utility of this approach. + +#if defined(__SUNPRO_CC) || defined(__GNUC__) +// breaks if we make these template class members: + enum {_ALIGN = 8}; + enum {_MAX_BYTES = 128}; + enum {_NFREELISTS = 16}; // _MAX_BYTES/_ALIGN +#endif + +template <bool threads, int inst> +class __default_alloc_template { + +private: + // Really we should use static const int x = N + // instead of enum { x = N }, but few compilers accept the former. +#if ! (defined(__SUNPRO_CC) || defined(__GNUC__)) + enum {_ALIGN = 8}; + enum {_MAX_BYTES = 128}; + enum {_NFREELISTS = 16}; // _MAX_BYTES/_ALIGN +# endif + static size_t + _S_round_up(size_t __bytes) + { return (((__bytes) + (size_t) _ALIGN-1) & ~((size_t) _ALIGN - 1)); } + +__PRIVATE: + union _Obj { + union _Obj* _M_free_list_link; + char _M_client_data[1]; /* The client sees this. */ + }; +private: +# if defined(__SUNPRO_CC) || defined(__GNUC__) || defined(__HP_aCC) + static _Obj* __STL_VOLATILE _S_free_list[]; + // Specifying a size results in duplicate def for 4.1 +# else + static _Obj* __STL_VOLATILE _S_free_list[_NFREELISTS]; +# endif + static size_t _S_freelist_index(size_t __bytes) { + return (((__bytes) + (size_t)_ALIGN-1)/(size_t)_ALIGN - 1); + } + + // Returns an object of size __n, and optionally adds to size __n free list. + static void* _S_refill(size_t __n); + // Allocates a chunk for nobjs of size size. nobjs may be reduced + // if it is inconvenient to allocate the requested number. + static char* _S_chunk_alloc(size_t __size, int& __nobjs); + + // Chunk allocation state. + static char* _S_start_free; + static char* _S_end_free; + static size_t _S_heap_size; + +# ifdef __STL_THREADS + static _STL_mutex_lock _S_node_allocator_lock; +# endif + + // It would be nice to use _STL_auto_lock here. But we + // don't need the NULL check. And we do need a test whether + // threads have actually been started. + class _Lock; + friend class _Lock; + class _Lock { + public: + _Lock() { __NODE_ALLOCATOR_LOCK; } + ~_Lock() { __NODE_ALLOCATOR_UNLOCK; } + }; + +public: + + /* __n must be > 0 */ + static void* allocate(size_t __n) + { + void* __ret = 0; + + if (__n > (size_t) _MAX_BYTES) { + __ret = malloc_alloc::allocate(__n); + } + else { + _Obj* __STL_VOLATILE* __my_free_list + = _S_free_list + _S_freelist_index(__n); + // Acquire the lock here with a constructor call. + // This ensures that it is released in exit or during stack + // unwinding. +# ifndef _NOTHREADS + /*REFERENCED*/ + _Lock __lock_instance; +# endif + _Obj* __RESTRICT __result = *__my_free_list; + if (__result == 0) + __ret = _S_refill(_S_round_up(__n)); + else { + *__my_free_list = __result -> _M_free_list_link; + __ret = __result; + } + } + + return __ret; + }; + + /* __p may not be 0 */ + static void deallocate(void* __p, size_t __n) + { + if (__n > (size_t) _MAX_BYTES) + malloc_alloc::deallocate(__p, __n); + else { + _Obj* __STL_VOLATILE* __my_free_list + = _S_free_list + _S_freelist_index(__n); + _Obj* __q = (_Obj*)__p; + + // acquire lock +# ifndef _NOTHREADS + /*REFERENCED*/ + _Lock __lock_instance; +# endif /* _NOTHREADS */ + __q -> _M_free_list_link = *__my_free_list; + *__my_free_list = __q; + // lock is released here + } + } + + static void* reallocate(void* __p, size_t __old_sz, size_t __new_sz); + +} ; + +typedef __default_alloc_template<__NODE_ALLOCATOR_THREADS, 0> alloc; +typedef __default_alloc_template<false, 0> single_client_alloc; + +template <bool __threads, int __inst> +inline bool operator==(const __default_alloc_template<__threads, __inst>&, + const __default_alloc_template<__threads, __inst>&) +{ + return true; +} + +# ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER +template <bool __threads, int __inst> +inline bool operator!=(const __default_alloc_template<__threads, __inst>&, + const __default_alloc_template<__threads, __inst>&) +{ + return false; +} +# endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + + + +/* We allocate memory in large chunks in order to avoid fragmenting */ +/* the malloc heap too much. */ +/* We assume that size is properly aligned. */ +/* We hold the allocation lock. */ +template <bool __threads, int __inst> +char* +__default_alloc_template<__threads, __inst>::_S_chunk_alloc(size_t __size, + int& __nobjs) +{ + char* __result; + size_t __total_bytes = __size * __nobjs; + size_t __bytes_left = _S_end_free - _S_start_free; + + if (__bytes_left >= __total_bytes) { + __result = _S_start_free; + _S_start_free += __total_bytes; + return(__result); + } else if (__bytes_left >= __size) { + __nobjs = (int)(__bytes_left/__size); + __total_bytes = __size * __nobjs; + __result = _S_start_free; + _S_start_free += __total_bytes; + return(__result); + } else { + size_t __bytes_to_get = + 2 * __total_bytes + _S_round_up(_S_heap_size >> 4); + // Try to make use of the left-over piece. + if (__bytes_left > 0) { + _Obj* __STL_VOLATILE* __my_free_list = + _S_free_list + _S_freelist_index(__bytes_left); + + ((_Obj*)_S_start_free) -> _M_free_list_link = *__my_free_list; + *__my_free_list = (_Obj*)_S_start_free; + } + _S_start_free = (char*)malloc(__bytes_to_get); + if (0 == _S_start_free) { + size_t __i; + _Obj* __STL_VOLATILE* __my_free_list; + _Obj* __p; + // Try to make do with what we have. That can't + // hurt. We do not try smaller requests, since that tends + // to result in disaster on multi-process machines. + for (__i = __size; + __i <= (size_t) _MAX_BYTES; + __i += (size_t) _ALIGN) { + __my_free_list = _S_free_list + _S_freelist_index(__i); + __p = *__my_free_list; + if (0 != __p) { + *__my_free_list = __p -> _M_free_list_link; + _S_start_free = (char*)__p; + _S_end_free = _S_start_free + __i; + return(_S_chunk_alloc(__size, __nobjs)); + // Any leftover piece will eventually make it to the + // right free list. + } + } + _S_end_free = 0; // In case of exception. + _S_start_free = (char*)malloc_alloc::allocate(__bytes_to_get); + // This should either throw an + // exception or remedy the situation. Thus we assume it + // succeeded. + } + _S_heap_size += __bytes_to_get; + _S_end_free = _S_start_free + __bytes_to_get; + return(_S_chunk_alloc(__size, __nobjs)); + } +} + + +/* Returns an object of size __n, and optionally adds to size __n free list.*/ +/* We assume that __n is properly aligned. */ +/* We hold the allocation lock. */ +template <bool __threads, int __inst> +void* +__default_alloc_template<__threads, __inst>::_S_refill(size_t __n) +{ + int __nobjs = 20; + char* __chunk = _S_chunk_alloc(__n, __nobjs); + _Obj* __STL_VOLATILE* __my_free_list; + _Obj* __result; + _Obj* __current_obj; + _Obj* __next_obj; + int __i; + + if (1 == __nobjs) return(__chunk); + __my_free_list = _S_free_list + _S_freelist_index(__n); + + /* Build free list in chunk */ + __result = (_Obj*)__chunk; + *__my_free_list = __next_obj = (_Obj*)(__chunk + __n); + for (__i = 1; ; __i++) { + __current_obj = __next_obj; + __next_obj = (_Obj*)((char*)__next_obj + __n); + if (__nobjs - 1 == __i) { + __current_obj -> _M_free_list_link = 0; + break; + } else { + __current_obj -> _M_free_list_link = __next_obj; + } + } + return(__result); +} + +template <bool threads, int inst> +void* +__default_alloc_template<threads, inst>::reallocate(void* __p, + size_t __old_sz, + size_t __new_sz) +{ + void* __result; + size_t __copy_sz; + + if (__old_sz > (size_t) _MAX_BYTES && __new_sz > (size_t) _MAX_BYTES) { + return(realloc(__p, __new_sz)); + } + if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return(__p); + __result = allocate(__new_sz); + __copy_sz = __new_sz > __old_sz? __old_sz : __new_sz; + memcpy(__result, __p, __copy_sz); + deallocate(__p, __old_sz); + return(__result); +} + +#ifdef __STL_THREADS + template <bool __threads, int __inst> + _STL_mutex_lock + __default_alloc_template<__threads, __inst>::_S_node_allocator_lock + __STL_MUTEX_INITIALIZER; +#endif + + +template <bool __threads, int __inst> +char* __default_alloc_template<__threads, __inst>::_S_start_free = 0; + +template <bool __threads, int __inst> +char* __default_alloc_template<__threads, __inst>::_S_end_free = 0; + +template <bool __threads, int __inst> +size_t __default_alloc_template<__threads, __inst>::_S_heap_size = 0; + +template <bool __threads, int __inst> +typename __default_alloc_template<__threads, __inst>::_Obj* __STL_VOLATILE +__default_alloc_template<__threads, __inst> ::_S_free_list[ +# if defined(__SUNPRO_CC) || defined(__GNUC__) || defined(__HP_aCC) + _NFREELISTS +# else + __default_alloc_template<__threads, __inst>::_NFREELISTS +# endif +] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; +// The 16 zeros are necessary to make version 4.1 of the SunPro +// compiler happy. Otherwise it appears to allocate too little +// space for the array. + +#endif /* ! __USE_MALLOC */ + +// This implements allocators as specified in the C++ standard. +// +// Note that standard-conforming allocators use many language features +// that are not yet widely implemented. In particular, they rely on +// member templates, partial specialization, partial ordering of function +// templates, the typename keyword, and the use of the template keyword +// to refer to a template member of a dependent type. + +#ifdef __STL_USE_STD_ALLOCATORS + +template <class _Tp> +class allocator { + typedef alloc _Alloc; // The underlying allocator. +public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Tp* pointer; + typedef const _Tp* const_pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + typedef _Tp value_type; + + template <class _Tp1> struct rebind { + typedef allocator<_Tp1> other; + }; + + allocator() __STL_NOTHROW {} + allocator(const allocator&) __STL_NOTHROW {} + template <class _Tp1> allocator(const allocator<_Tp1>&) __STL_NOTHROW {} + ~allocator() __STL_NOTHROW {} + + pointer address(reference __x) const { return &__x; } + const_pointer address(const_reference __x) const { return &__x; } + + // __n is permitted to be 0. The C++ standard says nothing about what + // the return value is when __n == 0. + _Tp* allocate(size_type __n, const void* = 0) { + return __n != 0 ? static_cast<_Tp*>(_Alloc::allocate(__n * sizeof(_Tp))) + : 0; + } + + // __p is not permitted to be a null pointer. + void deallocate(pointer __p, size_type __n) + { _Alloc::deallocate(__p, __n * sizeof(_Tp)); } + + size_type max_size() const __STL_NOTHROW + { return size_t(-1) / sizeof(_Tp); } + + void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); } + void destroy(pointer __p) { __p->~_Tp(); } +}; + +template<> +class allocator<void> { +public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef void* pointer; + typedef const void* const_pointer; + typedef void value_type; + + template <class _Tp1> struct rebind { + typedef allocator<_Tp1> other; + }; +}; + + +template <class _T1, class _T2> +inline bool operator==(const allocator<_T1>&, const allocator<_T2>&) +{ + return true; +} + +template <class _T1, class _T2> +inline bool operator!=(const allocator<_T1>&, const allocator<_T2>&) +{ + return false; +} + +// Allocator adaptor to turn an SGI-style allocator (e.g. alloc, malloc_alloc) +// into a standard-conforming allocator. Note that this adaptor does +// *not* assume that all objects of the underlying alloc class are +// identical, nor does it assume that all of the underlying alloc's +// member functions are static member functions. Note, also, that +// __allocator<_Tp, alloc> is essentially the same thing as allocator<_Tp>. + +template <class _Tp, class _Alloc> +struct __allocator { + _Alloc __underlying_alloc; + + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Tp* pointer; + typedef const _Tp* const_pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + typedef _Tp value_type; + + template <class _Tp1> struct rebind { + typedef __allocator<_Tp1, _Alloc> other; + }; + + __allocator() __STL_NOTHROW {} + __allocator(const __allocator& __a) __STL_NOTHROW + : __underlying_alloc(__a.__underlying_alloc) {} + template <class _Tp1> + __allocator(const __allocator<_Tp1, _Alloc>& __a) __STL_NOTHROW + : __underlying_alloc(__a.__underlying_alloc) {} + ~__allocator() __STL_NOTHROW {} + + pointer address(reference __x) const { return &__x; } + const_pointer address(const_reference __x) const { return &__x; } + + // __n is permitted to be 0. + _Tp* allocate(size_type __n, const void* = 0) { + return __n != 0 + ? static_cast<_Tp*>(__underlying_alloc.allocate(__n * sizeof(_Tp))) + : 0; + } + + // __p is not permitted to be a null pointer. + void deallocate(pointer __p, size_type __n) + { __underlying_alloc.deallocate(__p, __n * sizeof(_Tp)); } + + size_type max_size() const __STL_NOTHROW + { return size_t(-1) / sizeof(_Tp); } + + void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); } + void destroy(pointer __p) { __p->~_Tp(); } +}; + +template <class _Alloc> +class __allocator<void, _Alloc> { + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef void* pointer; + typedef const void* const_pointer; + typedef void value_type; + + template <class _Tp1> struct rebind { + typedef __allocator<_Tp1, _Alloc> other; + }; +}; + +template <class _Tp, class _Alloc> +inline bool operator==(const __allocator<_Tp, _Alloc>& __a1, + const __allocator<_Tp, _Alloc>& __a2) +{ + return __a1.__underlying_alloc == __a2.__underlying_alloc; +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER +template <class _Tp, class _Alloc> +inline bool operator!=(const __allocator<_Tp, _Alloc>& __a1, + const __allocator<_Tp, _Alloc>& __a2) +{ + return __a1.__underlying_alloc != __a2.__underlying_alloc; +} +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +// Comparison operators for all of the predifined SGI-style allocators. +// This ensures that __allocator<malloc_alloc> (for example) will +// work correctly. + +template <int inst> +inline bool operator==(const __malloc_alloc_template<inst>&, + const __malloc_alloc_template<inst>&) +{ + return true; +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER +template <int __inst> +inline bool operator!=(const __malloc_alloc_template<__inst>&, + const __malloc_alloc_template<__inst>&) +{ + return false; +} +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + + +template <class _Alloc> +inline bool operator==(const debug_alloc<_Alloc>&, + const debug_alloc<_Alloc>&) { + return true; +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER +template <class _Alloc> +inline bool operator!=(const debug_alloc<_Alloc>&, + const debug_alloc<_Alloc>&) { + return false; +} +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +// Another allocator adaptor: _Alloc_traits. This serves two +// purposes. First, make it possible to write containers that can use +// either SGI-style allocators or standard-conforming allocator. +// Second, provide a mechanism so that containers can query whether or +// not the allocator has distinct instances. If not, the container +// can avoid wasting a word of memory to store an empty object. + +// This adaptor uses partial specialization. The general case of +// _Alloc_traits<_Tp, _Alloc> assumes that _Alloc is a +// standard-conforming allocator, possibly with non-equal instances +// and non-static members. (It still behaves correctly even if _Alloc +// has static member and if all instances are equal. Refinements +// affect performance, not correctness.) + +// There are always two members: allocator_type, which is a standard- +// conforming allocator type for allocating objects of type _Tp, and +// _S_instanceless, a static const member of type bool. If +// _S_instanceless is true, this means that there is no difference +// between any two instances of type allocator_type. Furthermore, if +// _S_instanceless is true, then _Alloc_traits has one additional +// member: _Alloc_type. This type encapsulates allocation and +// deallocation of objects of type _Tp through a static interface; it +// has two member functions, whose signatures are +// static _Tp* allocate(size_t) +// static void deallocate(_Tp*, size_t) + +// The fully general version. + +template <class _Tp, class _Allocator> +struct _Alloc_traits +{ + static const bool _S_instanceless = false; + typedef typename _Allocator::__STL_TEMPLATE rebind<_Tp>::other + allocator_type; +}; + +template <class _Tp, class _Allocator> +const bool _Alloc_traits<_Tp, _Allocator>::_S_instanceless; + +// The version for the default allocator. + +template <class _Tp, class _Tp1> +struct _Alloc_traits<_Tp, allocator<_Tp1> > +{ + static const bool _S_instanceless = true; + typedef simple_alloc<_Tp, alloc> _Alloc_type; + typedef allocator<_Tp> allocator_type; +}; + +// Versions for the predefined SGI-style allocators. + +template <class _Tp, int __inst> +struct _Alloc_traits<_Tp, __malloc_alloc_template<__inst> > +{ + static const bool _S_instanceless = true; + typedef simple_alloc<_Tp, __malloc_alloc_template<__inst> > _Alloc_type; + typedef __allocator<_Tp, __malloc_alloc_template<__inst> > allocator_type; +}; + +template <class _Tp, bool __threads, int __inst> +struct _Alloc_traits<_Tp, __default_alloc_template<__threads, __inst> > +{ + static const bool _S_instanceless = true; + typedef simple_alloc<_Tp, __default_alloc_template<__threads, __inst> > + _Alloc_type; + typedef __allocator<_Tp, __default_alloc_template<__threads, __inst> > + allocator_type; +}; + +template <class _Tp, class _Alloc> +struct _Alloc_traits<_Tp, debug_alloc<_Alloc> > +{ + static const bool _S_instanceless = true; + typedef simple_alloc<_Tp, debug_alloc<_Alloc> > _Alloc_type; + typedef __allocator<_Tp, debug_alloc<_Alloc> > allocator_type; +}; + +// Versions for the __allocator adaptor used with the predefined +// SGI-style allocators. + +template <class _Tp, class _Tp1, int __inst> +struct _Alloc_traits<_Tp, + __allocator<_Tp1, __malloc_alloc_template<__inst> > > +{ + static const bool _S_instanceless = true; + typedef simple_alloc<_Tp, __malloc_alloc_template<__inst> > _Alloc_type; + typedef __allocator<_Tp, __malloc_alloc_template<__inst> > allocator_type; +}; + +template <class _Tp, class _Tp1, bool __thr, int __inst> +struct _Alloc_traits<_Tp, + __allocator<_Tp1, + __default_alloc_template<__thr, __inst> > > +{ + static const bool _S_instanceless = true; + typedef simple_alloc<_Tp, __default_alloc_template<__thr,__inst> > + _Alloc_type; + typedef __allocator<_Tp, __default_alloc_template<__thr,__inst> > + allocator_type; +}; + +template <class _Tp, class _Tp1, class _Alloc> +struct _Alloc_traits<_Tp, __allocator<_Tp1, debug_alloc<_Alloc> > > +{ + static const bool _S_instanceless = true; + typedef simple_alloc<_Tp, debug_alloc<_Alloc> > _Alloc_type; + typedef __allocator<_Tp, debug_alloc<_Alloc> > allocator_type; +}; + + +#endif /* __STL_USE_STD_ALLOCATORS */ + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1174 +#endif + +__STL_END_NAMESPACE + +#undef __PRIVATE + +#endif /* __SGI_STL_INTERNAL_ALLOC_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_bvector.h b/dtm_release/local/include/stl/stl_bvector.h new file mode 100644 index 0000000000000000000000000000000000000000..cba08355b875a182ffac0348d38bb8c3cc27eb33 --- /dev/null +++ b/dtm_release/local/include/stl/stl_bvector.h @@ -0,0 +1,896 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996-1999 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_BVECTOR_H +#define __SGI_STL_INTERNAL_BVECTOR_H + +__STL_BEGIN_NAMESPACE + +static const int __WORD_BIT = int(CHAR_BIT*sizeof(unsigned int)); + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1174 +#pragma set woff 1375 +#endif + +struct _Bit_reference { + unsigned int* _M_p; + unsigned int _M_mask; + _Bit_reference(unsigned int* __x, unsigned int __y) + : _M_p(__x), _M_mask(__y) {} + +public: + _Bit_reference() : _M_p(0), _M_mask(0) {} + operator bool() const { return !(!(*_M_p & _M_mask)); } + _Bit_reference& operator=(bool __x) + { + if (__x) *_M_p |= _M_mask; + else *_M_p &= ~_M_mask; + return *this; + } + _Bit_reference& operator=(const _Bit_reference& __x) + { return *this = bool(__x); } + bool operator==(const _Bit_reference& __x) const + { return bool(*this) == bool(__x); } + bool operator<(const _Bit_reference& __x) const { + return !bool(*this) && bool(__x); + } + void flip() { *_M_p ^= _M_mask; } +}; + +inline void swap(_Bit_reference __x, _Bit_reference __y) +{ + bool __tmp = __x; + __x = __y; + __y = __tmp; +} + +struct _Bit_iterator_base : public random_access_iterator<bool, ptrdiff_t> +{ + unsigned int* _M_p; + unsigned int _M_offset; + + _Bit_iterator_base(unsigned int* __x, unsigned int __y) + : _M_p(__x), _M_offset(__y) {} + + void _M_bump_up() { + if (_M_offset++ == __WORD_BIT - 1) { + _M_offset = 0; + ++_M_p; + } + } + void _M_bump_down() { + if (_M_offset-- == 0) { + _M_offset = __WORD_BIT - 1; + --_M_p; + } + } + + void _M_incr(ptrdiff_t __i) { + difference_type __n = __i + _M_offset; + _M_p += __n / __WORD_BIT; + __n = __n % __WORD_BIT; + if (__n < 0) { + _M_offset = (unsigned int) __n + __WORD_BIT; + --_M_p; + } else + _M_offset = (unsigned int) __n; + } + + bool operator==(const _Bit_iterator_base& __i) const { + return _M_p == __i._M_p && _M_offset == __i._M_offset; + } + bool operator<(const _Bit_iterator_base& __i) const { + return _M_p < __i._M_p || (_M_p == __i._M_p && _M_offset < __i._M_offset); + } + bool operator!=(const _Bit_iterator_base& __i) const { + return !(*this == __i); + } + bool operator>(const _Bit_iterator_base& __i) const { + return __i < *this; + } + bool operator<=(const _Bit_iterator_base& __i) const { + return !(__i < *this); + } + bool operator>=(const _Bit_iterator_base& __i) const { + return !(*this < __i); + } +}; + +inline ptrdiff_t +operator-(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) { + return __WORD_BIT * (__x._M_p - __y._M_p) + __x._M_offset - __y._M_offset; +} + + +struct _Bit_iterator : public _Bit_iterator_base +{ + typedef _Bit_reference reference; + typedef _Bit_reference* pointer; + typedef _Bit_iterator iterator; + + _Bit_iterator() : _Bit_iterator_base(0, 0) {} + _Bit_iterator(unsigned int* __x, unsigned int __y) + : _Bit_iterator_base(__x, __y) {} + + reference operator*() const { return reference(_M_p, 1U << _M_offset); } + iterator& operator++() { + _M_bump_up(); + return *this; + } + iterator operator++(int) { + iterator __tmp = *this; + _M_bump_up(); + return __tmp; + } + iterator& operator--() { + _M_bump_down(); + return *this; + } + iterator operator--(int) { + iterator __tmp = *this; + _M_bump_down(); + return __tmp; + } + iterator& operator+=(difference_type __i) { + _M_incr(__i); + return *this; + } + iterator& operator-=(difference_type __i) { + *this += -__i; + return *this; + } + iterator operator+(difference_type __i) const { + iterator __tmp = *this; + return __tmp += __i; + } + iterator operator-(difference_type __i) const { + iterator __tmp = *this; + return __tmp -= __i; + } + + reference operator[](difference_type __i) { return *(*this + __i); } +}; + +inline _Bit_iterator +operator+(ptrdiff_t __n, const _Bit_iterator& __x) { return __x + __n; } + + +struct _Bit_const_iterator : public _Bit_iterator_base +{ + typedef bool reference; + typedef bool const_reference; + typedef const bool* pointer; + typedef _Bit_const_iterator const_iterator; + + _Bit_const_iterator() : _Bit_iterator_base(0, 0) {} + _Bit_const_iterator(unsigned int* __x, unsigned int __y) + : _Bit_iterator_base(__x, __y) {} + _Bit_const_iterator(const _Bit_iterator& __x) + : _Bit_iterator_base(__x._M_p, __x._M_offset) {} + + const_reference operator*() const { + return _Bit_reference(_M_p, 1U << _M_offset); + } + const_iterator& operator++() { + _M_bump_up(); + return *this; + } + const_iterator operator++(int) { + const_iterator __tmp = *this; + _M_bump_up(); + return __tmp; + } + const_iterator& operator--() { + _M_bump_down(); + return *this; + } + const_iterator operator--(int) { + const_iterator __tmp = *this; + _M_bump_down(); + return __tmp; + } + const_iterator& operator+=(difference_type __i) { + _M_incr(__i); + return *this; + } + const_iterator& operator-=(difference_type __i) { + *this += -__i; + return *this; + } + const_iterator operator+(difference_type __i) const { + const_iterator __tmp = *this; + return __tmp += __i; + } + const_iterator operator-(difference_type __i) const { + const_iterator __tmp = *this; + return __tmp -= __i; + } + const_reference operator[](difference_type __i) { + return *(*this + __i); + } +}; + +inline _Bit_const_iterator +operator+(ptrdiff_t __n, const _Bit_const_iterator& __x) { return __x + __n; } + + +// Bit-vector base class, which encapsulates the difference between +// old SGI-style allocators and standard-conforming allocators. + +#ifdef __STL_USE_STD_ALLOCATORS + +// Base class for ordinary allocators. +template <class _Allocator, bool __is_static> +class _Bvector_alloc_base { +public: + typedef typename _Alloc_traits<bool, _Allocator>::allocator_type + allocator_type; + allocator_type get_allocator() const { return _M_data_allocator; } + + _Bvector_alloc_base(const allocator_type& __a) + : _M_data_allocator(__a), _M_start(), _M_finish(), _M_end_of_storage(0) {} + +protected: + unsigned int* _M_bit_alloc(size_t __n) + { return _M_data_allocator.allocate((__n + __WORD_BIT - 1)/__WORD_BIT); } + void _M_deallocate() { + if (_M_start._M_p) + _M_data_allocator.deallocate(_M_start._M_p, + _M_end_of_storage - _M_start._M_p); + } + + typename _Alloc_traits<unsigned int, _Allocator>::allocator_type + _M_data_allocator; + _Bit_iterator _M_start; + _Bit_iterator _M_finish; + unsigned int* _M_end_of_storage; +}; + +// Specialization for instanceless allocators. +template <class _Allocator> +class _Bvector_alloc_base<_Allocator, true> { +public: + typedef typename _Alloc_traits<bool, _Allocator>::allocator_type + allocator_type; + allocator_type get_allocator() const { return allocator_type(); } + + _Bvector_alloc_base(const allocator_type&) + : _M_start(), _M_finish(), _M_end_of_storage(0) {} + +protected: + typedef typename _Alloc_traits<unsigned int, _Allocator>::_Alloc_type + _Alloc_type; + + unsigned int* _M_bit_alloc(size_t __n) + { return _Alloc_type::allocate((__n + __WORD_BIT - 1)/__WORD_BIT); } + void _M_deallocate() { + if (_M_start._M_p) + _Alloc_type::deallocate(_M_start._M_p, + _M_end_of_storage - _M_start._M_p); + } + + _Bit_iterator _M_start; + _Bit_iterator _M_finish; + unsigned int* _M_end_of_storage; +}; + +template <class _Alloc> +class _Bvector_base + : public _Bvector_alloc_base<_Alloc, + _Alloc_traits<bool, _Alloc>::_S_instanceless> +{ + typedef _Bvector_alloc_base<_Alloc, + _Alloc_traits<bool, _Alloc>::_S_instanceless> + _Base; +public: + typedef typename _Base::allocator_type allocator_type; + + _Bvector_base(const allocator_type& __a) : _Base(__a) {} + ~_Bvector_base() { _Base::_M_deallocate(); } +}; + +#else /* __STL_USE_STD_ALLOCATORS */ + +template <class _Alloc> +class _Bvector_base +{ +public: + typedef _Alloc allocator_type; + allocator_type get_allocator() const { return allocator_type(); } + + _Bvector_base(const allocator_type&) + : _M_start(), _M_finish(), _M_end_of_storage(0) {} + ~_Bvector_base() { _M_deallocate(); } + +protected: + typedef simple_alloc<unsigned int, _Alloc> _Alloc_type; + + unsigned int* _M_bit_alloc(size_t __n) + { return _Alloc_type::allocate((__n + __WORD_BIT - 1)/__WORD_BIT); } + void _M_deallocate() { + if (_M_start._M_p) + _Alloc_type::deallocate(_M_start._M_p, + _M_end_of_storage - _M_start._M_p); + } + + _Bit_iterator _M_start; + _Bit_iterator _M_finish; + unsigned int* _M_end_of_storage; +}; + +#endif /* __STL_USE_STD_ALLOCATORS */ + +// The next few lines are confusing. What we're doing is declaring a +// partial specialization of vector<T, Alloc> if we have the necessary +// compiler support. Otherwise, we define a class bit_vector which uses +// the default allocator. + +#if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) && !defined(__STL_NO_BOOL) +# define __SGI_STL_VECBOOL_TEMPLATE +# define __BVECTOR vector<bool, _Alloc> +# define __VECTOR vector +# define __BVECTOR_BASE _Bvector_base<_Alloc> +# define __BVECTOR_TMPL_LIST template <class _Alloc> + __STL_END_NAMESPACE +# include <stl_vector.h> + __STL_BEGIN_NAMESPACE +#else /* __STL_CLASS_PARTIAL_SPECIALIZATION && !__STL_NO_BOOL */ +# undef __SGI_STL_VECBOOL_TEMPLATE +# define __BVECTOR bit_vector +# define __VECTOR bit_vector +# define __BVECTOR_BASE _Bvector_base<__STL_DEFAULT_ALLOCATOR(bool) > +# define __BVECTOR_TMPL_LIST +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION && !__STL_NO_BOOL */ + + +__BVECTOR_TMPL_LIST +class __BVECTOR : public __BVECTOR_BASE +{ +public: + typedef bool value_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Bit_reference reference; + typedef bool const_reference; + typedef _Bit_reference* pointer; + typedef const bool* const_pointer; + + typedef _Bit_iterator iterator; + typedef _Bit_const_iterator const_iterator; + +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + typedef reverse_iterator<const_iterator> const_reverse_iterator; + typedef reverse_iterator<iterator> reverse_iterator; +#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + typedef reverse_iterator<const_iterator, value_type, const_reference, + difference_type> const_reverse_iterator; + typedef reverse_iterator<iterator, value_type, reference, difference_type> + reverse_iterator; +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + + typedef typename __BVECTOR_BASE::allocator_type allocator_type; + allocator_type get_allocator() const { + return __BVECTOR_BASE::get_allocator(); + } + +protected: +#ifdef __STL_USE_NAMESPACES + using __BVECTOR_BASE::_M_bit_alloc; + using __BVECTOR_BASE::_M_deallocate; + using __BVECTOR_BASE::_M_start; + using __BVECTOR_BASE::_M_finish; + using __BVECTOR_BASE::_M_end_of_storage; +#endif /* __STL_USE_NAMESPACES */ + +protected: + void _M_initialize(size_type __n) { + unsigned int* __q = _M_bit_alloc(__n); + _M_end_of_storage = __q + (__n + __WORD_BIT - 1)/__WORD_BIT; + _M_start = iterator(__q, 0); + _M_finish = _M_start + difference_type(__n); + } + void _M_insert_aux(iterator __position, bool __x) { + if (_M_finish._M_p != _M_end_of_storage) { + copy_backward(__position, _M_finish, _M_finish + 1); + *__position = __x; + ++_M_finish; + } + else { + size_type __len = size() ? 2 * size() : __WORD_BIT; + unsigned int* __q = _M_bit_alloc(__len); + iterator __i = copy(begin(), __position, iterator(__q, 0)); + *__i++ = __x; + _M_finish = copy(__position, end(), __i); + _M_deallocate(); + _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT; + _M_start = iterator(__q, 0); + } + } + +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + void _M_initialize_range(_InputIterator __first, _InputIterator __last, + input_iterator_tag) { + _M_start = iterator(); + _M_finish = iterator(); + _M_end_of_storage = 0; + for ( ; __first != __last; ++__first) + push_back(*__first); + } + + template <class _ForwardIterator> + void _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last, + forward_iterator_tag) { + size_type __n = 0; + distance(__first, __last, __n); + _M_initialize(__n); + copy(__first, __last, _M_start); + } + + template <class _InputIterator> + void _M_insert_range(iterator __pos, + _InputIterator __first, _InputIterator __last, + input_iterator_tag) { + for ( ; __first != __last; ++__first) { + __pos = insert(__pos, *__first); + ++__pos; + } + } + + template <class _ForwardIterator> + void _M_insert_range(iterator __position, + _ForwardIterator __first, _ForwardIterator __last, + forward_iterator_tag) { + if (__first != __last) { + size_type __n = 0; + distance(__first, __last, __n); + if (capacity() - size() >= __n) { + copy_backward(__position, end(), _M_finish + difference_type(__n)); + copy(__first, __last, __position); + _M_finish += difference_type(__n); + } + else { + size_type __len = size() + max(size(), __n); + unsigned int* __q = _M_bit_alloc(__len); + iterator __i = copy(begin(), __position, iterator(__q, 0)); + __i = copy(__first, __last, __i); + _M_finish = copy(__position, end(), __i); + _M_deallocate(); + _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT; + _M_start = iterator(__q, 0); + } + } + } + +#endif /* __STL_MEMBER_TEMPLATES */ + +public: + iterator begin() { return _M_start; } + const_iterator begin() const { return _M_start; } + iterator end() { return _M_finish; } + const_iterator end() const { return _M_finish; } + + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const { + return const_reverse_iterator(end()); + } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const { + return const_reverse_iterator(begin()); + } + + size_type size() const { return size_type(end() - begin()); } + size_type max_size() const { return size_type(-1); } + size_type capacity() const { + return size_type(const_iterator(_M_end_of_storage, 0) - begin()); + } + bool empty() const { return begin() == end(); } + + reference operator[](size_type __n) + { return *(begin() + difference_type(__n)); } + const_reference operator[](size_type __n) const + { return *(begin() + difference_type(__n)); } + +#ifdef __STL_THROW_RANGE_ERRORS + void _M_range_check(size_type __n) const { + if (__n >= this->size()) + __stl_throw_range_error("vector<bool>"); + } + + reference at(size_type __n) + { _M_range_check(__n); return (*this)[__n]; } + const_reference at(size_type __n) const + { _M_range_check(__n); return (*this)[__n]; } +#endif /* __STL_THROW_RANGE_ERRORS */ + + explicit __VECTOR(const allocator_type& __a = allocator_type()) + : __BVECTOR_BASE(__a) {} + + __VECTOR(size_type __n, bool __value, + const allocator_type& __a = allocator_type()) + : __BVECTOR_BASE(__a) + { + _M_initialize(__n); + fill(_M_start._M_p, _M_end_of_storage, __value ? ~0 : 0); + } + + explicit __VECTOR(size_type __n) + : __BVECTOR_BASE(allocator_type()) + { + _M_initialize(__n); + fill(_M_start._M_p, _M_end_of_storage, 0); + } + + __VECTOR(const __VECTOR& __x) : __BVECTOR_BASE(__x.get_allocator()) { + _M_initialize(__x.size()); + copy(__x.begin(), __x.end(), _M_start); + } + +#ifdef __STL_MEMBER_TEMPLATES + + // Check whether it's an integral type. If so, it's not an iterator. + + template <class _Integer> + void _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) { + _M_initialize(__n); + fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0); + } + + template <class _InputIterator> + void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, + __false_type) { + _M_initialize_range(__first, __last, __ITERATOR_CATEGORY(__first)); + } + + template <class _InputIterator> + __VECTOR(_InputIterator __first, _InputIterator __last, + const allocator_type& __a = allocator_type()) + : __BVECTOR_BASE(__a) + { + typedef typename _Is_integer<_InputIterator>::_Integral _Integral; + _M_initialize_dispatch(__first, __last, _Integral()); + } + +#else /* __STL_MEMBER_TEMPLATES */ + + __VECTOR(const_iterator __first, const_iterator __last, + const allocator_type& __a = allocator_type()) + : __BVECTOR_BASE(__a) + { + size_type __n = 0; + distance(__first, __last, __n); + _M_initialize(__n); + copy(__first, __last, _M_start); + } + __VECTOR(const bool* __first, const bool* __last, + const allocator_type& __a = allocator_type()) + : __BVECTOR_BASE(__a) + { + size_type __n = 0; + distance(__first, __last, __n); + _M_initialize(__n); + copy(__first, __last, _M_start); + } + +#endif /* __STL_MEMBER_TEMPLATES */ + + ~__VECTOR() { } + + __VECTOR& operator=(const __VECTOR& __x) { + if (&__x == this) return *this; + if (__x.size() > capacity()) { + _M_deallocate(); + _M_initialize(__x.size()); + } + copy(__x.begin(), __x.end(), begin()); + _M_finish = begin() + difference_type(__x.size()); + return *this; + } + + // assign(), a generalized assignment member function. Two + // versions: one that takes a count, and one that takes a range. + // The range version is a member template, so we dispatch on whether + // or not the type is an integer. + + void _M_fill_assign(size_t __n, bool __x) { + if (__n > size()) { + fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0); + insert(end(), __n - size(), __x); + } + else { + erase(begin() + __n, end()); + fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0); + } + } + + void assign(size_t __n, bool __x) { _M_fill_assign(__n, __x); } + +#ifdef __STL_MEMBER_TEMPLATES + + template <class _InputIterator> + void assign(_InputIterator __first, _InputIterator __last) { + typedef typename _Is_integer<_InputIterator>::_Integral _Integral; + _M_assign_dispatch(__first, __last, _Integral()); + } + + template <class _Integer> + void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) + { _M_fill_assign((size_t) __n, (bool) __val); } + + template <class _InputIter> + void _M_assign_dispatch(_InputIter __first, _InputIter __last, __false_type) + { _M_assign_aux(__first, __last, __ITERATOR_CATEGORY(__first)); } + + template <class _InputIterator> + void _M_assign_aux(_InputIterator __first, _InputIterator __last, + input_iterator_tag) { + iterator __cur = begin(); + for ( ; __first != __last && __cur != end(); ++__cur, ++__first) + *__cur = *__first; + if (__first == __last) + erase(__cur, end()); + else + insert(end(), __first, __last); + } + + template <class _ForwardIterator> + void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, + forward_iterator_tag) { + size_type __len = 0; + distance(__first, __last, __len); + if (__len < size()) + erase(copy(__first, __last, begin()), end()); + else { + _ForwardIterator __mid = __first; + advance(__mid, size()); + copy(__first, __mid, begin()); + insert(end(), __mid, __last); + } + } + +#endif /* __STL_MEMBER_TEMPLATES */ + + void reserve(size_type __n) { + if (capacity() < __n) { + unsigned int* __q = _M_bit_alloc(__n); + _M_finish = copy(begin(), end(), iterator(__q, 0)); + _M_deallocate(); + _M_start = iterator(__q, 0); + _M_end_of_storage = __q + (__n + __WORD_BIT - 1)/__WORD_BIT; + } + } + + reference front() { return *begin(); } + const_reference front() const { return *begin(); } + reference back() { return *(end() - 1); } + const_reference back() const { return *(end() - 1); } + void push_back(bool __x) { + if (_M_finish._M_p != _M_end_of_storage) + *_M_finish++ = __x; + else + _M_insert_aux(end(), __x); + } + void swap(__BVECTOR& __x) { + __STD::swap(_M_start, __x._M_start); + __STD::swap(_M_finish, __x._M_finish); + __STD::swap(_M_end_of_storage, __x._M_end_of_storage); + } + iterator insert(iterator __position, bool __x = bool()) { + difference_type __n = __position - begin(); + if (_M_finish._M_p != _M_end_of_storage && __position == end()) + *_M_finish++ = __x; + else + _M_insert_aux(__position, __x); + return begin() + __n; + } + +#ifdef __STL_MEMBER_TEMPLATES + // Check whether it's an integral type. If so, it's not an iterator. + + template <class _Integer> + void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, + __true_type) { + _M_fill_insert(__pos, __n, __x); + } + + template <class _InputIterator> + void _M_insert_dispatch(iterator __pos, + _InputIterator __first, _InputIterator __last, + __false_type) { + _M_insert_range(__pos, __first, __last, __ITERATOR_CATEGORY(__first)); + } + + template <class _InputIterator> + void insert(iterator __position, + _InputIterator __first, _InputIterator __last) { + typedef typename _Is_integer<_InputIterator>::_Integral _Integral; + _M_insert_dispatch(__position, __first, __last, _Integral()); + } + +#else /* __STL_MEMBER_TEMPLATES */ + void insert(iterator __position, + const_iterator __first, const_iterator __last) { + if (__first == __last) return; + size_type __n = 0; + distance(__first, __last, __n); + if (capacity() - size() >= __n) { + copy_backward(__position, end(), _M_finish + __n); + copy(__first, __last, __position); + _M_finish += __n; + } + else { + size_type __len = size() + max(size(), __n); + unsigned int* __q = _M_bit_alloc(__len); + iterator __i = copy(begin(), __position, iterator(__q, 0)); + __i = copy(__first, __last, __i); + _M_finish = copy(__position, end(), __i); + _M_deallocate(); + _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT; + _M_start = iterator(__q, 0); + } + } + + void insert(iterator __position, const bool* __first, const bool* __last) { + if (__first == __last) return; + size_type __n = 0; + distance(__first, __last, __n); + if (capacity() - size() >= __n) { + copy_backward(__position, end(), _M_finish + __n); + copy(__first, __last, __position); + _M_finish += __n; + } + else { + size_type __len = size() + max(size(), __n); + unsigned int* __q = _M_bit_alloc(__len); + iterator __i = copy(begin(), __position, iterator(__q, 0)); + __i = copy(__first, __last, __i); + _M_finish = copy(__position, end(), __i); + _M_deallocate(); + _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT; + _M_start = iterator(__q, 0); + } + } +#endif /* __STL_MEMBER_TEMPLATES */ + + void _M_fill_insert(iterator __position, size_type __n, bool __x) { + if (__n == 0) return; + if (capacity() - size() >= __n) { + copy_backward(__position, end(), _M_finish + difference_type(__n)); + fill(__position, __position + difference_type(__n), __x); + _M_finish += difference_type(__n); + } + else { + size_type __len = size() + max(size(), __n); + unsigned int* __q = _M_bit_alloc(__len); + iterator __i = copy(begin(), __position, iterator(__q, 0)); + fill_n(__i, __n, __x); + _M_finish = copy(__position, end(), __i + difference_type(__n)); + _M_deallocate(); + _M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT; + _M_start = iterator(__q, 0); + } + } + + void insert(iterator __position, size_type __n, bool __x) { + _M_fill_insert(__position, __n, __x); + } + + void pop_back() { --_M_finish; } + iterator erase(iterator __position) { + if (__position + 1 != end()) + copy(__position + 1, end(), __position); + --_M_finish; + return __position; + } + iterator erase(iterator __first, iterator __last) { + _M_finish = copy(__last, end(), __first); + return __first; + } + void resize(size_type __new_size, bool __x = bool()) { + if (__new_size < size()) + erase(begin() + difference_type(__new_size), end()); + else + insert(end(), __new_size - size(), __x); + } + void flip() { + for (unsigned int* __p = _M_start._M_p; __p != _M_end_of_storage; ++__p) + *__p = ~*__p; + } + + void clear() { erase(begin(), end()); } +}; + +#ifdef __SGI_STL_VECBOOL_TEMPLATE + +// This typedef is non-standard. It is provided for backward compatibility. +typedef vector<bool, alloc> bit_vector; + +#else /* __SGI_STL_VECBOOL_TEMPLATE */ + +inline void swap(bit_vector& __x, bit_vector& __y) { + __x.swap(__y); +} + +inline bool +operator==(const bit_vector& __x, const bit_vector& __y) +{ + return (__x.size() == __y.size() && + equal(__x.begin(), __x.end(), __y.begin())); +} + +inline bool +operator!=(const bit_vector& __x, const bit_vector& __y) +{ + return !(__x == __y); +} + +inline bool +operator<(const bit_vector& __x, const bit_vector& __y) +{ + return lexicographical_compare(__x.begin(), __x.end(), + __y.begin(), __y.end()); +} + +inline bool operator>(const bit_vector& __x, const bit_vector& __y) +{ + return __y < __x; +} + +inline bool operator<=(const bit_vector& __x, const bit_vector& __y) +{ + return !(__y < __x); +} + +inline bool operator>=(const bit_vector& __x, const bit_vector& __y) +{ + return !(__x < __y); +} + +#endif /* __SGI_STL_VECBOOL_TEMPLATE */ + +#undef __SGI_STL_VECBOOL_TEMPLATE +#undef __BVECTOR +#undef __VECTOR +#undef __BVECTOR_BASE +#undef __BVECTOR_TMPL_LIST + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1174 +#pragma reset woff 1375 +#endif + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_BVECTOR_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_config.h b/dtm_release/local/include/stl/stl_config.h new file mode 100644 index 0000000000000000000000000000000000000000..6f371315d36eb0c914f4d4e15ad6c02cf94aeb97 --- /dev/null +++ b/dtm_release/local/include/stl/stl_config.h @@ -0,0 +1,576 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * Copyright (c) 1997 + * Silicon Graphics + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +#ifndef __STL_CONFIG_H +# define __STL_CONFIG_H + +// Flags: +// * __STL_NO_BOOL: defined if the compiler doesn't have bool as a builtin +// type. +// * __STL_HAS_WCHAR_T: defined if the compier has wchar_t as a builtin type. +// * __STL_NO_DRAND48: defined if the compiler doesn't have the drand48 +// function. +// * __STL_STATIC_TEMPLATE_MEMBER_BUG: defined if the compiler can't handle +// static members of template classes. +// * __STL_STATIC_CONST_INIT_BUG: defined if the compiler can't handle a +// constant-initializer in the declaration of a static const data member +// of integer type. (See section 9.4.2, paragraph 4, of the C++ standard.) +// * __STL_CLASS_PARTIAL_SPECIALIZATION: defined if the compiler supports +// partial specialization of template classes. +// * __STL_PARTIAL_SPECIALIZATION_SYNTAX: defined if the compiler +// supports partial specialization syntax for full specialization of +// class templates. (Even if it doesn't actually support partial +// specialization itself.) +// * __STL_FUNCTION_TMPL_PARTIAL_ORDER: defined if the compiler supports +// partial ordering of function templates. (a.k.a partial specialization +// of function templates.) +// * __STL_MEMBER_TEMPLATES: defined if the compiler supports template +// member functions of classes. +// * __STL_MEMBER_TEMPLATE_CLASSES: defined if the compiler supports +// nested classes that are member templates of other classes. +// * __STL_TEMPLATE_FRIENDS: defined if the compiler supports templatized +// friend declarations. +// * __STL_EXPLICIT_FUNCTION_TMPL_ARGS: defined if the compiler +// supports calling a function template by providing its template +// arguments explicitly. +// * __STL_LIMITED_DEFAULT_TEMPLATES: defined if the compiler is unable +// to handle default template parameters that depend on previous template +// parameters. +// * __STL_NON_TYPE_TMPL_PARAM_BUG: defined if the compiler has trouble with +// function template argument deduction for non-type template parameters. +// * __SGI_STL_NO_ARROW_OPERATOR: defined if the compiler is unable +// to support the -> operator for iterators. +// * __STL_DEFAULT_CONSTRUCTOR_BUG: defined if T() does not work properly +// when T is a builtin type. +// * __STL_USE_EXCEPTIONS: defined if the compiler (in the current compilation +// mode) supports exceptions. +// * __STL_USE_NAMESPACES: defined if the compiler has the necessary +// support for namespaces. +// * __STL_NO_EXCEPTION_HEADER: defined if the compiler does not have a +// standard-conforming header <exception>. +// * __STL_NO_BAD_ALLOC: defined if the compiler does not have a <new> +// header, or if <new> does not contain a bad_alloc class. If a bad_alloc +// class exists, it is assumed to be in namespace std. +// * __STL_SGI_THREADS: defined if this is being compiled for an SGI IRIX +// system in multithreaded mode, using native SGI threads instead of +// pthreads. +// * __STL_WIN32THREADS: defined if this is being compiled on a WIN32 +// compiler in multithreaded mode. +// * __STL_PTHREADS: defined if we should use portable pthreads +// synchronization. +// * __STL_UITHREADS: defined if we should use UI / solaris / UnixWare threads +// synchronization. UIthreads are similar to pthreads, but are based +// on an earlier version of the Posix threads standard. +// * __STL_LONG_LONG if the compiler has long long and unsigned long long +// types. (They're not in the C++ standard, but they are expected to be +// included in the forthcoming C9X standard.) +// * __STL_THREADS is defined if thread safety is needed. +// * __STL_VOLATILE is defined to be "volatile" if threads are being +// used, and the empty string otherwise. +// * __STL_USE_CONCEPT_CHECKS enables some extra compile-time error +// checking to make sure that user-defined template arguments satisfy +// all of the appropriate requirements. This may result in more +// comprehensible error messages. It incurs no runtime overhead. This +// feature requires member templates and partial specialization. +// * __STL_NO_USING_CLAUSE_IN_CLASS: The compiler does not handle "using" +// clauses inside of class definitions. +// * __STL_NO_FRIEND_TEMPLATE_CLASS: The compiler does not handle friend +// declaractions where the friend is a template class. +// * __STL_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE: The compiler does not +// support the use of a function pointer type as the argument +// for a template. +// * __STL_MEMBER_TEMPLATE_KEYWORD: standard C++ requires the template +// keyword in a few new places (14.2.4). This flag is set for +// compilers that support (and require) this usage. + + +// User-settable macros that control compilation: +// * __STL_USE_SGI_ALLOCATORS: if defined, then the STL will use older +// SGI-style allocators, instead of standard-conforming allocators, +// even if the compiler supports all of the language features needed +// for standard-conforming allocators. +// * __STL_NO_NAMESPACES: if defined, don't put the library in namespace +// std, even if the compiler supports namespaces. +// * __STL_NO_RELOPS_NAMESPACE: if defined, don't put the relational +// operator templates (>, <=. >=, !=) in namespace std::rel_ops, even +// if the compiler supports namespaces and partial ordering of +// function templates. +// * __STL_ASSERTIONS: if defined, then enable runtime checking through the +// __stl_assert macro. +// * _PTHREADS: if defined, use Posix threads for multithreading support. +// * _UITHREADS:if defined, use SCO/Solaris/UI threads for multithreading +// support +// * _NOTHREADS: if defined, don't use any multithreading support. +// * _STL_NO_CONCEPT_CHECKS: if defined, disables the error checking that +// we get from __STL_USE_CONCEPT_CHECKS. +// * __STL_USE_NEW_IOSTREAMS: if defined, then the STL will use new, +// standard-conforming iostreams (e.g. the <iosfwd> header). If not +// defined, the STL will use old cfront-style iostreams (e.g. the +// <iostream.h> header). + +// Other macros defined by this file: + +// * bool, true, and false, if __STL_NO_BOOL is defined. +// * typename, as a null macro if it's not already a keyword. +// * explicit, as a null macro if it's not already a keyword. +// * namespace-related macros (__STD, __STL_BEGIN_NAMESPACE, etc.) +// * exception-related macros (__STL_TRY, __STL_UNWIND, etc.) +// * __stl_assert, either as a test or as a null macro, depending on +// whether or not __STL_ASSERTIONS is defined. + +# if defined(_PTHREADS) && !defined(_NOTHREADS) +# define __STL_PTHREADS +# endif + +# if defined(_UITHREADS) && !defined(_PTHREADS) && !defined(_NOTHREADS) +# define __STL_UITHREADS +# endif + +# if defined(__sgi) && !defined(__GNUC__) +# include <standards.h> +# if !defined(_BOOL) +# define __STL_NO_BOOL +# endif +# if defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32 +# define __STL_STATIC_CONST_INIT_BUG +# endif +# if defined(_WCHAR_T_IS_KEYWORD) +# define __STL_HAS_WCHAR_T +# endif +# if !defined(_TYPENAME_IS_KEYWORD) +# define __STL_NEED_TYPENAME +# endif +# ifdef _PARTIAL_SPECIALIZATION_OF_CLASS_TEMPLATES +# define __STL_CLASS_PARTIAL_SPECIALIZATION +# endif +# if (_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32 +# define __STL_FUNCTION_TMPL_PARTIAL_ORDER +# endif +# ifdef _MEMBER_TEMPLATES +# define __STL_MEMBER_TEMPLATES +# define __STL_TEMPLATE_FRIENDS +# define __STL_MEMBER_TEMPLATE_CLASSES +# endif +# if defined(_MEMBER_TEMPLATE_KEYWORD) +# define __STL_MEMBER_TEMPLATE_KEYWORD +# endif +# if defined(_STANDARD_C_PLUS_PLUS) +# define __STL_EXPLICIT_FUNCTION_TMPL_ARGS +# endif +# if (_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32 +# define __STL_MEMBER_TEMPLATE_KEYWORD +# endif +# if COMPILER_VERSION < 720 || (defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32) +# define __STL_DEFAULT_CONSTRUCTOR_BUG +# endif +# if !defined(_EXPLICIT_IS_KEYWORD) +# define __STL_NEED_EXPLICIT +# endif +# ifdef __EXCEPTIONS +# define __STL_USE_EXCEPTIONS +# endif +# if (_COMPILER_VERSION >= 721) && defined(_NAMESPACES) +# define __STL_HAS_NAMESPACES +# endif +# if (_COMPILER_VERSION < 721) || \ + !defined(__STL_HAS_NAMESPACES) || defined(__STL_NO_NAMESPACES) +# define __STL_NO_EXCEPTION_HEADER +# endif +# if _COMPILER_VERSION < 730 || !defined(_STANDARD_C_PLUS_PLUS) || \ + !defined(_NAMESPACES) +# define __STL_NO_BAD_ALLOC +# endif +# if !defined(_NOTHREADS) && !defined(__STL_PTHREADS) +# define __STL_SGI_THREADS +# endif +# if defined(_LONGLONG) && defined(_SGIAPI) && _SGIAPI +# define __STL_LONG_LONG +# endif +# if _COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS) +# define __STL_USE_NEW_IOSTREAMS +# endif +# if _COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS) +# define __STL_CAN_THROW_RANGE_ERRORS +# endif +# if _COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS) +# define __SGI_STL_USE_AUTO_PTR_CONVERSIONS +# endif +# endif + + +/* + * Jochen Schlick '1999 - added new #defines (__STL)_UITHREADS (for + * providing SCO / Solaris / UI thread support) + * - added the necessary defines for the SCO UDK 7 + * compiler (and its template friend behavior) + * - all UDK7 specific STL changes are based on the + * macro __USLC__ being defined + */ +// SCO UDK 7 compiler (UnixWare 7x, OSR 5, UnixWare 2x) +# if defined(__USLC__) +# define __STL_HAS_WCHAR_T +# define __STL_CLASS_PARTIAL_SPECIALIZATION +# define __STL_PARTIAL_SPECIALIZATION_SYNTAX +# define __STL_FUNCTION_TMPL_PARTIAL_ORDER +# define __STL_MEMBER_TEMPLATES +# define __STL_MEMBER_TEMPLATE_CLASSES +# define __STL_USE_EXCEPTIONS +# define __STL_HAS_NAMESPACES +# define __STL_USE_NAMESPACES +# define __STL_LONG_LONG +# if defined(_REENTRANT) +# define _UITHREADS /* if UnixWare < 7.0.1 */ +# define __STL_UITHREADS +// use the following defines instead of the UI threads defines when +// you want to use POSIX threads +//# define _PTHREADS /* only if UnixWare >=7.0.1 */ +//# define __STL_PTHREADS +# endif +# endif + + + +# ifdef __GNUC__ +# if __GNUC__ == 2 && __GNUC_MINOR__ <= 7 +# define __STL_STATIC_TEMPLATE_MEMBER_BUG +# endif +# if __GNUC__ < 2 +# define __STL_NEED_TYPENAME +# define __STL_NEED_EXPLICIT +# endif +# if __GNUC__ == 2 && __GNUC_MINOR__ <= 8 +# define __STL_NO_EXCEPTION_HEADER +# define __STL_NO_BAD_ALLOC +# endif +# if __GNUC__ == 2 && __GNUC_MINOR__ >= 8 +# define __STL_CLASS_PARTIAL_SPECIALIZATION +# define __STL_FUNCTION_TMPL_PARTIAL_ORDER +# define __STL_EXPLICIT_FUNCTION_TMPL_ARGS +# define __STL_MEMBER_TEMPLATES +# define __STL_CAN_THROW_RANGE_ERRORS + // g++ 2.8.1 supports member template functions, but not member + // template nested classes. +# if __GNUC_MINOR__ >= 9 +# define __STL_MEMBER_TEMPLATE_CLASSES +# define __STL_TEMPLATE_FRIENDS +# define __SGI_STL_USE_AUTO_PTR_CONVERSIONS +# define __STL_HAS_NAMESPACES +//# define __STL_USE_NEW_IOSTREAMS +# endif +# endif +# define __STL_DEFAULT_CONSTRUCTOR_BUG +# ifdef __EXCEPTIONS +# define __STL_USE_EXCEPTIONS +# endif +# ifdef _REENTRANT +# define __STL_PTHREADS +# endif +# if (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR__ < 95) +# define __STL_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE +# endif +# endif + +# if defined(__SUNPRO_CC) +# define __STL_NO_BOOL +# define __STL_NEED_TYPENAME +# define __STL_NEED_EXPLICIT +# define __STL_USE_EXCEPTIONS +# ifdef _REENTRANT +# define __STL_PTHREADS +# endif +# define __SGI_STL_NO_ARROW_OPERATOR +# define __STL_PARTIAL_SPECIALIZATION_SYNTAX +# define __STL_NO_EXCEPTION_HEADER +# define __STL_NO_BAD_ALLOC +# endif + +# if defined(__COMO__) +# define __STL_MEMBER_TEMPLATES +# define __STL_MEMBER_TEMPLATE_CLASSES +# define __STL_TEMPLATE_FRIENDS +# define __STL_CLASS_PARTIAL_SPECIALIZATION +# define __STL_USE_EXCEPTIONS +# define __STL_HAS_NAMESPACES +# endif + +// Intel compiler, which uses the EDG front end. +# if defined(__ICL) +# define __STL_LONG_LONG +# define __STL_MEMBER_TEMPLATES +# define __STL_MEMBER_TEMPLATE_CLASSES +# define __STL_TEMPLATE_FRIENDS +# define __STL_FUNCTION_TMPL_PARTIAL_ORDER +# define __STL_CLASS_PARTIAL_SPECIALIZATION +# define __STL_NO_DRAND48 +# define __STL_HAS_NAMESPACES +# define __STL_USE_EXCEPTIONS +# define __STL_MEMBER_TEMPLATE_KEYWORD +# ifdef _CPPUNWIND +# define __STL_USE_EXCEPTIONS +# endif +# ifdef _MT +# define __STL_WIN32THREADS +# endif +# endif + +// Mingw32, egcs compiler using the Microsoft C runtime +# if defined(__MINGW32__) +# define __STL_NO_DRAND48 +# ifdef _MT +# define __STL_WIN32THREADS +# endif +# endif + +// Cygwin32, egcs compiler on MS Windows +# if defined(__CYGWIN__) +# define __STL_NO_DRAND48 +# endif + + + +// Microsoft compiler. +# if defined(_MSC_VER) && !defined(__ICL) && !defined(__MWERKS__) +# define __STL_NO_DRAND48 +# define __STL_STATIC_CONST_INIT_BUG +# define __STL_NEED_TYPENAME +# define __STL_NO_USING_CLAUSE_IN_CLASS +# define __STL_NO_FRIEND_TEMPLATE_CLASS +# if _MSC_VER < 1100 /* 1000 is version 4.0, 1100 is 5.0, 1200 is 6.0. */ +# define __STL_NEED_EXPLICIT +# define __STL_NO_BOOL +# define __STL_NO_BAD_ALLOC +# endif +# if _MSC_VER > 1000 +# include <yvals.h> +# define __STL_DONT_USE_BOOL_TYPEDEF +# endif +# define __STL_NON_TYPE_TMPL_PARAM_BUG +# define __SGI_STL_NO_ARROW_OPERATOR +# define __STL_DEFAULT_CONSTRUCTOR_BUG +# ifdef _CPPUNWIND +# define __STL_USE_EXCEPTIONS +# endif +# ifdef _MT +# define __STL_WIN32THREADS +# endif +# if _MSC_VER >= 1200 +# define __STL_PARTIAL_SPECIALIZATION_SYNTAX +# define __STL_HAS_NAMESPACES +# define __STL_CAN_THROW_RANGE_ERRORS +# define NOMINMAX +# undef min +# undef max +// disable warning 'initializers put in unrecognized initialization area' +# pragma warning ( disable : 4075 ) +// disable warning 'empty controlled statement found' +# pragma warning ( disable : 4390 ) +// disable warning 'debug symbol greater than 255 chars' +# pragma warning ( disable : 4786 ) +# endif +# if _MSC_VER < 1100 +# define __STL_NO_EXCEPTION_HEADER +# define __STL_NO_BAD_ALLOC +# endif + // Because of a Microsoft front end bug, we must not provide a + // namespace qualifier when declaring a friend function. +# define __STD_QUALIFIER +# endif + +# if defined(__BORLANDC__) +# define __STL_NO_BAD_ALLOC +# define __STL_NO_DRAND48 +# define __STL_DEFAULT_CONSTRUCTOR_BUG +# if __BORLANDC__ >= 0x540 /* C++ Builder 4.0 */ +# define __STL_CLASS_PARTIAL_SPECIALIZATION +# define __STL_FUNCTION_TMPL_PARTIAL_ORDER +# define __STL_EXPLICIT_FUNCTION_TMPL_ARGS +# define __STL_MEMBER_TEMPLATES +# define __STL_TEMPLATE_FRIENDS +# else +# define __STL_NEED_TYPENAME +# define __STL_LIMITED_DEFAULT_TEMPLATES +# define __SGI_STL_NO_ARROW_OPERATOR +# define __STL_NON_TYPE_TMPL_PARAM_BUG +# endif +# ifdef _CPPUNWIND +# define __STL_USE_EXCEPTIONS +# endif +# ifdef __MT__ +# define __STL_WIN32THREADS +# endif +# endif + +# if defined(__STL_NO_BOOL) && !defined(__STL_DONT_USE_BOOL_TYPEDEF) + typedef int bool; +# define true 1 +# define false 0 +# endif + +# ifdef __STL_NEED_TYPENAME +# define typename +# endif + +# ifdef __STL_LIMITED_DEFAULT_TEMPLATES +# define __STL_DEPENDENT_DEFAULT_TMPL(_Tp) +# else +# define __STL_DEPENDENT_DEFAULT_TMPL(_Tp) = _Tp +# endif + +# ifdef __STL_MEMBER_TEMPLATE_KEYWORD +# define __STL_TEMPLATE template +# else +# define __STL_TEMPLATE +# endif + +# ifdef __STL_NEED_EXPLICIT +# define explicit +# endif + +# ifdef __STL_EXPLICIT_FUNCTION_TMPL_ARGS +# define __STL_NULL_TMPL_ARGS <> +# else +# define __STL_NULL_TMPL_ARGS +# endif + +# if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) \ + || defined (__STL_PARTIAL_SPECIALIZATION_SYNTAX) +# define __STL_TEMPLATE_NULL template<> +# else +# define __STL_TEMPLATE_NULL +# endif + +// Use standard-conforming allocators if we have the necessary language +// features. __STL_USE_SGI_ALLOCATORS is a hook so that users can +// disable new-style allocators, and continue to use the same kind of +// allocators as before, without having to edit library headers. +# if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) && \ + defined(__STL_MEMBER_TEMPLATES) && \ + defined(__STL_MEMBER_TEMPLATE_CLASSES) && \ + !defined(__STL_NO_BOOL) && \ + !defined(__STL_NON_TYPE_TMPL_PARAM_BUG) && \ + !defined(__STL_LIMITED_DEFAULT_TEMPLATES) && \ + !defined(__STL_USE_SGI_ALLOCATORS) +# define __STL_USE_STD_ALLOCATORS +# endif + +# ifndef __STL_DEFAULT_ALLOCATOR +# ifdef __STL_USE_STD_ALLOCATORS +# define __STL_DEFAULT_ALLOCATOR(T) allocator< T > +# else +# define __STL_DEFAULT_ALLOCATOR(T) alloc +# endif +# endif + +// __STL_NO_NAMESPACES is a hook so that users can disable namespaces +// without having to edit library headers. __STL_NO_RELOPS_NAMESPACE is +// a hook so that users can disable the std::rel_ops namespace, keeping +// the relational operator template in namespace std, without having to +// edit library headers. +# if defined(__STL_HAS_NAMESPACES) && !defined(__STL_NO_NAMESPACES) +# define __STL_USE_NAMESPACES +# define __STD std +# define __STL_BEGIN_NAMESPACE namespace std { +# define __STL_END_NAMESPACE } +# if defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER) && \ + !defined(__STL_NO_RELOPS_NAMESPACE) +# define __STL_USE_NAMESPACE_FOR_RELOPS +# define __STL_BEGIN_RELOPS_NAMESPACE namespace std { namespace rel_ops { +# define __STL_END_RELOPS_NAMESPACE } } +# define __STD_RELOPS std::rel_ops +# else /* Use std::rel_ops namespace */ +# define __STL_USE_NAMESPACE_FOR_RELOPS +# define __STL_BEGIN_RELOPS_NAMESPACE namespace std { +# define __STL_END_RELOPS_NAMESPACE } +# define __STD_RELOPS std +# endif /* Use std::rel_ops namespace */ +# else +# define __STD +# define __STL_BEGIN_NAMESPACE +# define __STL_END_NAMESPACE +# undef __STL_USE_NAMESPACE_FOR_RELOPS +# define __STL_BEGIN_RELOPS_NAMESPACE +# define __STL_END_RELOPS_NAMESPACE +# define __STD_RELOPS +# undef __STL_USE_NAMESPACES +# endif + +// Some versions of the EDG front end sometimes require an explicit +// namespace spec where they shouldn't. This macro facilitates that. +// If the bug becomes irrelevant, then all uses of __STD_QUALIFIER +// should be removed. The 7.3 beta SGI compiler has this bug, but the +// MR version is not expected to have it. + +# if defined(__STL_USE_NAMESPACES) && !defined(__STD_QUALIFIER) +# define __STD_QUALIFIER std:: +# else +# define __STD_QUALIFIER +# endif + +# ifdef __STL_USE_EXCEPTIONS +# define __STL_TRY try +# define __STL_CATCH_ALL catch(...) +# define __STL_THROW(x) throw x +# define __STL_RETHROW throw +# define __STL_NOTHROW throw() +# define __STL_UNWIND(action) catch(...) { action; throw; } +# else +# define __STL_TRY +# define __STL_CATCH_ALL if (false) +# define __STL_THROW(x) +# define __STL_RETHROW +# define __STL_NOTHROW +# define __STL_UNWIND(action) +# endif + +#ifdef __STL_ASSERTIONS +# include <stdio.h> +# define __stl_assert(expr) \ + if (!(expr)) { fprintf(stderr, "%s:%d STL assertion failure: %s\n", \ + __FILE__, __LINE__, # expr); abort(); } +#else +# define __stl_assert(expr) +#endif + +#if defined(__STL_WIN32THREADS) || defined(__STL_SGI_THREADS) \ + || defined(__STL_PTHREADS) || defined(__STL_UITHREADS) +# define __STL_THREADS +# define __STL_VOLATILE volatile +#else +# define __STL_VOLATILE +#endif + +#if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) \ + && defined(__STL_MEMBER_TEMPLATES) \ + && !defined(_STL_NO_CONCEPT_CHECKS) +# define __STL_USE_CONCEPT_CHECKS +#endif + + +#endif /* __STL_CONFIG_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_construct.h b/dtm_release/local/include/stl/stl_construct.h new file mode 100644 index 0000000000000000000000000000000000000000..a17f9eef84a431057497ce1c901d24723b91de02 --- /dev/null +++ b/dtm_release/local/include/stl/stl_construct.h @@ -0,0 +1,124 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_CONSTRUCT_H +#define __SGI_STL_INTERNAL_CONSTRUCT_H + +#include <new.h> + +__STL_BEGIN_NAMESPACE + +// construct and destroy. These functions are not part of the C++ standard, +// and are provided for backward compatibility with the HP STL. We also +// provide internal names _Construct and _Destroy that can be used within +// the library, so that standard-conforming pieces don't have to rely on +// non-standard extensions. + +// Internal names + +template <class _T1, class _T2> +inline void _Construct(_T1* __p, const _T2& __value) { + new ((void*) __p) _T1(__value); +} + +template <class _T1> +inline void _Construct(_T1* __p) { + new ((void*) __p) _T1(); +} + +template <class _Tp> +inline void _Destroy(_Tp* __pointer) { + __pointer->~_Tp(); +} + +template <class _ForwardIterator> +void +__destroy_aux(_ForwardIterator __first, _ForwardIterator __last, __false_type) +{ + for ( ; __first != __last; ++__first) + destroy(&*__first); +} + +template <class _ForwardIterator> +inline void __destroy_aux(_ForwardIterator, _ForwardIterator, __true_type) {} + +template <class _ForwardIterator, class _Tp> +inline void +__destroy(_ForwardIterator __first, _ForwardIterator __last, _Tp*) +{ + typedef typename __type_traits<_Tp>::has_trivial_destructor + _Trivial_destructor; + __destroy_aux(__first, __last, _Trivial_destructor()); +} + +template <class _ForwardIterator> +inline void _Destroy(_ForwardIterator __first, _ForwardIterator __last) { + __destroy(__first, __last, __VALUE_TYPE(__first)); +} + +inline void _Destroy(char*, char*) {} +inline void _Destroy(int*, int*) {} +inline void _Destroy(long*, long*) {} +inline void _Destroy(float*, float*) {} +inline void _Destroy(double*, double*) {} +#ifdef __STL_HAS_WCHAR_T +inline void _Destroy(wchar_t*, wchar_t*) {} +#endif /* __STL_HAS_WCHAR_T */ + +// -------------------------------------------------- +// Old names from the HP STL. + +template <class _T1, class _T2> +inline void construct(_T1* __p, const _T2& __value) { + _Construct(__p, __value); +} + +template <class _T1> +inline void construct(_T1* __p) { + _Construct(__p); +} + +template <class _Tp> +inline void destroy(_Tp* __pointer) { + _Destroy(__pointer); +} + +template <class _ForwardIterator> +inline void destroy(_ForwardIterator __first, _ForwardIterator __last) { + _Destroy(__first, __last); +} + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_CONSTRUCT_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_ctraits_fns.h b/dtm_release/local/include/stl/stl_ctraits_fns.h new file mode 100644 index 0000000000000000000000000000000000000000..5577f4dbe7a0775a3acd08db3811e9621025656e --- /dev/null +++ b/dtm_release/local/include/stl/stl_ctraits_fns.h @@ -0,0 +1,69 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +// WARNING: This is an internal header file, included by other C++ +// standard library headers. You should not attempt to use this header +// file directly. + +#ifndef __SGI_STL_INTERNAL_CTRAITS_FUNCTIONS_H +#define __SGI_STL_INTERNAL_CTRAITS_FUNCTIONS_H + +// This file contains a few small adapters that allow a character +// traits class to be used as a function object. + +__STL_BEGIN_NAMESPACE + +template <class _Traits> +struct _Eq_traits + : public binary_function<typename _Traits::char_type, + typename _Traits::char_type, + bool> +{ + bool operator()(const typename _Traits::char_type& __x, + const typename _Traits::char_type& __y) const + { return _Traits::eq(__x, __y); } +}; + +template <class _Traits> +struct _Eq_int_traits + : public binary_function<typename _Traits::char_type, + typename _Traits::int_type, + bool> +{ + bool operator()(const typename _Traits::char_type& __x, + const typename _Traits::int_type& __y) const + { return _Traits::eq_int_type(_Traits::to_int_type(__x), __y); } +}; + +template <class _Traits> +struct _Lt_traits + : public binary_function<typename _Traits::char_type, + typename _Traits::char_type, + bool> +{ + bool operator()(const typename _Traits::char_type& __x, + const typename _Traits::char_type& __y) const + { return _Traits::lt(__x, __y); } +}; + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_CTRAITS_FUNCTIONS_H */ + +// Local Variables: +// mode:C++ +// End: + + + + diff --git a/dtm_release/local/include/stl/stl_deque.h b/dtm_release/local/include/stl/stl_deque.h new file mode 100644 index 0000000000000000000000000000000000000000..7978f7dd43866991fbe1dd2c40ede190fa250fc3 --- /dev/null +++ b/dtm_release/local/include/stl/stl_deque.h @@ -0,0 +1,1652 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#include <concept_checks.h> + +#ifndef __SGI_STL_INTERNAL_DEQUE_H +#define __SGI_STL_INTERNAL_DEQUE_H + +/* Class invariants: + * For any nonsingular iterator i: + * i.node is the address of an element in the map array. The + * contents of i.node is a pointer to the beginning of a node. + * i.first == *(i.node) + * i.last == i.first + node_size + * i.cur is a pointer in the range [i.first, i.last). NOTE: + * the implication of this is that i.cur is always a dereferenceable + * pointer, even if i is a past-the-end iterator. + * Start and Finish are always nonsingular iterators. NOTE: this means + * that an empty deque must have one node, and that a deque + * with N elements, where N is the buffer size, must have two nodes. + * For every node other than start.node and finish.node, every element + * in the node is an initialized object. If start.node == finish.node, + * then [start.cur, finish.cur) are initialized objects, and + * the elements outside that range are uninitialized storage. Otherwise, + * [start.cur, start.last) and [finish.first, finish.cur) are initialized + * objects, and [start.first, start.cur) and [finish.cur, finish.last) + * are uninitialized storage. + * [map, map + map_size) is a valid, non-empty range. + * [start.node, finish.node] is a valid range contained within + * [map, map + map_size). + * A pointer in the range [map, map + map_size) points to an allocated node + * if and only if the pointer is in the range [start.node, finish.node]. + */ + + +/* + * In previous versions of deque, there was an extra template + * parameter so users could control the node size. This extension + * turns out to violate the C++ standard (it can be detected using + * template template parameters), and it has been removed. + */ + +__STL_BEGIN_NAMESPACE + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1174 +#pragma set woff 1375 +#endif + +// Note: this function is simply a kludge to work around several compilers' +// bugs in handling constant expressions. +inline size_t __deque_buf_size(size_t __size) { + return __size < 512 ? size_t(512 / __size) : size_t(1); +} + +template <class _Tp, class _Ref, class _Ptr> +struct _Deque_iterator { + typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator; + typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator; + static size_t _S_buffer_size() { return __deque_buf_size(sizeof(_Tp)); } + + typedef random_access_iterator_tag iterator_category; + typedef _Tp value_type; + typedef _Ptr pointer; + typedef _Ref reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Tp** _Map_pointer; + + typedef _Deque_iterator _Self; + + _Tp* _M_cur; + _Tp* _M_first; + _Tp* _M_last; + _Map_pointer _M_node; + + _Deque_iterator(_Tp* __x, _Map_pointer __y) + : _M_cur(__x), _M_first(*__y), + _M_last(*__y + _S_buffer_size()), _M_node(__y) {} + _Deque_iterator() : _M_cur(0), _M_first(0), _M_last(0), _M_node(0) {} + _Deque_iterator(const iterator& __x) + : _M_cur(__x._M_cur), _M_first(__x._M_first), + _M_last(__x._M_last), _M_node(__x._M_node) {} + + reference operator*() const { return *_M_cur; } +#ifndef __SGI_STL_NO_ARROW_OPERATOR + pointer operator->() const { return _M_cur; } +#endif /* __SGI_STL_NO_ARROW_OPERATOR */ + + difference_type operator-(const _Self& __x) const { + return difference_type(_S_buffer_size()) * (_M_node - __x._M_node - 1) + + (_M_cur - _M_first) + (__x._M_last - __x._M_cur); + } + + _Self& operator++() { + ++_M_cur; + if (_M_cur == _M_last) { + _M_set_node(_M_node + 1); + _M_cur = _M_first; + } + return *this; + } + _Self operator++(int) { + _Self __tmp = *this; + ++*this; + return __tmp; + } + + _Self& operator--() { + if (_M_cur == _M_first) { + _M_set_node(_M_node - 1); + _M_cur = _M_last; + } + --_M_cur; + return *this; + } + _Self operator--(int) { + _Self __tmp = *this; + --*this; + return __tmp; + } + + _Self& operator+=(difference_type __n) + { + difference_type __offset = __n + (_M_cur - _M_first); + if (__offset >= 0 && __offset < difference_type(_S_buffer_size())) + _M_cur += __n; + else { + difference_type __node_offset = + __offset > 0 ? __offset / difference_type(_S_buffer_size()) + : -difference_type((-__offset - 1) / _S_buffer_size()) - 1; + _M_set_node(_M_node + __node_offset); + _M_cur = _M_first + + (__offset - __node_offset * difference_type(_S_buffer_size())); + } + return *this; + } + + _Self operator+(difference_type __n) const + { + _Self __tmp = *this; + return __tmp += __n; + } + + _Self& operator-=(difference_type __n) { return *this += -__n; } + + _Self operator-(difference_type __n) const { + _Self __tmp = *this; + return __tmp -= __n; + } + + reference operator[](difference_type __n) const { return *(*this + __n); } + + bool operator==(const _Self& __x) const { return _M_cur == __x._M_cur; } + bool operator!=(const _Self& __x) const { return !(*this == __x); } + bool operator<(const _Self& __x) const { + return (_M_node == __x._M_node) ? + (_M_cur < __x._M_cur) : (_M_node < __x._M_node); + } + bool operator>(const _Self& __x) const { return __x < *this; } + bool operator<=(const _Self& __x) const { return !(__x < *this); } + bool operator>=(const _Self& __x) const { return !(*this < __x); } + + void _M_set_node(_Map_pointer __new_node) { + _M_node = __new_node; + _M_first = *__new_node; + _M_last = _M_first + difference_type(_S_buffer_size()); + } +}; + +template <class _Tp, class _Ref, class _Ptr> +inline _Deque_iterator<_Tp, _Ref, _Ptr> +operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Ref, _Ptr>& __x) +{ + return __x + __n; +} + +#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION + +template <class _Tp, class _Ref, class _Ptr> +inline random_access_iterator_tag +iterator_category(const _Deque_iterator<_Tp,_Ref,_Ptr>&) +{ + return random_access_iterator_tag(); +} + +template <class _Tp, class _Ref, class _Ptr> +inline _Tp* value_type(const _Deque_iterator<_Tp,_Ref,_Ptr>&) { return 0; } + +template <class _Tp, class _Ref, class _Ptr> +inline ptrdiff_t* distance_type(const _Deque_iterator<_Tp,_Ref,_Ptr>&) { + return 0; +} + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +// Deque base class. It has two purposes. First, its constructor +// and destructor allocate (but don't initialize) storage. This makes +// exception safety easier. Second, the base class encapsulates all of +// the differences between SGI-style allocators and standard-conforming +// allocators. + +#ifdef __STL_USE_STD_ALLOCATORS + +// Base class for ordinary allocators. +template <class _Tp, class _Alloc, bool __is_static> +class _Deque_alloc_base { +public: + typedef typename _Alloc_traits<_Tp,_Alloc>::allocator_type allocator_type; + allocator_type get_allocator() const { return _M_node_allocator; } + + _Deque_alloc_base(const allocator_type& __a) + : _M_node_allocator(__a), _M_map_allocator(__a), + _M_map(0), _M_map_size(0) + {} + +protected: + typedef typename _Alloc_traits<_Tp*, _Alloc>::allocator_type + _Map_allocator_type; + + allocator_type _M_node_allocator; + _Map_allocator_type _M_map_allocator; + + _Tp* _M_allocate_node() { + return _M_node_allocator.allocate(__deque_buf_size(sizeof(_Tp))); + } + void _M_deallocate_node(_Tp* __p) { + _M_node_allocator.deallocate(__p, __deque_buf_size(sizeof(_Tp))); + } + _Tp** _M_allocate_map(size_t __n) + { return _M_map_allocator.allocate(__n); } + void _M_deallocate_map(_Tp** __p, size_t __n) + { _M_map_allocator.deallocate(__p, __n); } + + _Tp** _M_map; + size_t _M_map_size; +}; + +// Specialization for instanceless allocators. +template <class _Tp, class _Alloc> +class _Deque_alloc_base<_Tp, _Alloc, true> +{ +public: + typedef typename _Alloc_traits<_Tp,_Alloc>::allocator_type allocator_type; + allocator_type get_allocator() const { return allocator_type(); } + + _Deque_alloc_base(const allocator_type&) : _M_map(0), _M_map_size(0) {} + +protected: + typedef typename _Alloc_traits<_Tp, _Alloc>::_Alloc_type _Node_alloc_type; + typedef typename _Alloc_traits<_Tp*, _Alloc>::_Alloc_type _Map_alloc_type; + + _Tp* _M_allocate_node() { + return _Node_alloc_type::allocate(__deque_buf_size(sizeof(_Tp))); + } + void _M_deallocate_node(_Tp* __p) { + _Node_alloc_type::deallocate(__p, __deque_buf_size(sizeof(_Tp))); + } + _Tp** _M_allocate_map(size_t __n) + { return _Map_alloc_type::allocate(__n); } + void _M_deallocate_map(_Tp** __p, size_t __n) + { _Map_alloc_type::deallocate(__p, __n); } + + _Tp** _M_map; + size_t _M_map_size; +}; + +template <class _Tp, class _Alloc> +class _Deque_base + : public _Deque_alloc_base<_Tp,_Alloc, + _Alloc_traits<_Tp, _Alloc>::_S_instanceless> +{ +public: + typedef _Deque_alloc_base<_Tp,_Alloc, + _Alloc_traits<_Tp, _Alloc>::_S_instanceless> + _Base; + typedef typename _Base::allocator_type allocator_type; + typedef _Deque_iterator<_Tp,_Tp&,_Tp*> iterator; + typedef _Deque_iterator<_Tp,const _Tp&,const _Tp*> const_iterator; + + _Deque_base(const allocator_type& __a, size_t __num_elements) + : _Base(__a), _M_start(), _M_finish() + { _M_initialize_map(__num_elements); } + _Deque_base(const allocator_type& __a) + : _Base(__a), _M_start(), _M_finish() {} + ~_Deque_base(); + +protected: + void _M_initialize_map(size_t); + void _M_create_nodes(_Tp** __nstart, _Tp** __nfinish); + void _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish); + enum { _S_initial_map_size = 8 }; + +protected: + iterator _M_start; + iterator _M_finish; +}; + +#else /* __STL_USE_STD_ALLOCATORS */ + +template <class _Tp, class _Alloc> +class _Deque_base { +public: + typedef _Deque_iterator<_Tp,_Tp&,_Tp*> iterator; + typedef _Deque_iterator<_Tp,const _Tp&,const _Tp*> const_iterator; + + typedef _Alloc allocator_type; + allocator_type get_allocator() const { return allocator_type(); } + + _Deque_base(const allocator_type&, size_t __num_elements) + : _M_map(0), _M_map_size(0), _M_start(), _M_finish() { + _M_initialize_map(__num_elements); + } + _Deque_base(const allocator_type&) + : _M_map(0), _M_map_size(0), _M_start(), _M_finish() {} + ~_Deque_base(); + +protected: + void _M_initialize_map(size_t); + void _M_create_nodes(_Tp** __nstart, _Tp** __nfinish); + void _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish); + enum { _S_initial_map_size = 8 }; + +protected: + _Tp** _M_map; + size_t _M_map_size; + iterator _M_start; + iterator _M_finish; + + typedef simple_alloc<_Tp, _Alloc> _Node_alloc_type; + typedef simple_alloc<_Tp*, _Alloc> _Map_alloc_type; + + _Tp* _M_allocate_node() + { return _Node_alloc_type::allocate(__deque_buf_size(sizeof(_Tp))); } + void _M_deallocate_node(_Tp* __p) + { _Node_alloc_type::deallocate(__p, __deque_buf_size(sizeof(_Tp))); } + _Tp** _M_allocate_map(size_t __n) + { return _Map_alloc_type::allocate(__n); } + void _M_deallocate_map(_Tp** __p, size_t __n) + { _Map_alloc_type::deallocate(__p, __n); } +}; + +#endif /* __STL_USE_STD_ALLOCATORS */ + +// Non-inline member functions from _Deque_base. + +template <class _Tp, class _Alloc> +_Deque_base<_Tp,_Alloc>::~_Deque_base() { + if (_M_map) { + _M_destroy_nodes(_M_start._M_node, _M_finish._M_node + 1); + _M_deallocate_map(_M_map, _M_map_size); + } +} + +template <class _Tp, class _Alloc> +void +_Deque_base<_Tp,_Alloc>::_M_initialize_map(size_t __num_elements) +{ + size_t __num_nodes = + __num_elements / __deque_buf_size(sizeof(_Tp)) + 1; + + _M_map_size = max((size_t) _S_initial_map_size, __num_nodes + 2); + _M_map = _M_allocate_map(_M_map_size); + + _Tp** __nstart = _M_map + (_M_map_size - __num_nodes) / 2; + _Tp** __nfinish = __nstart + __num_nodes; + + __STL_TRY { + _M_create_nodes(__nstart, __nfinish); + } + __STL_UNWIND((_M_deallocate_map(_M_map, _M_map_size), + _M_map = 0, _M_map_size = 0)); + _M_start._M_set_node(__nstart); + _M_finish._M_set_node(__nfinish - 1); + _M_start._M_cur = _M_start._M_first; + _M_finish._M_cur = _M_finish._M_first + + __num_elements % __deque_buf_size(sizeof(_Tp)); +} + +template <class _Tp, class _Alloc> +void _Deque_base<_Tp,_Alloc>::_M_create_nodes(_Tp** __nstart, _Tp** __nfinish) +{ + _Tp** __cur; + __STL_TRY { + for (__cur = __nstart; __cur < __nfinish; ++__cur) + *__cur = _M_allocate_node(); + } + __STL_UNWIND(_M_destroy_nodes(__nstart, __cur)); +} + +template <class _Tp, class _Alloc> +void +_Deque_base<_Tp,_Alloc>::_M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish) +{ + for (_Tp** __n = __nstart; __n < __nfinish; ++__n) + _M_deallocate_node(*__n); +} + +template <class _Tp, class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) > +class deque : protected _Deque_base<_Tp, _Alloc> { + + // requirements: + + __STL_CLASS_REQUIRES(_Tp, _Assignable); + + typedef _Deque_base<_Tp, _Alloc> _Base; +public: // Basic types + typedef _Tp value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + + typedef typename _Base::allocator_type allocator_type; + allocator_type get_allocator() const { return _Base::get_allocator(); } + +public: // Iterators + typedef typename _Base::iterator iterator; + typedef typename _Base::const_iterator const_iterator; + +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + typedef reverse_iterator<const_iterator> const_reverse_iterator; + typedef reverse_iterator<iterator> reverse_iterator; +#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + typedef reverse_iterator<const_iterator, value_type, const_reference, + difference_type> + const_reverse_iterator; + typedef reverse_iterator<iterator, value_type, reference, difference_type> + reverse_iterator; +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +protected: // Internal typedefs + typedef pointer* _Map_pointer; + static size_t _S_buffer_size() { return __deque_buf_size(sizeof(_Tp)); } + +protected: +#ifdef __STL_USE_NAMESPACES + using _Base::_M_initialize_map; + using _Base::_M_create_nodes; + using _Base::_M_destroy_nodes; + using _Base::_M_allocate_node; + using _Base::_M_deallocate_node; + using _Base::_M_allocate_map; + using _Base::_M_deallocate_map; + + using _Base::_M_map; + using _Base::_M_map_size; + using _Base::_M_start; + using _Base::_M_finish; +#endif /* __STL_USE_NAMESPACES */ + +public: // Basic accessors + iterator begin() { return _M_start; } + iterator end() { return _M_finish; } + const_iterator begin() const { return _M_start; } + const_iterator end() const { return _M_finish; } + + reverse_iterator rbegin() { return reverse_iterator(_M_finish); } + reverse_iterator rend() { return reverse_iterator(_M_start); } + const_reverse_iterator rbegin() const + { return const_reverse_iterator(_M_finish); } + const_reverse_iterator rend() const + { return const_reverse_iterator(_M_start); } + + reference operator[](size_type __n) + { return _M_start[difference_type(__n)]; } + const_reference operator[](size_type __n) const + { return _M_start[difference_type(__n)]; } + +#ifdef __STL_THROW_RANGE_ERRORS + void _M_range_check(size_type __n) const { + if (__n >= this->size()) + __stl_throw_range_error("deque"); + } + + reference at(size_type __n) + { _M_range_check(__n); return (*this)[__n]; } + const_reference at(size_type __n) const + { _M_range_check(__n); return (*this)[__n]; } +#endif /* __STL_THROW_RANGE_ERRORS */ + + reference front() { return *_M_start; } + reference back() { + iterator __tmp = _M_finish; + --__tmp; + return *__tmp; + } + const_reference front() const { return *_M_start; } + const_reference back() const { + const_iterator __tmp = _M_finish; + --__tmp; + return *__tmp; + } + + size_type size() const { return _M_finish - _M_start; } + size_type max_size() const { return size_type(-1); } + bool empty() const { return _M_finish == _M_start; } + +public: // Constructor, destructor. + explicit deque(const allocator_type& __a = allocator_type()) + : _Base(__a, 0) {} + deque(const deque& __x) : _Base(__x.get_allocator(), __x.size()) + { uninitialized_copy(__x.begin(), __x.end(), _M_start); } + deque(size_type __n, const value_type& __value, + const allocator_type& __a = allocator_type()) : _Base(__a, __n) + { _M_fill_initialize(__value); } + explicit deque(size_type __n) : _Base(allocator_type(), __n) + { _M_fill_initialize(value_type()); } + +#ifdef __STL_MEMBER_TEMPLATES + + // Check whether it's an integral type. If so, it's not an iterator. + template <class _InputIterator> + deque(_InputIterator __first, _InputIterator __last, + const allocator_type& __a = allocator_type()) : _Base(__a) { + typedef typename _Is_integer<_InputIterator>::_Integral _Integral; + _M_initialize_dispatch(__first, __last, _Integral()); + } + + template <class _Integer> + void _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) { + _M_initialize_map(__n); + _M_fill_initialize(__x); + } + + template <class _InputIter> + void _M_initialize_dispatch(_InputIter __first, _InputIter __last, + __false_type) { + _M_range_initialize(__first, __last, __ITERATOR_CATEGORY(__first)); + } + +#else /* __STL_MEMBER_TEMPLATES */ + + deque(const value_type* __first, const value_type* __last, + const allocator_type& __a = allocator_type()) + : _Base(__a, __last - __first) + { uninitialized_copy(__first, __last, _M_start); } + deque(const_iterator __first, const_iterator __last, + const allocator_type& __a = allocator_type()) + : _Base(__a, __last - __first) + { uninitialized_copy(__first, __last, _M_start); } + +#endif /* __STL_MEMBER_TEMPLATES */ + + ~deque() { destroy(_M_start, _M_finish); } + + deque& operator= (const deque& __x) { + const size_type __len = size(); + if (&__x != this) { + if (__len >= __x.size()) + erase(copy(__x.begin(), __x.end(), _M_start), _M_finish); + else { + const_iterator __mid = __x.begin() + difference_type(__len); + copy(__x.begin(), __mid, _M_start); + insert(_M_finish, __mid, __x.end()); + } + } + return *this; + } + + void swap(deque& __x) { + __STD::swap(_M_start, __x._M_start); + __STD::swap(_M_finish, __x._M_finish); + __STD::swap(_M_map, __x._M_map); + __STD::swap(_M_map_size, __x._M_map_size); + } + +public: + // assign(), a generalized assignment member function. Two + // versions: one that takes a count, and one that takes a range. + // The range version is a member template, so we dispatch on whether + // or not the type is an integer. + + void _M_fill_assign(size_type __n, const _Tp& __val) { + if (__n > size()) { + fill(begin(), end(), __val); + insert(end(), __n - size(), __val); + } + else { + erase(begin() + __n, end()); + fill(begin(), end(), __val); + } + } + + void assign(size_type __n, const _Tp& __val) { + _M_fill_assign(__n, __val); + } + +#ifdef __STL_MEMBER_TEMPLATES + + template <class _InputIterator> + void assign(_InputIterator __first, _InputIterator __last) { + typedef typename _Is_integer<_InputIterator>::_Integral _Integral; + _M_assign_dispatch(__first, __last, _Integral()); + } + +private: // helper functions for assign() + + template <class _Integer> + void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) + { _M_fill_assign((size_type) __n, (_Tp) __val); } + + template <class _InputIterator> + void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, + __false_type) { + _M_assign_aux(__first, __last, __ITERATOR_CATEGORY(__first)); + } + + template <class _InputIterator> + void _M_assign_aux(_InputIterator __first, _InputIterator __last, + input_iterator_tag); + + template <class _ForwardIterator> + void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, + forward_iterator_tag) { + size_type __len = 0; + distance(__first, __last, __len); + if (__len > size()) { + _ForwardIterator __mid = __first; + advance(__mid, size()); + copy(__first, __mid, begin()); + insert(end(), __mid, __last); + } + else + erase(copy(__first, __last, begin()), end()); + } + +#endif /* __STL_MEMBER_TEMPLATES */ + +public: // push_* and pop_* + + void push_back(const value_type& __t) { + if (_M_finish._M_cur != _M_finish._M_last - 1) { + construct(_M_finish._M_cur, __t); + ++_M_finish._M_cur; + } + else + _M_push_back_aux(__t); + } + + void push_back() { + if (_M_finish._M_cur != _M_finish._M_last - 1) { + construct(_M_finish._M_cur); + ++_M_finish._M_cur; + } + else + _M_push_back_aux(); + } + + void push_front(const value_type& __t) { + if (_M_start._M_cur != _M_start._M_first) { + construct(_M_start._M_cur - 1, __t); + --_M_start._M_cur; + } + else + _M_push_front_aux(__t); + } + + void push_front() { + if (_M_start._M_cur != _M_start._M_first) { + construct(_M_start._M_cur - 1); + --_M_start._M_cur; + } + else + _M_push_front_aux(); + } + + + void pop_back() { + if (_M_finish._M_cur != _M_finish._M_first) { + --_M_finish._M_cur; + destroy(_M_finish._M_cur); + } + else + _M_pop_back_aux(); + } + + void pop_front() { + if (_M_start._M_cur != _M_start._M_last - 1) { + destroy(_M_start._M_cur); + ++_M_start._M_cur; + } + else + _M_pop_front_aux(); + } + +public: // Insert + + iterator insert(iterator position, const value_type& __x) { + if (position._M_cur == _M_start._M_cur) { + push_front(__x); + return _M_start; + } + else if (position._M_cur == _M_finish._M_cur) { + push_back(__x); + iterator __tmp = _M_finish; + --__tmp; + return __tmp; + } + else { + return _M_insert_aux(position, __x); + } + } + + iterator insert(iterator __position) + { return insert(__position, value_type()); } + + void insert(iterator __pos, size_type __n, const value_type& __x) + { _M_fill_insert(__pos, __n, __x); } + + void _M_fill_insert(iterator __pos, size_type __n, const value_type& __x); + +#ifdef __STL_MEMBER_TEMPLATES + + // Check whether it's an integral type. If so, it's not an iterator. + template <class _InputIterator> + void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { + typedef typename _Is_integer<_InputIterator>::_Integral _Integral; + _M_insert_dispatch(__pos, __first, __last, _Integral()); + } + + template <class _Integer> + void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, + __true_type) { + _M_fill_insert(__pos, (size_type) __n, (value_type) __x); + } + + template <class _InputIterator> + void _M_insert_dispatch(iterator __pos, + _InputIterator __first, _InputIterator __last, + __false_type) { + insert(__pos, __first, __last, __ITERATOR_CATEGORY(__first)); + } + +#else /* __STL_MEMBER_TEMPLATES */ + + void insert(iterator __pos, + const value_type* __first, const value_type* __last); + void insert(iterator __pos, + const_iterator __first, const_iterator __last); + +#endif /* __STL_MEMBER_TEMPLATES */ + + void resize(size_type __new_size, const value_type& __x) { + const size_type __len = size(); + if (__new_size < __len) + erase(_M_start + __new_size, _M_finish); + else + insert(_M_finish, __new_size - __len, __x); + } + + void resize(size_type new_size) { resize(new_size, value_type()); } + +public: // Erase + iterator erase(iterator __pos) { + iterator __next = __pos; + ++__next; + difference_type __index = __pos - _M_start; + if (size_type(__index) < (this->size() >> 1)) { + copy_backward(_M_start, __pos, __next); + pop_front(); + } + else { + copy(__next, _M_finish, __pos); + pop_back(); + } + return _M_start + __index; + } + + iterator erase(iterator __first, iterator __last); + void clear(); + +protected: // Internal construction/destruction + + void _M_fill_initialize(const value_type& __value); + +#ifdef __STL_MEMBER_TEMPLATES + + template <class _InputIterator> + void _M_range_initialize(_InputIterator __first, _InputIterator __last, + input_iterator_tag); + + template <class _ForwardIterator> + void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last, + forward_iterator_tag); + +#endif /* __STL_MEMBER_TEMPLATES */ + +protected: // Internal push_* and pop_* + + void _M_push_back_aux(const value_type&); + void _M_push_back_aux(); + void _M_push_front_aux(const value_type&); + void _M_push_front_aux(); + void _M_pop_back_aux(); + void _M_pop_front_aux(); + +protected: // Internal insert functions + +#ifdef __STL_MEMBER_TEMPLATES + + template <class _InputIterator> + void insert(iterator __pos, _InputIterator __first, _InputIterator __last, + input_iterator_tag); + + template <class _ForwardIterator> + void insert(iterator __pos, + _ForwardIterator __first, _ForwardIterator __last, + forward_iterator_tag); + +#endif /* __STL_MEMBER_TEMPLATES */ + + iterator _M_insert_aux(iterator __pos, const value_type& __x); + iterator _M_insert_aux(iterator __pos); + void _M_insert_aux(iterator __pos, size_type __n, const value_type& __x); + +#ifdef __STL_MEMBER_TEMPLATES + + template <class _ForwardIterator> + void _M_insert_aux(iterator __pos, + _ForwardIterator __first, _ForwardIterator __last, + size_type __n); + +#else /* __STL_MEMBER_TEMPLATES */ + + void _M_insert_aux(iterator __pos, + const value_type* __first, const value_type* __last, + size_type __n); + + void _M_insert_aux(iterator __pos, + const_iterator __first, const_iterator __last, + size_type __n); + +#endif /* __STL_MEMBER_TEMPLATES */ + + iterator _M_reserve_elements_at_front(size_type __n) { + size_type __vacancies = _M_start._M_cur - _M_start._M_first; + if (__n > __vacancies) + _M_new_elements_at_front(__n - __vacancies); + return _M_start - difference_type(__n); + } + + iterator _M_reserve_elements_at_back(size_type __n) { + size_type __vacancies = (_M_finish._M_last - _M_finish._M_cur) - 1; + if (__n > __vacancies) + _M_new_elements_at_back(__n - __vacancies); + return _M_finish + difference_type(__n); + } + + void _M_new_elements_at_front(size_type __new_elements); + void _M_new_elements_at_back(size_type __new_elements); + +protected: // Allocation of _M_map and nodes + + // Makes sure the _M_map has space for new nodes. Does not actually + // add the nodes. Can invalidate _M_map pointers. (And consequently, + // deque iterators.) + + void _M_reserve_map_at_back (size_type __nodes_to_add = 1) { + if (__nodes_to_add + 1 > _M_map_size - (_M_finish._M_node - _M_map)) + _M_reallocate_map(__nodes_to_add, false); + } + + void _M_reserve_map_at_front (size_type __nodes_to_add = 1) { + if (__nodes_to_add > size_type(_M_start._M_node - _M_map)) + _M_reallocate_map(__nodes_to_add, true); + } + + void _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front); +}; + +// Non-inline member functions + +#ifdef __STL_MEMBER_TEMPLATES + +template <class _Tp, class _Alloc> +template <class _InputIter> +void deque<_Tp, _Alloc> + ::_M_assign_aux(_InputIter __first, _InputIter __last, input_iterator_tag) +{ + iterator __cur = begin(); + for ( ; __first != __last && __cur != end(); ++__cur, ++__first) + *__cur = *__first; + if (__first == __last) + erase(__cur, end()); + else + insert(end(), __first, __last); +} + +#endif /* __STL_MEMBER_TEMPLATES */ + +template <class _Tp, class _Alloc> +void deque<_Tp, _Alloc>::_M_fill_insert(iterator __pos, + size_type __n, const value_type& __x) +{ + if (__pos._M_cur == _M_start._M_cur) { + iterator __new_start = _M_reserve_elements_at_front(__n); + __STL_TRY { + uninitialized_fill(__new_start, _M_start, __x); + _M_start = __new_start; + } + __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node)); + } + else if (__pos._M_cur == _M_finish._M_cur) { + iterator __new_finish = _M_reserve_elements_at_back(__n); + __STL_TRY { + uninitialized_fill(_M_finish, __new_finish, __x); + _M_finish = __new_finish; + } + __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1, + __new_finish._M_node + 1)); + } + else + _M_insert_aux(__pos, __n, __x); +} + +#ifndef __STL_MEMBER_TEMPLATES + +template <class _Tp, class _Alloc> +void deque<_Tp, _Alloc>::insert(iterator __pos, + const value_type* __first, + const value_type* __last) { + size_type __n = __last - __first; + if (__pos._M_cur == _M_start._M_cur) { + iterator __new_start = _M_reserve_elements_at_front(__n); + __STL_TRY { + uninitialized_copy(__first, __last, __new_start); + _M_start = __new_start; + } + __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node)); + } + else if (__pos._M_cur == _M_finish._M_cur) { + iterator __new_finish = _M_reserve_elements_at_back(__n); + __STL_TRY { + uninitialized_copy(__first, __last, _M_finish); + _M_finish = __new_finish; + } + __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1, + __new_finish._M_node + 1)); + } + else + _M_insert_aux(__pos, __first, __last, __n); +} + +template <class _Tp, class _Alloc> +void deque<_Tp,_Alloc>::insert(iterator __pos, + const_iterator __first, const_iterator __last) +{ + size_type __n = __last - __first; + if (__pos._M_cur == _M_start._M_cur) { + iterator __new_start = _M_reserve_elements_at_front(__n); + __STL_TRY { + uninitialized_copy(__first, __last, __new_start); + _M_start = __new_start; + } + __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node)); + } + else if (__pos._M_cur == _M_finish._M_cur) { + iterator __new_finish = _M_reserve_elements_at_back(__n); + __STL_TRY { + uninitialized_copy(__first, __last, _M_finish); + _M_finish = __new_finish; + } + __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1, + __new_finish._M_node + 1)); + } + else + _M_insert_aux(__pos, __first, __last, __n); +} + +#endif /* __STL_MEMBER_TEMPLATES */ + +template <class _Tp, class _Alloc> +typename deque<_Tp,_Alloc>::iterator +deque<_Tp,_Alloc>::erase(iterator __first, iterator __last) +{ + if (__first == _M_start && __last == _M_finish) { + clear(); + return _M_finish; + } + else { + difference_type __n = __last - __first; + difference_type __elems_before = __first - _M_start; + if (__elems_before < difference_type((this->size() - __n) / 2)) { + copy_backward(_M_start, __first, __last); + iterator __new_start = _M_start + __n; + destroy(_M_start, __new_start); + _M_destroy_nodes(__new_start._M_node, _M_start._M_node); + _M_start = __new_start; + } + else { + copy(__last, _M_finish, __first); + iterator __new_finish = _M_finish - __n; + destroy(__new_finish, _M_finish); + _M_destroy_nodes(__new_finish._M_node + 1, _M_finish._M_node + 1); + _M_finish = __new_finish; + } + return _M_start + __elems_before; + } +} + +template <class _Tp, class _Alloc> +void deque<_Tp,_Alloc>::clear() +{ + for (_Map_pointer __node = _M_start._M_node + 1; + __node < _M_finish._M_node; + ++__node) { + destroy(*__node, *__node + _S_buffer_size()); + _M_deallocate_node(*__node); + } + + if (_M_start._M_node != _M_finish._M_node) { + destroy(_M_start._M_cur, _M_start._M_last); + destroy(_M_finish._M_first, _M_finish._M_cur); + _M_deallocate_node(_M_finish._M_first); + } + else + destroy(_M_start._M_cur, _M_finish._M_cur); + + _M_finish = _M_start; +} + +// Precondition: _M_start and _M_finish have already been initialized, +// but none of the deque's elements have yet been constructed. +template <class _Tp, class _Alloc> +void deque<_Tp,_Alloc>::_M_fill_initialize(const value_type& __value) { + _Map_pointer __cur; + __STL_TRY { + for (__cur = _M_start._M_node; __cur < _M_finish._M_node; ++__cur) + uninitialized_fill(*__cur, *__cur + _S_buffer_size(), __value); + uninitialized_fill(_M_finish._M_first, _M_finish._M_cur, __value); + } + __STL_UNWIND(destroy(_M_start, iterator(*__cur, __cur))); +} + +#ifdef __STL_MEMBER_TEMPLATES + +template <class _Tp, class _Alloc> template <class _InputIterator> +void deque<_Tp,_Alloc>::_M_range_initialize(_InputIterator __first, + _InputIterator __last, + input_iterator_tag) +{ + _M_initialize_map(0); + __STL_TRY { + for ( ; __first != __last; ++__first) + push_back(*__first); + } + __STL_UNWIND(clear()); +} + +template <class _Tp, class _Alloc> template <class _ForwardIterator> +void deque<_Tp,_Alloc>::_M_range_initialize(_ForwardIterator __first, + _ForwardIterator __last, + forward_iterator_tag) +{ + size_type __n = 0; + distance(__first, __last, __n); + _M_initialize_map(__n); + + _Map_pointer __cur_node; + __STL_TRY { + for (__cur_node = _M_start._M_node; + __cur_node < _M_finish._M_node; + ++__cur_node) { + _ForwardIterator __mid = __first; + advance(__mid, _S_buffer_size()); + uninitialized_copy(__first, __mid, *__cur_node); + __first = __mid; + } + uninitialized_copy(__first, __last, _M_finish._M_first); + } + __STL_UNWIND(destroy(_M_start, iterator(*__cur_node, __cur_node))); +} + +#endif /* __STL_MEMBER_TEMPLATES */ + +// Called only if _M_finish._M_cur == _M_finish._M_last - 1. +template <class _Tp, class _Alloc> +void deque<_Tp,_Alloc>::_M_push_back_aux(const value_type& __t) +{ + value_type __t_copy = __t; + _M_reserve_map_at_back(); + *(_M_finish._M_node + 1) = _M_allocate_node(); + __STL_TRY { + construct(_M_finish._M_cur, __t_copy); + _M_finish._M_set_node(_M_finish._M_node + 1); + _M_finish._M_cur = _M_finish._M_first; + } + __STL_UNWIND(_M_deallocate_node(*(_M_finish._M_node + 1))); +} + +// Called only if _M_finish._M_cur == _M_finish._M_last - 1. +template <class _Tp, class _Alloc> +void deque<_Tp,_Alloc>::_M_push_back_aux() +{ + _M_reserve_map_at_back(); + *(_M_finish._M_node + 1) = _M_allocate_node(); + __STL_TRY { + construct(_M_finish._M_cur); + _M_finish._M_set_node(_M_finish._M_node + 1); + _M_finish._M_cur = _M_finish._M_first; + } + __STL_UNWIND(_M_deallocate_node(*(_M_finish._M_node + 1))); +} + +// Called only if _M_start._M_cur == _M_start._M_first. +template <class _Tp, class _Alloc> +void deque<_Tp,_Alloc>::_M_push_front_aux(const value_type& __t) +{ + value_type __t_copy = __t; + _M_reserve_map_at_front(); + *(_M_start._M_node - 1) = _M_allocate_node(); + __STL_TRY { + _M_start._M_set_node(_M_start._M_node - 1); + _M_start._M_cur = _M_start._M_last - 1; + construct(_M_start._M_cur, __t_copy); + } + __STL_UNWIND((++_M_start, _M_deallocate_node(*(_M_start._M_node - 1)))); +} + +// Called only if _M_start._M_cur == _M_start._M_first. +template <class _Tp, class _Alloc> +void deque<_Tp,_Alloc>::_M_push_front_aux() +{ + _M_reserve_map_at_front(); + *(_M_start._M_node - 1) = _M_allocate_node(); + __STL_TRY { + _M_start._M_set_node(_M_start._M_node - 1); + _M_start._M_cur = _M_start._M_last - 1; + construct(_M_start._M_cur); + } + __STL_UNWIND((++_M_start, _M_deallocate_node(*(_M_start._M_node - 1)))); +} + +// Called only if _M_finish._M_cur == _M_finish._M_first. +template <class _Tp, class _Alloc> +void deque<_Tp,_Alloc>::_M_pop_back_aux() +{ + _M_deallocate_node(_M_finish._M_first); + _M_finish._M_set_node(_M_finish._M_node - 1); + _M_finish._M_cur = _M_finish._M_last - 1; + destroy(_M_finish._M_cur); +} + +// Called only if _M_start._M_cur == _M_start._M_last - 1. Note that +// if the deque has at least one element (a precondition for this member +// function), and if _M_start._M_cur == _M_start._M_last, then the deque +// must have at least two nodes. +template <class _Tp, class _Alloc> +void deque<_Tp,_Alloc>::_M_pop_front_aux() +{ + destroy(_M_start._M_cur); + _M_deallocate_node(_M_start._M_first); + _M_start._M_set_node(_M_start._M_node + 1); + _M_start._M_cur = _M_start._M_first; +} + +#ifdef __STL_MEMBER_TEMPLATES + +template <class _Tp, class _Alloc> template <class _InputIterator> +void deque<_Tp,_Alloc>::insert(iterator __pos, + _InputIterator __first, _InputIterator __last, + input_iterator_tag) +{ + copy(__first, __last, inserter(*this, __pos)); +} + +template <class _Tp, class _Alloc> template <class _ForwardIterator> +void +deque<_Tp,_Alloc>::insert(iterator __pos, + _ForwardIterator __first, _ForwardIterator __last, + forward_iterator_tag) { + size_type __n = 0; + distance(__first, __last, __n); + if (__pos._M_cur == _M_start._M_cur) { + iterator __new_start = _M_reserve_elements_at_front(__n); + __STL_TRY { + uninitialized_copy(__first, __last, __new_start); + _M_start = __new_start; + } + __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node)); + } + else if (__pos._M_cur == _M_finish._M_cur) { + iterator __new_finish = _M_reserve_elements_at_back(__n); + __STL_TRY { + uninitialized_copy(__first, __last, _M_finish); + _M_finish = __new_finish; + } + __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1, + __new_finish._M_node + 1)); + } + else + _M_insert_aux(__pos, __first, __last, __n); +} + +#endif /* __STL_MEMBER_TEMPLATES */ + +template <class _Tp, class _Alloc> +typename deque<_Tp, _Alloc>::iterator +deque<_Tp,_Alloc>::_M_insert_aux(iterator __pos, const value_type& __x) +{ + difference_type __index = __pos - _M_start; + value_type __x_copy = __x; + if (size_type(__index) < this->size() / 2) { + push_front(front()); + iterator __front1 = _M_start; + ++__front1; + iterator __front2 = __front1; + ++__front2; + __pos = _M_start + __index; + iterator __pos1 = __pos; + ++__pos1; + copy(__front2, __pos1, __front1); + } + else { + push_back(back()); + iterator __back1 = _M_finish; + --__back1; + iterator __back2 = __back1; + --__back2; + __pos = _M_start + __index; + copy_backward(__pos, __back2, __back1); + } + *__pos = __x_copy; + return __pos; +} + +template <class _Tp, class _Alloc> +typename deque<_Tp,_Alloc>::iterator +deque<_Tp,_Alloc>::_M_insert_aux(iterator __pos) +{ + difference_type __index = __pos - _M_start; + if (__index < size() / 2) { + push_front(front()); + iterator __front1 = _M_start; + ++__front1; + iterator __front2 = __front1; + ++__front2; + __pos = _M_start + __index; + iterator __pos1 = __pos; + ++__pos1; + copy(__front2, __pos1, __front1); + } + else { + push_back(back()); + iterator __back1 = _M_finish; + --__back1; + iterator __back2 = __back1; + --__back2; + __pos = _M_start + __index; + copy_backward(__pos, __back2, __back1); + } + *__pos = value_type(); + return __pos; +} + +template <class _Tp, class _Alloc> +void deque<_Tp,_Alloc>::_M_insert_aux(iterator __pos, + size_type __n, + const value_type& __x) +{ + const difference_type __elems_before = __pos - _M_start; + size_type __length = this->size(); + value_type __x_copy = __x; + if (__elems_before < difference_type(__length / 2)) { + iterator __new_start = _M_reserve_elements_at_front(__n); + iterator __old_start = _M_start; + __pos = _M_start + __elems_before; + __STL_TRY { + if (__elems_before >= difference_type(__n)) { + iterator __start_n = _M_start + difference_type(__n); + uninitialized_copy(_M_start, __start_n, __new_start); + _M_start = __new_start; + copy(__start_n, __pos, __old_start); + fill(__pos - difference_type(__n), __pos, __x_copy); + } + else { + __uninitialized_copy_fill(_M_start, __pos, __new_start, + _M_start, __x_copy); + _M_start = __new_start; + fill(__old_start, __pos, __x_copy); + } + } + __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node)); + } + else { + iterator __new_finish = _M_reserve_elements_at_back(__n); + iterator __old_finish = _M_finish; + const difference_type __elems_after = + difference_type(__length) - __elems_before; + __pos = _M_finish - __elems_after; + __STL_TRY { + if (__elems_after > difference_type(__n)) { + iterator __finish_n = _M_finish - difference_type(__n); + uninitialized_copy(__finish_n, _M_finish, _M_finish); + _M_finish = __new_finish; + copy_backward(__pos, __finish_n, __old_finish); + fill(__pos, __pos + difference_type(__n), __x_copy); + } + else { + __uninitialized_fill_copy(_M_finish, __pos + difference_type(__n), + __x_copy, __pos, _M_finish); + _M_finish = __new_finish; + fill(__pos, __old_finish, __x_copy); + } + } + __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1, + __new_finish._M_node + 1)); + } +} + +#ifdef __STL_MEMBER_TEMPLATES + +template <class _Tp, class _Alloc> template <class _ForwardIterator> +void deque<_Tp,_Alloc>::_M_insert_aux(iterator __pos, + _ForwardIterator __first, + _ForwardIterator __last, + size_type __n) +{ + const difference_type __elemsbefore = __pos - _M_start; + size_type __length = size(); + if (__elemsbefore < __length / 2) { + iterator __new_start = _M_reserve_elements_at_front(__n); + iterator __old_start = _M_start; + __pos = _M_start + __elemsbefore; + __STL_TRY { + if (__elemsbefore >= difference_type(__n)) { + iterator __start_n = _M_start + difference_type(__n); + uninitialized_copy(_M_start, __start_n, __new_start); + _M_start = __new_start; + copy(__start_n, __pos, __old_start); + copy(__first, __last, __pos - difference_type(__n)); + } + else { + _ForwardIterator __mid = __first; + advance(__mid, difference_type(__n) - __elemsbefore); + __uninitialized_copy_copy(_M_start, __pos, __first, __mid, + __new_start); + _M_start = __new_start; + copy(__mid, __last, __old_start); + } + } + __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node)); + } + else { + iterator __new_finish = _M_reserve_elements_at_back(__n); + iterator __old_finish = _M_finish; + const difference_type __elemsafter = + difference_type(__length) - __elemsbefore; + __pos = _M_finish - __elemsafter; + __STL_TRY { + if (__elemsafter > difference_type(__n)) { + iterator __finish_n = _M_finish - difference_type(__n); + uninitialized_copy(__finish_n, _M_finish, _M_finish); + _M_finish = __new_finish; + copy_backward(__pos, __finish_n, __old_finish); + copy(__first, __last, __pos); + } + else { + _ForwardIterator __mid = __first; + advance(__mid, __elemsafter); + __uninitialized_copy_copy(__mid, __last, __pos, _M_finish, _M_finish); + _M_finish = __new_finish; + copy(__first, __mid, __pos); + } + } + __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1, + __new_finish._M_node + 1)); + } +} + +#else /* __STL_MEMBER_TEMPLATES */ + +template <class _Tp, class _Alloc> +void deque<_Tp,_Alloc>::_M_insert_aux(iterator __pos, + const value_type* __first, + const value_type* __last, + size_type __n) +{ + const difference_type __elemsbefore = __pos - _M_start; + size_type __length = size(); + if (__elemsbefore < __length / 2) { + iterator __new_start = _M_reserve_elements_at_front(__n); + iterator __old_start = _M_start; + __pos = _M_start + __elemsbefore; + __STL_TRY { + if (__elemsbefore >= difference_type(__n)) { + iterator __start_n = _M_start + difference_type(__n); + uninitialized_copy(_M_start, __start_n, __new_start); + _M_start = __new_start; + copy(__start_n, __pos, __old_start); + copy(__first, __last, __pos - difference_type(__n)); + } + else { + const value_type* __mid = + __first + (difference_type(__n) - __elemsbefore); + __uninitialized_copy_copy(_M_start, __pos, __first, __mid, + __new_start); + _M_start = __new_start; + copy(__mid, __last, __old_start); + } + } + __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node)); + } + else { + iterator __new_finish = _M_reserve_elements_at_back(__n); + iterator __old_finish = _M_finish; + const difference_type __elemsafter = + difference_type(__length) - __elemsbefore; + __pos = _M_finish - __elemsafter; + __STL_TRY { + if (__elemsafter > difference_type(__n)) { + iterator __finish_n = _M_finish - difference_type(__n); + uninitialized_copy(__finish_n, _M_finish, _M_finish); + _M_finish = __new_finish; + copy_backward(__pos, __finish_n, __old_finish); + copy(__first, __last, __pos); + } + else { + const value_type* __mid = __first + __elemsafter; + __uninitialized_copy_copy(__mid, __last, __pos, _M_finish, _M_finish); + _M_finish = __new_finish; + copy(__first, __mid, __pos); + } + } + __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1, + __new_finish._M_node + 1)); + } +} + +template <class _Tp, class _Alloc> +void deque<_Tp,_Alloc>::_M_insert_aux(iterator __pos, + const_iterator __first, + const_iterator __last, + size_type __n) +{ + const difference_type __elemsbefore = __pos - _M_start; + size_type __length = size(); + if (__elemsbefore < __length / 2) { + iterator __new_start = _M_reserve_elements_at_front(__n); + iterator __old_start = _M_start; + __pos = _M_start + __elemsbefore; + __STL_TRY { + if (__elemsbefore >= __n) { + iterator __start_n = _M_start + __n; + uninitialized_copy(_M_start, __start_n, __new_start); + _M_start = __new_start; + copy(__start_n, __pos, __old_start); + copy(__first, __last, __pos - difference_type(__n)); + } + else { + const_iterator __mid = __first + (__n - __elemsbefore); + __uninitialized_copy_copy(_M_start, __pos, __first, __mid, + __new_start); + _M_start = __new_start; + copy(__mid, __last, __old_start); + } + } + __STL_UNWIND(_M_destroy_nodes(__new_start._M_node, _M_start._M_node)); + } + else { + iterator __new_finish = _M_reserve_elements_at_back(__n); + iterator __old_finish = _M_finish; + const difference_type __elemsafter = __length - __elemsbefore; + __pos = _M_finish - __elemsafter; + __STL_TRY { + if (__elemsafter > __n) { + iterator __finish_n = _M_finish - difference_type(__n); + uninitialized_copy(__finish_n, _M_finish, _M_finish); + _M_finish = __new_finish; + copy_backward(__pos, __finish_n, __old_finish); + copy(__first, __last, __pos); + } + else { + const_iterator __mid = __first + __elemsafter; + __uninitialized_copy_copy(__mid, __last, __pos, _M_finish, _M_finish); + _M_finish = __new_finish; + copy(__first, __mid, __pos); + } + } + __STL_UNWIND(_M_destroy_nodes(_M_finish._M_node + 1, + __new_finish._M_node + 1)); + } +} + +#endif /* __STL_MEMBER_TEMPLATES */ + +template <class _Tp, class _Alloc> +void deque<_Tp,_Alloc>::_M_new_elements_at_front(size_type __new_elems) +{ + size_type __new_nodes + = (__new_elems + _S_buffer_size() - 1) / _S_buffer_size(); + _M_reserve_map_at_front(__new_nodes); + size_type __i; + __STL_TRY { + for (__i = 1; __i <= __new_nodes; ++__i) + *(_M_start._M_node - __i) = _M_allocate_node(); + } +# ifdef __STL_USE_EXCEPTIONS + catch(...) { + for (size_type __j = 1; __j < __i; ++__j) + _M_deallocate_node(*(_M_start._M_node - __j)); + throw; + } +# endif /* __STL_USE_EXCEPTIONS */ +} + +template <class _Tp, class _Alloc> +void deque<_Tp,_Alloc>::_M_new_elements_at_back(size_type __new_elems) +{ + size_type __new_nodes + = (__new_elems + _S_buffer_size() - 1) / _S_buffer_size(); + _M_reserve_map_at_back(__new_nodes); + size_type __i; + __STL_TRY { + for (__i = 1; __i <= __new_nodes; ++__i) + *(_M_finish._M_node + __i) = _M_allocate_node(); + } +# ifdef __STL_USE_EXCEPTIONS + catch(...) { + for (size_type __j = 1; __j < __i; ++__j) + _M_deallocate_node(*(_M_finish._M_node + __j)); + throw; + } +# endif /* __STL_USE_EXCEPTIONS */ +} + +template <class _Tp, class _Alloc> +void deque<_Tp,_Alloc>::_M_reallocate_map(size_type __nodes_to_add, + bool __add_at_front) +{ + size_type __old_num_nodes = _M_finish._M_node - _M_start._M_node + 1; + size_type __new_num_nodes = __old_num_nodes + __nodes_to_add; + + _Map_pointer __new_nstart; + if (_M_map_size > 2 * __new_num_nodes) { + __new_nstart = _M_map + (_M_map_size - __new_num_nodes) / 2 + + (__add_at_front ? __nodes_to_add : 0); + if (__new_nstart < _M_start._M_node) + copy(_M_start._M_node, _M_finish._M_node + 1, __new_nstart); + else + copy_backward(_M_start._M_node, _M_finish._M_node + 1, + __new_nstart + __old_num_nodes); + } + else { + size_type __new_map_size = + _M_map_size + max(_M_map_size, __nodes_to_add) + 2; + + _Map_pointer __new_map = _M_allocate_map(__new_map_size); + __new_nstart = __new_map + (__new_map_size - __new_num_nodes) / 2 + + (__add_at_front ? __nodes_to_add : 0); + copy(_M_start._M_node, _M_finish._M_node + 1, __new_nstart); + _M_deallocate_map(_M_map, _M_map_size); + + _M_map = __new_map; + _M_map_size = __new_map_size; + } + + _M_start._M_set_node(__new_nstart); + _M_finish._M_set_node(__new_nstart + __old_num_nodes - 1); +} + + +// Nonmember functions. + +template <class _Tp, class _Alloc> +inline bool operator==(const deque<_Tp, _Alloc>& __x, + const deque<_Tp, _Alloc>& __y) { + return __x.size() == __y.size() && + equal(__x.begin(), __x.end(), __y.begin()); +} + +template <class _Tp, class _Alloc> +inline bool operator<(const deque<_Tp, _Alloc>& __x, + const deque<_Tp, _Alloc>& __y) { + return lexicographical_compare(__x.begin(), __x.end(), + __y.begin(), __y.end()); +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Tp, class _Alloc> +inline bool operator!=(const deque<_Tp, _Alloc>& __x, + const deque<_Tp, _Alloc>& __y) { + return !(__x == __y); +} + +template <class _Tp, class _Alloc> +inline bool operator>(const deque<_Tp, _Alloc>& __x, + const deque<_Tp, _Alloc>& __y) { + return __y < __x; +} + +template <class _Tp, class _Alloc> +inline bool operator<=(const deque<_Tp, _Alloc>& __x, + const deque<_Tp, _Alloc>& __y) { + return !(__y < __x); +} +template <class _Tp, class _Alloc> +inline bool operator>=(const deque<_Tp, _Alloc>& __x, + const deque<_Tp, _Alloc>& __y) { + return !(__x < __y); +} + +template <class _Tp, class _Alloc> +inline void swap(deque<_Tp,_Alloc>& __x, deque<_Tp,_Alloc>& __y) { + __x.swap(__y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1174 +#pragma reset woff 1375 +#endif + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_DEQUE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_exception.h b/dtm_release/local/include/stl/stl_exception.h new file mode 100644 index 0000000000000000000000000000000000000000..37b54d74442abb1c7ee083f3c1728ebfe593ef52 --- /dev/null +++ b/dtm_release/local/include/stl/stl_exception.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_EXCEPTION_H +#define __SGI_STL_EXCEPTION_H + +// This header exists solely for portability. Normally it just includes +// the header <exception>. + +// The header <exception> contains low-level functions that interact +// with a compiler's exception-handling mechanism. It is assumed to +// be supplied with the compiler, rather than with the library, because +// it is inherently tied very closely to the compiler itself. + +// On platforms where <exception> does not exist, this header defines +// an exception base class. This is *not* a substitute for everything +// in <exception>, but it suffices to support a bare minimum of STL +// functionality. + +#include <stl_config.h> + +#ifndef __STL_NO_EXCEPTION_HEADER + +#include <exception> +#define __STL_EXCEPTION_BASE exception + +#else /* __STL_NO_EXCEPTION_HEADER */ + +__STL_BEGIN_NAMESPACE + +class _Exception { +public: + virtual ~_Exception() __STL_NOTHROW {} + virtual const char* what() const __STL_NOTHROW { return ""; } +}; + +#define __STL_EXCEPTION_BASE _Exception + +__STL_END_NAMESPACE + +#endif /* __STL_NO_EXCEPTION_HEADER */ + +#endif /* __SGI_STL_EXCEPTION_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_function.h b/dtm_release/local/include/stl/stl_function.h new file mode 100644 index 0000000000000000000000000000000000000000..90752e219f4a851afd480125d353e355bf4aa20d --- /dev/null +++ b/dtm_release/local/include/stl/stl_function.h @@ -0,0 +1,725 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_FUNCTION_H +#define __SGI_STL_INTERNAL_FUNCTION_H + +__STL_BEGIN_NAMESPACE + +template <class _Arg, class _Result> +struct unary_function { + typedef _Arg argument_type; + typedef _Result result_type; +}; + +template <class _Arg1, class _Arg2, class _Result> +struct binary_function { + typedef _Arg1 first_argument_type; + typedef _Arg2 second_argument_type; + typedef _Result result_type; +}; + +template <class _Tp> +struct plus : public binary_function<_Tp,_Tp,_Tp> { + _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x + __y; } +}; + +template <class _Tp> +struct minus : public binary_function<_Tp,_Tp,_Tp> { + _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x - __y; } +}; + +template <class _Tp> +struct multiplies : public binary_function<_Tp,_Tp,_Tp> { + _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x * __y; } +}; + +template <class _Tp> +struct divides : public binary_function<_Tp,_Tp,_Tp> { + _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x / __y; } +}; + +// identity_element (not part of the C++ standard). + +template <class _Tp> inline _Tp identity_element(plus<_Tp>) { + return _Tp(0); +} +template <class _Tp> inline _Tp identity_element(multiplies<_Tp>) { + return _Tp(1); +} + +template <class _Tp> +struct modulus : public binary_function<_Tp,_Tp,_Tp> +{ + _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x % __y; } +}; + +template <class _Tp> +struct negate : public unary_function<_Tp,_Tp> +{ + _Tp operator()(const _Tp& __x) const { return -__x; } +}; + +template <class _Tp> +struct equal_to : public binary_function<_Tp,_Tp,bool> +{ + bool operator()(const _Tp& __x, const _Tp& __y) const { return __x == __y; } +}; + +template <class _Tp> +struct not_equal_to : public binary_function<_Tp,_Tp,bool> +{ + bool operator()(const _Tp& __x, const _Tp& __y) const { return __x != __y; } +}; + +template <class _Tp> +struct greater : public binary_function<_Tp,_Tp,bool> +{ + bool operator()(const _Tp& __x, const _Tp& __y) const { return __x > __y; } +}; + +template <class _Tp> +struct less : public binary_function<_Tp,_Tp,bool> +{ + bool operator()(const _Tp& __x, const _Tp& __y) const { return __x < __y; } +}; + +template <class _Tp> +struct greater_equal : public binary_function<_Tp,_Tp,bool> +{ + bool operator()(const _Tp& __x, const _Tp& __y) const { return __x >= __y; } +}; + +template <class _Tp> +struct less_equal : public binary_function<_Tp,_Tp,bool> +{ + bool operator()(const _Tp& __x, const _Tp& __y) const { return __x <= __y; } +}; + +template <class _Tp> +struct logical_and : public binary_function<_Tp,_Tp,bool> +{ + bool operator()(const _Tp& __x, const _Tp& __y) const { return __x && __y; } +}; + +template <class _Tp> +struct logical_or : public binary_function<_Tp,_Tp,bool> +{ + bool operator()(const _Tp& __x, const _Tp& __y) const { return __x || __y; } +}; + +template <class _Tp> +struct logical_not : public unary_function<_Tp,bool> +{ + bool operator()(const _Tp& __x) const { return !__x; } +}; + +template <class _Predicate> +class unary_negate + : public unary_function<typename _Predicate::argument_type, bool> { +protected: + _Predicate _M_pred; +public: + explicit unary_negate(const _Predicate& __x) : _M_pred(__x) {} + bool operator()(const typename _Predicate::argument_type& __x) const { + return !_M_pred(__x); + } +}; + +template <class _Predicate> +inline unary_negate<_Predicate> +not1(const _Predicate& __pred) +{ + return unary_negate<_Predicate>(__pred); +} + +template <class _Predicate> +class binary_negate + : public binary_function<typename _Predicate::first_argument_type, + typename _Predicate::second_argument_type, + bool> { +protected: + _Predicate _M_pred; +public: + explicit binary_negate(const _Predicate& __x) : _M_pred(__x) {} + bool operator()(const typename _Predicate::first_argument_type& __x, + const typename _Predicate::second_argument_type& __y) const + { + return !_M_pred(__x, __y); + } +}; + +template <class _Predicate> +inline binary_negate<_Predicate> +not2(const _Predicate& __pred) +{ + return binary_negate<_Predicate>(__pred); +} + +template <class _Operation> +class binder1st + : public unary_function<typename _Operation::second_argument_type, + typename _Operation::result_type> { +protected: + _Operation op; + typename _Operation::first_argument_type value; +public: + binder1st(const _Operation& __x, + const typename _Operation::first_argument_type& __y) + : op(__x), value(__y) {} + typename _Operation::result_type + operator()(const typename _Operation::second_argument_type& __x) const { + return op(value, __x); + } +}; + +template <class _Operation, class _Tp> +inline binder1st<_Operation> +bind1st(const _Operation& __fn, const _Tp& __x) +{ + typedef typename _Operation::first_argument_type _Arg1_type; + return binder1st<_Operation>(__fn, _Arg1_type(__x)); +} + +template <class _Operation> +class binder2nd + : public unary_function<typename _Operation::first_argument_type, + typename _Operation::result_type> { +protected: + _Operation op; + typename _Operation::second_argument_type value; +public: + binder2nd(const _Operation& __x, + const typename _Operation::second_argument_type& __y) + : op(__x), value(__y) {} + typename _Operation::result_type + operator()(const typename _Operation::first_argument_type& __x) const { + return op(__x, value); + } +}; + +template <class _Operation, class _Tp> +inline binder2nd<_Operation> +bind2nd(const _Operation& __fn, const _Tp& __x) +{ + typedef typename _Operation::second_argument_type _Arg2_type; + return binder2nd<_Operation>(__fn, _Arg2_type(__x)); +} + +// unary_compose and binary_compose (extensions, not part of the standard). + +template <class _Operation1, class _Operation2> +class unary_compose + : public unary_function<typename _Operation2::argument_type, + typename _Operation1::result_type> +{ +protected: + _Operation1 _M_fn1; + _Operation2 _M_fn2; +public: + unary_compose(const _Operation1& __x, const _Operation2& __y) + : _M_fn1(__x), _M_fn2(__y) {} + typename _Operation1::result_type + operator()(const typename _Operation2::argument_type& __x) const { + return _M_fn1(_M_fn2(__x)); + } +}; + +template <class _Operation1, class _Operation2> +inline unary_compose<_Operation1,_Operation2> +compose1(const _Operation1& __fn1, const _Operation2& __fn2) +{ + return unary_compose<_Operation1,_Operation2>(__fn1, __fn2); +} + +template <class _Operation1, class _Operation2, class _Operation3> +class binary_compose + : public unary_function<typename _Operation2::argument_type, + typename _Operation1::result_type> { +protected: + _Operation1 _M_fn1; + _Operation2 _M_fn2; + _Operation3 _M_fn3; +public: + binary_compose(const _Operation1& __x, const _Operation2& __y, + const _Operation3& __z) + : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { } + typename _Operation1::result_type + operator()(const typename _Operation2::argument_type& __x) const { + return _M_fn1(_M_fn2(__x), _M_fn3(__x)); + } +}; + +template <class _Operation1, class _Operation2, class _Operation3> +inline binary_compose<_Operation1, _Operation2, _Operation3> +compose2(const _Operation1& __fn1, const _Operation2& __fn2, + const _Operation3& __fn3) +{ + return binary_compose<_Operation1,_Operation2,_Operation3> + (__fn1, __fn2, __fn3); +} + +template <class _Arg, class _Result> +class pointer_to_unary_function : public unary_function<_Arg, _Result> { +protected: + _Result (*_M_ptr)(_Arg); +public: + pointer_to_unary_function() {} + explicit pointer_to_unary_function(_Result (*__x)(_Arg)) : _M_ptr(__x) {} + _Result operator()(_Arg __x) const { return _M_ptr(__x); } +}; + +template <class _Arg, class _Result> +inline pointer_to_unary_function<_Arg, _Result> ptr_fun(_Result (*__x)(_Arg)) +{ + return pointer_to_unary_function<_Arg, _Result>(__x); +} + +template <class _Arg1, class _Arg2, class _Result> +class pointer_to_binary_function : + public binary_function<_Arg1,_Arg2,_Result> { +protected: + _Result (*_M_ptr)(_Arg1, _Arg2); +public: + pointer_to_binary_function() {} + explicit pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2)) + : _M_ptr(__x) {} + _Result operator()(_Arg1 __x, _Arg2 __y) const { + return _M_ptr(__x, __y); + } +}; + +template <class _Arg1, class _Arg2, class _Result> +inline pointer_to_binary_function<_Arg1,_Arg2,_Result> +ptr_fun(_Result (*__x)(_Arg1, _Arg2)) { + return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__x); +} + +// identity is an extensions: it is not part of the standard. +template <class _Tp> +struct _Identity : public unary_function<_Tp,_Tp> { + const _Tp& operator()(const _Tp& __x) const { return __x; } +}; + +template <class _Tp> struct identity : public _Identity<_Tp> {}; + +// select1st and select2nd are extensions: they are not part of the standard. +template <class _Pair> +struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> { + const typename _Pair::first_type& operator()(const _Pair& __x) const { + return __x.first; + } +}; + +template <class _Pair> +struct _Select2nd : public unary_function<_Pair, typename _Pair::second_type> +{ + const typename _Pair::second_type& operator()(const _Pair& __x) const { + return __x.second; + } +}; + +template <class _Pair> struct select1st : public _Select1st<_Pair> {}; +template <class _Pair> struct select2nd : public _Select2nd<_Pair> {}; + +// project1st and project2nd are extensions: they are not part of the standard +template <class _Arg1, class _Arg2> +struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1> { + _Arg1 operator()(const _Arg1& __x, const _Arg2&) const { return __x; } +}; + +template <class _Arg1, class _Arg2> +struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2> { + _Arg2 operator()(const _Arg1&, const _Arg2& __y) const { return __y; } +}; + +template <class _Arg1, class _Arg2> +struct project1st : public _Project1st<_Arg1, _Arg2> {}; + +template <class _Arg1, class _Arg2> +struct project2nd : public _Project2nd<_Arg1, _Arg2> {}; + +// constant_void_fun, constant_unary_fun, and constant_binary_fun are +// extensions: they are not part of the standard. (The same, of course, +// is true of the helper functions constant0, constant1, and constant2.) + +template <class _Result> +struct _Constant_void_fun { + typedef _Result result_type; + result_type _M_val; + + _Constant_void_fun(const result_type& __v) : _M_val(__v) {} + const result_type& operator()() const { return _M_val; } +}; + +template <class _Result, class _Argument> +struct _Constant_unary_fun { + typedef _Argument argument_type; + typedef _Result result_type; + result_type _M_val; + + _Constant_unary_fun(const result_type& __v) : _M_val(__v) {} + const result_type& operator()(const _Argument&) const { return _M_val; } +}; + +template <class _Result, class _Arg1, class _Arg2> +struct _Constant_binary_fun { + typedef _Arg1 first_argument_type; + typedef _Arg2 second_argument_type; + typedef _Result result_type; + _Result _M_val; + + _Constant_binary_fun(const _Result& __v) : _M_val(__v) {} + const result_type& operator()(const _Arg1&, const _Arg2&) const { + return _M_val; + } +}; + +template <class _Result> +struct constant_void_fun : public _Constant_void_fun<_Result> { + constant_void_fun(const _Result& __v) : _Constant_void_fun<_Result>(__v) {} +}; + + +template <class _Result, + class _Argument __STL_DEPENDENT_DEFAULT_TMPL(_Result)> +struct constant_unary_fun : public _Constant_unary_fun<_Result, _Argument> +{ + constant_unary_fun(const _Result& __v) + : _Constant_unary_fun<_Result, _Argument>(__v) {} +}; + + +template <class _Result, + class _Arg1 __STL_DEPENDENT_DEFAULT_TMPL(_Result), + class _Arg2 __STL_DEPENDENT_DEFAULT_TMPL(_Arg1)> +struct constant_binary_fun + : public _Constant_binary_fun<_Result, _Arg1, _Arg2> +{ + constant_binary_fun(const _Result& __v) + : _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {} +}; + +template <class _Result> +inline constant_void_fun<_Result> constant0(const _Result& __val) +{ + return constant_void_fun<_Result>(__val); +} + +template <class _Result> +inline constant_unary_fun<_Result,_Result> constant1(const _Result& __val) +{ + return constant_unary_fun<_Result,_Result>(__val); +} + +template <class _Result> +inline constant_binary_fun<_Result,_Result,_Result> +constant2(const _Result& __val) +{ + return constant_binary_fun<_Result,_Result,_Result>(__val); +} + +// subtractive_rng is an extension: it is not part of the standard. +// Note: this code assumes that int is 32 bits. +class subtractive_rng : public unary_function<unsigned int, unsigned int> { +private: + unsigned int _M_table[55]; + size_t _M_index1; + size_t _M_index2; +public: + unsigned int operator()(unsigned int __limit) { + _M_index1 = (_M_index1 + 1) % 55; + _M_index2 = (_M_index2 + 1) % 55; + _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2]; + return _M_table[_M_index1] % __limit; + } + + void _M_initialize(unsigned int __seed) + { + unsigned int __k = 1; + _M_table[54] = __seed; + size_t __i; + for (__i = 0; __i < 54; __i++) { + size_t __ii = (21 * (__i + 1) % 55) - 1; + _M_table[__ii] = __k; + __k = __seed - __k; + __seed = _M_table[__ii]; + } + for (int __loop = 0; __loop < 4; __loop++) { + for (__i = 0; __i < 55; __i++) + _M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55]; + } + _M_index1 = 0; + _M_index2 = 31; + } + + subtractive_rng(unsigned int __seed) { _M_initialize(__seed); } + subtractive_rng() { _M_initialize(161803398u); } +}; + + +// Adaptor function objects: pointers to member functions. + +// There are a total of 16 = 2^4 function objects in this family. +// (1) Member functions taking no arguments vs member functions taking +// one argument. +// (2) Call through pointer vs call through reference. +// (3) Member function with void return type vs member function with +// non-void return type. +// (4) Const vs non-const member function. + +// Note that choice (3) is nothing more than a workaround: according +// to the draft, compilers should handle void and non-void the same way. +// This feature is not yet widely implemented, though. You can only use +// member functions returning void if your compiler supports partial +// specialization. + +// All of this complexity is in the function objects themselves. You can +// ignore it by using the helper function mem_fun and mem_fun_ref, +// which create whichever type of adaptor is appropriate. +// (mem_fun1 and mem_fun1_ref are no longer part of the C++ standard, +// but they are provided for backward compatibility.) + + +template <class _Ret, class _Tp> +class mem_fun_t : public unary_function<_Tp*,_Ret> { +public: + explicit mem_fun_t(_Ret (_Tp::*__pf)()) : _M_f(__pf) {} + _Ret operator()(_Tp* __p) const { return (__p->*_M_f)(); } +private: + _Ret (_Tp::*_M_f)(); +}; + +template <class _Ret, class _Tp> +class const_mem_fun_t : public unary_function<const _Tp*,_Ret> { +public: + explicit const_mem_fun_t(_Ret (_Tp::*__pf)() const) : _M_f(__pf) {} + _Ret operator()(const _Tp* __p) const { return (__p->*_M_f)(); } +private: + _Ret (_Tp::*_M_f)() const; +}; + + +template <class _Ret, class _Tp> +class mem_fun_ref_t : public unary_function<_Tp,_Ret> { +public: + explicit mem_fun_ref_t(_Ret (_Tp::*__pf)()) : _M_f(__pf) {} + _Ret operator()(_Tp& __r) const { return (__r.*_M_f)(); } +private: + _Ret (_Tp::*_M_f)(); +}; + +template <class _Ret, class _Tp> +class const_mem_fun_ref_t : public unary_function<_Tp,_Ret> { +public: + explicit const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const) : _M_f(__pf) {} + _Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); } +private: + _Ret (_Tp::*_M_f)() const; +}; + +template <class _Ret, class _Tp, class _Arg> +class mem_fun1_t : public binary_function<_Tp*,_Arg,_Ret> { +public: + explicit mem_fun1_t(_Ret (_Tp::*__pf)(_Arg)) : _M_f(__pf) {} + _Ret operator()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); } +private: + _Ret (_Tp::*_M_f)(_Arg); +}; + +template <class _Ret, class _Tp, class _Arg> +class const_mem_fun1_t : public binary_function<const _Tp*,_Arg,_Ret> { +public: + explicit const_mem_fun1_t(_Ret (_Tp::*__pf)(_Arg) const) : _M_f(__pf) {} + _Ret operator()(const _Tp* __p, _Arg __x) const + { return (__p->*_M_f)(__x); } +private: + _Ret (_Tp::*_M_f)(_Arg) const; +}; + +template <class _Ret, class _Tp, class _Arg> +class mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> { +public: + explicit mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg)) : _M_f(__pf) {} + _Ret operator()(_Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); } +private: + _Ret (_Tp::*_M_f)(_Arg); +}; + +template <class _Ret, class _Tp, class _Arg> +class const_mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> { +public: + explicit const_mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg) const) : _M_f(__pf) {} + _Ret operator()(const _Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); } +private: + _Ret (_Tp::*_M_f)(_Arg) const; +}; + +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + +template <class _Tp> +class mem_fun_t<void, _Tp> : public unary_function<_Tp*,void> { +public: + explicit mem_fun_t(void (_Tp::*__pf)()) : _M_f(__pf) {} + void operator()(_Tp* __p) const { (__p->*_M_f)(); } +private: + void (_Tp::*_M_f)(); +}; + +template <class _Tp> +class const_mem_fun_t<void, _Tp> : public unary_function<const _Tp*,void> { +public: + explicit const_mem_fun_t(void (_Tp::*__pf)() const) : _M_f(__pf) {} + void operator()(const _Tp* __p) const { (__p->*_M_f)(); } +private: + void (_Tp::*_M_f)() const; +}; + +template <class _Tp> +class mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> { +public: + explicit mem_fun_ref_t(void (_Tp::*__pf)()) : _M_f(__pf) {} + void operator()(_Tp& __r) const { (__r.*_M_f)(); } +private: + void (_Tp::*_M_f)(); +}; + +template <class _Tp> +class const_mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> { +public: + explicit const_mem_fun_ref_t(void (_Tp::*__pf)() const) : _M_f(__pf) {} + void operator()(const _Tp& __r) const { (__r.*_M_f)(); } +private: + void (_Tp::*_M_f)() const; +}; + +template <class _Tp, class _Arg> +class mem_fun1_t<void, _Tp, _Arg> : public binary_function<_Tp*,_Arg,void> { +public: + explicit mem_fun1_t(void (_Tp::*__pf)(_Arg)) : _M_f(__pf) {} + void operator()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); } +private: + void (_Tp::*_M_f)(_Arg); +}; + +template <class _Tp, class _Arg> +class const_mem_fun1_t<void, _Tp, _Arg> + : public binary_function<const _Tp*,_Arg,void> { +public: + explicit const_mem_fun1_t(void (_Tp::*__pf)(_Arg) const) : _M_f(__pf) {} + void operator()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); } +private: + void (_Tp::*_M_f)(_Arg) const; +}; + +template <class _Tp, class _Arg> +class mem_fun1_ref_t<void, _Tp, _Arg> + : public binary_function<_Tp,_Arg,void> { +public: + explicit mem_fun1_ref_t(void (_Tp::*__pf)(_Arg)) : _M_f(__pf) {} + void operator()(_Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); } +private: + void (_Tp::*_M_f)(_Arg); +}; + +template <class _Tp, class _Arg> +class const_mem_fun1_ref_t<void, _Tp, _Arg> + : public binary_function<_Tp,_Arg,void> { +public: + explicit const_mem_fun1_ref_t(void (_Tp::*__pf)(_Arg) const) : _M_f(__pf) {} + void operator()(const _Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); } +private: + void (_Tp::*_M_f)(_Arg) const; +}; + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +// Mem_fun adaptor helper functions. There are only two: +// mem_fun and mem_fun_ref. (mem_fun1 and mem_fun1_ref +// are provided for backward compatibility, but they are no longer +// part of the C++ standard.) + +template <class _Ret, class _Tp> +inline mem_fun_t<_Ret,_Tp> mem_fun(_Ret (_Tp::*__f)()) + { return mem_fun_t<_Ret,_Tp>(__f); } + +template <class _Ret, class _Tp> +inline const_mem_fun_t<_Ret,_Tp> mem_fun(_Ret (_Tp::*__f)() const) + { return const_mem_fun_t<_Ret,_Tp>(__f); } + +template <class _Ret, class _Tp> +inline mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)()) + { return mem_fun_ref_t<_Ret,_Tp>(__f); } + +template <class _Ret, class _Tp> +inline const_mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)() const) + { return const_mem_fun_ref_t<_Ret,_Tp>(__f); } + +template <class _Ret, class _Tp, class _Arg> +inline mem_fun1_t<_Ret,_Tp,_Arg> mem_fun(_Ret (_Tp::*__f)(_Arg)) + { return mem_fun1_t<_Ret,_Tp,_Arg>(__f); } + +template <class _Ret, class _Tp, class _Arg> +inline const_mem_fun1_t<_Ret,_Tp,_Arg> mem_fun(_Ret (_Tp::*__f)(_Arg) const) + { return const_mem_fun1_t<_Ret,_Tp,_Arg>(__f); } + +template <class _Ret, class _Tp, class _Arg> +inline mem_fun1_ref_t<_Ret,_Tp,_Arg> mem_fun_ref(_Ret (_Tp::*__f)(_Arg)) + { return mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); } + +template <class _Ret, class _Tp, class _Arg> +inline const_mem_fun1_ref_t<_Ret,_Tp,_Arg> +mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const) + { return const_mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); } + +template <class _Ret, class _Tp, class _Arg> +inline mem_fun1_t<_Ret,_Tp,_Arg> mem_fun1(_Ret (_Tp::*__f)(_Arg)) + { return mem_fun1_t<_Ret,_Tp,_Arg>(__f); } + +template <class _Ret, class _Tp, class _Arg> +inline const_mem_fun1_t<_Ret,_Tp,_Arg> mem_fun1(_Ret (_Tp::*__f)(_Arg) const) + { return const_mem_fun1_t<_Ret,_Tp,_Arg>(__f); } + +template <class _Ret, class _Tp, class _Arg> +inline mem_fun1_ref_t<_Ret,_Tp,_Arg> mem_fun1_ref(_Ret (_Tp::*__f)(_Arg)) + { return mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); } + +template <class _Ret, class _Tp, class _Arg> +inline const_mem_fun1_ref_t<_Ret,_Tp,_Arg> +mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const) + { return const_mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); } + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_FUNCTION_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_hash_fun.h b/dtm_release/local/include/stl/stl_hash_fun.h new file mode 100644 index 0000000000000000000000000000000000000000..44ab9bb567937a6cfe2b2193bc0b9ae25956db38 --- /dev/null +++ b/dtm_release/local/include/stl/stl_hash_fun.h @@ -0,0 +1,93 @@ +/* + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_HASH_FUN_H +#define __SGI_STL_HASH_FUN_H + +#include <stddef.h> + +__STL_BEGIN_NAMESPACE + +template <class _Key> struct hash { }; + +inline size_t __stl_hash_string(const char* __s) +{ + unsigned long __h = 0; + for ( ; *__s; ++__s) + __h = 5*__h + *__s; + + return size_t(__h); +} + +__STL_TEMPLATE_NULL struct hash<char*> +{ + size_t operator()(const char* __s) const { return __stl_hash_string(__s); } +}; + +__STL_TEMPLATE_NULL struct hash<const char*> +{ + size_t operator()(const char* __s) const { return __stl_hash_string(__s); } +}; + +__STL_TEMPLATE_NULL struct hash<char> { + size_t operator()(char __x) const { return __x; } +}; +__STL_TEMPLATE_NULL struct hash<unsigned char> { + size_t operator()(unsigned char __x) const { return __x; } +}; +__STL_TEMPLATE_NULL struct hash<signed char> { + size_t operator()(unsigned char __x) const { return __x; } +}; +__STL_TEMPLATE_NULL struct hash<short> { + size_t operator()(short __x) const { return __x; } +}; +__STL_TEMPLATE_NULL struct hash<unsigned short> { + size_t operator()(unsigned short __x) const { return __x; } +}; +__STL_TEMPLATE_NULL struct hash<int> { + size_t operator()(int __x) const { return __x; } +}; +__STL_TEMPLATE_NULL struct hash<unsigned int> { + size_t operator()(unsigned int __x) const { return __x; } +}; +__STL_TEMPLATE_NULL struct hash<long> { + size_t operator()(long __x) const { return __x; } +}; +__STL_TEMPLATE_NULL struct hash<unsigned long> { + size_t operator()(unsigned long __x) const { return __x; } +}; + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_HASH_FUN_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_hash_map.h b/dtm_release/local/include/stl/stl_hash_map.h new file mode 100644 index 0000000000000000000000000000000000000000..0d5bc8af4d21751da1fc484be30ef552d8a387ec --- /dev/null +++ b/dtm_release/local/include/stl/stl_hash_map.h @@ -0,0 +1,532 @@ +/* + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_HASH_MAP_H +#define __SGI_STL_INTERNAL_HASH_MAP_H + +#include <concept_checks.h> + +__STL_BEGIN_NAMESPACE + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1174 +#pragma set woff 1375 +#endif + +// Forward declaration of equality operator; needed for friend declaration. + +template <class _Key, class _Tp, + class _HashFcn __STL_DEPENDENT_DEFAULT_TMPL(hash<_Key>), + class _EqualKey __STL_DEPENDENT_DEFAULT_TMPL(equal_to<_Key>), + class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) > +class hash_map; + +template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc> +inline bool operator==(const hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>&, + const hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>&); + +template <class _Key, class _Tp, class _HashFcn, class _EqualKey, + class _Alloc> +class hash_map +{ + // requirements: + + __STL_CLASS_REQUIRES(_Key, _Assignable); + __STL_CLASS_REQUIRES(_Tp, _Assignable); + __STL_CLASS_UNARY_FUNCTION_CHECK(_HashFcn, size_t, _Key); + __STL_CLASS_BINARY_FUNCTION_CHECK(_EqualKey, bool, _Key, _Key); + +private: + typedef hashtable<pair<const _Key,_Tp>,_Key,_HashFcn, + _Select1st<pair<const _Key,_Tp> >,_EqualKey,_Alloc> _Ht; + _Ht _M_ht; + +public: + typedef typename _Ht::key_type key_type; + typedef _Tp data_type; + typedef _Tp mapped_type; + typedef typename _Ht::value_type value_type; + typedef typename _Ht::hasher hasher; + typedef typename _Ht::key_equal key_equal; + + typedef typename _Ht::size_type size_type; + typedef typename _Ht::difference_type difference_type; + typedef typename _Ht::pointer pointer; + typedef typename _Ht::const_pointer const_pointer; + typedef typename _Ht::reference reference; + typedef typename _Ht::const_reference const_reference; + + typedef typename _Ht::iterator iterator; + typedef typename _Ht::const_iterator const_iterator; + + typedef typename _Ht::allocator_type allocator_type; + + hasher hash_funct() const { return _M_ht.hash_funct(); } + key_equal key_eq() const { return _M_ht.key_eq(); } + allocator_type get_allocator() const { return _M_ht.get_allocator(); } + +public: + hash_map() : _M_ht(100, hasher(), key_equal(), allocator_type()) {} + explicit hash_map(size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} + hash_map(size_type __n, const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) {} + hash_map(size_type __n, const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) {} + +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + hash_map(_InputIterator __f, _InputIterator __l) + : _M_ht(100, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + template <class _InputIterator> + hash_map(_InputIterator __f, _InputIterator __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + template <class _InputIterator> + hash_map(_InputIterator __f, _InputIterator __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + template <class _InputIterator> + hash_map(_InputIterator __f, _InputIterator __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_unique(__f, __l); } + +#else + hash_map(const value_type* __f, const value_type* __l) + : _M_ht(100, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_map(const value_type* __f, const value_type* __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_map(const value_type* __f, const value_type* __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_map(const value_type* __f, const value_type* __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_unique(__f, __l); } + + hash_map(const_iterator __f, const_iterator __l) + : _M_ht(100, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_map(const_iterator __f, const_iterator __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_map(const_iterator __f, const_iterator __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_map(const_iterator __f, const_iterator __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_unique(__f, __l); } +#endif /*__STL_MEMBER_TEMPLATES */ + +public: + size_type size() const { return _M_ht.size(); } + size_type max_size() const { return _M_ht.max_size(); } + bool empty() const { return _M_ht.empty(); } + void swap(hash_map& __hs) { _M_ht.swap(__hs._M_ht); } + +#ifdef __STL_MEMBER_TEMPLATES + template <class _K1, class _T1, class _HF, class _EqK, class _Al> + friend bool operator== (const hash_map<_K1, _T1, _HF, _EqK, _Al>&, + const hash_map<_K1, _T1, _HF, _EqK, _Al>&); +#else /* __STL_MEMBER_TEMPLATES */ + friend bool __STD_QUALIFIER + operator== __STL_NULL_TMPL_ARGS (const hash_map&, const hash_map&); +#endif /* __STL_MEMBER_TEMPLATES */ + + + iterator begin() { return _M_ht.begin(); } + iterator end() { return _M_ht.end(); } + const_iterator begin() const { return _M_ht.begin(); } + const_iterator end() const { return _M_ht.end(); } + +public: + pair<iterator,bool> insert(const value_type& __obj) + { return _M_ht.insert_unique(__obj); } +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + void insert(_InputIterator __f, _InputIterator __l) + { _M_ht.insert_unique(__f,__l); } +#else + void insert(const value_type* __f, const value_type* __l) { + _M_ht.insert_unique(__f,__l); + } + void insert(const_iterator __f, const_iterator __l) + { _M_ht.insert_unique(__f, __l); } +#endif /*__STL_MEMBER_TEMPLATES */ + pair<iterator,bool> insert_noresize(const value_type& __obj) + { return _M_ht.insert_unique_noresize(__obj); } + + iterator find(const key_type& __key) { return _M_ht.find(__key); } + const_iterator find(const key_type& __key) const + { return _M_ht.find(__key); } + + _Tp& operator[](const key_type& __key) { + return _M_ht.find_or_insert(value_type(__key, _Tp())).second; + } + + size_type count(const key_type& __key) const { return _M_ht.count(__key); } + + pair<iterator, iterator> equal_range(const key_type& __key) + { return _M_ht.equal_range(__key); } + pair<const_iterator, const_iterator> + equal_range(const key_type& __key) const + { return _M_ht.equal_range(__key); } + + size_type erase(const key_type& __key) {return _M_ht.erase(__key); } + void erase(iterator __it) { _M_ht.erase(__it); } + void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } + void clear() { _M_ht.clear(); } + + void resize(size_type __hint) { _M_ht.resize(__hint); } + size_type bucket_count() const { return _M_ht.bucket_count(); } + size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } + size_type elems_in_bucket(size_type __n) const + { return _M_ht.elems_in_bucket(__n); } +}; + +template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc> +inline bool +operator==(const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1, + const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2) +{ + return __hm1._M_ht == __hm2._M_ht; +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc> +inline bool +operator!=(const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1, + const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2) { + return !(__hm1 == __hm2); +} + +template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc> +inline void +swap(hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1, + hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2) +{ + __hm1.swap(__hm2); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +// Forward declaration of equality operator; needed for friend declaration. + +template <class _Key, class _Tp, + class _HashFcn __STL_DEPENDENT_DEFAULT_TMPL(hash<_Key>), + class _EqualKey __STL_DEPENDENT_DEFAULT_TMPL(equal_to<_Key>), + class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) > +class hash_multimap; + +template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc> +inline bool +operator==(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1, + const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm2); + +template <class _Key, class _Tp, class _HashFcn, class _EqualKey, + class _Alloc> +class hash_multimap +{ + // requirements: + + __STL_CLASS_REQUIRES(_Key, _Assignable); + __STL_CLASS_REQUIRES(_Tp, _Assignable); + __STL_CLASS_UNARY_FUNCTION_CHECK(_HashFcn, size_t, _Key); + __STL_CLASS_BINARY_FUNCTION_CHECK(_EqualKey, bool, _Key, _Key); + +private: + typedef hashtable<pair<const _Key, _Tp>, _Key, _HashFcn, + _Select1st<pair<const _Key, _Tp> >, _EqualKey, _Alloc> + _Ht; + _Ht _M_ht; + +public: + typedef typename _Ht::key_type key_type; + typedef _Tp data_type; + typedef _Tp mapped_type; + typedef typename _Ht::value_type value_type; + typedef typename _Ht::hasher hasher; + typedef typename _Ht::key_equal key_equal; + + typedef typename _Ht::size_type size_type; + typedef typename _Ht::difference_type difference_type; + typedef typename _Ht::pointer pointer; + typedef typename _Ht::const_pointer const_pointer; + typedef typename _Ht::reference reference; + typedef typename _Ht::const_reference const_reference; + + typedef typename _Ht::iterator iterator; + typedef typename _Ht::const_iterator const_iterator; + + typedef typename _Ht::allocator_type allocator_type; + + hasher hash_funct() const { return _M_ht.hash_funct(); } + key_equal key_eq() const { return _M_ht.key_eq(); } + allocator_type get_allocator() const { return _M_ht.get_allocator(); } + +public: + hash_multimap() : _M_ht(100, hasher(), key_equal(), allocator_type()) {} + explicit hash_multimap(size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} + hash_multimap(size_type __n, const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) {} + hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) {} + +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + hash_multimap(_InputIterator __f, _InputIterator __l) + : _M_ht(100, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + template <class _InputIterator> + hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + template <class _InputIterator> + hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + template <class _InputIterator> + hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_equal(__f, __l); } + +#else + hash_multimap(const value_type* __f, const value_type* __l) + : _M_ht(100, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multimap(const value_type* __f, const value_type* __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multimap(const value_type* __f, const value_type* __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multimap(const value_type* __f, const value_type* __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_equal(__f, __l); } + + hash_multimap(const_iterator __f, const_iterator __l) + : _M_ht(100, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multimap(const_iterator __f, const_iterator __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multimap(const_iterator __f, const_iterator __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multimap(const_iterator __f, const_iterator __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_equal(__f, __l); } +#endif /*__STL_MEMBER_TEMPLATES */ + +public: + size_type size() const { return _M_ht.size(); } + size_type max_size() const { return _M_ht.max_size(); } + bool empty() const { return _M_ht.empty(); } + void swap(hash_multimap& __hs) { _M_ht.swap(__hs._M_ht); } + +#ifdef __STL_MEMBER_TEMPLATES + template <class _K1, class _T1, class _HF, class _EqK, class _Al> + friend bool operator== (const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&, + const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&); +#else /* __STL_MEMBER_TEMPLATES */ + friend bool __STD_QUALIFIER + operator== __STL_NULL_TMPL_ARGS (const hash_multimap&,const hash_multimap&); +#endif /* __STL_MEMBER_TEMPLATES */ + + iterator begin() { return _M_ht.begin(); } + iterator end() { return _M_ht.end(); } + const_iterator begin() const { return _M_ht.begin(); } + const_iterator end() const { return _M_ht.end(); } + +public: + iterator insert(const value_type& __obj) + { return _M_ht.insert_equal(__obj); } +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + void insert(_InputIterator __f, _InputIterator __l) + { _M_ht.insert_equal(__f,__l); } +#else + void insert(const value_type* __f, const value_type* __l) { + _M_ht.insert_equal(__f,__l); + } + void insert(const_iterator __f, const_iterator __l) + { _M_ht.insert_equal(__f, __l); } +#endif /*__STL_MEMBER_TEMPLATES */ + iterator insert_noresize(const value_type& __obj) + { return _M_ht.insert_equal_noresize(__obj); } + + iterator find(const key_type& __key) { return _M_ht.find(__key); } + const_iterator find(const key_type& __key) const + { return _M_ht.find(__key); } + + size_type count(const key_type& __key) const { return _M_ht.count(__key); } + + pair<iterator, iterator> equal_range(const key_type& __key) + { return _M_ht.equal_range(__key); } + pair<const_iterator, const_iterator> + equal_range(const key_type& __key) const + { return _M_ht.equal_range(__key); } + + size_type erase(const key_type& __key) {return _M_ht.erase(__key); } + void erase(iterator __it) { _M_ht.erase(__it); } + void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } + void clear() { _M_ht.clear(); } + +public: + void resize(size_type __hint) { _M_ht.resize(__hint); } + size_type bucket_count() const { return _M_ht.bucket_count(); } + size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } + size_type elems_in_bucket(size_type __n) const + { return _M_ht.elems_in_bucket(__n); } +}; + +template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc> +inline bool +operator==(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1, + const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm2) +{ + return __hm1._M_ht == __hm2._M_ht; +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc> +inline bool +operator!=(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1, + const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm2) { + return !(__hm1 == __hm2); +} + +template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc> +inline void +swap(hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1, + hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2) +{ + __hm1.swap(__hm2); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +// Specialization of insert_iterator so that it will work for hash_map +// and hash_multimap. + +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + +template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc> +class insert_iterator<hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > { +protected: + typedef hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container; + _Container* container; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + insert_iterator(_Container& __x) : container(&__x) {} + insert_iterator(_Container& __x, typename _Container::iterator) + : container(&__x) {} + insert_iterator<_Container>& + operator=(const typename _Container::value_type& __value) { + container->insert(__value); + return *this; + } + insert_iterator<_Container>& operator*() { return *this; } + insert_iterator<_Container>& operator++() { return *this; } + insert_iterator<_Container>& operator++(int) { return *this; } +}; + +template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc> +class insert_iterator<hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > { +protected: + typedef hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container; + _Container* container; + typename _Container::iterator iter; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + insert_iterator(_Container& __x) : container(&__x) {} + insert_iterator(_Container& __x, typename _Container::iterator) + : container(&__x) {} + insert_iterator<_Container>& + operator=(const typename _Container::value_type& __value) { + container->insert(__value); + return *this; + } + insert_iterator<_Container>& operator*() { return *this; } + insert_iterator<_Container>& operator++() { return *this; } + insert_iterator<_Container>& operator++(int) { return *this; } +}; + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1174 +#pragma reset woff 1375 +#endif + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_HASH_MAP_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_hash_set.h b/dtm_release/local/include/stl/stl_hash_set.h new file mode 100644 index 0000000000000000000000000000000000000000..a4b845b877d3dbed85b20f2d312b832eaaf45542 --- /dev/null +++ b/dtm_release/local/include/stl/stl_hash_set.h @@ -0,0 +1,514 @@ +/* + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_HASH_SET_H +#define __SGI_STL_INTERNAL_HASH_SET_H + +#include <concept_checks.h> + +__STL_BEGIN_NAMESPACE + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1174 +#pragma set woff 1375 +#endif + +// Forward declaration of equality operator; needed for friend declaration. + +template <class _Value, + class _HashFcn __STL_DEPENDENT_DEFAULT_TMPL(hash<_Value>), + class _EqualKey __STL_DEPENDENT_DEFAULT_TMPL(equal_to<_Value>), + class _Alloc = __STL_DEFAULT_ALLOCATOR(_Value) > +class hash_set; + +template <class _Value, class _HashFcn, class _EqualKey, class _Alloc> +inline bool +operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1, + const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2); + +template <class _Value, class _HashFcn, class _EqualKey, class _Alloc> +class hash_set +{ + // requirements: + + __STL_CLASS_REQUIRES(_Value, _Assignable); + __STL_CLASS_UNARY_FUNCTION_CHECK(_HashFcn, size_t, _Value); + __STL_CLASS_BINARY_FUNCTION_CHECK(_EqualKey, bool, _Value, _Value); + +private: + typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, + _EqualKey, _Alloc> _Ht; + _Ht _M_ht; + +public: + typedef typename _Ht::key_type key_type; + typedef typename _Ht::value_type value_type; + typedef typename _Ht::hasher hasher; + typedef typename _Ht::key_equal key_equal; + + typedef typename _Ht::size_type size_type; + typedef typename _Ht::difference_type difference_type; + typedef typename _Ht::const_pointer pointer; + typedef typename _Ht::const_pointer const_pointer; + typedef typename _Ht::const_reference reference; + typedef typename _Ht::const_reference const_reference; + + typedef typename _Ht::const_iterator iterator; + typedef typename _Ht::const_iterator const_iterator; + + typedef typename _Ht::allocator_type allocator_type; + + hasher hash_funct() const { return _M_ht.hash_funct(); } + key_equal key_eq() const { return _M_ht.key_eq(); } + allocator_type get_allocator() const { return _M_ht.get_allocator(); } + +public: + hash_set() + : _M_ht(100, hasher(), key_equal(), allocator_type()) {} + explicit hash_set(size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} + hash_set(size_type __n, const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) {} + hash_set(size_type __n, const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) {} + +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + hash_set(_InputIterator __f, _InputIterator __l) + : _M_ht(100, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + template <class _InputIterator> + hash_set(_InputIterator __f, _InputIterator __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + template <class _InputIterator> + hash_set(_InputIterator __f, _InputIterator __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + template <class _InputIterator> + hash_set(_InputIterator __f, _InputIterator __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_unique(__f, __l); } +#else + + hash_set(const value_type* __f, const value_type* __l) + : _M_ht(100, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_set(const value_type* __f, const value_type* __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_set(const value_type* __f, const value_type* __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_set(const value_type* __f, const value_type* __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_unique(__f, __l); } + + hash_set(const_iterator __f, const_iterator __l) + : _M_ht(100, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_set(const_iterator __f, const_iterator __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_set(const_iterator __f, const_iterator __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_set(const_iterator __f, const_iterator __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_unique(__f, __l); } +#endif /*__STL_MEMBER_TEMPLATES */ + +public: + size_type size() const { return _M_ht.size(); } + size_type max_size() const { return _M_ht.max_size(); } + bool empty() const { return _M_ht.empty(); } + void swap(hash_set& __hs) { _M_ht.swap(__hs._M_ht); } + +#ifdef __STL_MEMBER_TEMPLATES + template <class _Val, class _HF, class _EqK, class _Al> + friend bool operator== (const hash_set<_Val, _HF, _EqK, _Al>&, + const hash_set<_Val, _HF, _EqK, _Al>&); +#else /* __STL_MEMBER_TEMPLATES */ + friend bool __STD_QUALIFIER + operator== __STL_NULL_TMPL_ARGS (const hash_set&, const hash_set&); +#endif /* __STL_MEMBER_TEMPLATES */ + + iterator begin() const { return _M_ht.begin(); } + iterator end() const { return _M_ht.end(); } + +public: + pair<iterator, bool> insert(const value_type& __obj) + { + pair<typename _Ht::iterator, bool> __p = _M_ht.insert_unique(__obj); + return pair<iterator,bool>(__p.first, __p.second); + } +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + void insert(_InputIterator __f, _InputIterator __l) + { _M_ht.insert_unique(__f,__l); } +#else + void insert(const value_type* __f, const value_type* __l) { + _M_ht.insert_unique(__f,__l); + } + void insert(const_iterator __f, const_iterator __l) + {_M_ht.insert_unique(__f, __l); } +#endif /*__STL_MEMBER_TEMPLATES */ + pair<iterator, bool> insert_noresize(const value_type& __obj) + { + pair<typename _Ht::iterator, bool> __p = + _M_ht.insert_unique_noresize(__obj); + return pair<iterator, bool>(__p.first, __p.second); + } + + iterator find(const key_type& __key) const { return _M_ht.find(__key); } + + size_type count(const key_type& __key) const { return _M_ht.count(__key); } + + pair<iterator, iterator> equal_range(const key_type& __key) const + { return _M_ht.equal_range(__key); } + + size_type erase(const key_type& __key) {return _M_ht.erase(__key); } + void erase(iterator __it) { _M_ht.erase(__it); } + void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } + void clear() { _M_ht.clear(); } + +public: + void resize(size_type __hint) { _M_ht.resize(__hint); } + size_type bucket_count() const { return _M_ht.bucket_count(); } + size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } + size_type elems_in_bucket(size_type __n) const + { return _M_ht.elems_in_bucket(__n); } +}; + +template <class _Value, class _HashFcn, class _EqualKey, class _Alloc> +inline bool +operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1, + const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2) +{ + return __hs1._M_ht == __hs2._M_ht; +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Value, class _HashFcn, class _EqualKey, class _Alloc> +inline bool +operator!=(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1, + const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2) { + return !(__hs1 == __hs2); +} + +template <class _Val, class _HashFcn, class _EqualKey, class _Alloc> +inline void +swap(hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1, + hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) +{ + __hs1.swap(__hs2); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + + +template <class _Value, + class _HashFcn __STL_DEPENDENT_DEFAULT_TMPL(hash<_Value>), + class _EqualKey __STL_DEPENDENT_DEFAULT_TMPL(equal_to<_Value>), + class _Alloc = __STL_DEFAULT_ALLOCATOR(_Value) > +class hash_multiset; + +template <class _Val, class _HashFcn, class _EqualKey, class _Alloc> +inline bool +operator==(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1, + const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2); + + +template <class _Value, class _HashFcn, class _EqualKey, class _Alloc> +class hash_multiset +{ + // requirements: + + __STL_CLASS_REQUIRES(_Value, _Assignable); + __STL_CLASS_UNARY_FUNCTION_CHECK(_HashFcn, size_t, _Value); + __STL_CLASS_BINARY_FUNCTION_CHECK(_EqualKey, bool, _Value, _Value); + +private: + typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, + _EqualKey, _Alloc> _Ht; + _Ht _M_ht; + +public: + typedef typename _Ht::key_type key_type; + typedef typename _Ht::value_type value_type; + typedef typename _Ht::hasher hasher; + typedef typename _Ht::key_equal key_equal; + + typedef typename _Ht::size_type size_type; + typedef typename _Ht::difference_type difference_type; + typedef typename _Ht::const_pointer pointer; + typedef typename _Ht::const_pointer const_pointer; + typedef typename _Ht::const_reference reference; + typedef typename _Ht::const_reference const_reference; + + typedef typename _Ht::const_iterator iterator; + typedef typename _Ht::const_iterator const_iterator; + + typedef typename _Ht::allocator_type allocator_type; + + hasher hash_funct() const { return _M_ht.hash_funct(); } + key_equal key_eq() const { return _M_ht.key_eq(); } + allocator_type get_allocator() const { return _M_ht.get_allocator(); } + +public: + hash_multiset() + : _M_ht(100, hasher(), key_equal(), allocator_type()) {} + explicit hash_multiset(size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} + hash_multiset(size_type __n, const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) {} + hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) {} + +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + hash_multiset(_InputIterator __f, _InputIterator __l) + : _M_ht(100, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + template <class _InputIterator> + hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + template <class _InputIterator> + hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + template <class _InputIterator> + hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_equal(__f, __l); } +#else + + hash_multiset(const value_type* __f, const value_type* __l) + : _M_ht(100, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multiset(const value_type* __f, const value_type* __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multiset(const value_type* __f, const value_type* __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multiset(const value_type* __f, const value_type* __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_equal(__f, __l); } + + hash_multiset(const_iterator __f, const_iterator __l) + : _M_ht(100, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multiset(const_iterator __f, const_iterator __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multiset(const_iterator __f, const_iterator __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multiset(const_iterator __f, const_iterator __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_equal(__f, __l); } +#endif /*__STL_MEMBER_TEMPLATES */ + +public: + size_type size() const { return _M_ht.size(); } + size_type max_size() const { return _M_ht.max_size(); } + bool empty() const { return _M_ht.empty(); } + void swap(hash_multiset& hs) { _M_ht.swap(hs._M_ht); } + +#ifdef __STL_MEMBER_TEMPLATES + template <class _Val, class _HF, class _EqK, class _Al> + friend bool operator== (const hash_multiset<_Val, _HF, _EqK, _Al>&, + const hash_multiset<_Val, _HF, _EqK, _Al>&); +#else /* __STL_MEMBER_TEMPLATES */ + friend bool __STD_QUALIFIER + operator== __STL_NULL_TMPL_ARGS (const hash_multiset&,const hash_multiset&); +#endif /* __STL_MEMBER_TEMPLATES */ + + iterator begin() const { return _M_ht.begin(); } + iterator end() const { return _M_ht.end(); } + +public: + iterator insert(const value_type& __obj) + { return _M_ht.insert_equal(__obj); } +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + void insert(_InputIterator __f, _InputIterator __l) + { _M_ht.insert_equal(__f,__l); } +#else + void insert(const value_type* __f, const value_type* __l) { + _M_ht.insert_equal(__f,__l); + } + void insert(const_iterator __f, const_iterator __l) + { _M_ht.insert_equal(__f, __l); } +#endif /*__STL_MEMBER_TEMPLATES */ + iterator insert_noresize(const value_type& __obj) + { return _M_ht.insert_equal_noresize(__obj); } + + iterator find(const key_type& __key) const { return _M_ht.find(__key); } + + size_type count(const key_type& __key) const { return _M_ht.count(__key); } + + pair<iterator, iterator> equal_range(const key_type& __key) const + { return _M_ht.equal_range(__key); } + + size_type erase(const key_type& __key) {return _M_ht.erase(__key); } + void erase(iterator __it) { _M_ht.erase(__it); } + void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } + void clear() { _M_ht.clear(); } + +public: + void resize(size_type __hint) { _M_ht.resize(__hint); } + size_type bucket_count() const { return _M_ht.bucket_count(); } + size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } + size_type elems_in_bucket(size_type __n) const + { return _M_ht.elems_in_bucket(__n); } +}; + +template <class _Val, class _HashFcn, class _EqualKey, class _Alloc> +inline bool +operator==(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1, + const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) +{ + return __hs1._M_ht == __hs2._M_ht; +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Val, class _HashFcn, class _EqualKey, class _Alloc> +inline bool +operator!=(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1, + const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) { + return !(__hs1 == __hs2); +} + +template <class _Val, class _HashFcn, class _EqualKey, class _Alloc> +inline void +swap(hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1, + hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) { + __hs1.swap(__hs2); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +// Specialization of insert_iterator so that it will work for hash_set +// and hash_multiset. + +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + +template <class _Value, class _HashFcn, class _EqualKey, class _Alloc> +class insert_iterator<hash_set<_Value, _HashFcn, _EqualKey, _Alloc> > { +protected: + typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Container; + _Container* container; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + insert_iterator(_Container& __x) : container(&__x) {} + insert_iterator(_Container& __x, typename _Container::iterator) + : container(&__x) {} + insert_iterator<_Container>& + operator=(const typename _Container::value_type& __value) { + container->insert(__value); + return *this; + } + insert_iterator<_Container>& operator*() { return *this; } + insert_iterator<_Container>& operator++() { return *this; } + insert_iterator<_Container>& operator++(int) { return *this; } +}; + +template <class _Value, class _HashFcn, class _EqualKey, class _Alloc> +class insert_iterator<hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > { +protected: + typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Container; + _Container* container; + typename _Container::iterator iter; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + insert_iterator(_Container& __x) : container(&__x) {} + insert_iterator(_Container& __x, typename _Container::iterator) + : container(&__x) {} + insert_iterator<_Container>& + operator=(const typename _Container::value_type& __value) { + container->insert(__value); + return *this; + } + insert_iterator<_Container>& operator*() { return *this; } + insert_iterator<_Container>& operator++() { return *this; } + insert_iterator<_Container>& operator++(int) { return *this; } +}; + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1174 +#pragma reset woff 1375 +#endif + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_HASH_SET_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_hashtable.h b/dtm_release/local/include/stl/stl_hashtable.h new file mode 100644 index 0000000000000000000000000000000000000000..04a08235263a0a766f48d8d750ba915cbe59040f --- /dev/null +++ b/dtm_release/local/include/stl/stl_hashtable.h @@ -0,0 +1,1054 @@ +/* + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_HASHTABLE_H +#define __SGI_STL_INTERNAL_HASHTABLE_H + +// Hashtable class, used to implement the hashed associative containers +// hash_set, hash_map, hash_multiset, and hash_multimap. + +#include <stl_algobase.h> +#include <stl_alloc.h> +#include <stl_construct.h> +#include <stl_tempbuf.h> +#include <stl_algo.h> +#include <stl_uninitialized.h> +#include <stl_function.h> +#include <stl_vector.h> +#include <stl_hash_fun.h> + +__STL_BEGIN_NAMESPACE + +template <class _Val> +struct _Hashtable_node +{ + _Hashtable_node* _M_next; + _Val _M_val; +}; + +template <class _Val, class _Key, class _HashFcn, + class _ExtractKey, class _EqualKey, class _Alloc = alloc> +class hashtable; + +template <class _Val, class _Key, class _HashFcn, + class _ExtractKey, class _EqualKey, class _Alloc> +struct _Hashtable_iterator; + +template <class _Val, class _Key, class _HashFcn, + class _ExtractKey, class _EqualKey, class _Alloc> +struct _Hashtable_const_iterator; + +template <class _Val, class _Key, class _HashFcn, + class _ExtractKey, class _EqualKey, class _Alloc> +struct _Hashtable_iterator { + typedef hashtable<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc> + _Hashtable; + typedef _Hashtable_iterator<_Val, _Key, _HashFcn, + _ExtractKey, _EqualKey, _Alloc> + iterator; + typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, + _ExtractKey, _EqualKey, _Alloc> + const_iterator; + typedef _Hashtable_node<_Val> _Node; + + typedef forward_iterator_tag iterator_category; + typedef _Val value_type; + typedef ptrdiff_t difference_type; + typedef size_t size_type; + typedef _Val& reference; + typedef _Val* pointer; + + _Node* _M_cur; + _Hashtable* _M_ht; + + _Hashtable_iterator(_Node* __n, _Hashtable* __tab) + : _M_cur(__n), _M_ht(__tab) {} + _Hashtable_iterator() {} + reference operator*() const { return _M_cur->_M_val; } +#ifndef __SGI_STL_NO_ARROW_OPERATOR + pointer operator->() const { return &(operator*()); } +#endif /* __SGI_STL_NO_ARROW_OPERATOR */ + iterator& operator++(); + iterator operator++(int); + bool operator==(const iterator& __it) const + { return _M_cur == __it._M_cur; } + bool operator!=(const iterator& __it) const + { return _M_cur != __it._M_cur; } +}; + + +template <class _Val, class _Key, class _HashFcn, + class _ExtractKey, class _EqualKey, class _Alloc> +struct _Hashtable_const_iterator { + typedef hashtable<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc> + _Hashtable; + typedef _Hashtable_iterator<_Val,_Key,_HashFcn, + _ExtractKey,_EqualKey,_Alloc> + iterator; + typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, + _ExtractKey, _EqualKey, _Alloc> + const_iterator; + typedef _Hashtable_node<_Val> _Node; + + typedef forward_iterator_tag iterator_category; + typedef _Val value_type; + typedef ptrdiff_t difference_type; + typedef size_t size_type; + typedef const _Val& reference; + typedef const _Val* pointer; + + const _Node* _M_cur; + const _Hashtable* _M_ht; + + _Hashtable_const_iterator(const _Node* __n, const _Hashtable* __tab) + : _M_cur(__n), _M_ht(__tab) {} + _Hashtable_const_iterator() {} + _Hashtable_const_iterator(const iterator& __it) + : _M_cur(__it._M_cur), _M_ht(__it._M_ht) {} + reference operator*() const { return _M_cur->_M_val; } +#ifndef __SGI_STL_NO_ARROW_OPERATOR + pointer operator->() const { return &(operator*()); } +#endif /* __SGI_STL_NO_ARROW_OPERATOR */ + const_iterator& operator++(); + const_iterator operator++(int); + bool operator==(const const_iterator& __it) const + { return _M_cur == __it._M_cur; } + bool operator!=(const const_iterator& __it) const + { return _M_cur != __it._M_cur; } +}; + +// Note: assumes long is at least 32 bits. +enum { __stl_num_primes = 28 }; + +static const unsigned long __stl_prime_list[__stl_num_primes] = +{ + 53ul, 97ul, 193ul, 389ul, 769ul, + 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, + 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, + 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul, + 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul, + 1610612741ul, 3221225473ul, 4294967291ul +}; + +inline unsigned long __stl_next_prime(unsigned long __n) +{ + const unsigned long* __first = __stl_prime_list; + const unsigned long* __last = __stl_prime_list + (int)__stl_num_primes; + const unsigned long* pos = lower_bound(__first, __last, __n); + return pos == __last ? *(__last - 1) : *pos; +} + +// Forward declaration of operator==. + +template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> +class hashtable; + +template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> +bool operator==(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1, + const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht2); + + +// Hashtables handle allocators a bit differently than other containers +// do. If we're using standard-conforming allocators, then a hashtable +// unconditionally has a member variable to hold its allocator, even if +// it so happens that all instances of the allocator type are identical. +// This is because, for hashtables, this extra storage is negligible. +// Additionally, a base class wouldn't serve any other purposes; it +// wouldn't, for example, simplify the exception-handling code. + +template <class _Val, class _Key, class _HashFcn, + class _ExtractKey, class _EqualKey, class _Alloc> +class hashtable { +public: + typedef _Key key_type; + typedef _Val value_type; + typedef _HashFcn hasher; + typedef _EqualKey key_equal; + + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + + hasher hash_funct() const { return _M_hash; } + key_equal key_eq() const { return _M_equals; } + +private: + typedef _Hashtable_node<_Val> _Node; + +#ifdef __STL_USE_STD_ALLOCATORS +public: + typedef typename _Alloc_traits<_Val,_Alloc>::allocator_type allocator_type; + allocator_type get_allocator() const { return _M_node_allocator; } +private: + typename _Alloc_traits<_Node, _Alloc>::allocator_type _M_node_allocator; + _Node* _M_get_node() { return _M_node_allocator.allocate(1); } + void _M_put_node(_Node* __p) { _M_node_allocator.deallocate(__p, 1); } +# define __HASH_ALLOC_INIT(__a) _M_node_allocator(__a), +#else /* __STL_USE_STD_ALLOCATORS */ +public: + typedef _Alloc allocator_type; + allocator_type get_allocator() const { return allocator_type(); } +private: + typedef simple_alloc<_Node, _Alloc> _M_node_allocator_type; + _Node* _M_get_node() { return _M_node_allocator_type::allocate(1); } + void _M_put_node(_Node* __p) { _M_node_allocator_type::deallocate(__p, 1); } +# define __HASH_ALLOC_INIT(__a) +#endif /* __STL_USE_STD_ALLOCATORS */ + +private: + hasher _M_hash; + key_equal _M_equals; + _ExtractKey _M_get_key; + vector<_Node*,_Alloc> _M_buckets; + size_type _M_num_elements; + +public: + typedef _Hashtable_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc> + iterator; + typedef _Hashtable_const_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey, + _Alloc> + const_iterator; + + friend struct + _Hashtable_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>; + friend struct + _Hashtable_const_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>; + +public: + hashtable(size_type __n, + const _HashFcn& __hf, + const _EqualKey& __eql, + const _ExtractKey& __ext, + const allocator_type& __a = allocator_type()) + : __HASH_ALLOC_INIT(__a) + _M_hash(__hf), + _M_equals(__eql), + _M_get_key(__ext), + _M_buckets(__a), + _M_num_elements(0) + { + _M_initialize_buckets(__n); + } + + hashtable(size_type __n, + const _HashFcn& __hf, + const _EqualKey& __eql, + const allocator_type& __a = allocator_type()) + : __HASH_ALLOC_INIT(__a) + _M_hash(__hf), + _M_equals(__eql), + _M_get_key(_ExtractKey()), + _M_buckets(__a), + _M_num_elements(0) + { + _M_initialize_buckets(__n); + } + + hashtable(const hashtable& __ht) + : __HASH_ALLOC_INIT(__ht.get_allocator()) + _M_hash(__ht._M_hash), + _M_equals(__ht._M_equals), + _M_get_key(__ht._M_get_key), + _M_buckets(__ht.get_allocator()), + _M_num_elements(0) + { + _M_copy_from(__ht); + } + +#undef __HASH_ALLOC_INIT + + hashtable& operator= (const hashtable& __ht) + { + if (&__ht != this) { + clear(); + _M_hash = __ht._M_hash; + _M_equals = __ht._M_equals; + _M_get_key = __ht._M_get_key; + _M_copy_from(__ht); + } + return *this; + } + + ~hashtable() { clear(); } + + size_type size() const { return _M_num_elements; } + size_type max_size() const { return size_type(-1); } + bool empty() const { return size() == 0; } + + void swap(hashtable& __ht) + { + __STD::swap(_M_hash, __ht._M_hash); + __STD::swap(_M_equals, __ht._M_equals); + __STD::swap(_M_get_key, __ht._M_get_key); + _M_buckets.swap(__ht._M_buckets); + __STD::swap(_M_num_elements, __ht._M_num_elements); + } + + iterator begin() + { + for (size_type __n = 0; __n < _M_buckets.size(); ++__n) + if (_M_buckets[__n]) + return iterator(_M_buckets[__n], this); + return end(); + } + + iterator end() { return iterator(0, this); } + + const_iterator begin() const + { + for (size_type __n = 0; __n < _M_buckets.size(); ++__n) + if (_M_buckets[__n]) + return const_iterator(_M_buckets[__n], this); + return end(); + } + + const_iterator end() const { return const_iterator(0, this); } + +#ifdef __STL_MEMBER_TEMPLATES + template <class _Vl, class _Ky, class _HF, class _Ex, class _Eq, class _Al> + friend bool operator== (const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&, + const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&); +#else /* __STL_MEMBER_TEMPLATES */ + friend bool __STD_QUALIFIER + operator== __STL_NULL_TMPL_ARGS (const hashtable&, const hashtable&); +#endif /* __STL_MEMBER_TEMPLATES */ + +public: + + size_type bucket_count() const { return _M_buckets.size(); } + + size_type max_bucket_count() const + { return __stl_prime_list[(int)__stl_num_primes - 1]; } + + size_type elems_in_bucket(size_type __bucket) const + { + size_type __result = 0; + for (_Node* __cur = _M_buckets[__bucket]; __cur; __cur = __cur->_M_next) + __result += 1; + return __result; + } + + pair<iterator, bool> insert_unique(const value_type& __obj) + { + resize(_M_num_elements + 1); + return insert_unique_noresize(__obj); + } + + iterator insert_equal(const value_type& __obj) + { + resize(_M_num_elements + 1); + return insert_equal_noresize(__obj); + } + + pair<iterator, bool> insert_unique_noresize(const value_type& __obj); + iterator insert_equal_noresize(const value_type& __obj); + +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + void insert_unique(_InputIterator __f, _InputIterator __l) + { + insert_unique(__f, __l, __ITERATOR_CATEGORY(__f)); + } + + template <class _InputIterator> + void insert_equal(_InputIterator __f, _InputIterator __l) + { + insert_equal(__f, __l, __ITERATOR_CATEGORY(__f)); + } + + template <class _InputIterator> + void insert_unique(_InputIterator __f, _InputIterator __l, + input_iterator_tag) + { + for ( ; __f != __l; ++__f) + insert_unique(*__f); + } + + template <class _InputIterator> + void insert_equal(_InputIterator __f, _InputIterator __l, + input_iterator_tag) + { + for ( ; __f != __l; ++__f) + insert_equal(*__f); + } + + template <class _ForwardIterator> + void insert_unique(_ForwardIterator __f, _ForwardIterator __l, + forward_iterator_tag) + { + size_type __n = 0; + distance(__f, __l, __n); + resize(_M_num_elements + __n); + for ( ; __n > 0; --__n, ++__f) + insert_unique_noresize(*__f); + } + + template <class _ForwardIterator> + void insert_equal(_ForwardIterator __f, _ForwardIterator __l, + forward_iterator_tag) + { + size_type __n = 0; + distance(__f, __l, __n); + resize(_M_num_elements + __n); + for ( ; __n > 0; --__n, ++__f) + insert_equal_noresize(*__f); + } + +#else /* __STL_MEMBER_TEMPLATES */ + void insert_unique(const value_type* __f, const value_type* __l) + { + size_type __n = __l - __f; + resize(_M_num_elements + __n); + for ( ; __n > 0; --__n, ++__f) + insert_unique_noresize(*__f); + } + + void insert_equal(const value_type* __f, const value_type* __l) + { + size_type __n = __l - __f; + resize(_M_num_elements + __n); + for ( ; __n > 0; --__n, ++__f) + insert_equal_noresize(*__f); + } + + void insert_unique(const_iterator __f, const_iterator __l) + { + size_type __n = 0; + distance(__f, __l, __n); + resize(_M_num_elements + __n); + for ( ; __n > 0; --__n, ++__f) + insert_unique_noresize(*__f); + } + + void insert_equal(const_iterator __f, const_iterator __l) + { + size_type __n = 0; + distance(__f, __l, __n); + resize(_M_num_elements + __n); + for ( ; __n > 0; --__n, ++__f) + insert_equal_noresize(*__f); + } +#endif /*__STL_MEMBER_TEMPLATES */ + + reference find_or_insert(const value_type& __obj); + + iterator find(const key_type& __key) + { + size_type __n = _M_bkt_num_key(__key); + _Node* __first; + for ( __first = _M_buckets[__n]; + __first && !_M_equals(_M_get_key(__first->_M_val), __key); + __first = __first->_M_next) + {} + return iterator(__first, this); + } + + const_iterator find(const key_type& __key) const + { + size_type __n = _M_bkt_num_key(__key); + const _Node* __first; + for ( __first = _M_buckets[__n]; + __first && !_M_equals(_M_get_key(__first->_M_val), __key); + __first = __first->_M_next) + {} + return const_iterator(__first, this); + } + + size_type count(const key_type& __key) const + { + const size_type __n = _M_bkt_num_key(__key); + size_type __result = 0; + + for (const _Node* __cur = _M_buckets[__n]; __cur; __cur = __cur->_M_next) + if (_M_equals(_M_get_key(__cur->_M_val), __key)) + ++__result; + return __result; + } + + pair<iterator, iterator> + equal_range(const key_type& __key); + + pair<const_iterator, const_iterator> + equal_range(const key_type& __key) const; + + size_type erase(const key_type& __key); + void erase(const iterator& __it); + void erase(iterator __first, iterator __last); + + void erase(const const_iterator& __it); + void erase(const_iterator __first, const_iterator __last); + + void resize(size_type __num_elements_hint); + void clear(); + +private: + size_type _M_next_size(size_type __n) const + { return __stl_next_prime(__n); } + + void _M_initialize_buckets(size_type __n) + { + const size_type __n_buckets = _M_next_size(__n); + _M_buckets.reserve(__n_buckets); + _M_buckets.insert(_M_buckets.end(), __n_buckets, (_Node*) 0); + _M_num_elements = 0; + } + + size_type _M_bkt_num_key(const key_type& __key) const + { + return _M_bkt_num_key(__key, _M_buckets.size()); + } + + size_type _M_bkt_num(const value_type& __obj) const + { + return _M_bkt_num_key(_M_get_key(__obj)); + } + + size_type _M_bkt_num_key(const key_type& __key, size_t __n) const + { + return _M_hash(__key) % __n; + } + + size_type _M_bkt_num(const value_type& __obj, size_t __n) const + { + return _M_bkt_num_key(_M_get_key(__obj), __n); + } + + _Node* _M_new_node(const value_type& __obj) + { + _Node* __n = _M_get_node(); + __n->_M_next = 0; + __STL_TRY { + construct(&__n->_M_val, __obj); + return __n; + } + __STL_UNWIND(_M_put_node(__n)); + } + + void _M_delete_node(_Node* __n) + { + destroy(&__n->_M_val); + _M_put_node(__n); + } + + void _M_erase_bucket(const size_type __n, _Node* __first, _Node* __last); + void _M_erase_bucket(const size_type __n, _Node* __last); + + void _M_copy_from(const hashtable& __ht); + +}; + +template <class _Val, class _Key, class _HF, class _ExK, class _EqK, + class _All> +_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>& +_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++() +{ + const _Node* __old = _M_cur; + _M_cur = _M_cur->_M_next; + if (!_M_cur) { + size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val); + while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size()) + _M_cur = _M_ht->_M_buckets[__bucket]; + } + return *this; +} + +template <class _Val, class _Key, class _HF, class _ExK, class _EqK, + class _All> +inline _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All> +_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++(int) +{ + iterator __tmp = *this; + ++*this; + return __tmp; +} + +template <class _Val, class _Key, class _HF, class _ExK, class _EqK, + class _All> +_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>& +_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++() +{ + const _Node* __old = _M_cur; + _M_cur = _M_cur->_M_next; + if (!_M_cur) { + size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val); + while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size()) + _M_cur = _M_ht->_M_buckets[__bucket]; + } + return *this; +} + +template <class _Val, class _Key, class _HF, class _ExK, class _EqK, + class _All> +inline _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All> +_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++(int) +{ + const_iterator __tmp = *this; + ++*this; + return __tmp; +} + +#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION + +template <class _Val, class _Key, class _HF, class _ExK, class _EqK, + class _All> +inline forward_iterator_tag +iterator_category(const _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&) +{ + return forward_iterator_tag(); +} + +template <class _Val, class _Key, class _HF, class _ExK, class _EqK, + class _All> +inline _Val* +value_type(const _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&) +{ + return (_Val*) 0; +} + +template <class _Val, class _Key, class _HF, class _ExK, class _EqK, + class _All> +inline hashtable<_Val,_Key,_HF,_ExK,_EqK,_All>::difference_type* +distance_type(const _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&) +{ + return (hashtable<_Val,_Key,_HF,_ExK,_EqK,_All>::difference_type*) 0; +} + +template <class _Val, class _Key, class _HF, class _ExK, class _EqK, + class _All> +inline forward_iterator_tag +iterator_category(const _Hashtable_const_iterator<_Val,_Key,_HF, + _ExK,_EqK,_All>&) +{ + return forward_iterator_tag(); +} + +template <class _Val, class _Key, class _HF, class _ExK, class _EqK, + class _All> +inline _Val* +value_type(const _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&) +{ + return (_Val*) 0; +} + +template <class _Val, class _Key, class _HF, class _ExK, class _EqK, + class _All> +inline hashtable<_Val,_Key,_HF,_ExK,_EqK,_All>::difference_type* +distance_type(const _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&) +{ + return (hashtable<_Val,_Key,_HF,_ExK,_EqK,_All>::difference_type*) 0; +} + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> +bool operator==(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1, + const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht2) +{ + typedef typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::_Node _Node; + if (__ht1._M_buckets.size() != __ht2._M_buckets.size()) + return false; + for (int __n = 0; __n < __ht1._M_buckets.size(); ++__n) { + _Node* __cur1 = __ht1._M_buckets[__n]; + _Node* __cur2 = __ht2._M_buckets[__n]; + for ( ; __cur1 && __cur2 && __cur1->_M_val == __cur2->_M_val; + __cur1 = __cur1->_M_next, __cur2 = __cur2->_M_next) + {} + if (__cur1 || __cur2) + return false; + } + return true; +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> +inline bool operator!=(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1, + const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht2) { + return !(__ht1 == __ht2); +} + +template <class _Val, class _Key, class _HF, class _Extract, class _EqKey, + class _All> +inline void swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1, + hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht2) { + __ht1.swap(__ht2); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + + +template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> +pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator, bool> +hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> + ::insert_unique_noresize(const value_type& __obj) +{ + const size_type __n = _M_bkt_num(__obj); + _Node* __first = _M_buckets[__n]; + + for (_Node* __cur = __first; __cur; __cur = __cur->_M_next) + if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) + return pair<iterator, bool>(iterator(__cur, this), false); + + _Node* __tmp = _M_new_node(__obj); + __tmp->_M_next = __first; + _M_buckets[__n] = __tmp; + ++_M_num_elements; + return pair<iterator, bool>(iterator(__tmp, this), true); +} + +template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> +typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator +hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> + ::insert_equal_noresize(const value_type& __obj) +{ + const size_type __n = _M_bkt_num(__obj); + _Node* __first = _M_buckets[__n]; + + for (_Node* __cur = __first; __cur; __cur = __cur->_M_next) + if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) { + _Node* __tmp = _M_new_node(__obj); + __tmp->_M_next = __cur->_M_next; + __cur->_M_next = __tmp; + ++_M_num_elements; + return iterator(__tmp, this); + } + + _Node* __tmp = _M_new_node(__obj); + __tmp->_M_next = __first; + _M_buckets[__n] = __tmp; + ++_M_num_elements; + return iterator(__tmp, this); +} + +template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> +typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::reference +hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::find_or_insert(const value_type& __obj) +{ + resize(_M_num_elements + 1); + + size_type __n = _M_bkt_num(__obj); + _Node* __first = _M_buckets[__n]; + + for (_Node* __cur = __first; __cur; __cur = __cur->_M_next) + if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) + return __cur->_M_val; + + _Node* __tmp = _M_new_node(__obj); + __tmp->_M_next = __first; + _M_buckets[__n] = __tmp; + ++_M_num_elements; + return __tmp->_M_val; +} + +template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> +pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator, + typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator> +hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::equal_range(const key_type& __key) +{ + typedef pair<iterator, iterator> _Pii; + const size_type __n = _M_bkt_num_key(__key); + + for (_Node* __first = _M_buckets[__n]; __first; __first = __first->_M_next) + if (_M_equals(_M_get_key(__first->_M_val), __key)) { + for (_Node* __cur = __first->_M_next; __cur; __cur = __cur->_M_next) + if (!_M_equals(_M_get_key(__cur->_M_val), __key)) + return _Pii(iterator(__first, this), iterator(__cur, this)); + for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m) + if (_M_buckets[__m]) + return _Pii(iterator(__first, this), + iterator(_M_buckets[__m], this)); + return _Pii(iterator(__first, this), end()); + } + return _Pii(end(), end()); +} + +template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> +pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator, + typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator> +hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> + ::equal_range(const key_type& __key) const +{ + typedef pair<const_iterator, const_iterator> _Pii; + const size_type __n = _M_bkt_num_key(__key); + + for (const _Node* __first = _M_buckets[__n] ; + __first; + __first = __first->_M_next) { + if (_M_equals(_M_get_key(__first->_M_val), __key)) { + for (const _Node* __cur = __first->_M_next; + __cur; + __cur = __cur->_M_next) + if (!_M_equals(_M_get_key(__cur->_M_val), __key)) + return _Pii(const_iterator(__first, this), + const_iterator(__cur, this)); + for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m) + if (_M_buckets[__m]) + return _Pii(const_iterator(__first, this), + const_iterator(_M_buckets[__m], this)); + return _Pii(const_iterator(__first, this), end()); + } + } + return _Pii(end(), end()); +} + +template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> +typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::size_type +hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const key_type& __key) +{ + const size_type __n = _M_bkt_num_key(__key); + _Node* __first = _M_buckets[__n]; + size_type __erased = 0; + + if (__first) { + _Node* __cur = __first; + _Node* __next = __cur->_M_next; + while (__next) { + if (_M_equals(_M_get_key(__next->_M_val), __key)) { + __cur->_M_next = __next->_M_next; + _M_delete_node(__next); + __next = __cur->_M_next; + ++__erased; + --_M_num_elements; + } + else { + __cur = __next; + __next = __cur->_M_next; + } + } + if (_M_equals(_M_get_key(__first->_M_val), __key)) { + _M_buckets[__n] = __first->_M_next; + _M_delete_node(__first); + ++__erased; + --_M_num_elements; + } + } + return __erased; +} + +template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> +void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const iterator& __it) +{ + _Node* __p = __it._M_cur; + if (__p) { + const size_type __n = _M_bkt_num(__p->_M_val); + _Node* __cur = _M_buckets[__n]; + + if (__cur == __p) { + _M_buckets[__n] = __cur->_M_next; + _M_delete_node(__cur); + --_M_num_elements; + } + else { + _Node* __next = __cur->_M_next; + while (__next) { + if (__next == __p) { + __cur->_M_next = __next->_M_next; + _M_delete_node(__next); + --_M_num_elements; + break; + } + else { + __cur = __next; + __next = __cur->_M_next; + } + } + } + } +} + +template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> +void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> + ::erase(iterator __first, iterator __last) +{ + size_type __f_bucket = __first._M_cur ? + _M_bkt_num(__first._M_cur->_M_val) : _M_buckets.size(); + size_type __l_bucket = __last._M_cur ? + _M_bkt_num(__last._M_cur->_M_val) : _M_buckets.size(); + + if (__first._M_cur == __last._M_cur) + return; + else if (__f_bucket == __l_bucket) + _M_erase_bucket(__f_bucket, __first._M_cur, __last._M_cur); + else { + _M_erase_bucket(__f_bucket, __first._M_cur, 0); + for (size_type __n = __f_bucket + 1; __n < __l_bucket; ++__n) + _M_erase_bucket(__n, 0); + if (__l_bucket != _M_buckets.size()) + _M_erase_bucket(__l_bucket, __last._M_cur); + } +} + +template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> +inline void +hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const_iterator __first, + const_iterator __last) +{ + erase(iterator(const_cast<_Node*>(__first._M_cur), + const_cast<hashtable*>(__first._M_ht)), + iterator(const_cast<_Node*>(__last._M_cur), + const_cast<hashtable*>(__last._M_ht))); +} + +template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> +inline void +hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const const_iterator& __it) +{ + erase(iterator(const_cast<_Node*>(__it._M_cur), + const_cast<hashtable*>(__it._M_ht))); +} + +template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> +void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> + ::resize(size_type __num_elements_hint) +{ + const size_type __old_n = _M_buckets.size(); + if (__num_elements_hint > __old_n) { + const size_type __n = _M_next_size(__num_elements_hint); + if (__n > __old_n) { + vector<_Node*, _All> __tmp(__n, (_Node*)(0), + _M_buckets.get_allocator()); + __STL_TRY { + for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) { + _Node* __first = _M_buckets[__bucket]; + while (__first) { + size_type __new_bucket = _M_bkt_num(__first->_M_val, __n); + _M_buckets[__bucket] = __first->_M_next; + __first->_M_next = __tmp[__new_bucket]; + __tmp[__new_bucket] = __first; + __first = _M_buckets[__bucket]; + } + } + _M_buckets.swap(__tmp); + } +# ifdef __STL_USE_EXCEPTIONS + catch(...) { + for (size_type __bucket = 0; __bucket < __tmp.size(); ++__bucket) { + while (__tmp[__bucket]) { + _Node* __next = __tmp[__bucket]->_M_next; + _M_delete_node(__tmp[__bucket]); + __tmp[__bucket] = __next; + } + } + throw; + } +# endif /* __STL_USE_EXCEPTIONS */ + } + } +} + +template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> +void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> + ::_M_erase_bucket(const size_type __n, _Node* __first, _Node* __last) +{ + _Node* __cur = _M_buckets[__n]; + if (__cur == __first) + _M_erase_bucket(__n, __last); + else { + _Node* __next; + for (__next = __cur->_M_next; + __next != __first; + __cur = __next, __next = __cur->_M_next) + ; + while (__next != __last) { + __cur->_M_next = __next->_M_next; + _M_delete_node(__next); + __next = __cur->_M_next; + --_M_num_elements; + } + } +} + +template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> +void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> + ::_M_erase_bucket(const size_type __n, _Node* __last) +{ + _Node* __cur = _M_buckets[__n]; + while (__cur != __last) { + _Node* __next = __cur->_M_next; + _M_delete_node(__cur); + __cur = __next; + _M_buckets[__n] = __cur; + --_M_num_elements; + } +} + +template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> +void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::clear() +{ + for (size_type __i = 0; __i < _M_buckets.size(); ++__i) { + _Node* __cur = _M_buckets[__i]; + while (__cur != 0) { + _Node* __next = __cur->_M_next; + _M_delete_node(__cur); + __cur = __next; + } + _M_buckets[__i] = 0; + } + _M_num_elements = 0; +} + + +template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> +void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> + ::_M_copy_from(const hashtable& __ht) +{ + _M_buckets.clear(); + _M_buckets.reserve(__ht._M_buckets.size()); + _M_buckets.insert(_M_buckets.end(), __ht._M_buckets.size(), (_Node*) 0); + __STL_TRY { + for (size_type __i = 0; __i < __ht._M_buckets.size(); ++__i) { + const _Node* __cur = __ht._M_buckets[__i]; + if (__cur) { + _Node* __copy = _M_new_node(__cur->_M_val); + _M_buckets[__i] = __copy; + + for (_Node* __next = __cur->_M_next; + __next; + __cur = __next, __next = __cur->_M_next) { + __copy->_M_next = _M_new_node(__next->_M_val); + __copy = __copy->_M_next; + } + } + } + _M_num_elements = __ht._M_num_elements; + } + __STL_UNWIND(clear()); +} + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_HASHTABLE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_heap.h b/dtm_release/local/include/stl/stl_heap.h new file mode 100644 index 0000000000000000000000000000000000000000..651d21aa29ccfee5bc3cdcfdbd4659ba5023b37f --- /dev/null +++ b/dtm_release/local/include/stl/stl_heap.h @@ -0,0 +1,297 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_HEAP_H +#define __SGI_STL_INTERNAL_HEAP_H + +__STL_BEGIN_NAMESPACE + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1209 +#endif + +// Heap-manipulation functions: push_heap, pop_heap, make_heap, sort_heap. + +template <class _RandomAccessIterator, class _Distance, class _Tp> +void +__push_heap(_RandomAccessIterator __first, + _Distance __holeIndex, _Distance __topIndex, _Tp __value) +{ + _Distance __parent = (__holeIndex - 1) / 2; + while (__holeIndex > __topIndex && *(__first + __parent) < __value) { + *(__first + __holeIndex) = *(__first + __parent); + __holeIndex = __parent; + __parent = (__holeIndex - 1) / 2; + } + *(__first + __holeIndex) = __value; +} + +template <class _RandomAccessIterator, class _Distance, class _Tp> +inline void +__push_heap_aux(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Distance*, _Tp*) +{ + __push_heap(__first, _Distance((__last - __first) - 1), _Distance(0), + _Tp(*(__last - 1))); +} + +template <class _RandomAccessIterator> +inline void +push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) +{ + __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); + __STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type, + _LessThanComparable); + __push_heap_aux(__first, __last, + __DISTANCE_TYPE(__first), __VALUE_TYPE(__first)); +} + +template <class _RandomAccessIterator, class _Distance, class _Tp, + class _Compare> +void +__push_heap(_RandomAccessIterator __first, _Distance __holeIndex, + _Distance __topIndex, _Tp __value, _Compare __comp) +{ + _Distance __parent = (__holeIndex - 1) / 2; + while (__holeIndex > __topIndex && __comp(*(__first + __parent), __value)) { + *(__first + __holeIndex) = *(__first + __parent); + __holeIndex = __parent; + __parent = (__holeIndex - 1) / 2; + } + *(__first + __holeIndex) = __value; +} + +template <class _RandomAccessIterator, class _Compare, + class _Distance, class _Tp> +inline void +__push_heap_aux(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Compare __comp, + _Distance*, _Tp*) +{ + __push_heap(__first, _Distance((__last - __first) - 1), _Distance(0), + _Tp(*(__last - 1)), __comp); +} + +template <class _RandomAccessIterator, class _Compare> +inline void +push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, + _Compare __comp) +{ + __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); + __push_heap_aux(__first, __last, __comp, + __DISTANCE_TYPE(__first), __VALUE_TYPE(__first)); +} + +template <class _RandomAccessIterator, class _Distance, class _Tp> +void +__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex, + _Distance __len, _Tp __value) +{ + _Distance __topIndex = __holeIndex; + _Distance __secondChild = 2 * __holeIndex + 2; + while (__secondChild < __len) { + if (*(__first + __secondChild) < *(__first + (__secondChild - 1))) + __secondChild--; + *(__first + __holeIndex) = *(__first + __secondChild); + __holeIndex = __secondChild; + __secondChild = 2 * (__secondChild + 1); + } + if (__secondChild == __len) { + *(__first + __holeIndex) = *(__first + (__secondChild - 1)); + __holeIndex = __secondChild - 1; + } + __push_heap(__first, __holeIndex, __topIndex, __value); +} + +template <class _RandomAccessIterator, class _Tp, class _Distance> +inline void +__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, + _RandomAccessIterator __result, _Tp __value, _Distance*) +{ + *__result = *__first; + __adjust_heap(__first, _Distance(0), _Distance(__last - __first), __value); +} + +template <class _RandomAccessIterator, class _Tp> +inline void +__pop_heap_aux(_RandomAccessIterator __first, _RandomAccessIterator __last, + _Tp*) +{ + __pop_heap(__first, __last - 1, __last - 1, + _Tp(*(__last - 1)), __DISTANCE_TYPE(__first)); +} + +template <class _RandomAccessIterator> +inline void pop_heap(_RandomAccessIterator __first, + _RandomAccessIterator __last) +{ + __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); + __STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type, + _LessThanComparable); + __pop_heap_aux(__first, __last, __VALUE_TYPE(__first)); +} + +template <class _RandomAccessIterator, class _Distance, + class _Tp, class _Compare> +void +__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex, + _Distance __len, _Tp __value, _Compare __comp) +{ + _Distance __topIndex = __holeIndex; + _Distance __secondChild = 2 * __holeIndex + 2; + while (__secondChild < __len) { + if (__comp(*(__first + __secondChild), *(__first + (__secondChild - 1)))) + __secondChild--; + *(__first + __holeIndex) = *(__first + __secondChild); + __holeIndex = __secondChild; + __secondChild = 2 * (__secondChild + 1); + } + if (__secondChild == __len) { + *(__first + __holeIndex) = *(__first + (__secondChild - 1)); + __holeIndex = __secondChild - 1; + } + __push_heap(__first, __holeIndex, __topIndex, __value, __comp); +} + +template <class _RandomAccessIterator, class _Tp, class _Compare, + class _Distance> +inline void +__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, + _RandomAccessIterator __result, _Tp __value, _Compare __comp, + _Distance*) +{ + *__result = *__first; + __adjust_heap(__first, _Distance(0), _Distance(__last - __first), + __value, __comp); +} + +template <class _RandomAccessIterator, class _Tp, class _Compare> +inline void +__pop_heap_aux(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Tp*, _Compare __comp) +{ + __pop_heap(__first, __last - 1, __last - 1, _Tp(*(__last - 1)), __comp, + __DISTANCE_TYPE(__first)); +} + +template <class _RandomAccessIterator, class _Compare> +inline void +pop_heap(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Compare __comp) +{ + __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); + __pop_heap_aux(__first, __last, __VALUE_TYPE(__first), __comp); +} + +template <class _RandomAccessIterator, class _Tp, class _Distance> +void +__make_heap(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Tp*, _Distance*) +{ + if (__last - __first < 2) return; + _Distance __len = __last - __first; + _Distance __parent = (__len - 2)/2; + + while (true) { + __adjust_heap(__first, __parent, __len, _Tp(*(__first + __parent))); + if (__parent == 0) return; + __parent--; + } +} + +template <class _RandomAccessIterator> +inline void +make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) +{ + __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); + __STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type, + _LessThanComparable); + __make_heap(__first, __last, + __VALUE_TYPE(__first), __DISTANCE_TYPE(__first)); +} + +template <class _RandomAccessIterator, class _Compare, + class _Tp, class _Distance> +void +__make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, + _Compare __comp, _Tp*, _Distance*) +{ + if (__last - __first < 2) return; + _Distance __len = __last - __first; + _Distance __parent = (__len - 2)/2; + + while (true) { + __adjust_heap(__first, __parent, __len, _Tp(*(__first + __parent)), + __comp); + if (__parent == 0) return; + __parent--; + } +} + +template <class _RandomAccessIterator, class _Compare> +inline void +make_heap(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Compare __comp) +{ + __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); + __make_heap(__first, __last, __comp, + __VALUE_TYPE(__first), __DISTANCE_TYPE(__first)); +} + +template <class _RandomAccessIterator> +void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) +{ + __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); + __STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type, + _LessThanComparable); + while (__last - __first > 1) + pop_heap(__first, __last--); +} + +template <class _RandomAccessIterator, class _Compare> +void +sort_heap(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Compare __comp) +{ + __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator); + while (__last - __first > 1) + pop_heap(__first, __last--, __comp); +} + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1209 +#endif + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_HEAP_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_iterator.h b/dtm_release/local/include/stl/stl_iterator.h new file mode 100644 index 0000000000000000000000000000000000000000..807871e84c6a92fc8c7969da6e6493c5a0e304b9 --- /dev/null +++ b/dtm_release/local/include/stl/stl_iterator.h @@ -0,0 +1,964 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_ITERATOR_H +#define __SGI_STL_INTERNAL_ITERATOR_H + +__STL_BEGIN_NAMESPACE + + +template <class _Container> +class back_insert_iterator { +protected: + _Container* container; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + explicit back_insert_iterator(_Container& __x) : container(&__x) {} + back_insert_iterator<_Container>& + operator=(const typename _Container::value_type& __value) { + container->push_back(__value); + return *this; + } + back_insert_iterator<_Container>& operator*() { return *this; } + back_insert_iterator<_Container>& operator++() { return *this; } + back_insert_iterator<_Container>& operator++(int) { return *this; } +}; + +#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION + +template <class _Container> +inline output_iterator_tag +iterator_category(const back_insert_iterator<_Container>&) +{ + return output_iterator_tag(); +} + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +template <class _Container> +inline back_insert_iterator<_Container> back_inserter(_Container& __x) { + return back_insert_iterator<_Container>(__x); +} + +template <class _Container> +class front_insert_iterator { +protected: + _Container* container; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + explicit front_insert_iterator(_Container& __x) : container(&__x) {} + front_insert_iterator<_Container>& + operator=(const typename _Container::value_type& __value) { + container->push_front(__value); + return *this; + } + front_insert_iterator<_Container>& operator*() { return *this; } + front_insert_iterator<_Container>& operator++() { return *this; } + front_insert_iterator<_Container>& operator++(int) { return *this; } +}; + +#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION + +template <class _Container> +inline output_iterator_tag +iterator_category(const front_insert_iterator<_Container>&) +{ + return output_iterator_tag(); +} + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +template <class _Container> +inline front_insert_iterator<_Container> front_inserter(_Container& __x) { + return front_insert_iterator<_Container>(__x); +} + +template <class _Container> +class insert_iterator { +protected: + _Container* container; + typename _Container::iterator iter; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + insert_iterator(_Container& __x, typename _Container::iterator __i) + : container(&__x), iter(__i) {} + insert_iterator<_Container>& + operator=(const typename _Container::value_type& __value) { + iter = container->insert(iter, __value); + ++iter; + return *this; + } + insert_iterator<_Container>& operator*() { return *this; } + insert_iterator<_Container>& operator++() { return *this; } + insert_iterator<_Container>& operator++(int) { return *this; } +}; + +#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION + +template <class _Container> +inline output_iterator_tag +iterator_category(const insert_iterator<_Container>&) +{ + return output_iterator_tag(); +} + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +template <class _Container, class _Iterator> +inline +insert_iterator<_Container> inserter(_Container& __x, _Iterator __i) +{ + typedef typename _Container::iterator __iter; + return insert_iterator<_Container>(__x, __iter(__i)); +} + +#ifndef __STL_LIMITED_DEFAULT_TEMPLATES +template <class _BidirectionalIterator, class _Tp, class _Reference = _Tp&, + class _Distance = ptrdiff_t> +#else +template <class _BidirectionalIterator, class _Tp, class _Reference, + class _Distance> +#endif +class reverse_bidirectional_iterator { + typedef reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, + _Reference, _Distance> _Self; +protected: + _BidirectionalIterator current; +public: + typedef bidirectional_iterator_tag iterator_category; + typedef _Tp value_type; + typedef _Distance difference_type; + typedef _Tp* pointer; + typedef _Reference reference; + + reverse_bidirectional_iterator() {} + explicit reverse_bidirectional_iterator(_BidirectionalIterator __x) + : current(__x) {} + _BidirectionalIterator base() const { return current; } + _Reference operator*() const { + _BidirectionalIterator __tmp = current; + return *--__tmp; + } +#ifndef __SGI_STL_NO_ARROW_OPERATOR + pointer operator->() const { return &(operator*()); } +#endif /* __SGI_STL_NO_ARROW_OPERATOR */ + _Self& operator++() { + --current; + return *this; + } + _Self operator++(int) { + _Self __tmp = *this; + --current; + return __tmp; + } + _Self& operator--() { + ++current; + return *this; + } + _Self operator--(int) { + _Self __tmp = *this; + ++current; + return __tmp; + } +}; + +#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION + +template <class _BidirectionalIterator, class _Tp, class _Reference, + class _Distance> +inline bidirectional_iterator_tag +iterator_category(const reverse_bidirectional_iterator<_BidirectionalIterator, + _Tp, _Reference, + _Distance>&) +{ + return bidirectional_iterator_tag(); +} + +template <class _BidirectionalIterator, class _Tp, class _Reference, + class _Distance> +inline _Tp* +value_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, + _Reference, _Distance>&) +{ + return (_Tp*) 0; +} + +template <class _BidirectionalIterator, class _Tp, class _Reference, + class _Distance> +inline _Distance* +distance_type(const reverse_bidirectional_iterator<_BidirectionalIterator, + _Tp, + _Reference, _Distance>&) +{ + return (_Distance*) 0; +} + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +template <class _BiIter, class _Tp, class _Ref, class _Distance> +inline bool operator==( + const reverse_bidirectional_iterator<_BiIter, _Tp, _Ref, _Distance>& __x, + const reverse_bidirectional_iterator<_BiIter, _Tp, _Ref, _Distance>& __y) +{ + return __x.base() == __y.base(); +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _BiIter, class _Tp, class _Ref, class _Distance> +inline bool operator!=( + const reverse_bidirectional_iterator<_BiIter, _Tp, _Ref, _Distance>& __x, + const reverse_bidirectional_iterator<_BiIter, _Tp, _Ref, _Distance>& __y) +{ + return !(__x == __y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + + +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + +// This is the new version of reverse_iterator, as defined in the +// draft C++ standard. It relies on the iterator_traits template, +// which in turn relies on partial specialization. The class +// reverse_bidirectional_iterator is no longer part of the draft +// standard, but it is retained for backward compatibility. + +template <class _Iterator> +class reverse_iterator +{ +protected: + _Iterator current; +public: + typedef typename iterator_traits<_Iterator>::iterator_category + iterator_category; + typedef typename iterator_traits<_Iterator>::value_type + value_type; + typedef typename iterator_traits<_Iterator>::difference_type + difference_type; + typedef typename iterator_traits<_Iterator>::pointer + pointer; + typedef typename iterator_traits<_Iterator>::reference + reference; + + typedef _Iterator iterator_type; + typedef reverse_iterator<_Iterator> _Self; + +public: + reverse_iterator() {} + explicit reverse_iterator(iterator_type __x) : current(__x) {} + + reverse_iterator(const _Self& __x) : current(__x.current) {} +#ifdef __STL_MEMBER_TEMPLATES + template <class _Iter> + reverse_iterator(const reverse_iterator<_Iter>& __x) + : current(__x.base()) {} +#endif /* __STL_MEMBER_TEMPLATES */ + + iterator_type base() const { return current; } + reference operator*() const { + _Iterator __tmp = current; + return *--__tmp; + } +#ifndef __SGI_STL_NO_ARROW_OPERATOR + pointer operator->() const { return &(operator*()); } +#endif /* __SGI_STL_NO_ARROW_OPERATOR */ + + _Self& operator++() { + --current; + return *this; + } + _Self operator++(int) { + _Self __tmp = *this; + --current; + return __tmp; + } + _Self& operator--() { + ++current; + return *this; + } + _Self operator--(int) { + _Self __tmp = *this; + ++current; + return __tmp; + } + + _Self operator+(difference_type __n) const { + return _Self(current - __n); + } + _Self& operator+=(difference_type __n) { + current -= __n; + return *this; + } + _Self operator-(difference_type __n) const { + return _Self(current + __n); + } + _Self& operator-=(difference_type __n) { + current += __n; + return *this; + } + reference operator[](difference_type __n) const { return *(*this + __n); } +}; + +template <class _Iterator> +inline bool operator==(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) { + return __x.base() == __y.base(); +} + +template <class _Iterator> +inline bool operator<(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) { + return __y.base() < __x.base(); +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Iterator> +inline bool operator!=(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) { + return !(__x == __y); +} + +template <class _Iterator> +inline bool operator>(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) { + return __y < __x; +} + +template <class _Iterator> +inline bool operator<=(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) { + return !(__y < __x); +} + +template <class _Iterator> +inline bool operator>=(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) { + return !(__x < __y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +template <class _Iterator> +inline typename reverse_iterator<_Iterator>::difference_type +operator-(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) { + return __y.base() - __x.base(); +} + +template <class _Iterator> +inline reverse_iterator<_Iterator> +operator+(typename reverse_iterator<_Iterator>::difference_type __n, + const reverse_iterator<_Iterator>& __x) { + return reverse_iterator<_Iterator>(__x.base() - __n); +} + +#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +// This is the old version of reverse_iterator, as found in the original +// HP STL. It does not use partial specialization. + +#ifndef __STL_LIMITED_DEFAULT_TEMPLATES +template <class _RandomAccessIterator, class _Tp, class _Reference = _Tp&, + class _Distance = ptrdiff_t> +#else +template <class _RandomAccessIterator, class _Tp, class _Reference, + class _Distance> +#endif +class reverse_iterator { + typedef reverse_iterator<_RandomAccessIterator, _Tp, _Reference, _Distance> + _Self; +protected: + _RandomAccessIterator current; +public: + typedef random_access_iterator_tag iterator_category; + typedef _Tp value_type; + typedef _Distance difference_type; + typedef _Tp* pointer; + typedef _Reference reference; + + reverse_iterator() {} + explicit reverse_iterator(_RandomAccessIterator __x) : current(__x) {} + _RandomAccessIterator base() const { return current; } + _Reference operator*() const { return *(current - 1); } +#ifndef __SGI_STL_NO_ARROW_OPERATOR + pointer operator->() const { return &(operator*()); } +#endif /* __SGI_STL_NO_ARROW_OPERATOR */ + _Self& operator++() { + --current; + return *this; + } + _Self operator++(int) { + _Self __tmp = *this; + --current; + return __tmp; + } + _Self& operator--() { + ++current; + return *this; + } + _Self operator--(int) { + _Self __tmp = *this; + ++current; + return __tmp; + } + _Self operator+(_Distance __n) const { + return _Self(current - __n); + } + _Self& operator+=(_Distance __n) { + current -= __n; + return *this; + } + _Self operator-(_Distance __n) const { + return _Self(current + __n); + } + _Self& operator-=(_Distance __n) { + current += __n; + return *this; + } + _Reference operator[](_Distance __n) const { return *(*this + __n); } +}; + +template <class _RandomAccessIterator, class _Tp, + class _Reference, class _Distance> +inline random_access_iterator_tag +iterator_category(const reverse_iterator<_RandomAccessIterator, _Tp, + _Reference, _Distance>&) +{ + return random_access_iterator_tag(); +} + +template <class _RandomAccessIterator, class _Tp, + class _Reference, class _Distance> +inline _Tp* value_type(const reverse_iterator<_RandomAccessIterator, _Tp, + _Reference, _Distance>&) +{ + return (_Tp*) 0; +} + +template <class _RandomAccessIterator, class _Tp, + class _Reference, class _Distance> +inline _Distance* +distance_type(const reverse_iterator<_RandomAccessIterator, + _Tp, _Reference, _Distance>&) +{ + return (_Distance*) 0; +} + + +template <class _RandomAccessIterator, class _Tp, + class _Reference, class _Distance> +inline bool +operator==(const reverse_iterator<_RandomAccessIterator, _Tp, + _Reference, _Distance>& __x, + const reverse_iterator<_RandomAccessIterator, _Tp, + _Reference, _Distance>& __y) +{ + return __x.base() == __y.base(); +} + +template <class _RandomAccessIterator, class _Tp, + class _Reference, class _Distance> +inline bool +operator<(const reverse_iterator<_RandomAccessIterator, _Tp, + _Reference, _Distance>& __x, + const reverse_iterator<_RandomAccessIterator, _Tp, + _Reference, _Distance>& __y) +{ + return __y.base() < __x.base(); +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _RandomAccessIterator, class _Tp, + class _Reference, class _Distance> +inline bool +operator!=(const reverse_iterator<_RandomAccessIterator, _Tp, + _Reference, _Distance>& __x, + const reverse_iterator<_RandomAccessIterator, _Tp, + _Reference, _Distance>& __y) { + return !(__x == __y); +} + +template <class _RandomAccessIterator, class _Tp, + class _Reference, class _Distance> +inline bool +operator>(const reverse_iterator<_RandomAccessIterator, _Tp, + _Reference, _Distance>& __x, + const reverse_iterator<_RandomAccessIterator, _Tp, + _Reference, _Distance>& __y) { + return __y < __x; +} + +template <class _RandomAccessIterator, class _Tp, + class _Reference, class _Distance> +inline bool +operator<=(const reverse_iterator<_RandomAccessIterator, _Tp, + _Reference, _Distance>& __x, + const reverse_iterator<_RandomAccessIterator, _Tp, + _Reference, _Distance>& __y) { + return !(__y < __x); +} + +template <class _RandomAccessIterator, class _Tp, + class _Reference, class _Distance> +inline bool +operator>=(const reverse_iterator<_RandomAccessIterator, _Tp, + _Reference, _Distance>& __x, + const reverse_iterator<_RandomAccessIterator, _Tp, + _Reference, _Distance>& __y) { + return !(__x < __y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +template <class _RandomAccessIterator, class _Tp, + class _Reference, class _Distance> +inline _Distance +operator-(const reverse_iterator<_RandomAccessIterator, _Tp, + _Reference, _Distance>& __x, + const reverse_iterator<_RandomAccessIterator, _Tp, + _Reference, _Distance>& __y) +{ + return __y.base() - __x.base(); +} + +template <class _RandAccIter, class _Tp, class _Ref, class _Dist> +inline reverse_iterator<_RandAccIter, _Tp, _Ref, _Dist> +operator+(_Dist __n, + const reverse_iterator<_RandAccIter, _Tp, _Ref, _Dist>& __x) +{ + return reverse_iterator<_RandAccIter, _Tp, _Ref, _Dist>(__x.base() - __n); +} + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +// istream_iterator and ostream_iterator look very different if we're +// using new, templatized iostreams than if we're using the old cfront +// version. + +#ifdef __STL_USE_NEW_IOSTREAMS + +template <class _Tp, + class _CharT = char, class _Traits = char_traits<_CharT>, + class _Dist = ptrdiff_t> +class istream_iterator { +public: + typedef _CharT char_type; + typedef _Traits traits_type; + typedef basic_istream<_CharT, _Traits> istream_type; + + typedef input_iterator_tag iterator_category; + typedef _Tp value_type; + typedef _Dist difference_type; + typedef const _Tp* pointer; + typedef const _Tp& reference; + + istream_iterator() : _M_stream(0), _M_ok(false) {} + istream_iterator(istream_type& __s) : _M_stream(&__s) { _M_read(); } + + reference operator*() const { return _M_value; } + pointer operator->() const { return &(operator*()); } + + istream_iterator& operator++() { + _M_read(); + return *this; + } + istream_iterator operator++(int) { + istream_iterator __tmp = *this; + _M_read(); + return __tmp; + } + + bool _M_equal(const istream_iterator& __x) const + { return (_M_ok == __x._M_ok) && (!_M_ok || _M_stream == __x._M_stream); } + +private: + istream_type* _M_stream; + _Tp _M_value; + bool _M_ok; + + void _M_read() { + _M_ok = (_M_stream && *_M_stream) ? true : false; + if (_M_ok) { + *_M_stream >> _M_value; + _M_ok = *_M_stream ? true : false; + } + } +}; + +template <class _Tp, class _CharT, class _Traits, class _Dist> +inline bool +operator==(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x, + const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y) { + return __x._M_equal(__y); +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Tp, class _CharT, class _Traits, class _Dist> +inline bool +operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x, + const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y) { + return !__x._M_equal(__y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +template <class _Tp, + class _CharT = char, class _Traits = char_traits<_CharT> > +class ostream_iterator { +public: + typedef _CharT char_type; + typedef _Traits traits_type; + typedef basic_ostream<_CharT, _Traits> ostream_type; + + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + ostream_iterator(ostream_type& __s) : _M_stream(&__s), _M_string(0) {} + ostream_iterator(ostream_type& __s, const _CharT* __c) + : _M_stream(&__s), _M_string(__c) {} + ostream_iterator<_Tp>& operator=(const _Tp& __value) { + *_M_stream << __value; + if (_M_string) *_M_stream << _M_string; + return *this; + } + ostream_iterator<_Tp>& operator*() { return *this; } + ostream_iterator<_Tp>& operator++() { return *this; } + ostream_iterator<_Tp>& operator++(int) { return *this; } +private: + ostream_type* _M_stream; + const _CharT* _M_string; +}; + +// The default template argument is declared in iosfwd + +// We do not read any characters until operator* is called. The first +// time operator* is called, it calls getc. Subsequent calls to getc +// return a cached character, and calls to operator++ use snextc. Before +// operator* or operator++ has been called, _M_is_initialized is false. +template<class _CharT, class _Traits> +class istreambuf_iterator + : public iterator<input_iterator_tag, _CharT, + typename _Traits::off_type, _CharT*, _CharT&> +{ +public: + typedef _CharT char_type; + typedef _Traits traits_type; + typedef typename _Traits::int_type int_type; + typedef basic_streambuf<_CharT, _Traits> streambuf_type; + typedef basic_istream<_CharT, _Traits> istream_type; + +public: + istreambuf_iterator(streambuf_type* __p = 0) { this->_M_init(__p); } + istreambuf_iterator(istream_type& __is) { this->_M_init(__is.rdbuf()); } + + char_type operator*() const + { return _M_is_initialized ? _M_c : _M_dereference_aux(); } + + istreambuf_iterator& operator++() { this->_M_nextc(); return *this; } + istreambuf_iterator operator++(int) { + if (!_M_is_initialized) + _M_postincr_aux(); + istreambuf_iterator __tmp = *this; + this->_M_nextc(); + return __tmp; + } + + bool equal(const istreambuf_iterator& __i) const { + return this->_M_is_initialized && __i._M_is_initialized + ? this->_M_eof == __i._M_eof + : this->_M_equal_aux(__i); + } + +private: + void _M_init(streambuf_type* __p) { + _M_buf = __p; + _M_eof = !__p; + _M_is_initialized = _M_eof; + } + + char_type _M_dereference_aux() const; + bool _M_equal_aux(const istreambuf_iterator&) const; + void _M_postincr_aux(); + + void _M_nextc() { + int_type __c = _M_buf->snextc(); + _M_c = traits_type::to_char_type(__c); + _M_eof = traits_type::eq_int_type(__c, traits_type::eof()); + _M_is_initialized = true; + } + + void _M_getc() const { + int_type __c = _M_buf->sgetc(); + _M_c = traits_type::to_char_type(__c); + _M_eof = traits_type::eq_int_type(__c, traits_type::eof()); + _M_is_initialized = true; + } + +private: + streambuf_type* _M_buf; + mutable _CharT _M_c; + mutable bool _M_eof : 1; + mutable bool _M_is_initialized : 1; +}; + +template<class _CharT, class _Traits> +_CharT istreambuf_iterator<_CharT, _Traits>::_M_dereference_aux() const +{ + this->_M_getc(); + return _M_c; +} + +template<class _CharT, class _Traits> +bool istreambuf_iterator<_CharT, _Traits> + ::_M_equal_aux(const istreambuf_iterator& __i) const +{ + if (!this->_M_is_initialized) + this->_M_getc(); + if (!__i._M_is_initialized) + __i._M_getc(); + + return this->_M_eof == __i._M_eof; +} + +template<class _CharT, class _Traits> +void istreambuf_iterator<_CharT, _Traits>::_M_postincr_aux() +{ + this->_M_getc(); +} + +template<class _CharT, class _Traits> +inline bool operator==(const istreambuf_iterator<_CharT, _Traits>& __x, + const istreambuf_iterator<_CharT, _Traits>& __y) { + return __x.equal(__y); +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template<class _CharT, class _Traits> +inline bool operator!=(const istreambuf_iterator<_CharT, _Traits>& __x, + const istreambuf_iterator<_CharT, _Traits>& __y) { + return !__x.equal(__y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +// The default template argument is declared in iosfwd +template<class _CharT, class _Traits> +class ostreambuf_iterator + : public iterator<output_iterator_tag, void, void, void, void> +{ +public: + typedef _CharT char_type; + typedef _Traits traits_type; + typedef typename _Traits::int_type int_type; + typedef basic_streambuf<_CharT, _Traits> streambuf_type; + typedef basic_ostream<_CharT, _Traits> ostream_type; + +public: + ostreambuf_iterator(streambuf_type* __buf) : _M_buf(__buf), _M_ok(__buf) {} + ostreambuf_iterator(ostream_type& __o) + : _M_buf(__o.rdbuf()), _M_ok(__o.rdbuf() != 0) {} + + ostreambuf_iterator& operator=(char_type __c) { + _M_ok = _M_ok && !traits_type::eq_int_type(_M_buf->sputc(__c), + traits_type::eof()); + return *this; + } + + ostreambuf_iterator& operator*() { return *this; } + ostreambuf_iterator& operator++() { return *this; } + ostreambuf_iterator& operator++(int) { return *this; } + + bool failed() const { return !_M_ok; } + +private: + streambuf_type* _M_buf; + bool _M_ok; +}; + +#else /* __STL_USE_NEW_IOSTREAMS */ + +template <class _Tp, class _Dist = ptrdiff_t> class istream_iterator; + +template <class _Tp, class _Dist> +inline bool operator==(const istream_iterator<_Tp, _Dist>&, + const istream_iterator<_Tp, _Dist>&); + +template <class _Tp, class _Dist> +class istream_iterator { +#ifdef __STL_TEMPLATE_FRIENDS + template <class _T1, class _D1> + friend bool operator==(const istream_iterator<_T1, _D1>&, + const istream_iterator<_T1, _D1>&); +#else /* __STL_TEMPLATE_FRIENDS */ + friend bool __STD_QUALIFIER + operator== __STL_NULL_TMPL_ARGS (const istream_iterator&, + const istream_iterator&); +#endif /* __STL_TEMPLATE_FRIENDS */ + +protected: + istream* _M_stream; + _Tp _M_value; + bool _M_end_marker; + void _M_read() { + _M_end_marker = (*_M_stream) ? true : false; + if (_M_end_marker) *_M_stream >> _M_value; + _M_end_marker = (*_M_stream) ? true : false; + } +public: + typedef input_iterator_tag iterator_category; + typedef _Tp value_type; + typedef _Dist difference_type; + typedef const _Tp* pointer; + typedef const _Tp& reference; + + istream_iterator() : _M_stream(&cin), _M_end_marker(false) {} + istream_iterator(istream& __s) : _M_stream(&__s) { _M_read(); } + reference operator*() const { return _M_value; } +#ifndef __SGI_STL_NO_ARROW_OPERATOR + pointer operator->() const { return &(operator*()); } +#endif /* __SGI_STL_NO_ARROW_OPERATOR */ + istream_iterator<_Tp, _Dist>& operator++() { + _M_read(); + return *this; + } + istream_iterator<_Tp, _Dist> operator++(int) { + istream_iterator<_Tp, _Dist> __tmp = *this; + _M_read(); + return __tmp; + } +}; + +#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION + +template <class _Tp, class _Dist> +inline input_iterator_tag +iterator_category(const istream_iterator<_Tp, _Dist>&) +{ + return input_iterator_tag(); +} + +template <class _Tp, class _Dist> +inline _Tp* +value_type(const istream_iterator<_Tp, _Dist>&) { return (_Tp*) 0; } + +template <class _Tp, class _Dist> +inline _Dist* +distance_type(const istream_iterator<_Tp, _Dist>&) { return (_Dist*)0; } + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +template <class _Tp, class _Distance> +inline bool operator==(const istream_iterator<_Tp, _Distance>& __x, + const istream_iterator<_Tp, _Distance>& __y) { + return (__x._M_stream == __y._M_stream && + __x._M_end_marker == __y._M_end_marker) || + __x._M_end_marker == false && __y._M_end_marker == false; +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Tp, class _Distance> +inline bool operator!=(const istream_iterator<_Tp, _Distance>& __x, + const istream_iterator<_Tp, _Distance>& __y) { + return !(__x == __y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +template <class _Tp> +class ostream_iterator { +protected: + ostream* _M_stream; + const char* _M_string; +public: + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + ostream_iterator(ostream& __s) : _M_stream(&__s), _M_string(0) {} + ostream_iterator(ostream& __s, const char* __c) + : _M_stream(&__s), _M_string(__c) {} + ostream_iterator<_Tp>& operator=(const _Tp& __value) { + *_M_stream << __value; + if (_M_string) *_M_stream << _M_string; + return *this; + } + ostream_iterator<_Tp>& operator*() { return *this; } + ostream_iterator<_Tp>& operator++() { return *this; } + ostream_iterator<_Tp>& operator++(int) { return *this; } +}; + +#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION + +template <class _Tp> +inline output_iterator_tag +iterator_category(const ostream_iterator<_Tp>&) { + return output_iterator_tag(); +} + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +#endif /* __STL_USE_NEW_IOSTREAMS */ + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_ITERATOR_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_iterator_base.h b/dtm_release/local/include/stl/stl_iterator_base.h new file mode 100644 index 0000000000000000000000000000000000000000..9c54225501b099e38790af2b0147027c64c8b83d --- /dev/null +++ b/dtm_release/local/include/stl/stl_iterator_base.h @@ -0,0 +1,367 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_ITERATOR_BASE_H +#define __SGI_STL_INTERNAL_ITERATOR_BASE_H + +// This file contains all of the general iterator-related utilities. +// The internal file stl_iterator.h contains predefined iterators, +// such as front_insert_iterator and istream_iterator. + +#include <concept_checks.h> + +__STL_BEGIN_NAMESPACE + +struct input_iterator_tag {}; +struct output_iterator_tag {}; +struct forward_iterator_tag : public input_iterator_tag {}; +struct bidirectional_iterator_tag : public forward_iterator_tag {}; +struct random_access_iterator_tag : public bidirectional_iterator_tag {}; + +// The base classes input_iterator, output_iterator, forward_iterator, +// bidirectional_iterator, and random_access_iterator are not part of +// the C++ standard. (They have been replaced by struct iterator.) +// They are included for backward compatibility with the HP STL. + +template <class _Tp, class _Distance> struct input_iterator { + typedef input_iterator_tag iterator_category; + typedef _Tp value_type; + typedef _Distance difference_type; + typedef _Tp* pointer; + typedef _Tp& reference; +}; + +struct output_iterator { + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; +}; + +template <class _Tp, class _Distance> struct forward_iterator { + typedef forward_iterator_tag iterator_category; + typedef _Tp value_type; + typedef _Distance difference_type; + typedef _Tp* pointer; + typedef _Tp& reference; +}; + + +template <class _Tp, class _Distance> struct bidirectional_iterator { + typedef bidirectional_iterator_tag iterator_category; + typedef _Tp value_type; + typedef _Distance difference_type; + typedef _Tp* pointer; + typedef _Tp& reference; +}; + +template <class _Tp, class _Distance> struct random_access_iterator { + typedef random_access_iterator_tag iterator_category; + typedef _Tp value_type; + typedef _Distance difference_type; + typedef _Tp* pointer; + typedef _Tp& reference; +}; + +#ifdef __STL_USE_NAMESPACES +template <class _Category, class _Tp, class _Distance = ptrdiff_t, + class _Pointer = _Tp*, class _Reference = _Tp&> +struct iterator { + typedef _Category iterator_category; + typedef _Tp value_type; + typedef _Distance difference_type; + typedef _Pointer pointer; + typedef _Reference reference; +}; +#endif /* __STL_USE_NAMESPACES */ + +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + +template <class _Iterator> +struct iterator_traits { + typedef typename _Iterator::iterator_category iterator_category; + typedef typename _Iterator::value_type value_type; + typedef typename _Iterator::difference_type difference_type; + typedef typename _Iterator::pointer pointer; + typedef typename _Iterator::reference reference; +}; + +template <class _Tp> +struct iterator_traits<_Tp*> { + typedef random_access_iterator_tag iterator_category; + typedef _Tp value_type; + typedef ptrdiff_t difference_type; + typedef _Tp* pointer; + typedef _Tp& reference; +}; + +template <class _Tp> +struct iterator_traits<const _Tp*> { + typedef random_access_iterator_tag iterator_category; + typedef _Tp value_type; + typedef ptrdiff_t difference_type; + typedef const _Tp* pointer; + typedef const _Tp& reference; +}; + +// The overloaded functions iterator_category, distance_type, and +// value_type are not part of the C++ standard. (They have been +// replaced by struct iterator_traits.) They are included for +// backward compatibility with the HP STL. + +// We introduce internal names for these functions. + +template <class _Iter> +inline typename iterator_traits<_Iter>::iterator_category +__iterator_category(const _Iter&) +{ + typedef typename iterator_traits<_Iter>::iterator_category _Category; + return _Category(); +} + +template <class _Iter> +inline typename iterator_traits<_Iter>::difference_type* +__distance_type(const _Iter&) +{ + return static_cast<typename iterator_traits<_Iter>::difference_type*>(0); +} + +template <class _Iter> +inline typename iterator_traits<_Iter>::value_type* +__value_type(const _Iter&) +{ + return static_cast<typename iterator_traits<_Iter>::value_type*>(0); +} + +template <class _Iter> +inline typename iterator_traits<_Iter>::iterator_category +iterator_category(const _Iter& __i) { return __iterator_category(__i); } + + +template <class _Iter> +inline typename iterator_traits<_Iter>::difference_type* +distance_type(const _Iter& __i) { return __distance_type(__i); } + +template <class _Iter> +inline typename iterator_traits<_Iter>::value_type* +value_type(const _Iter& __i) { return __value_type(__i); } + +#define __ITERATOR_CATEGORY(__i) __iterator_category(__i) +#define __DISTANCE_TYPE(__i) __distance_type(__i) +#define __VALUE_TYPE(__i) __value_type(__i) + +#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +template <class _Tp, class _Distance> +inline input_iterator_tag +iterator_category(const input_iterator<_Tp, _Distance>&) + { return input_iterator_tag(); } + +inline output_iterator_tag iterator_category(const output_iterator&) + { return output_iterator_tag(); } + +template <class _Tp, class _Distance> +inline forward_iterator_tag +iterator_category(const forward_iterator<_Tp, _Distance>&) + { return forward_iterator_tag(); } + +template <class _Tp, class _Distance> +inline bidirectional_iterator_tag +iterator_category(const bidirectional_iterator<_Tp, _Distance>&) + { return bidirectional_iterator_tag(); } + +template <class _Tp, class _Distance> +inline random_access_iterator_tag +iterator_category(const random_access_iterator<_Tp, _Distance>&) + { return random_access_iterator_tag(); } + +template <class _Tp> +inline random_access_iterator_tag iterator_category(const _Tp*) + { return random_access_iterator_tag(); } + +template <class _Tp, class _Distance> +inline _Tp* value_type(const input_iterator<_Tp, _Distance>&) + { return (_Tp*)(0); } + +template <class _Tp, class _Distance> +inline _Tp* value_type(const forward_iterator<_Tp, _Distance>&) + { return (_Tp*)(0); } + +template <class _Tp, class _Distance> +inline _Tp* value_type(const bidirectional_iterator<_Tp, _Distance>&) + { return (_Tp*)(0); } + +template <class _Tp, class _Distance> +inline _Tp* value_type(const random_access_iterator<_Tp, _Distance>&) + { return (_Tp*)(0); } + +template <class _Tp> +inline _Tp* value_type(const _Tp*) { return (_Tp*)(0); } + +template <class _Tp, class _Distance> +inline _Distance* distance_type(const input_iterator<_Tp, _Distance>&) +{ + return (_Distance*)(0); +} + +template <class _Tp, class _Distance> +inline _Distance* distance_type(const forward_iterator<_Tp, _Distance>&) +{ + return (_Distance*)(0); +} + +template <class _Tp, class _Distance> +inline _Distance* +distance_type(const bidirectional_iterator<_Tp, _Distance>&) +{ + return (_Distance*)(0); +} + +template <class _Tp, class _Distance> +inline _Distance* +distance_type(const random_access_iterator<_Tp, _Distance>&) +{ + return (_Distance*)(0); +} + +template <class _Tp> +inline ptrdiff_t* distance_type(const _Tp*) { return (ptrdiff_t*)(0); } + +// Without partial specialization we can't use iterator_traits, so +// we must keep the old iterator query functions around. + +#define __ITERATOR_CATEGORY(__i) iterator_category(__i) +#define __DISTANCE_TYPE(__i) distance_type(__i) +#define __VALUE_TYPE(__i) value_type(__i) + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +template <class _InputIterator, class _Distance> +inline void __distance(_InputIterator __first, _InputIterator __last, + _Distance& __n, input_iterator_tag) +{ + while (__first != __last) { ++__first; ++__n; } +} + +template <class _RandomAccessIterator, class _Distance> +inline void __distance(_RandomAccessIterator __first, + _RandomAccessIterator __last, + _Distance& __n, random_access_iterator_tag) +{ + __STL_REQUIRES(_RandomAccessIterator, _RandomAccessIterator); + __n += __last - __first; +} + +template <class _InputIterator, class _Distance> +inline void distance(_InputIterator __first, + _InputIterator __last, _Distance& __n) +{ + __STL_REQUIRES(_InputIterator, _InputIterator); + __distance(__first, __last, __n, iterator_category(__first)); +} + +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + +template <class _InputIterator> +inline typename iterator_traits<_InputIterator>::difference_type +__distance(_InputIterator __first, _InputIterator __last, input_iterator_tag) +{ + typename iterator_traits<_InputIterator>::difference_type __n = 0; + while (__first != __last) { + ++__first; ++__n; + } + return __n; +} + +template <class _RandomAccessIterator> +inline typename iterator_traits<_RandomAccessIterator>::difference_type +__distance(_RandomAccessIterator __first, _RandomAccessIterator __last, + random_access_iterator_tag) { + __STL_REQUIRES(_RandomAccessIterator, _RandomAccessIterator); + return __last - __first; +} + +template <class _InputIterator> +inline typename iterator_traits<_InputIterator>::difference_type +distance(_InputIterator __first, _InputIterator __last) { + typedef typename iterator_traits<_InputIterator>::iterator_category + _Category; + __STL_REQUIRES(_InputIterator, _InputIterator); + return __distance(__first, __last, _Category()); +} + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +template <class _InputIter, class _Distance> +inline void __advance(_InputIter& __i, _Distance __n, input_iterator_tag) { + while (__n--) ++__i; +} + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1183 +#endif + +template <class _BidirectionalIterator, class _Distance> +inline void __advance(_BidirectionalIterator& __i, _Distance __n, + bidirectional_iterator_tag) { + __STL_REQUIRES(_BidirectionalIterator, _BidirectionalIterator); + if (__n >= 0) + while (__n--) ++__i; + else + while (__n++) --__i; +} + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1183 +#endif + +template <class _RandomAccessIterator, class _Distance> +inline void __advance(_RandomAccessIterator& __i, _Distance __n, + random_access_iterator_tag) { + __STL_REQUIRES(_RandomAccessIterator, _RandomAccessIterator); + __i += __n; +} + +template <class _InputIterator, class _Distance> +inline void advance(_InputIterator& __i, _Distance __n) { + __STL_REQUIRES(_InputIterator, _InputIterator); + __advance(__i, __n, iterator_category(__i)); +} + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_ITERATOR_BASE_H */ + + + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_list.h b/dtm_release/local/include/stl/stl_list.h new file mode 100644 index 0000000000000000000000000000000000000000..1aa603a793b1243a4c7aa003f4957f762e410b7a --- /dev/null +++ b/dtm_release/local/include/stl/stl_list.h @@ -0,0 +1,885 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_LIST_H +#define __SGI_STL_INTERNAL_LIST_H + +#include <concept_checks.h> + +__STL_BEGIN_NAMESPACE + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1174 +#pragma set woff 1375 +#endif + +struct _List_node_base { + _List_node_base* _M_next; + _List_node_base* _M_prev; +}; + +template <class _Tp> +struct _List_node : public _List_node_base { + _Tp _M_data; +}; + +struct _List_iterator_base { + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef bidirectional_iterator_tag iterator_category; + + _List_node_base* _M_node; + + _List_iterator_base(_List_node_base* __x) : _M_node(__x) {} + _List_iterator_base() {} + + void _M_incr() { _M_node = _M_node->_M_next; } + void _M_decr() { _M_node = _M_node->_M_prev; } + + bool operator==(const _List_iterator_base& __x) const { + return _M_node == __x._M_node; + } + bool operator!=(const _List_iterator_base& __x) const { + return _M_node != __x._M_node; + } +}; + +template<class _Tp, class _Ref, class _Ptr> +struct _List_iterator : public _List_iterator_base { + typedef _List_iterator<_Tp,_Tp&,_Tp*> iterator; + typedef _List_iterator<_Tp,const _Tp&,const _Tp*> const_iterator; + typedef _List_iterator<_Tp,_Ref,_Ptr> _Self; + + typedef _Tp value_type; + typedef _Ptr pointer; + typedef _Ref reference; + typedef _List_node<_Tp> _Node; + + _List_iterator(_Node* __x) : _List_iterator_base(__x) {} + _List_iterator() {} + _List_iterator(const iterator& __x) : _List_iterator_base(__x._M_node) {} + + reference operator*() const { return ((_Node*) _M_node)->_M_data; } + +#ifndef __SGI_STL_NO_ARROW_OPERATOR + pointer operator->() const { return &(operator*()); } +#endif /* __SGI_STL_NO_ARROW_OPERATOR */ + + _Self& operator++() { + this->_M_incr(); + return *this; + } + _Self operator++(int) { + _Self __tmp = *this; + this->_M_incr(); + return __tmp; + } + _Self& operator--() { + this->_M_decr(); + return *this; + } + _Self operator--(int) { + _Self __tmp = *this; + this->_M_decr(); + return __tmp; + } +}; + +#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION + +inline bidirectional_iterator_tag +iterator_category(const _List_iterator_base&) +{ + return bidirectional_iterator_tag(); +} + +template <class _Tp, class _Ref, class _Ptr> +inline _Tp* +value_type(const _List_iterator<_Tp, _Ref, _Ptr>&) +{ + return 0; +} + +inline ptrdiff_t* +distance_type(const _List_iterator_base&) +{ + return 0; +} + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + + +// Base class that encapsulates details of allocators. Three cases: +// an ordinary standard-conforming allocator, a standard-conforming +// allocator with no non-static data, and an SGI-style allocator. +// This complexity is necessary only because we're worrying about backward +// compatibility and because we want to avoid wasting storage on an +// allocator instance if it isn't necessary. + +#ifdef __STL_USE_STD_ALLOCATORS + +// Base for general standard-conforming allocators. +template <class _Tp, class _Allocator, bool _IsStatic> +class _List_alloc_base { +public: + typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type + allocator_type; + allocator_type get_allocator() const { return _Node_allocator; } + + _List_alloc_base(const allocator_type& __a) : _Node_allocator(__a) {} + +protected: + _List_node<_Tp>* _M_get_node() + { return _Node_allocator.allocate(1); } + void _M_put_node(_List_node<_Tp>* __p) + { _Node_allocator.deallocate(__p, 1); } + +protected: + typename _Alloc_traits<_List_node<_Tp>, _Allocator>::allocator_type + _Node_allocator; + _List_node<_Tp>* _M_node; +}; + +// Specialization for instanceless allocators. + +template <class _Tp, class _Allocator> +class _List_alloc_base<_Tp, _Allocator, true> { +public: + typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type + allocator_type; + allocator_type get_allocator() const { return allocator_type(); } + + _List_alloc_base(const allocator_type&) {} + +protected: + typedef typename _Alloc_traits<_List_node<_Tp>, _Allocator>::_Alloc_type + _Alloc_type; + _List_node<_Tp>* _M_get_node() { return _Alloc_type::allocate(1); } + void _M_put_node(_List_node<_Tp>* __p) { _Alloc_type::deallocate(__p, 1); } + +protected: + _List_node<_Tp>* _M_node; +}; + +template <class _Tp, class _Alloc> +class _List_base + : public _List_alloc_base<_Tp, _Alloc, + _Alloc_traits<_Tp, _Alloc>::_S_instanceless> +{ +public: + typedef _List_alloc_base<_Tp, _Alloc, + _Alloc_traits<_Tp, _Alloc>::_S_instanceless> + _Base; + typedef typename _Base::allocator_type allocator_type; + + _List_base(const allocator_type& __a) : _Base(__a) { + _M_node = _M_get_node(); + _M_node->_M_next = _M_node; + _M_node->_M_prev = _M_node; + } + ~_List_base() { + clear(); + _M_put_node(_M_node); + } + + void clear(); +}; + +#else /* __STL_USE_STD_ALLOCATORS */ + +template <class _Tp, class _Alloc> +class _List_base +{ +public: + typedef _Alloc allocator_type; + allocator_type get_allocator() const { return allocator_type(); } + + _List_base(const allocator_type&) { + _M_node = _M_get_node(); + _M_node->_M_next = _M_node; + _M_node->_M_prev = _M_node; + } + ~_List_base() { + clear(); + _M_put_node(_M_node); + } + + void clear(); + +protected: + typedef simple_alloc<_List_node<_Tp>, _Alloc> _Alloc_type; + _List_node<_Tp>* _M_get_node() { return _Alloc_type::allocate(1); } + void _M_put_node(_List_node<_Tp>* __p) { _Alloc_type::deallocate(__p, 1); } + +protected: + _List_node<_Tp>* _M_node; +}; + +#endif /* __STL_USE_STD_ALLOCATORS */ + +template <class _Tp, class _Alloc> +void +_List_base<_Tp,_Alloc>::clear() +{ + _List_node<_Tp>* __cur = (_List_node<_Tp>*) _M_node->_M_next; + while (__cur != _M_node) { + _List_node<_Tp>* __tmp = __cur; + __cur = (_List_node<_Tp>*) __cur->_M_next; + _Destroy(&__tmp->_M_data); + _M_put_node(__tmp); + } + _M_node->_M_next = _M_node; + _M_node->_M_prev = _M_node; +} + +template <class _Tp, class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) > +class list : protected _List_base<_Tp, _Alloc> { + // requirements: + + __STL_CLASS_REQUIRES(_Tp, _Assignable); + + typedef _List_base<_Tp, _Alloc> _Base; +protected: + typedef void* _Void_pointer; + +public: + typedef _Tp value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef _List_node<_Tp> _Node; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + + typedef typename _Base::allocator_type allocator_type; + allocator_type get_allocator() const { return _Base::get_allocator(); } + +public: + typedef _List_iterator<_Tp,_Tp&,_Tp*> iterator; + typedef _List_iterator<_Tp,const _Tp&,const _Tp*> const_iterator; + +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + typedef reverse_iterator<const_iterator> const_reverse_iterator; + typedef reverse_iterator<iterator> reverse_iterator; +#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + typedef reverse_bidirectional_iterator<const_iterator,value_type, + const_reference,difference_type> + const_reverse_iterator; + typedef reverse_bidirectional_iterator<iterator,value_type,reference, + difference_type> + reverse_iterator; +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +protected: +#ifdef __STL_HAS_NAMESPACES + using _Base::_M_node; + using _Base::_M_put_node; + using _Base::_M_get_node; +#endif /* __STL_HAS_NAMESPACES */ + +protected: + _Node* _M_create_node(const _Tp& __x) + { + _Node* __p = _M_get_node(); + __STL_TRY { + _Construct(&__p->_M_data, __x); + } + __STL_UNWIND(_M_put_node(__p)); + return __p; + } + + _Node* _M_create_node() + { + _Node* __p = _M_get_node(); + __STL_TRY { + _Construct(&__p->_M_data); + } + __STL_UNWIND(_M_put_node(__p)); + return __p; + } + +public: + explicit list(const allocator_type& __a = allocator_type()) : _Base(__a) {} + + iterator begin() { return (_Node*)(_M_node->_M_next); } + const_iterator begin() const { return (_Node*)(_M_node->_M_next); } + + iterator end() { return _M_node; } + const_iterator end() const { return _M_node; } + + reverse_iterator rbegin() + { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const + { return const_reverse_iterator(end()); } + + reverse_iterator rend() + { return reverse_iterator(begin()); } + const_reverse_iterator rend() const + { return const_reverse_iterator(begin()); } + + bool empty() const { return _M_node->_M_next == _M_node; } + size_type size() const { + size_type __result = 0; + distance(begin(), end(), __result); + return __result; + } + size_type max_size() const { return size_type(-1); } + + reference front() { return *begin(); } + const_reference front() const { return *begin(); } + reference back() { return *(--end()); } + const_reference back() const { return *(--end()); } + + void swap(list<_Tp, _Alloc>& __x) { __STD::swap(_M_node, __x._M_node); } + + iterator insert(iterator __position, const _Tp& __x) { + _Node* __tmp = _M_create_node(__x); + __tmp->_M_next = __position._M_node; + __tmp->_M_prev = __position._M_node->_M_prev; + __position._M_node->_M_prev->_M_next = __tmp; + __position._M_node->_M_prev = __tmp; + return __tmp; + } + iterator insert(iterator __position) { return insert(__position, _Tp()); } +#ifdef __STL_MEMBER_TEMPLATES + // Check whether it's an integral type. If so, it's not an iterator. + + template<class _Integer> + void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, + __true_type) { + _M_fill_insert(__pos, (size_type) __n, (_Tp) __x); + } + + template <class _InputIterator> + void _M_insert_dispatch(iterator __pos, + _InputIterator __first, _InputIterator __last, + __false_type); + + template <class _InputIterator> + void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { + typedef typename _Is_integer<_InputIterator>::_Integral _Integral; + _M_insert_dispatch(__pos, __first, __last, _Integral()); + } + +#else /* __STL_MEMBER_TEMPLATES */ + void insert(iterator __position, const _Tp* __first, const _Tp* __last); + void insert(iterator __position, + const_iterator __first, const_iterator __last); +#endif /* __STL_MEMBER_TEMPLATES */ + void insert(iterator __pos, size_type __n, const _Tp& __x) + { _M_fill_insert(__pos, __n, __x); } + void _M_fill_insert(iterator __pos, size_type __n, const _Tp& __x); + + void push_front(const _Tp& __x) { insert(begin(), __x); } + void push_front() {insert(begin());} + void push_back(const _Tp& __x) { insert(end(), __x); } + void push_back() {insert(end());} + + iterator erase(iterator __position) { + _List_node_base* __next_node = __position._M_node->_M_next; + _List_node_base* __prev_node = __position._M_node->_M_prev; + _Node* __n = (_Node*) __position._M_node; + __prev_node->_M_next = __next_node; + __next_node->_M_prev = __prev_node; + _Destroy(&__n->_M_data); + _M_put_node(__n); + return iterator((_Node*) __next_node); + } + iterator erase(iterator __first, iterator __last); + void clear() { _Base::clear(); } + + void resize(size_type __new_size, const _Tp& __x); + void resize(size_type __new_size) { this->resize(__new_size, _Tp()); } + + void pop_front() { erase(begin()); } + void pop_back() { + iterator __tmp = end(); + erase(--__tmp); + } + list(size_type __n, const _Tp& __value, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { insert(begin(), __n, __value); } + explicit list(size_type __n) + : _Base(allocator_type()) + { insert(begin(), __n, _Tp()); } + +#ifdef __STL_MEMBER_TEMPLATES + + // We don't need any dispatching tricks here, because insert does all of + // that anyway. + template <class _InputIterator> + list(_InputIterator __first, _InputIterator __last, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { insert(begin(), __first, __last); } + +#else /* __STL_MEMBER_TEMPLATES */ + + list(const _Tp* __first, const _Tp* __last, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { this->insert(begin(), __first, __last); } + list(const_iterator __first, const_iterator __last, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { this->insert(begin(), __first, __last); } + +#endif /* __STL_MEMBER_TEMPLATES */ + list(const list<_Tp, _Alloc>& __x) : _Base(__x.get_allocator()) + { insert(begin(), __x.begin(), __x.end()); } + + ~list() { } + + list<_Tp, _Alloc>& operator=(const list<_Tp, _Alloc>& __x); + +public: + // assign(), a generalized assignment member function. Two + // versions: one that takes a count, and one that takes a range. + // The range version is a member template, so we dispatch on whether + // or not the type is an integer. + + void assign(size_type __n, const _Tp& __val) { _M_fill_assign(__n, __val); } + + void _M_fill_assign(size_type __n, const _Tp& __val); + +#ifdef __STL_MEMBER_TEMPLATES + + template <class _InputIterator> + void assign(_InputIterator __first, _InputIterator __last) { + typedef typename _Is_integer<_InputIterator>::_Integral _Integral; + _M_assign_dispatch(__first, __last, _Integral()); + } + + template <class _Integer> + void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) + { _M_fill_assign((size_type) __n, (_Tp) __val); } + + template <class _InputIterator> + void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, + __false_type); + +#endif /* __STL_MEMBER_TEMPLATES */ + +protected: + void transfer(iterator __position, iterator __first, iterator __last) { + if (__position != __last) { + // Remove [first, last) from its old position. + __last._M_node->_M_prev->_M_next = __position._M_node; + __first._M_node->_M_prev->_M_next = __last._M_node; + __position._M_node->_M_prev->_M_next = __first._M_node; + + // Splice [first, last) into its new position. + _List_node_base* __tmp = __position._M_node->_M_prev; + __position._M_node->_M_prev = __last._M_node->_M_prev; + __last._M_node->_M_prev = __first._M_node->_M_prev; + __first._M_node->_M_prev = __tmp; + } + } + +public: + void splice(iterator __position, list& __x) { + if (!__x.empty()) + this->transfer(__position, __x.begin(), __x.end()); + } + void splice(iterator __position, list&, iterator __i) { + iterator __j = __i; + ++__j; + if (__position == __i || __position == __j) return; + this->transfer(__position, __i, __j); + } + void splice(iterator __position, list&, iterator __first, iterator __last) { + if (__first != __last) + this->transfer(__position, __first, __last); + } + void remove(const _Tp& __value); + void unique(); + void merge(list& __x); + void reverse(); + void sort(); + +#ifdef __STL_MEMBER_TEMPLATES + template <class _Predicate> void remove_if(_Predicate); + template <class _BinaryPredicate> void unique(_BinaryPredicate); + template <class _StrictWeakOrdering> void merge(list&, _StrictWeakOrdering); + template <class _StrictWeakOrdering> void sort(_StrictWeakOrdering); +#endif /* __STL_MEMBER_TEMPLATES */ +}; + +template <class _Tp, class _Alloc> +inline bool +operator==(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y) +{ + typedef typename list<_Tp,_Alloc>::const_iterator const_iterator; + const_iterator __end1 = __x.end(); + const_iterator __end2 = __y.end(); + + const_iterator __i1 = __x.begin(); + const_iterator __i2 = __y.begin(); + while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) { + ++__i1; + ++__i2; + } + return __i1 == __end1 && __i2 == __end2; +} + +template <class _Tp, class _Alloc> +inline bool operator<(const list<_Tp,_Alloc>& __x, + const list<_Tp,_Alloc>& __y) +{ + return lexicographical_compare(__x.begin(), __x.end(), + __y.begin(), __y.end()); +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Tp, class _Alloc> +inline bool operator!=(const list<_Tp,_Alloc>& __x, + const list<_Tp,_Alloc>& __y) { + return !(__x == __y); +} + +template <class _Tp, class _Alloc> +inline bool operator>(const list<_Tp,_Alloc>& __x, + const list<_Tp,_Alloc>& __y) { + return __y < __x; +} + +template <class _Tp, class _Alloc> +inline bool operator<=(const list<_Tp,_Alloc>& __x, + const list<_Tp,_Alloc>& __y) { + return !(__y < __x); +} + +template <class _Tp, class _Alloc> +inline bool operator>=(const list<_Tp,_Alloc>& __x, + const list<_Tp,_Alloc>& __y) { + return !(__x < __y); +} + +template <class _Tp, class _Alloc> +inline void +swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y) +{ + __x.swap(__y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +#ifdef __STL_MEMBER_TEMPLATES + +template <class _Tp, class _Alloc> template <class _InputIter> +void +list<_Tp, _Alloc>::_M_insert_dispatch(iterator __position, + _InputIter __first, _InputIter __last, + __false_type) +{ + for ( ; __first != __last; ++__first) + insert(__position, *__first); +} + +#else /* __STL_MEMBER_TEMPLATES */ + +template <class _Tp, class _Alloc> +void +list<_Tp, _Alloc>::insert(iterator __position, + const _Tp* __first, const _Tp* __last) +{ + for ( ; __first != __last; ++__first) + insert(__position, *__first); +} + +template <class _Tp, class _Alloc> +void +list<_Tp, _Alloc>::insert(iterator __position, + const_iterator __first, const_iterator __last) +{ + for ( ; __first != __last; ++__first) + insert(__position, *__first); +} + +#endif /* __STL_MEMBER_TEMPLATES */ + +template <class _Tp, class _Alloc> +void +list<_Tp, _Alloc>::_M_fill_insert(iterator __position, + size_type __n, const _Tp& __x) +{ + for ( ; __n > 0; --__n) + insert(__position, __x); +} + +template <class _Tp, class _Alloc> +typename list<_Tp,_Alloc>::iterator list<_Tp, _Alloc>::erase(iterator __first, + iterator __last) +{ + while (__first != __last) + erase(__first++); + return __last; +} + +template <class _Tp, class _Alloc> +void list<_Tp, _Alloc>::resize(size_type __new_size, const _Tp& __x) +{ + iterator __i = begin(); + size_type __len = 0; + for ( ; __i != end() && __len < __new_size; ++__i, ++__len) + ; + if (__len == __new_size) + erase(__i, end()); + else // __i == end() + insert(end(), __new_size - __len, __x); +} + +template <class _Tp, class _Alloc> +list<_Tp, _Alloc>& list<_Tp, _Alloc>::operator=(const list<_Tp, _Alloc>& __x) +{ + if (this != &__x) { + iterator __first1 = begin(); + iterator __last1 = end(); + const_iterator __first2 = __x.begin(); + const_iterator __last2 = __x.end(); + while (__first1 != __last1 && __first2 != __last2) + *__first1++ = *__first2++; + if (__first2 == __last2) + erase(__first1, __last1); + else + insert(__last1, __first2, __last2); + } + return *this; +} + +template <class _Tp, class _Alloc> +void list<_Tp, _Alloc>::_M_fill_assign(size_type __n, const _Tp& __val) { + iterator __i = begin(); + for ( ; __i != end() && __n > 0; ++__i, --__n) + *__i = __val; + if (__n > 0) + insert(end(), __n, __val); + else + erase(__i, end()); +} + +#ifdef __STL_MEMBER_TEMPLATES + +template <class _Tp, class _Alloc> template <class _InputIter> +void +list<_Tp, _Alloc>::_M_assign_dispatch(_InputIter __first2, _InputIter __last2, + __false_type) +{ + iterator __first1 = begin(); + iterator __last1 = end(); + for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2) + *__first1 = *__first2; + if (__first2 == __last2) + erase(__first1, __last1); + else + insert(__last1, __first2, __last2); +} + +#endif /* __STL_MEMBER_TEMPLATES */ + +template <class _Tp, class _Alloc> +void list<_Tp, _Alloc>::remove(const _Tp& __value) +{ + iterator __first = begin(); + iterator __last = end(); + while (__first != __last) { + iterator __next = __first; + ++__next; + if (*__first == __value) erase(__first); + __first = __next; + } +} + +template <class _Tp, class _Alloc> +void list<_Tp, _Alloc>::unique() +{ + iterator __first = begin(); + iterator __last = end(); + if (__first == __last) return; + iterator __next = __first; + while (++__next != __last) { + if (*__first == *__next) + erase(__next); + else + __first = __next; + __next = __first; + } +} + +template <class _Tp, class _Alloc> +void list<_Tp, _Alloc>::merge(list<_Tp, _Alloc>& __x) +{ + iterator __first1 = begin(); + iterator __last1 = end(); + iterator __first2 = __x.begin(); + iterator __last2 = __x.end(); + while (__first1 != __last1 && __first2 != __last2) + if (*__first2 < *__first1) { + iterator __next = __first2; + transfer(__first1, __first2, ++__next); + __first2 = __next; + } + else + ++__first1; + if (__first2 != __last2) transfer(__last1, __first2, __last2); +} + +inline void __List_base_reverse(_List_node_base* __p) +{ + _List_node_base* __tmp = __p; + do { + __STD::swap(__tmp->_M_next, __tmp->_M_prev); + __tmp = __tmp->_M_prev; // Old next node is now prev. + } while (__tmp != __p); +} + +template <class _Tp, class _Alloc> +inline void list<_Tp, _Alloc>::reverse() +{ + __List_base_reverse(this->_M_node); +} + +template <class _Tp, class _Alloc> +void list<_Tp, _Alloc>::sort() +{ + // Do nothing if the list has length 0 or 1. + if (_M_node->_M_next != _M_node && _M_node->_M_next->_M_next != _M_node) { + list<_Tp, _Alloc> __carry; + list<_Tp, _Alloc> __counter[64]; + int __fill = 0; + while (!empty()) { + __carry.splice(__carry.begin(), *this, begin()); + int __i = 0; + while(__i < __fill && !__counter[__i].empty()) { + __counter[__i].merge(__carry); + __carry.swap(__counter[__i++]); + } + __carry.swap(__counter[__i]); + if (__i == __fill) ++__fill; + } + + for (int __i = 1; __i < __fill; ++__i) + __counter[__i].merge(__counter[__i-1]); + swap(__counter[__fill-1]); + } +} + +#ifdef __STL_MEMBER_TEMPLATES + +template <class _Tp, class _Alloc> template <class _Predicate> +void list<_Tp, _Alloc>::remove_if(_Predicate __pred) +{ + iterator __first = begin(); + iterator __last = end(); + while (__first != __last) { + iterator __next = __first; + ++__next; + if (__pred(*__first)) erase(__first); + __first = __next; + } +} + +template <class _Tp, class _Alloc> template <class _BinaryPredicate> +void list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred) +{ + iterator __first = begin(); + iterator __last = end(); + if (__first == __last) return; + iterator __next = __first; + while (++__next != __last) { + if (__binary_pred(*__first, *__next)) + erase(__next); + else + __first = __next; + __next = __first; + } +} + +template <class _Tp, class _Alloc> template <class _StrictWeakOrdering> +void list<_Tp, _Alloc>::merge(list<_Tp, _Alloc>& __x, + _StrictWeakOrdering __comp) +{ + iterator __first1 = begin(); + iterator __last1 = end(); + iterator __first2 = __x.begin(); + iterator __last2 = __x.end(); + while (__first1 != __last1 && __first2 != __last2) + if (__comp(*__first2, *__first1)) { + iterator __next = __first2; + transfer(__first1, __first2, ++__next); + __first2 = __next; + } + else + ++__first1; + if (__first2 != __last2) transfer(__last1, __first2, __last2); +} + +template <class _Tp, class _Alloc> template <class _StrictWeakOrdering> +void list<_Tp, _Alloc>::sort(_StrictWeakOrdering __comp) +{ + // Do nothing if the list has length 0 or 1. + if (_M_node->_M_next != _M_node && _M_node->_M_next->_M_next != _M_node) { + list<_Tp, _Alloc> __carry; + list<_Tp, _Alloc> __counter[64]; + int __fill = 0; + while (!empty()) { + __carry.splice(__carry.begin(), *this, begin()); + int __i = 0; + while(__i < __fill && !__counter[__i].empty()) { + __counter[__i].merge(__carry, __comp); + __carry.swap(__counter[__i++]); + } + __carry.swap(__counter[__i]); + if (__i == __fill) ++__fill; + } + + for (int __i = 1; __i < __fill; ++__i) + __counter[__i].merge(__counter[__i-1], __comp); + swap(__counter[__fill-1]); + } +} + +#endif /* __STL_MEMBER_TEMPLATES */ + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1174 +#pragma reset woff 1375 +#endif + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_LIST_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_map.h b/dtm_release/local/include/stl/stl_map.h new file mode 100644 index 0000000000000000000000000000000000000000..a2ea66c5483a0654b7bcd9c10382e4d53f483a72 --- /dev/null +++ b/dtm_release/local/include/stl/stl_map.h @@ -0,0 +1,295 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_MAP_H +#define __SGI_STL_INTERNAL_MAP_H + +#include <concept_checks.h> + +__STL_BEGIN_NAMESPACE + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1174 +#pragma set woff 1375 +#endif + +// Forward declarations of operators == and <, needed for friend declarations. +template <class _Key, class _Tp, + class _Compare __STL_DEPENDENT_DEFAULT_TMPL(less<_Key>), + class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) > +class map; + +template <class _Key, class _Tp, class _Compare, class _Alloc> +inline bool operator==(const map<_Key,_Tp,_Compare,_Alloc>& __x, + const map<_Key,_Tp,_Compare,_Alloc>& __y); + +template <class _Key, class _Tp, class _Compare, class _Alloc> +inline bool operator<(const map<_Key,_Tp,_Compare,_Alloc>& __x, + const map<_Key,_Tp,_Compare,_Alloc>& __y); + +template <class _Key, class _Tp, class _Compare, class _Alloc> +class map { +public: + +// requirements: + + __STL_CLASS_REQUIRES(_Tp, _Assignable); + __STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Key, _Key); + +// typedefs: + + typedef _Key key_type; + typedef _Tp data_type; + typedef _Tp mapped_type; + typedef pair<const _Key, _Tp> value_type; + typedef _Compare key_compare; + + class value_compare + : public binary_function<value_type, value_type, bool> { + friend class map<_Key,_Tp,_Compare,_Alloc>; + protected : + _Compare comp; + value_compare(_Compare __c) : comp(__c) {} + public: + bool operator()(const value_type& __x, const value_type& __y) const { + return comp(__x.first, __y.first); + } + }; + +private: + typedef _Rb_tree<key_type, value_type, + _Select1st<value_type>, key_compare, _Alloc> _Rep_type; + _Rep_type _M_t; // red-black tree representing map +public: + typedef typename _Rep_type::pointer pointer; + typedef typename _Rep_type::const_pointer const_pointer; + typedef typename _Rep_type::reference reference; + typedef typename _Rep_type::const_reference const_reference; + typedef typename _Rep_type::iterator iterator; + typedef typename _Rep_type::const_iterator const_iterator; + typedef typename _Rep_type::reverse_iterator reverse_iterator; + typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; + typedef typename _Rep_type::size_type size_type; + typedef typename _Rep_type::difference_type difference_type; + typedef typename _Rep_type::allocator_type allocator_type; + + // allocation/deallocation + + map() : _M_t(_Compare(), allocator_type()) {} + explicit map(const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) {} + +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + map(_InputIterator __first, _InputIterator __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_unique(__first, __last); } + + template <class _InputIterator> + map(_InputIterator __first, _InputIterator __last, const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); } +#else + map(const value_type* __first, const value_type* __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_unique(__first, __last); } + + map(const value_type* __first, + const value_type* __last, const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); } + + map(const_iterator __first, const_iterator __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_unique(__first, __last); } + + map(const_iterator __first, const_iterator __last, const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); } + +#endif /* __STL_MEMBER_TEMPLATES */ + + map(const map<_Key,_Tp,_Compare,_Alloc>& __x) : _M_t(__x._M_t) {} + map<_Key,_Tp,_Compare,_Alloc>& + operator=(const map<_Key, _Tp, _Compare, _Alloc>& __x) + { + _M_t = __x._M_t; + return *this; + } + + // accessors: + + key_compare key_comp() const { return _M_t.key_comp(); } + value_compare value_comp() const { return value_compare(_M_t.key_comp()); } + allocator_type get_allocator() const { return _M_t.get_allocator(); } + + iterator begin() { return _M_t.begin(); } + const_iterator begin() const { return _M_t.begin(); } + iterator end() { return _M_t.end(); } + const_iterator end() const { return _M_t.end(); } + reverse_iterator rbegin() { return _M_t.rbegin(); } + const_reverse_iterator rbegin() const { return _M_t.rbegin(); } + reverse_iterator rend() { return _M_t.rend(); } + const_reverse_iterator rend() const { return _M_t.rend(); } + bool empty() const { return _M_t.empty(); } + size_type size() const { return _M_t.size(); } + size_type max_size() const { return _M_t.max_size(); } + _Tp& operator[](const key_type& __k) { + iterator __i = lower_bound(__k); + // __i->first is greater than or equivalent to __k. + if (__i == end() || key_comp()(__k, (*__i).first)) + __i = insert(__i, value_type(__k, _Tp())); + return (*__i).second; + } + void swap(map<_Key,_Tp,_Compare,_Alloc>& __x) { _M_t.swap(__x._M_t); } + + // insert/erase + + pair<iterator,bool> insert(const value_type& __x) + { return _M_t.insert_unique(__x); } + iterator insert(iterator position, const value_type& __x) + { return _M_t.insert_unique(position, __x); } +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + void insert(_InputIterator __first, _InputIterator __last) { + _M_t.insert_unique(__first, __last); + } +#else + void insert(const value_type* __first, const value_type* __last) { + _M_t.insert_unique(__first, __last); + } + void insert(const_iterator __first, const_iterator __last) { + _M_t.insert_unique(__first, __last); + } +#endif /* __STL_MEMBER_TEMPLATES */ + + void erase(iterator __position) { _M_t.erase(__position); } + size_type erase(const key_type& __x) { return _M_t.erase(__x); } + void erase(iterator __first, iterator __last) + { _M_t.erase(__first, __last); } + void clear() { _M_t.clear(); } + + // map operations: + + iterator find(const key_type& __x) { return _M_t.find(__x); } + const_iterator find(const key_type& __x) const { return _M_t.find(__x); } + size_type count(const key_type& __x) const { + return _M_t.find(__x) == _M_t.end() ? 0 : 1; + } + iterator lower_bound(const key_type& __x) {return _M_t.lower_bound(__x); } + const_iterator lower_bound(const key_type& __x) const { + return _M_t.lower_bound(__x); + } + iterator upper_bound(const key_type& __x) {return _M_t.upper_bound(__x); } + const_iterator upper_bound(const key_type& __x) const { + return _M_t.upper_bound(__x); + } + + pair<iterator,iterator> equal_range(const key_type& __x) { + return _M_t.equal_range(__x); + } + pair<const_iterator,const_iterator> equal_range(const key_type& __x) const { + return _M_t.equal_range(__x); + } + +#ifdef __STL_TEMPLATE_FRIENDS + template <class _K1, class _T1, class _C1, class _A1> + friend bool operator== (const map<_K1, _T1, _C1, _A1>&, + const map<_K1, _T1, _C1, _A1>&); + template <class _K1, class _T1, class _C1, class _A1> + friend bool operator< (const map<_K1, _T1, _C1, _A1>&, + const map<_K1, _T1, _C1, _A1>&); +#else /* __STL_TEMPLATE_FRIENDS */ + friend bool __STD_QUALIFIER + operator== __STL_NULL_TMPL_ARGS (const map&, const map&); + friend bool __STD_QUALIFIER + operator< __STL_NULL_TMPL_ARGS (const map&, const map&); +#endif /* __STL_TEMPLATE_FRIENDS */ +}; + +template <class _Key, class _Tp, class _Compare, class _Alloc> +inline bool operator==(const map<_Key,_Tp,_Compare,_Alloc>& __x, + const map<_Key,_Tp,_Compare,_Alloc>& __y) { + return __x._M_t == __y._M_t; +} + +template <class _Key, class _Tp, class _Compare, class _Alloc> +inline bool operator<(const map<_Key,_Tp,_Compare,_Alloc>& __x, + const map<_Key,_Tp,_Compare,_Alloc>& __y) { + return __x._M_t < __y._M_t; +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Key, class _Tp, class _Compare, class _Alloc> +inline bool operator!=(const map<_Key,_Tp,_Compare,_Alloc>& __x, + const map<_Key,_Tp,_Compare,_Alloc>& __y) { + return !(__x == __y); +} + +template <class _Key, class _Tp, class _Compare, class _Alloc> +inline bool operator>(const map<_Key,_Tp,_Compare,_Alloc>& __x, + const map<_Key,_Tp,_Compare,_Alloc>& __y) { + return __y < __x; +} + +template <class _Key, class _Tp, class _Compare, class _Alloc> +inline bool operator<=(const map<_Key,_Tp,_Compare,_Alloc>& __x, + const map<_Key,_Tp,_Compare,_Alloc>& __y) { + return !(__y < __x); +} + +template <class _Key, class _Tp, class _Compare, class _Alloc> +inline bool operator>=(const map<_Key,_Tp,_Compare,_Alloc>& __x, + const map<_Key,_Tp,_Compare,_Alloc>& __y) { + return !(__x < __y); +} + +template <class _Key, class _Tp, class _Compare, class _Alloc> +inline void swap(map<_Key,_Tp,_Compare,_Alloc>& __x, + map<_Key,_Tp,_Compare,_Alloc>& __y) { + __x.swap(__y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1174 +#pragma reset woff 1375 +#endif + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_MAP_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_multimap.h b/dtm_release/local/include/stl/stl_multimap.h new file mode 100644 index 0000000000000000000000000000000000000000..ecd959c5e9f4a7246987b7fa64318ae1f62b154d --- /dev/null +++ b/dtm_release/local/include/stl/stl_multimap.h @@ -0,0 +1,282 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_MULTIMAP_H +#define __SGI_STL_INTERNAL_MULTIMAP_H + +#include <concept_checks.h> + +__STL_BEGIN_NAMESPACE + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1174 +#pragma set woff 1375 +#endif + +// Forward declaration of operators < and ==, needed for friend declaration. + +template <class _Key, class _Tp, + class _Compare __STL_DEPENDENT_DEFAULT_TMPL(less<_Key>), + class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) > +class multimap; + +template <class _Key, class _Tp, class _Compare, class _Alloc> +inline bool operator==(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, + const multimap<_Key,_Tp,_Compare,_Alloc>& __y); + +template <class _Key, class _Tp, class _Compare, class _Alloc> +inline bool operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, + const multimap<_Key,_Tp,_Compare,_Alloc>& __y); + +template <class _Key, class _Tp, class _Compare, class _Alloc> +class multimap { + // requirements: + + __STL_CLASS_REQUIRES(_Tp, _Assignable); + __STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Key, _Key); + +public: + +// typedefs: + + typedef _Key key_type; + typedef _Tp data_type; + typedef _Tp mapped_type; + typedef pair<const _Key, _Tp> value_type; + typedef _Compare key_compare; + + class value_compare : public binary_function<value_type, value_type, bool> { + friend class multimap<_Key,_Tp,_Compare,_Alloc>; + protected: + _Compare comp; + value_compare(_Compare __c) : comp(__c) {} + public: + bool operator()(const value_type& __x, const value_type& __y) const { + return comp(__x.first, __y.first); + } + }; + +private: + typedef _Rb_tree<key_type, value_type, + _Select1st<value_type>, key_compare, _Alloc> _Rep_type; + _Rep_type _M_t; // red-black tree representing multimap +public: + typedef typename _Rep_type::pointer pointer; + typedef typename _Rep_type::const_pointer const_pointer; + typedef typename _Rep_type::reference reference; + typedef typename _Rep_type::const_reference const_reference; + typedef typename _Rep_type::iterator iterator; + typedef typename _Rep_type::const_iterator const_iterator; + typedef typename _Rep_type::reverse_iterator reverse_iterator; + typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; + typedef typename _Rep_type::size_type size_type; + typedef typename _Rep_type::difference_type difference_type; + typedef typename _Rep_type::allocator_type allocator_type; + +// allocation/deallocation + + multimap() : _M_t(_Compare(), allocator_type()) { } + explicit multimap(const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { } + +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + multimap(_InputIterator __first, _InputIterator __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_equal(__first, __last); } + + template <class _InputIterator> + multimap(_InputIterator __first, _InputIterator __last, + const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); } +#else + multimap(const value_type* __first, const value_type* __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_equal(__first, __last); } + multimap(const value_type* __first, const value_type* __last, + const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); } + + multimap(const_iterator __first, const_iterator __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_equal(__first, __last); } + multimap(const_iterator __first, const_iterator __last, + const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); } +#endif /* __STL_MEMBER_TEMPLATES */ + + multimap(const multimap<_Key,_Tp,_Compare,_Alloc>& __x) : _M_t(__x._M_t) { } + multimap<_Key,_Tp,_Compare,_Alloc>& + operator=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x) { + _M_t = __x._M_t; + return *this; + } + + // accessors: + + key_compare key_comp() const { return _M_t.key_comp(); } + value_compare value_comp() const { return value_compare(_M_t.key_comp()); } + allocator_type get_allocator() const { return _M_t.get_allocator(); } + + iterator begin() { return _M_t.begin(); } + const_iterator begin() const { return _M_t.begin(); } + iterator end() { return _M_t.end(); } + const_iterator end() const { return _M_t.end(); } + reverse_iterator rbegin() { return _M_t.rbegin(); } + const_reverse_iterator rbegin() const { return _M_t.rbegin(); } + reverse_iterator rend() { return _M_t.rend(); } + const_reverse_iterator rend() const { return _M_t.rend(); } + bool empty() const { return _M_t.empty(); } + size_type size() const { return _M_t.size(); } + size_type max_size() const { return _M_t.max_size(); } + void swap(multimap<_Key,_Tp,_Compare,_Alloc>& __x) { _M_t.swap(__x._M_t); } + + // insert/erase + + iterator insert(const value_type& __x) { return _M_t.insert_equal(__x); } + iterator insert(iterator __position, const value_type& __x) { + return _M_t.insert_equal(__position, __x); + } +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + void insert(_InputIterator __first, _InputIterator __last) { + _M_t.insert_equal(__first, __last); + } +#else + void insert(const value_type* __first, const value_type* __last) { + _M_t.insert_equal(__first, __last); + } + void insert(const_iterator __first, const_iterator __last) { + _M_t.insert_equal(__first, __last); + } +#endif /* __STL_MEMBER_TEMPLATES */ + void erase(iterator __position) { _M_t.erase(__position); } + size_type erase(const key_type& __x) { return _M_t.erase(__x); } + void erase(iterator __first, iterator __last) + { _M_t.erase(__first, __last); } + void clear() { _M_t.clear(); } + + // multimap operations: + + iterator find(const key_type& __x) { return _M_t.find(__x); } + const_iterator find(const key_type& __x) const { return _M_t.find(__x); } + size_type count(const key_type& __x) const { return _M_t.count(__x); } + iterator lower_bound(const key_type& __x) {return _M_t.lower_bound(__x); } + const_iterator lower_bound(const key_type& __x) const { + return _M_t.lower_bound(__x); + } + iterator upper_bound(const key_type& __x) {return _M_t.upper_bound(__x); } + const_iterator upper_bound(const key_type& __x) const { + return _M_t.upper_bound(__x); + } + pair<iterator,iterator> equal_range(const key_type& __x) { + return _M_t.equal_range(__x); + } + pair<const_iterator,const_iterator> equal_range(const key_type& __x) const { + return _M_t.equal_range(__x); + } + +#ifdef __STL_TEMPLATE_FRIENDS + template <class _K1, class _T1, class _C1, class _A1> + friend bool operator== (const multimap<_K1, _T1, _C1, _A1>&, + const multimap<_K1, _T1, _C1, _A1>&); + template <class _K1, class _T1, class _C1, class _A1> + friend bool operator< (const multimap<_K1, _T1, _C1, _A1>&, + const multimap<_K1, _T1, _C1, _A1>&); +#else /* __STL_TEMPLATE_FRIENDS */ + friend bool __STD_QUALIFIER + operator== __STL_NULL_TMPL_ARGS (const multimap&, const multimap&); + friend bool __STD_QUALIFIER + operator< __STL_NULL_TMPL_ARGS (const multimap&, const multimap&); +#endif /* __STL_TEMPLATE_FRIENDS */ +}; + +template <class _Key, class _Tp, class _Compare, class _Alloc> +inline bool operator==(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, + const multimap<_Key,_Tp,_Compare,_Alloc>& __y) { + return __x._M_t == __y._M_t; +} + +template <class _Key, class _Tp, class _Compare, class _Alloc> +inline bool operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, + const multimap<_Key,_Tp,_Compare,_Alloc>& __y) { + return __x._M_t < __y._M_t; +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Key, class _Tp, class _Compare, class _Alloc> +inline bool operator!=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, + const multimap<_Key,_Tp,_Compare,_Alloc>& __y) { + return !(__x == __y); +} + +template <class _Key, class _Tp, class _Compare, class _Alloc> +inline bool operator>(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, + const multimap<_Key,_Tp,_Compare,_Alloc>& __y) { + return __y < __x; +} + +template <class _Key, class _Tp, class _Compare, class _Alloc> +inline bool operator<=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, + const multimap<_Key,_Tp,_Compare,_Alloc>& __y) { + return !(__y < __x); +} + +template <class _Key, class _Tp, class _Compare, class _Alloc> +inline bool operator>=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x, + const multimap<_Key,_Tp,_Compare,_Alloc>& __y) { + return !(__x < __y); +} + +template <class _Key, class _Tp, class _Compare, class _Alloc> +inline void swap(multimap<_Key,_Tp,_Compare,_Alloc>& __x, + multimap<_Key,_Tp,_Compare,_Alloc>& __y) { + __x.swap(__y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1174 +#pragma reset woff 1375 +#endif + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_MULTIMAP_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_multiset.h b/dtm_release/local/include/stl/stl_multiset.h new file mode 100644 index 0000000000000000000000000000000000000000..5365ffb2d4625f351b2a23e14aa1e4611e1ec8b9 --- /dev/null +++ b/dtm_release/local/include/stl/stl_multiset.h @@ -0,0 +1,274 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_MULTISET_H +#define __SGI_STL_INTERNAL_MULTISET_H + +#include <concept_checks.h> + +__STL_BEGIN_NAMESPACE + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1174 +#pragma set woff 1375 +#endif + +// Forward declaration of operators < and ==, needed for friend declaration. + +template <class _Key, class _Compare __STL_DEPENDENT_DEFAULT_TMPL(less<_Key>), + class _Alloc = __STL_DEFAULT_ALLOCATOR(_Key) > +class multiset; + +template <class _Key, class _Compare, class _Alloc> +inline bool operator==(const multiset<_Key,_Compare,_Alloc>& __x, + const multiset<_Key,_Compare,_Alloc>& __y); + +template <class _Key, class _Compare, class _Alloc> +inline bool operator<(const multiset<_Key,_Compare,_Alloc>& __x, + const multiset<_Key,_Compare,_Alloc>& __y); + +template <class _Key, class _Compare, class _Alloc> +class multiset { + // requirements: + + __STL_CLASS_REQUIRES(_Key, _Assignable); + __STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Key, _Key); + +public: + + // typedefs: + + typedef _Key key_type; + typedef _Key value_type; + typedef _Compare key_compare; + typedef _Compare value_compare; +private: + typedef _Rb_tree<key_type, value_type, + _Identity<value_type>, key_compare, _Alloc> _Rep_type; + _Rep_type _M_t; // red-black tree representing multiset +public: + typedef typename _Rep_type::const_pointer pointer; + typedef typename _Rep_type::const_pointer const_pointer; + typedef typename _Rep_type::const_reference reference; + typedef typename _Rep_type::const_reference const_reference; + typedef typename _Rep_type::const_iterator iterator; + typedef typename _Rep_type::const_iterator const_iterator; + typedef typename _Rep_type::const_reverse_iterator reverse_iterator; + typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; + typedef typename _Rep_type::size_type size_type; + typedef typename _Rep_type::difference_type difference_type; + typedef typename _Rep_type::allocator_type allocator_type; + + // allocation/deallocation + + multiset() : _M_t(_Compare(), allocator_type()) {} + explicit multiset(const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) {} + +#ifdef __STL_MEMBER_TEMPLATES + + template <class _InputIterator> + multiset(_InputIterator __first, _InputIterator __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_equal(__first, __last); } + + template <class _InputIterator> + multiset(_InputIterator __first, _InputIterator __last, + const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); } + +#else + + multiset(const value_type* __first, const value_type* __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_equal(__first, __last); } + + multiset(const value_type* __first, const value_type* __last, + const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); } + + multiset(const_iterator __first, const_iterator __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_equal(__first, __last); } + + multiset(const_iterator __first, const_iterator __last, + const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); } + +#endif /* __STL_MEMBER_TEMPLATES */ + + multiset(const multiset<_Key,_Compare,_Alloc>& __x) : _M_t(__x._M_t) {} + multiset<_Key,_Compare,_Alloc>& + operator=(const multiset<_Key,_Compare,_Alloc>& __x) { + _M_t = __x._M_t; + return *this; + } + + // accessors: + + key_compare key_comp() const { return _M_t.key_comp(); } + value_compare value_comp() const { return _M_t.key_comp(); } + allocator_type get_allocator() const { return _M_t.get_allocator(); } + + iterator begin() const { return _M_t.begin(); } + iterator end() const { return _M_t.end(); } + reverse_iterator rbegin() const { return _M_t.rbegin(); } + reverse_iterator rend() const { return _M_t.rend(); } + bool empty() const { return _M_t.empty(); } + size_type size() const { return _M_t.size(); } + size_type max_size() const { return _M_t.max_size(); } + void swap(multiset<_Key,_Compare,_Alloc>& __x) { _M_t.swap(__x._M_t); } + + // insert/erase + iterator insert(const value_type& __x) { + return _M_t.insert_equal(__x); + } + iterator insert(iterator __position, const value_type& __x) { + typedef typename _Rep_type::iterator _Rep_iterator; + return _M_t.insert_equal((_Rep_iterator&)__position, __x); + } + +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + void insert(_InputIterator __first, _InputIterator __last) { + _M_t.insert_equal(__first, __last); + } +#else + void insert(const value_type* __first, const value_type* __last) { + _M_t.insert_equal(__first, __last); + } + void insert(const_iterator __first, const_iterator __last) { + _M_t.insert_equal(__first, __last); + } +#endif /* __STL_MEMBER_TEMPLATES */ + void erase(iterator __position) { + typedef typename _Rep_type::iterator _Rep_iterator; + _M_t.erase((_Rep_iterator&)__position); + } + size_type erase(const key_type& __x) { + return _M_t.erase(__x); + } + void erase(iterator __first, iterator __last) { + typedef typename _Rep_type::iterator _Rep_iterator; + _M_t.erase((_Rep_iterator&)__first, (_Rep_iterator&)__last); + } + void clear() { _M_t.clear(); } + + // multiset operations: + + iterator find(const key_type& __x) const { return _M_t.find(__x); } + size_type count(const key_type& __x) const { return _M_t.count(__x); } + iterator lower_bound(const key_type& __x) const { + return _M_t.lower_bound(__x); + } + iterator upper_bound(const key_type& __x) const { + return _M_t.upper_bound(__x); + } + pair<iterator,iterator> equal_range(const key_type& __x) const { + return _M_t.equal_range(__x); + } + +#ifdef __STL_TEMPLATE_FRIENDS + template <class _K1, class _C1, class _A1> + friend bool operator== (const multiset<_K1,_C1,_A1>&, + const multiset<_K1,_C1,_A1>&); + template <class _K1, class _C1, class _A1> + friend bool operator< (const multiset<_K1,_C1,_A1>&, + const multiset<_K1,_C1,_A1>&); +#else /* __STL_TEMPLATE_FRIENDS */ + friend bool __STD_QUALIFIER + operator== __STL_NULL_TMPL_ARGS (const multiset&, const multiset&); + friend bool __STD_QUALIFIER + operator< __STL_NULL_TMPL_ARGS (const multiset&, const multiset&); +#endif /* __STL_TEMPLATE_FRIENDS */ +}; + +template <class _Key, class _Compare, class _Alloc> +inline bool operator==(const multiset<_Key,_Compare,_Alloc>& __x, + const multiset<_Key,_Compare,_Alloc>& __y) { + return __x._M_t == __y._M_t; +} + +template <class _Key, class _Compare, class _Alloc> +inline bool operator<(const multiset<_Key,_Compare,_Alloc>& __x, + const multiset<_Key,_Compare,_Alloc>& __y) { + return __x._M_t < __y._M_t; +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Key, class _Compare, class _Alloc> +inline bool operator!=(const multiset<_Key,_Compare,_Alloc>& __x, + const multiset<_Key,_Compare,_Alloc>& __y) { + return !(__x == __y); +} + +template <class _Key, class _Compare, class _Alloc> +inline bool operator>(const multiset<_Key,_Compare,_Alloc>& __x, + const multiset<_Key,_Compare,_Alloc>& __y) { + return __y < __x; +} + +template <class _Key, class _Compare, class _Alloc> +inline bool operator<=(const multiset<_Key,_Compare,_Alloc>& __x, + const multiset<_Key,_Compare,_Alloc>& __y) { + return !(__y < __x); +} + +template <class _Key, class _Compare, class _Alloc> +inline bool operator>=(const multiset<_Key,_Compare,_Alloc>& __x, + const multiset<_Key,_Compare,_Alloc>& __y) { + return !(__x < __y); +} + +template <class _Key, class _Compare, class _Alloc> +inline void swap(multiset<_Key,_Compare,_Alloc>& __x, + multiset<_Key,_Compare,_Alloc>& __y) { + __x.swap(__y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1174 +#pragma reset woff 1375 +#endif + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_MULTISET_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_numeric.h b/dtm_release/local/include/stl/stl_numeric.h new file mode 100644 index 0000000000000000000000000000000000000000..f8e95944301876686a7d436ecabb36367d8c3d4e --- /dev/null +++ b/dtm_release/local/include/stl/stl_numeric.h @@ -0,0 +1,255 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + + +#ifndef __SGI_STL_INTERNAL_NUMERIC_H +#define __SGI_STL_INTERNAL_NUMERIC_H + +__STL_BEGIN_NAMESPACE + +template <class _InputIterator, class _Tp> +_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) +{ + __STL_REQUIRES(_InputIterator, _InputIterator); + for ( ; __first != __last; ++__first) + __init = __init + *__first; + return __init; +} + +template <class _InputIterator, class _Tp, class _BinaryOperation> +_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, + _BinaryOperation __binary_op) +{ + __STL_REQUIRES(_InputIterator, _InputIterator); + for ( ; __first != __last; ++__first) + __init = __binary_op(__init, *__first); + return __init; +} + +template <class _InputIterator1, class _InputIterator2, class _Tp> +_Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _Tp __init) +{ + __STL_REQUIRES(_InputIterator2, _InputIterator); + __STL_REQUIRES(_InputIterator2, _InputIterator); + for ( ; __first1 != __last1; ++__first1, ++__first2) + __init = __init + (*__first1 * *__first2); + return __init; +} + +template <class _InputIterator1, class _InputIterator2, class _Tp, + class _BinaryOperation1, class _BinaryOperation2> +_Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _Tp __init, + _BinaryOperation1 __binary_op1, + _BinaryOperation2 __binary_op2) +{ + __STL_REQUIRES(_InputIterator2, _InputIterator); + __STL_REQUIRES(_InputIterator2, _InputIterator); + for ( ; __first1 != __last1; ++__first1, ++__first2) + __init = __binary_op1(__init, __binary_op2(*__first1, *__first2)); + return __init; +} + +template <class _InputIterator, class _OutputIterator, class _Tp> +_OutputIterator +__partial_sum(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _Tp*) +{ + _Tp __value = *__first; + while (++__first != __last) { + __value = __value + *__first; + *++__result = __value; + } + return ++__result; +} + +template <class _InputIterator, class _OutputIterator> +_OutputIterator +partial_sum(_InputIterator __first, _InputIterator __last, + _OutputIterator __result) +{ + __STL_REQUIRES(_InputIterator, _InputIterator); + __STL_REQUIRES(_OutputIterator, _OutputIterator); + if (__first == __last) return __result; + *__result = *__first; + return __partial_sum(__first, __last, __result, __VALUE_TYPE(__first)); +} + +template <class _InputIterator, class _OutputIterator, class _Tp, + class _BinaryOperation> +_OutputIterator +__partial_sum(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _Tp*, _BinaryOperation __binary_op) +{ + _Tp __value = *__first; + while (++__first != __last) { + __value = __binary_op(__value, *__first); + *++__result = __value; + } + return ++__result; +} + +template <class _InputIterator, class _OutputIterator, class _BinaryOperation> +_OutputIterator +partial_sum(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _BinaryOperation __binary_op) +{ + __STL_REQUIRES(_InputIterator, _InputIterator); + __STL_REQUIRES(_OutputIterator, _OutputIterator); + if (__first == __last) return __result; + *__result = *__first; + return __partial_sum(__first, __last, __result, __VALUE_TYPE(__first), + __binary_op); +} + +template <class _InputIterator, class _OutputIterator, class _Tp> +_OutputIterator +__adjacent_difference(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _Tp*) +{ + _Tp __value = *__first; + while (++__first != __last) { + _Tp __tmp = *__first; + *++__result = __tmp - __value; + __value = __tmp; + } + return ++__result; +} + +template <class _InputIterator, class _OutputIterator> +_OutputIterator +adjacent_difference(_InputIterator __first, + _InputIterator __last, _OutputIterator __result) +{ + __STL_REQUIRES(_InputIterator, _InputIterator); + __STL_REQUIRES(_OutputIterator, _OutputIterator); + if (__first == __last) return __result; + *__result = *__first; + return __adjacent_difference(__first, __last, __result, + __VALUE_TYPE(__first)); +} + +template <class _InputIterator, class _OutputIterator, class _Tp, + class _BinaryOperation> +_OutputIterator +__adjacent_difference(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _Tp*, + _BinaryOperation __binary_op) { + _Tp __value = *__first; + while (++__first != __last) { + _Tp __tmp = *__first; + *++__result = __binary_op(__tmp, __value); + __value = __tmp; + } + return ++__result; +} + +template <class _InputIterator, class _OutputIterator, class _BinaryOperation> +_OutputIterator +adjacent_difference(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _BinaryOperation __binary_op) +{ + __STL_REQUIRES(_InputIterator, _InputIterator); + __STL_REQUIRES(_OutputIterator, _OutputIterator); + if (__first == __last) return __result; + *__result = *__first; + return __adjacent_difference(__first, __last, __result, + __VALUE_TYPE(__first), + __binary_op); +} + +// Returns __x ** __n, where __n >= 0. _Note that "multiplication" +// is required to be associative, but not necessarily commutative. + + +template <class _Tp, class _Integer, class _MonoidOperation> +_Tp __power(_Tp __x, _Integer __n, _MonoidOperation __opr) +{ + if (__n == 0) + return identity_element(__opr); + else { + while ((__n & 1) == 0) { + __n >>= 1; + __x = __opr(__x, __x); + } + + _Tp __result = __x; + __n >>= 1; + while (__n != 0) { + __x = __opr(__x, __x); + if ((__n & 1) != 0) + __result = __opr(__result, __x); + __n >>= 1; + } + return __result; + } +} + +template <class _Tp, class _Integer> +inline _Tp __power(_Tp __x, _Integer __n) +{ + return __power(__x, __n, multiplies<_Tp>()); +} + +// Alias for the internal name __power. Note that power is an extension, +// not part of the C++ standard. + +template <class _Tp, class _Integer, class _MonoidOperation> +inline _Tp power(_Tp __x, _Integer __n, _MonoidOperation __opr) +{ + return __power(__x, __n, __opr); +} + +template <class _Tp, class _Integer> +inline _Tp power(_Tp __x, _Integer __n) +{ + return __power(__x, __n); +} + +// iota is not part of the C++ standard. It is an extension. + +template <class _ForwardIter, class _Tp> +void +iota(_ForwardIter __first, _ForwardIter __last, _Tp __value) +{ + __STL_REQUIRES(_ForwardIter, _Mutable_ForwardIterator); + __STL_CONVERTIBLE(_Tp, typename iterator_traits<_ForwardIter>::value_type); + while (__first != __last) + *__first++ = __value++; +} + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_NUMERIC_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_pair.h b/dtm_release/local/include/stl/stl_pair.h new file mode 100644 index 0000000000000000000000000000000000000000..a6155a698e1c7d3a35b7e8f9f6a0de497c8883d0 --- /dev/null +++ b/dtm_release/local/include/stl/stl_pair.h @@ -0,0 +1,101 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_PAIR_H +#define __SGI_STL_INTERNAL_PAIR_H + +__STL_BEGIN_NAMESPACE + +template <class _T1, class _T2> +struct pair { + typedef _T1 first_type; + typedef _T2 second_type; + + _T1 first; + _T2 second; + pair() : first(_T1()), second(_T2()) {} + pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {} + +#ifdef __STL_MEMBER_TEMPLATES + template <class _U1, class _U2> + pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {} +#endif +}; + +template <class _T1, class _T2> +inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) +{ + return __x.first == __y.first && __x.second == __y.second; +} + +template <class _T1, class _T2> +inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) +{ + return __x.first < __y.first || + (!(__y.first < __x.first) && __x.second < __y.second); +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _T1, class _T2> +inline bool operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { + return !(__x == __y); +} + +template <class _T1, class _T2> +inline bool operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { + return __y < __x; +} + +template <class _T1, class _T2> +inline bool operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { + return !(__y < __x); +} + +template <class _T1, class _T2> +inline bool operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { + return !(__x < __y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +template <class _T1, class _T2> +inline pair<_T1, _T2> make_pair(const _T1& __x, const _T2& __y) +{ + return pair<_T1, _T2>(__x, __y); +} + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_PAIR_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_queue.h b/dtm_release/local/include/stl/stl_queue.h new file mode 100644 index 0000000000000000000000000000000000000000..833e45f54765d22460a4c3e2271cf97b9c5afa51 --- /dev/null +++ b/dtm_release/local/include/stl/stl_queue.h @@ -0,0 +1,243 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_QUEUE_H +#define __SGI_STL_INTERNAL_QUEUE_H + +#include <sequence_concepts.h> + +__STL_BEGIN_NAMESPACE + +// Forward declarations of operators < and ==, needed for friend declaration. + +template <class _Tp, + class _Sequence __STL_DEPENDENT_DEFAULT_TMPL(deque<_Tp>) > +class queue; + +template <class _Tp, class _Seq> +inline bool operator==(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&); + +template <class _Tp, class _Seq> +inline bool operator<(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&); + + +template <class _Tp, class _Sequence> +class queue { + + // requirements: + + __STL_CLASS_REQUIRES(_Tp, _Assignable); + __STL_CLASS_REQUIRES(_Sequence, _FrontInsertionSequence); + __STL_CLASS_REQUIRES(_Sequence, _BackInsertionSequence); + typedef typename _Sequence::value_type _Sequence_value_type; + __STL_CLASS_REQUIRES_SAME_TYPE(_Tp, _Sequence_value_type); + + +#ifdef __STL_MEMBER_TEMPLATES + template <class _Tp1, class _Seq1> + friend bool operator== (const queue<_Tp1, _Seq1>&, + const queue<_Tp1, _Seq1>&); + template <class _Tp1, class _Seq1> + friend bool operator< (const queue<_Tp1, _Seq1>&, + const queue<_Tp1, _Seq1>&); +#else /* __STL_MEMBER_TEMPLATES */ + friend bool __STD_QUALIFIER + operator== __STL_NULL_TMPL_ARGS (const queue&, const queue&); + friend bool __STD_QUALIFIER + operator< __STL_NULL_TMPL_ARGS (const queue&, const queue&); +#endif /* __STL_MEMBER_TEMPLATES */ + +public: + typedef typename _Sequence::value_type value_type; + typedef typename _Sequence::size_type size_type; + typedef _Sequence container_type; + + typedef typename _Sequence::reference reference; + typedef typename _Sequence::const_reference const_reference; +protected: + _Sequence c; +public: + queue() : c() {} + explicit queue(const _Sequence& __c) : c(__c) {} + + bool empty() const { return c.empty(); } + size_type size() const { return c.size(); } + reference front() { return c.front(); } + const_reference front() const { return c.front(); } + reference back() { return c.back(); } + const_reference back() const { return c.back(); } + void push(const value_type& __x) { c.push_back(__x); } + void pop() { c.pop_front(); } +}; + +template <class _Tp, class _Sequence> +bool +operator==(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y) +{ + return __x.c == __y.c; +} + +template <class _Tp, class _Sequence> +bool +operator<(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y) +{ + return __x.c < __y.c; +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Tp, class _Sequence> +bool +operator!=(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y) +{ + return !(__x == __y); +} + +template <class _Tp, class _Sequence> +bool +operator>(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y) +{ + return __y < __x; +} + +template <class _Tp, class _Sequence> +bool +operator<=(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y) +{ + return !(__y < __x); +} + +template <class _Tp, class _Sequence> +bool +operator>=(const queue<_Tp, _Sequence>& __x, const queue<_Tp, _Sequence>& __y) +{ + return !(__x < __y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +template <class _Tp, + class _Sequence __STL_DEPENDENT_DEFAULT_TMPL(vector<_Tp>), + class _Compare + __STL_DEPENDENT_DEFAULT_TMPL(less<typename _Sequence::value_type>) > +class priority_queue { + + // requirements: + + __STL_CLASS_REQUIRES(_Tp, _Assignable); + __STL_CLASS_REQUIRES(_Sequence, _Sequence); + __STL_CLASS_REQUIRES(_Sequence, _RandomAccessContainer); + typedef typename _Sequence::value_type _Sequence_value_type; + __STL_CLASS_REQUIRES_SAME_TYPE(_Tp, _Sequence_value_type); + __STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Tp, _Tp); + +public: + typedef typename _Sequence::value_type value_type; + typedef typename _Sequence::size_type size_type; + typedef _Sequence container_type; + + typedef typename _Sequence::reference reference; + typedef typename _Sequence::const_reference const_reference; +protected: + _Sequence c; + _Compare comp; +public: + priority_queue() : c() {} + explicit priority_queue(const _Compare& __x) : c(), comp(__x) {} + priority_queue(const _Compare& __x, const _Sequence& __s) + : c(__s), comp(__x) + { make_heap(c.begin(), c.end(), comp); } + +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + priority_queue(_InputIterator __first, _InputIterator __last) + : c(__first, __last) { make_heap(c.begin(), c.end(), comp); } + + template <class _InputIterator> + priority_queue(_InputIterator __first, + _InputIterator __last, const _Compare& __x) + : c(__first, __last), comp(__x) + { make_heap(c.begin(), c.end(), comp); } + + template <class _InputIterator> + priority_queue(_InputIterator __first, _InputIterator __last, + const _Compare& __x, const _Sequence& __s) + : c(__s), comp(__x) + { + c.insert(c.end(), __first, __last); + make_heap(c.begin(), c.end(), comp); + } + +#else /* __STL_MEMBER_TEMPLATES */ + priority_queue(const value_type* __first, const value_type* __last) + : c(__first, __last) { make_heap(c.begin(), c.end(), comp); } + + priority_queue(const value_type* __first, const value_type* __last, + const _Compare& __x) + : c(__first, __last), comp(__x) + { make_heap(c.begin(), c.end(), comp); } + + priority_queue(const value_type* __first, const value_type* __last, + const _Compare& __x, const _Sequence& __c) + : c(__c), comp(__x) + { + c.insert(c.end(), __first, __last); + make_heap(c.begin(), c.end(), comp); + } +#endif /* __STL_MEMBER_TEMPLATES */ + + bool empty() const { return c.empty(); } + size_type size() const { return c.size(); } + const_reference top() const { return c.front(); } + void push(const value_type& __x) { + __STL_TRY { + c.push_back(__x); + push_heap(c.begin(), c.end(), comp); + } + __STL_UNWIND(c.clear()); + } + void pop() { + __STL_TRY { + pop_heap(c.begin(), c.end(), comp); + c.pop_back(); + } + __STL_UNWIND(c.clear()); + } +}; + +// no equality is provided + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_QUEUE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_range_errors.h b/dtm_release/local/include/stl/stl_range_errors.h new file mode 100644 index 0000000000000000000000000000000000000000..3ddde6dcbd972d66e62686fc6d688d0d761594e8 --- /dev/null +++ b/dtm_release/local/include/stl/stl_range_errors.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +#ifndef __STL_RANGE_ERRORS_H +#define __STL_RANGE_ERRORS_H + +// A few places in the STL throw range errors, using standard exception +// classes defined in <stdexcept>. This header file provides functions +// to throw those exception objects. + +// __STL_DONT_THROW_RANGE_ERRORS is a hook so that users can disable +// this exception throwing. + +#include <stl_config.h> + +#if defined(__STL_CAN_THROW_RANGE_ERRORS) && \ + defined(__STL_USE_EXCEPTIONS) && \ + !defined(__STL_DONT_THROW_RANGE_ERRORS) +# define __STL_THROW_RANGE_ERRORS +#endif + +// For the SGI 7.3 compiler, declare these functions here and define them +// elsewhere. +#if defined(__STL_THROW_RANGE_ERRORS) && \ + defined(__sgi) && !defined(__GNUC__) && \ + _COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS) + +__STL_BEGIN_NAMESPACE +void __stl_throw_range_error(const char* __msg); +void __stl_throw_length_error(const char* __msg); +__STL_END_NAMESPACE + +// For other compilers where we're throwing range errors, include the +// stdexcept header and throw the appropriate exceptions directly. +#elif defined(__STL_THROW_RANGE_ERRORS) + +#include <stdexcept> + +__STL_BEGIN_NAMESPACE +inline void __stl_throw_range_error(const char* __msg) + { throw range_error(__msg); } +inline void __stl_throw_length_error(const char* __msg) + { throw length_error(__msg); } +__STL_END_NAMESPACE + +// Otherwise, define inline functions that do nothing. +#else + +__STL_BEGIN_NAMESPACE +inline void __stl_throw_range_error(const char*) {} +inline void __stl_throw_length_error(const char*) {} +__STL_END_NAMESPACE + +#endif + +#endif /* __STL_RANGE_ERRORS_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_raw_storage_iter.h b/dtm_release/local/include/stl/stl_raw_storage_iter.h new file mode 100644 index 0000000000000000000000000000000000000000..6f3951cb8af83b43443c3804484e6755415c8c76 --- /dev/null +++ b/dtm_release/local/include/stl/stl_raw_storage_iter.h @@ -0,0 +1,81 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_RAW_STORAGE_ITERATOR_H +#define __SGI_STL_INTERNAL_RAW_STORAGE_ITERATOR_H + +__STL_BEGIN_NAMESPACE + +template <class _ForwardIterator, class _Tp> +class raw_storage_iterator { +protected: + _ForwardIterator _M_iter; +public: + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + explicit raw_storage_iterator(_ForwardIterator __x) : _M_iter(__x) {} + raw_storage_iterator& operator*() { return *this; } + raw_storage_iterator& operator=(const _Tp& __element) { + construct(&*_M_iter, __element); + return *this; + } + raw_storage_iterator<_ForwardIterator, _Tp>& operator++() { + ++_M_iter; + return *this; + } + raw_storage_iterator<_ForwardIterator, _Tp> operator++(int) { + raw_storage_iterator<_ForwardIterator, _Tp> __tmp = *this; + ++_M_iter; + return __tmp; + } +}; + +#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION + +template <class _ForwardIterator, class _Tp> +inline output_iterator_tag +iterator_category(const raw_storage_iterator<_ForwardIterator, _Tp>&) +{ + return output_iterator_tag(); +} + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_RAW_STORAGE_ITERATOR_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_relops.h b/dtm_release/local/include/stl/stl_relops.h new file mode 100644 index 0000000000000000000000000000000000000000..16cad1b84e20feed343226f3c00e5b028ba462d1 --- /dev/null +++ b/dtm_release/local/include/stl/stl_relops.h @@ -0,0 +1,62 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * Copyright (c) 1996,1997 + * Silicon Graphics + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_RELOPS +#define __SGI_STL_INTERNAL_RELOPS + +__STL_BEGIN_RELOPS_NAMESPACE + +template <class _Tp> +inline bool operator!=(const _Tp& __x, const _Tp& __y) { + return !(__x == __y); +} + +template <class _Tp> +inline bool operator>(const _Tp& __x, const _Tp& __y) { + return __y < __x; +} + +template <class _Tp> +inline bool operator<=(const _Tp& __x, const _Tp& __y) { + return !(__y < __x); +} + +template <class _Tp> +inline bool operator>=(const _Tp& __x, const _Tp& __y) { + return !(__x < __y); +} + +__STL_END_RELOPS_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_RELOPS */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_rope.h b/dtm_release/local/include/stl/stl_rope.h new file mode 100644 index 0000000000000000000000000000000000000000..54ddb70d0c460df3edd8f4a7335545a85c06feb3 --- /dev/null +++ b/dtm_release/local/include/stl/stl_rope.h @@ -0,0 +1,2714 @@ +/* + * Copyright (c) 1997-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +// rope<_CharT,_Alloc> is a sequence of _CharT. +// Ropes appear to be mutable, but update operations +// really copy enough of the data structure to leave the original +// valid. Thus ropes can be logically copied by just copying +// a pointer value. + +#ifndef __SGI_STL_INTERNAL_ROPE_H +# define __SGI_STL_INTERNAL_ROPE_H + +# ifdef __GC +# define __GC_CONST const +# else +# include <stl_threads.h> +# define __GC_CONST // constant except for deallocation +# endif +# ifdef __STL_SGI_THREADS +# include <mutex.h> +# endif + +__STL_BEGIN_NAMESPACE + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1174 +#endif + +// The _S_eos function is used for those functions that +// convert to/from C-like strings to detect the end of the string. + +// The end-of-C-string character. +// This is what the draft standard says it should be. +template <class _CharT> +inline _CharT _S_eos(_CharT*) { return _CharT(); } + +// Test for basic character types. +// For basic character types leaves having a trailing eos. +template <class _CharT> +inline bool _S_is_basic_char_type(_CharT*) { return false; } +template <class _CharT> +inline bool _S_is_one_byte_char_type(_CharT*) { return false; } + +inline bool _S_is_basic_char_type(char*) { return true; } +inline bool _S_is_one_byte_char_type(char*) { return true; } +inline bool _S_is_basic_char_type(wchar_t*) { return true; } + +// Store an eos iff _CharT is a basic character type. +// Do not reference _S_eos if it isn't. +template <class _CharT> +inline void _S_cond_store_eos(_CharT&) {} + +inline void _S_cond_store_eos(char& __c) { __c = 0; } +inline void _S_cond_store_eos(wchar_t& __c) { __c = 0; } + +// char_producers are logically functions that generate a section of +// a string. These can be convereted to ropes. The resulting rope +// invokes the char_producer on demand. This allows, for example, +// files to be viewed as ropes without reading the entire file. +template <class _CharT> +class char_producer { + public: + virtual ~char_producer() {}; + virtual void operator()(size_t __start_pos, size_t __len, + _CharT* __buffer) = 0; + // Buffer should really be an arbitrary output iterator. + // That way we could flatten directly into an ostream, etc. + // This is thoroughly impossible, since iterator types don't + // have runtime descriptions. +}; + +// Sequence buffers: +// +// Sequence must provide an append operation that appends an +// array to the sequence. Sequence buffers are useful only if +// appending an entire array is cheaper than appending element by element. +// This is true for many string representations. +// This should perhaps inherit from ostream<sequence::value_type> +// and be implemented correspondingly, so that they can be used +// for formatted. For the sake of portability, we don't do this yet. +// +// For now, sequence buffers behave as output iterators. But they also +// behave a little like basic_ostringstream<sequence::value_type> and a +// little like containers. + +template<class _Sequence, size_t _Buf_sz = 100 +# if defined(__sgi) && !defined(__GNUC__) +# define __TYPEDEF_WORKAROUND + ,class _V = typename _Sequence::value_type +# endif + > +// The 3rd parameter works around a common compiler bug. +class sequence_buffer : public output_iterator { + public: +# ifndef __TYPEDEF_WORKAROUND + typedef typename _Sequence::value_type value_type; +# else + typedef _V value_type; +# endif + protected: + _Sequence* _M_prefix; + value_type _M_buffer[_Buf_sz]; + size_t _M_buf_count; + public: + void flush() { + _M_prefix->append(_M_buffer, _M_buffer + _M_buf_count); + _M_buf_count = 0; + } + ~sequence_buffer() { flush(); } + sequence_buffer() : _M_prefix(0), _M_buf_count(0) {} + sequence_buffer(const sequence_buffer& __x) { + _M_prefix = __x._M_prefix; + _M_buf_count = __x._M_buf_count; + copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer); + } + sequence_buffer(sequence_buffer& __x) { + __x.flush(); + _M_prefix = __x._M_prefix; + _M_buf_count = 0; + } + sequence_buffer(_Sequence& __s) : _M_prefix(&__s), _M_buf_count(0) {} + sequence_buffer& operator= (sequence_buffer& __x) { + __x.flush(); + _M_prefix = __x._M_prefix; + _M_buf_count = 0; + return *this; + } + sequence_buffer& operator= (const sequence_buffer& __x) { + _M_prefix = __x._M_prefix; + _M_buf_count = __x._M_buf_count; + copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer); + return *this; + } + void push_back(value_type __x) + { + if (_M_buf_count < _Buf_sz) { + _M_buffer[_M_buf_count] = __x; + ++_M_buf_count; + } else { + flush(); + _M_buffer[0] = __x; + _M_buf_count = 1; + } + } + void append(value_type* __s, size_t __len) + { + if (__len + _M_buf_count <= _Buf_sz) { + size_t __i = _M_buf_count; + size_t __j = 0; + for (; __j < __len; __i++, __j++) { + _M_buffer[__i] = __s[__j]; + } + _M_buf_count += __len; + } else if (0 == _M_buf_count) { + _M_prefix->append(__s, __s + __len); + } else { + flush(); + append(__s, __len); + } + } + sequence_buffer& write(value_type* __s, size_t __len) + { + append(__s, __len); + return *this; + } + sequence_buffer& put(value_type __x) + { + push_back(__x); + return *this; + } + sequence_buffer& operator=(const value_type& __rhs) + { + push_back(__rhs); + return *this; + } + sequence_buffer& operator*() { return *this; } + sequence_buffer& operator++() { return *this; } + sequence_buffer& operator++(int) { return *this; } +}; + +// The following should be treated as private, at least for now. +template<class _CharT> +class _Rope_char_consumer { + public: + // If we had member templates, these should not be virtual. + // For now we need to use run-time parametrization where + // compile-time would do. Hence this should all be private + // for now. + // The symmetry with char_producer is accidental and temporary. + virtual ~_Rope_char_consumer() {}; + virtual bool operator()(const _CharT* __buffer, size_t __len) = 0; +}; + +// First a lot of forward declarations. The standard seems to require +// much stricter "declaration before use" than many of the implementations +// that preceded it. +template<class _CharT, class _Alloc=__STL_DEFAULT_ALLOCATOR(_CharT)> class rope; +template<class _CharT, class _Alloc> struct _Rope_RopeConcatenation; +template<class _CharT, class _Alloc> struct _Rope_RopeLeaf; +template<class _CharT, class _Alloc> struct _Rope_RopeFunction; +template<class _CharT, class _Alloc> struct _Rope_RopeSubstring; +template<class _CharT, class _Alloc> class _Rope_iterator; +template<class _CharT, class _Alloc> class _Rope_const_iterator; +template<class _CharT, class _Alloc> class _Rope_char_ref_proxy; +template<class _CharT, class _Alloc> class _Rope_char_ptr_proxy; + +template<class _CharT, class _Alloc> +bool operator== (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x, + const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y); + +template<class _CharT, class _Alloc> +_Rope_const_iterator<_CharT,_Alloc> operator- + (const _Rope_const_iterator<_CharT,_Alloc>& __x, + ptrdiff_t __n); + +template<class _CharT, class _Alloc> +_Rope_const_iterator<_CharT,_Alloc> operator+ + (const _Rope_const_iterator<_CharT,_Alloc>& __x, + ptrdiff_t __n); + +template<class _CharT, class _Alloc> +_Rope_const_iterator<_CharT,_Alloc> operator+ + (ptrdiff_t __n, + const _Rope_const_iterator<_CharT,_Alloc>& __x); + +template<class _CharT, class _Alloc> +bool operator== + (const _Rope_const_iterator<_CharT,_Alloc>& __x, + const _Rope_const_iterator<_CharT,_Alloc>& __y); + +template<class _CharT, class _Alloc> +bool operator< + (const _Rope_const_iterator<_CharT,_Alloc>& __x, + const _Rope_const_iterator<_CharT,_Alloc>& __y); + +template<class _CharT, class _Alloc> +ptrdiff_t operator- + (const _Rope_const_iterator<_CharT,_Alloc>& __x, + const _Rope_const_iterator<_CharT,_Alloc>& __y); + +template<class _CharT, class _Alloc> +_Rope_iterator<_CharT,_Alloc> operator- + (const _Rope_iterator<_CharT,_Alloc>& __x, + ptrdiff_t __n); + +template<class _CharT, class _Alloc> +_Rope_iterator<_CharT,_Alloc> operator+ + (const _Rope_iterator<_CharT,_Alloc>& __x, + ptrdiff_t __n); + +template<class _CharT, class _Alloc> +_Rope_iterator<_CharT,_Alloc> operator+ + (ptrdiff_t __n, + const _Rope_iterator<_CharT,_Alloc>& __x); + +template<class _CharT, class _Alloc> +bool operator== + (const _Rope_iterator<_CharT,_Alloc>& __x, + const _Rope_iterator<_CharT,_Alloc>& __y); + +template<class _CharT, class _Alloc> +bool operator< + (const _Rope_iterator<_CharT,_Alloc>& __x, + const _Rope_iterator<_CharT,_Alloc>& __y); + +template<class _CharT, class _Alloc> +ptrdiff_t operator- + (const _Rope_iterator<_CharT,_Alloc>& __x, + const _Rope_iterator<_CharT,_Alloc>& __y); + +template<class _CharT, class _Alloc> +rope<_CharT,_Alloc> operator+ (const rope<_CharT,_Alloc>& __left, + const rope<_CharT,_Alloc>& __right); + +template<class _CharT, class _Alloc> +rope<_CharT,_Alloc> operator+ (const rope<_CharT,_Alloc>& __left, + const _CharT* __right); + +template<class _CharT, class _Alloc> +rope<_CharT,_Alloc> operator+ (const rope<_CharT,_Alloc>& __left, + _CharT __right); + +// Some helpers, so we can use power on ropes. +// See below for why this isn't local to the implementation. + +// This uses a nonstandard refcount convention. +// The result has refcount 0. +template<class _CharT, class _Alloc> +struct _Rope_Concat_fn + : public binary_function<rope<_CharT,_Alloc>, rope<_CharT,_Alloc>, + rope<_CharT,_Alloc> > { + rope<_CharT,_Alloc> operator() (const rope<_CharT,_Alloc>& __x, + const rope<_CharT,_Alloc>& __y) { + return __x + __y; + } +}; + +template <class _CharT, class _Alloc> +inline +rope<_CharT,_Alloc> +identity_element(_Rope_Concat_fn<_CharT, _Alloc>) +{ + return rope<_CharT,_Alloc>(); +} + + +// +// What follows should really be local to rope. Unfortunately, +// that doesn't work, since it makes it impossible to define generic +// equality on rope iterators. According to the draft standard, the +// template parameters for such an equality operator cannot be inferred +// from the occurence of a member class as a parameter. +// (SGI compilers in fact allow this, but the __result wouldn't be +// portable.) +// Similarly, some of the static member functions are member functions +// only to avoid polluting the global namespace, and to circumvent +// restrictions on type inference for template functions. +// + +// +// The internal data structure for representing a rope. This is +// private to the implementation. A rope is really just a pointer +// to one of these. +// +// A few basic functions for manipulating this data structure +// are members of _RopeRep. Most of the more complex algorithms +// are implemented as rope members. +// +// Some of the static member functions of _RopeRep have identically +// named functions in rope that simply invoke the _RopeRep versions. +// +// A macro to introduce various allocation and deallocation functions +// These need to be defined differently depending on whether or not +// we are using standard conforming allocators, and whether the allocator +// instances have real state. Thus this macro is invoked repeatedly +// with different definitions of __ROPE_DEFINE_ALLOC. +// __ROPE_DEFINE_ALLOC(type,name) defines +// type * name_allocate(size_t) and +// void name_deallocate(tipe *, size_t) +// Both functions may or may not be static. + +#define __ROPE_DEFINE_ALLOCS(__a) \ + __ROPE_DEFINE_ALLOC(_CharT,_Data) /* character data */ \ + typedef _Rope_RopeConcatenation<_CharT,__a> __C; \ + __ROPE_DEFINE_ALLOC(__C,_C) \ + typedef _Rope_RopeLeaf<_CharT,__a> __L; \ + __ROPE_DEFINE_ALLOC(__L,_L) \ + typedef _Rope_RopeFunction<_CharT,__a> __F; \ + __ROPE_DEFINE_ALLOC(__F,_F) \ + typedef _Rope_RopeSubstring<_CharT,__a> __S; \ + __ROPE_DEFINE_ALLOC(__S,_S) + +// Internal rope nodes potentially store a copy of the allocator +// instance used to allocate them. This is mostly redundant. +// But the alternative would be to pass allocator instances around +// in some form to nearly all internal functions, since any pointer +// assignment may result in a zero reference count and thus require +// deallocation. +// The _Rope_rep_base class encapsulates +// the differences between SGI-style allocators and standard-conforming +// allocators. + +#ifdef __STL_USE_STD_ALLOCATORS + +#define __STATIC_IF_SGI_ALLOC /* not static */ + +// Base class for ordinary allocators. +template <class _CharT, class _Allocator, bool _IsStatic> +class _Rope_rep_alloc_base { +public: + typedef typename _Alloc_traits<_CharT,_Allocator>::allocator_type + allocator_type; + allocator_type get_allocator() const { return _M_data_allocator; } + _Rope_rep_alloc_base(size_t __size, const allocator_type& __a) + : _M_size(__size), _M_data_allocator(__a) {} + size_t _M_size; // This is here only to avoid wasting space + // for an otherwise empty base class. + + +protected: + allocator_type _M_data_allocator; + +# define __ROPE_DEFINE_ALLOC(_Tp, __name) \ + typedef typename \ + _Alloc_traits<_Tp,_Allocator>::allocator_type __name##Allocator; \ + /*static*/ _Tp * __name##_allocate(size_t __n) \ + { return __name##Allocator(_M_data_allocator).allocate(__n); } \ + void __name##_deallocate(_Tp* __p, size_t __n) \ + { __name##Allocator(_M_data_allocator).deallocate(__p, __n); } + __ROPE_DEFINE_ALLOCS(_Allocator); +# undef __ROPE_DEFINE_ALLOC +}; + +// Specialization for allocators that have the property that we don't +// actually have to store an allocator object. +template <class _CharT, class _Allocator> +class _Rope_rep_alloc_base<_CharT,_Allocator,true> { +public: + typedef typename _Alloc_traits<_CharT,_Allocator>::allocator_type + allocator_type; + allocator_type get_allocator() const { return allocator_type(); } + _Rope_rep_alloc_base(size_t __size, const allocator_type&) + : _M_size(__size) {} + size_t _M_size; + +protected: + +# define __ROPE_DEFINE_ALLOC(_Tp, __name) \ + typedef typename \ + _Alloc_traits<_Tp,_Allocator>::_Alloc_type __name##Alloc; \ + typedef typename \ + _Alloc_traits<_Tp,_Allocator>::allocator_type __name##Allocator; \ + static _Tp* __name##_allocate(size_t __n) \ + { return __name##Alloc::allocate(__n); } \ + void __name##_deallocate(_Tp *__p, size_t __n) \ + { __name##Alloc::deallocate(__p, __n); } + __ROPE_DEFINE_ALLOCS(_Allocator); +# undef __ROPE_DEFINE_ALLOC +}; + +template <class _CharT, class _Alloc> +struct _Rope_rep_base + : public _Rope_rep_alloc_base<_CharT,_Alloc, + _Alloc_traits<_CharT,_Alloc>::_S_instanceless> +{ + typedef _Rope_rep_alloc_base<_CharT,_Alloc, + _Alloc_traits<_CharT,_Alloc>::_S_instanceless> + _Base; + typedef typename _Base::allocator_type allocator_type; + _Rope_rep_base(size_t __size, const allocator_type& __a) + : _Base(__size, __a) {} +}; + +#else /* !__STL_USE_STD_ALLOCATORS */ + +#define __STATIC_IF_SGI_ALLOC static + +template <class _CharT, class _Alloc> +class _Rope_rep_base { +public: + typedef _Alloc allocator_type; + static allocator_type get_allocator() { return allocator_type(); } + _Rope_rep_base(size_t __size, const allocator_type&) : _M_size(__size) {} + size_t _M_size; + +protected: + +# define __ROPE_DEFINE_ALLOC(_Tp, __name) \ + typedef simple_alloc<_Tp, _Alloc> __name##Alloc; \ + static _Tp* __name##_allocate(size_t __n) \ + { return __name##Alloc::allocate(__n); } \ + static void __name##_deallocate(_Tp* __p, size_t __n) \ + { __name##Alloc::deallocate(__p, __n); } + __ROPE_DEFINE_ALLOCS(_Alloc); +# undef __ROPE_DEFINE_ALLOC +}; + +#endif /* __STL_USE_STD_ALLOCATORS */ + + +template<class _CharT, class _Alloc> +struct _Rope_RopeRep : public _Rope_rep_base<_CharT,_Alloc> +# ifndef __GC + , _Refcount_Base +# endif +{ + public: + enum { _S_max_rope_depth = 45 }; + enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function}; + _Tag _M_tag:8; + bool _M_is_balanced:8; + unsigned char _M_depth; + __GC_CONST _CharT* _M_c_string; + /* Flattened version of string, if needed. */ + /* typically 0. */ + /* If it's not 0, then the memory is owned */ + /* by this node. */ + /* In the case of a leaf, this may point to */ + /* the same memory as the data field. */ + typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type + allocator_type; + _Rope_RopeRep(_Tag __t, int __d, bool __b, size_t __size, + allocator_type __a) + : _Rope_rep_base<_CharT,_Alloc>(__size, __a), +# ifndef __GC + _Refcount_Base(1), +# endif + _M_tag(__t), _M_is_balanced(__b), _M_depth(__d), _M_c_string(0) + { } +# ifdef __GC + void _M_incr () {} +# endif +# ifdef __STL_USE_STD_ALLOCATORS + static void _S_free_string(__GC_CONST _CharT*, size_t __len, + allocator_type __a); +# define __STL_FREE_STRING(__s, __l, __a) _S_free_string(__s, __l, __a); +# else + static void _S_free_string(__GC_CONST _CharT*, size_t __len); +# define __STL_FREE_STRING(__s, __l, __a) _S_free_string(__s, __l); +# endif + // Deallocate data section of a leaf. + // This shouldn't be a member function. + // But its hard to do anything else at the + // moment, because it's templatized w.r.t. + // an allocator. + // Does nothing if __GC is defined. +# ifndef __GC + void _M_free_c_string(); + void _M_free_tree(); + // Deallocate t. Assumes t is not 0. + void _M_unref_nonnil() + { + if (0 == _M_decr()) _M_free_tree(); + } + void _M_ref_nonnil() + { + _M_incr(); + } + static void _S_unref(_Rope_RopeRep* __t) + { + if (0 != __t) { + __t->_M_unref_nonnil(); + } + } + static void _S_ref(_Rope_RopeRep* __t) + { + if (0 != __t) __t->_M_incr(); + } + static void _S_free_if_unref(_Rope_RopeRep* __t) + { + if (0 != __t && 0 == __t->_M_ref_count) __t->_M_free_tree(); + } +# else /* __GC */ + void _M_unref_nonnil() {} + void _M_ref_nonnil() {} + static void _S_unref(_Rope_RopeRep*) {} + static void _S_ref(_Rope_RopeRep*) {} + static void _S_free_if_unref(_Rope_RopeRep*) {} +# endif + +}; + +template<class _CharT, class _Alloc> +struct _Rope_RopeLeaf : public _Rope_RopeRep<_CharT,_Alloc> { + public: + // Apparently needed by VC++ + // The data fields of leaves are allocated with some + // extra space, to accomodate future growth and for basic + // character types, to hold a trailing eos character. + enum { _S_alloc_granularity = 8 }; + static size_t _S_rounded_up_size(size_t __n) { + size_t __size_with_eos; + + if (_S_is_basic_char_type((_CharT*)0)) { + __size_with_eos = __n + 1; + } else { + __size_with_eos = __n; + } +# ifdef __GC + return __size_with_eos; +# else + // Allow slop for in-place expansion. + return (__size_with_eos + _S_alloc_granularity-1) + &~ (_S_alloc_granularity-1); +# endif + } + __GC_CONST _CharT* _M_data; /* Not necessarily 0 terminated. */ + /* The allocated size is */ + /* _S_rounded_up_size(size), except */ + /* in the GC case, in which it */ + /* doesn't matter. */ + typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type + allocator_type; + _Rope_RopeLeaf(__GC_CONST _CharT* __d, size_t __size, allocator_type __a) + : _Rope_RopeRep<_CharT,_Alloc>(_S_leaf, 0, true, __size, __a), + _M_data(__d) + { + __stl_assert(__size > 0); + if (_S_is_basic_char_type((_CharT *)0)) { + // already eos terminated. + _M_c_string = __d; + } + } + // The constructor assumes that d has been allocated with + // the proper allocator and the properly padded size. + // In contrast, the destructor deallocates the data: +# ifndef __GC + ~_Rope_RopeLeaf() { + if (_M_data != _M_c_string) { + _M_free_c_string(); + } + __STL_FREE_STRING(_M_data, _M_size, get_allocator()); + } +# endif +}; + +template<class _CharT, class _Alloc> +struct _Rope_RopeConcatenation : public _Rope_RopeRep<_CharT,_Alloc> { + public: + _Rope_RopeRep<_CharT,_Alloc>* _M_left; + _Rope_RopeRep<_CharT,_Alloc>* _M_right; + typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type + allocator_type; + _Rope_RopeConcatenation(_Rope_RopeRep<_CharT,_Alloc>* __l, + _Rope_RopeRep<_CharT,_Alloc>* __r, + allocator_type __a) + + : _Rope_RopeRep<_CharT,_Alloc>(_S_concat, + max(__l->_M_depth, __r->_M_depth) + 1, + false, + __l->_M_size + __r->_M_size, __a), + _M_left(__l), _M_right(__r) + {} +# ifndef __GC + ~_Rope_RopeConcatenation() { + _M_free_c_string(); + _M_left->_M_unref_nonnil(); + _M_right->_M_unref_nonnil(); + } +# endif +}; + +template<class _CharT, class _Alloc> +struct _Rope_RopeFunction : public _Rope_RopeRep<_CharT,_Alloc> { + public: + char_producer<_CharT>* _M_fn; +# ifndef __GC + bool _M_delete_when_done; // Char_producer is owned by the + // rope and should be explicitly + // deleted when the rope becomes + // inaccessible. +# else + // In the GC case, we either register the rope for + // finalization, or not. Thus the field is unnecessary; + // the information is stored in the collector data structures. + // We do need a finalization procedure to be invoked by the + // collector. + static void _S_fn_finalization_proc(void * __tree, void *) { + delete ((_Rope_RopeFunction *)__tree) -> _M_fn; + } +# endif + typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type + allocator_type; + _Rope_RopeFunction(char_producer<_CharT>* __f, size_t __size, + bool __d, allocator_type __a) + : _Rope_RopeRep<_CharT,_Alloc>(_S_function, 0, true, __size, __a) + , _M_fn(__f) +# ifndef __GC + , _M_delete_when_done(__d) +# endif + { + __stl_assert(__size > 0); +# ifdef __GC + if (__d) { + GC_REGISTER_FINALIZER( + this, _Rope_RopeFunction::_S_fn_finalization_proc, 0, 0, 0); + } +# endif + } +# ifndef __GC + ~_Rope_RopeFunction() { + _M_free_c_string(); + if (_M_delete_when_done) { + delete _M_fn; + } + } +# endif +}; +// Substring results are usually represented using just +// concatenation nodes. But in the case of very long flat ropes +// or ropes with a functional representation that isn't practical. +// In that case, we represent the __result as a special case of +// RopeFunction, whose char_producer points back to the rope itself. +// In all cases except repeated substring operations and +// deallocation, we treat the __result as a RopeFunction. +template<class _CharT, class _Alloc> +struct _Rope_RopeSubstring : public _Rope_RopeFunction<_CharT,_Alloc>, + public char_producer<_CharT> { + public: + // XXX this whole class should be rewritten. + _Rope_RopeRep<_CharT,_Alloc>* _M_base; // not 0 + size_t _M_start; + virtual void operator()(size_t __start_pos, size_t __req_len, + _CharT* __buffer) { + switch(_M_base->_M_tag) { + case _S_function: + case _S_substringfn: + { + char_producer<_CharT>* __fn = + ((_Rope_RopeFunction<_CharT,_Alloc>*)_M_base)->_M_fn; + __stl_assert(__start_pos + __req_len <= _M_size); + __stl_assert(_M_start + _M_size <= _M_base->_M_size); + (*__fn)(__start_pos + _M_start, __req_len, __buffer); + } + break; + case _S_leaf: + { + __GC_CONST _CharT* __s = + ((_Rope_RopeLeaf<_CharT,_Alloc>*)_M_base)->_M_data; + uninitialized_copy_n(__s + __start_pos + _M_start, __req_len, + __buffer); + } + break; + default: + __stl_assert(false); + } + } + typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type + allocator_type; + _Rope_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s, + size_t __l, allocator_type __a) + : _Rope_RopeFunction<_CharT,_Alloc>(this, __l, false, __a), + char_producer<_CharT>(), + _M_base(__b), + _M_start(__s) + { + __stl_assert(__l > 0); + __stl_assert(__s + __l <= __b->_M_size); +# ifndef __GC + _M_base->_M_ref_nonnil(); +# endif + _M_tag = _S_substringfn; + } + virtual ~_Rope_RopeSubstring() + { +# ifndef __GC + _M_base->_M_unref_nonnil(); + // _M_free_c_string(); -- done by parent class +# endif + } +}; + + +// Self-destructing pointers to Rope_rep. +// These are not conventional smart pointers. Their +// only purpose in life is to ensure that unref is called +// on the pointer either at normal exit or if an exception +// is raised. It is the caller's responsibility to +// adjust reference counts when these pointers are initialized +// or assigned to. (This convention significantly reduces +// the number of potentially expensive reference count +// updates.) +#ifndef __GC + template<class _CharT, class _Alloc> + struct _Rope_self_destruct_ptr { + _Rope_RopeRep<_CharT,_Alloc>* _M_ptr; + ~_Rope_self_destruct_ptr() + { _Rope_RopeRep<_CharT,_Alloc>::_S_unref(_M_ptr); } +# ifdef __STL_USE_EXCEPTIONS + _Rope_self_destruct_ptr() : _M_ptr(0) {}; +# else + _Rope_self_destruct_ptr() {}; +# endif + _Rope_self_destruct_ptr(_Rope_RopeRep<_CharT,_Alloc>* __p) : _M_ptr(__p) {} + _Rope_RopeRep<_CharT,_Alloc>& operator*() { return *_M_ptr; } + _Rope_RopeRep<_CharT,_Alloc>* operator->() { return _M_ptr; } + operator _Rope_RopeRep<_CharT,_Alloc>*() { return _M_ptr; } + _Rope_self_destruct_ptr& operator= (_Rope_RopeRep<_CharT,_Alloc>* __x) + { _M_ptr = __x; return *this; } + }; +#endif + +// Dereferencing a nonconst iterator has to return something +// that behaves almost like a reference. It's not possible to +// return an actual reference since assignment requires extra +// work. And we would get into the same problems as with the +// CD2 version of basic_string. +template<class _CharT, class _Alloc> +class _Rope_char_ref_proxy { + friend class rope<_CharT,_Alloc>; + friend class _Rope_iterator<_CharT,_Alloc>; + friend class _Rope_char_ptr_proxy<_CharT,_Alloc>; +# ifdef __GC + typedef _Rope_RopeRep<_CharT,_Alloc>* _Self_destruct_ptr; +# else + typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr; +# endif + typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; + typedef rope<_CharT,_Alloc> _My_rope; + size_t _M_pos; + _CharT _M_current; + bool _M_current_valid; + _My_rope* _M_root; // The whole rope. + public: + _Rope_char_ref_proxy(_My_rope* __r, size_t __p) + : _M_pos(__p), _M_current_valid(false), _M_root(__r) {} + _Rope_char_ref_proxy(const _Rope_char_ref_proxy& __x) + : _M_pos(__x._M_pos), _M_current_valid(false), _M_root(__x._M_root) {} + // Don't preserve cache if the reference can outlive the + // expression. We claim that's not possible without calling + // a copy constructor or generating reference to a proxy + // reference. We declare the latter to have undefined semantics. + _Rope_char_ref_proxy(_My_rope* __r, size_t __p, _CharT __c) + : _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) {} + inline operator _CharT () const; + _Rope_char_ref_proxy& operator= (_CharT __c); + _Rope_char_ptr_proxy<_CharT,_Alloc> operator& () const; + _Rope_char_ref_proxy& operator= (const _Rope_char_ref_proxy& __c) { + return operator=((_CharT)__c); + } +}; + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + template<class _CharT, class __Alloc> + inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a, + _Rope_char_ref_proxy <_CharT, __Alloc > __b) { + _CharT __tmp = __a; + __a = __b; + __b = __tmp; + } +#else +// There is no really acceptable way to handle this. The default +// definition of swap doesn't work for proxy references. +// It can't really be made to work, even with ugly hacks, since +// the only unusual operation it uses is the copy constructor, which +// is needed for other purposes. We provide a macro for +// full specializations, and instantiate the most common case. +# define _ROPE_SWAP_SPECIALIZATION(_CharT, __Alloc) \ + inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a, \ + _Rope_char_ref_proxy <_CharT, __Alloc > __b) { \ + _CharT __tmp = __a; \ + __a = __b; \ + __b = __tmp; \ + } + +_ROPE_SWAP_SPECIALIZATION(char,__STL_DEFAULT_ALLOCATOR(char)) + +#endif /* !__STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +template<class _CharT, class _Alloc> +class _Rope_char_ptr_proxy { + // XXX this class should be rewritten. + friend class _Rope_char_ref_proxy<_CharT,_Alloc>; + size_t _M_pos; + rope<_CharT,_Alloc>* _M_root; // The whole rope. + public: + _Rope_char_ptr_proxy(const _Rope_char_ref_proxy<_CharT,_Alloc>& __x) + : _M_pos(__x._M_pos), _M_root(__x._M_root) {} + _Rope_char_ptr_proxy(const _Rope_char_ptr_proxy& __x) + : _M_pos(__x._M_pos), _M_root(__x._M_root) {} + _Rope_char_ptr_proxy() {} + _Rope_char_ptr_proxy(_CharT* __x) : _M_root(0), _M_pos(0) { + __stl_assert(0 == __x); + } + _Rope_char_ptr_proxy& + operator= (const _Rope_char_ptr_proxy& __x) { + _M_pos = __x._M_pos; + _M_root = __x._M_root; + return *this; + } +#ifdef __STL_MEMBER_TEMPLATES + template<class _CharT2, class _Alloc2> + friend bool operator== (const _Rope_char_ptr_proxy<_CharT2,_Alloc2>& __x, + const _Rope_char_ptr_proxy<_CharT2,_Alloc2>& __y); +#else + friend bool operator== __STL_NULL_TMPL_ARGS + (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x, + const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y); +#endif + _Rope_char_ref_proxy<_CharT,_Alloc> operator*() const { + return _Rope_char_ref_proxy<_CharT,_Alloc>(_M_root, _M_pos); + } +}; + + +// Rope iterators: +// Unlike in the C version, we cache only part of the stack +// for rope iterators, since they must be efficiently copyable. +// When we run out of cache, we have to reconstruct the iterator +// value. +// Pointers from iterators are not included in reference counts. +// Iterators are assumed to be thread private. Ropes can +// be shared. + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1375 +#endif + +template<class _CharT, class _Alloc> +class _Rope_iterator_base + : public random_access_iterator<_CharT, ptrdiff_t> { + friend class rope<_CharT,_Alloc>; + public: + typedef _Alloc _allocator_type; // used in _Rope_rotate, VC++ workaround + typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; + // Borland doesnt want this to be protected. + protected: + enum { _S_path_cache_len = 4 }; // Must be <= 9. + enum { _S_iterator_buf_len = 15 }; + size_t _M_current_pos; + _RopeRep* _M_root; // The whole rope. + size_t _M_leaf_pos; // Starting position for current leaf + __GC_CONST _CharT* _M_buf_start; + // Buffer possibly + // containing current char. + __GC_CONST _CharT* _M_buf_ptr; + // Pointer to current char in buffer. + // != 0 ==> buffer valid. + __GC_CONST _CharT* _M_buf_end; + // One past __last valid char in buffer. + // What follows is the path cache. We go out of our + // way to make this compact. + // Path_end contains the bottom section of the path from + // the root to the current leaf. + const _RopeRep* _M_path_end[_S_path_cache_len]; + int _M_leaf_index; // Last valid __pos in path_end; + // _M_path_end[0] ... _M_path_end[leaf_index-1] + // point to concatenation nodes. + unsigned char _M_path_directions; + // (path_directions >> __i) & 1 is 1 + // iff we got from _M_path_end[leaf_index - __i - 1] + // to _M_path_end[leaf_index - __i] by going to the + // __right. Assumes path_cache_len <= 9. + _CharT _M_tmp_buf[_S_iterator_buf_len]; + // Short buffer for surrounding chars. + // This is useful primarily for + // RopeFunctions. We put the buffer + // here to avoid locking in the + // multithreaded case. + // The cached path is generally assumed to be valid + // only if the buffer is valid. + static void _S_setbuf(_Rope_iterator_base& __x); + // Set buffer contents given + // path cache. + static void _S_setcache(_Rope_iterator_base& __x); + // Set buffer contents and + // path cache. + static void _S_setcache_for_incr(_Rope_iterator_base& __x); + // As above, but assumes path + // cache is valid for previous posn. + _Rope_iterator_base() {} + _Rope_iterator_base(_RopeRep* __root, size_t __pos) + : _M_current_pos(__pos), _M_root(__root), _M_buf_ptr(0) {} + void _M_incr(size_t __n); + void _M_decr(size_t __n); + public: + size_t index() const { return _M_current_pos; } + _Rope_iterator_base(const _Rope_iterator_base& __x) { + if (0 != __x._M_buf_ptr) { + *this = __x; + } else { + _M_current_pos = __x._M_current_pos; + _M_root = __x._M_root; + _M_buf_ptr = 0; + } + } +}; + +template<class _CharT, class _Alloc> class _Rope_iterator; + +template<class _CharT, class _Alloc> +class _Rope_const_iterator : public _Rope_iterator_base<_CharT,_Alloc> { + friend class rope<_CharT,_Alloc>; + protected: +# ifdef __STL_HAS_NAMESPACES + typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; + // The one from the base class may not be directly visible. +# endif + _Rope_const_iterator(const _RopeRep* __root, size_t __pos): + _Rope_iterator_base<_CharT,_Alloc>( + const_cast<_RopeRep*>(__root), __pos) + // Only nonconst iterators modify root ref count + {} + public: + typedef _CharT reference; // Really a value. Returning a reference + // Would be a mess, since it would have + // to be included in refcount. + typedef const _CharT* pointer; + + public: + _Rope_const_iterator() {}; + _Rope_const_iterator(const _Rope_const_iterator& __x) : + _Rope_iterator_base<_CharT,_Alloc>(__x) { } + _Rope_const_iterator(const _Rope_iterator<_CharT,_Alloc>& __x); + _Rope_const_iterator(const rope<_CharT,_Alloc>& __r, size_t __pos) : + _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos) {} + _Rope_const_iterator& operator= (const _Rope_const_iterator& __x) { + if (0 != __x._M_buf_ptr) { + *(static_cast<_Rope_iterator_base<_CharT,_Alloc>*>(this)) = __x; + } else { + _M_current_pos = __x._M_current_pos; + _M_root = __x._M_root; + _M_buf_ptr = 0; + } + return(*this); + } + reference operator*() { + if (0 == _M_buf_ptr) _S_setcache(*this); + return *_M_buf_ptr; + } + _Rope_const_iterator& operator++() { + __GC_CONST _CharT* __next; + if (0 != _M_buf_ptr && (__next = _M_buf_ptr + 1) < _M_buf_end) { + _M_buf_ptr = __next; + ++_M_current_pos; + } else { + _M_incr(1); + } + return *this; + } + _Rope_const_iterator& operator+=(ptrdiff_t __n) { + if (__n >= 0) { + _M_incr(__n); + } else { + _M_decr(-__n); + } + return *this; + } + _Rope_const_iterator& operator--() { + _M_decr(1); + return *this; + } + _Rope_const_iterator& operator-=(ptrdiff_t __n) { + if (__n >= 0) { + _M_decr(__n); + } else { + _M_incr(-__n); + } + return *this; + } + _Rope_const_iterator operator++(int) { + size_t __old_pos = _M_current_pos; + _M_incr(1); + return _Rope_const_iterator<_CharT,_Alloc>(_M_root, __old_pos); + // This makes a subsequent dereference expensive. + // Perhaps we should instead copy the iterator + // if it has a valid cache? + } + _Rope_const_iterator operator--(int) { + size_t __old_pos = _M_current_pos; + _M_decr(1); + return _Rope_const_iterator<_CharT,_Alloc>(_M_root, __old_pos); + } +#if defined(__STL_MEMBER_TEMPLATES) && defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER) + template<class _CharT2, class _Alloc2> + friend _Rope_const_iterator<_CharT2,_Alloc2> operator- + (const _Rope_const_iterator<_CharT2,_Alloc2>& __x, + ptrdiff_t __n); + template<class _CharT2, class _Alloc2> + friend _Rope_const_iterator<_CharT2,_Alloc2> operator+ + (const _Rope_const_iterator<_CharT2,_Alloc2>& __x, + ptrdiff_t __n); + template<class _CharT2, class _Alloc2> + friend _Rope_const_iterator<_CharT2,_Alloc2> operator+ + (ptrdiff_t __n, + const _Rope_const_iterator<_CharT2,_Alloc2>& __x); +#else + friend _Rope_const_iterator<_CharT,_Alloc> operator- __STL_NULL_TMPL_ARGS + (const _Rope_const_iterator<_CharT,_Alloc>& __x, + ptrdiff_t __n); + friend _Rope_const_iterator<_CharT,_Alloc> operator+ __STL_NULL_TMPL_ARGS + (const _Rope_const_iterator<_CharT,_Alloc>& __x, + ptrdiff_t __n); + friend _Rope_const_iterator<_CharT,_Alloc> operator+ __STL_NULL_TMPL_ARGS + (ptrdiff_t __n, + const _Rope_const_iterator<_CharT,_Alloc>& __x); +#endif + + reference operator[](size_t __n) { + return rope<_CharT,_Alloc>::_S_fetch(_M_root, _M_current_pos + __n); + } + +#if defined(__STL_MEMBER_TEMPLATES) && defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER) + template<class _CharT2, class _Alloc2> + friend bool operator== + (const _Rope_const_iterator<_CharT2,_Alloc2>& __x, + const _Rope_const_iterator<_CharT2,_Alloc2>& __y); + template<class _CharT2, class _Alloc2> + friend bool operator< + (const _Rope_const_iterator<_CharT2,_Alloc2>& __x, + const _Rope_const_iterator<_CharT2,_Alloc2>& __y); + template<class _CharT2, class _Alloc2> + friend ptrdiff_t operator- + (const _Rope_const_iterator<_CharT2,_Alloc2>& __x, + const _Rope_const_iterator<_CharT2,_Alloc2>& __y); +#else + friend bool operator== __STL_NULL_TMPL_ARGS + (const _Rope_const_iterator<_CharT,_Alloc>& __x, + const _Rope_const_iterator<_CharT,_Alloc>& __y); + friend bool operator< __STL_NULL_TMPL_ARGS + (const _Rope_const_iterator<_CharT,_Alloc>& __x, + const _Rope_const_iterator<_CharT,_Alloc>& __y); + friend ptrdiff_t operator- __STL_NULL_TMPL_ARGS + (const _Rope_const_iterator<_CharT,_Alloc>& __x, + const _Rope_const_iterator<_CharT,_Alloc>& __y); +#endif +}; + +template<class _CharT, class _Alloc> +class _Rope_iterator : public _Rope_iterator_base<_CharT,_Alloc> { + friend class rope<_CharT,_Alloc>; + protected: + rope<_CharT,_Alloc>* _M_root_rope; + // root is treated as a cached version of this, + // and is used to detect changes to the underlying + // rope. + // Root is included in the reference count. + // This is necessary so that we can detect changes reliably. + // Unfortunately, it requires careful bookkeeping for the + // nonGC case. + _Rope_iterator(rope<_CharT,_Alloc>* __r, size_t __pos) + : _Rope_iterator_base<_CharT,_Alloc>(__r->_M_tree_ptr, __pos), + _M_root_rope(__r) + { _RopeRep::_S_ref(_M_root); if (!(__r -> empty()))_S_setcache(*this); } + + void _M_check(); + public: + typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference; + typedef _Rope_char_ref_proxy<_CharT,_Alloc>* pointer; + + public: + rope<_CharT,_Alloc>& container() { return *_M_root_rope; } + _Rope_iterator() { + _M_root = 0; // Needed for reference counting. + }; + _Rope_iterator(const _Rope_iterator& __x) : + _Rope_iterator_base<_CharT,_Alloc>(__x) { + _M_root_rope = __x._M_root_rope; + _RopeRep::_S_ref(_M_root); + } + _Rope_iterator(rope<_CharT,_Alloc>& __r, size_t __pos); + ~_Rope_iterator() { + _RopeRep::_S_unref(_M_root); + } + _Rope_iterator& operator= (const _Rope_iterator& __x) { + _RopeRep* __old = _M_root; + + _RopeRep::_S_ref(__x._M_root); + if (0 != __x._M_buf_ptr) { + _M_root_rope = __x._M_root_rope; + *(static_cast<_Rope_iterator_base<_CharT,_Alloc>*>(this)) = __x; + } else { + _M_current_pos = __x._M_current_pos; + _M_root = __x._M_root; + _M_root_rope = __x._M_root_rope; + _M_buf_ptr = 0; + } + _RopeRep::_S_unref(__old); + return(*this); + } + reference operator*() { + _M_check(); + if (0 == _M_buf_ptr) { + return _Rope_char_ref_proxy<_CharT,_Alloc>( + _M_root_rope, _M_current_pos); + } else { + return _Rope_char_ref_proxy<_CharT,_Alloc>( + _M_root_rope, _M_current_pos, *_M_buf_ptr); + } + } + _Rope_iterator& operator++() { + _M_incr(1); + return *this; + } + _Rope_iterator& operator+=(ptrdiff_t __n) { + if (__n >= 0) { + _M_incr(__n); + } else { + _M_decr(-__n); + } + return *this; + } + _Rope_iterator& operator--() { + _M_decr(1); + return *this; + } + _Rope_iterator& operator-=(ptrdiff_t __n) { + if (__n >= 0) { + _M_decr(__n); + } else { + _M_incr(-__n); + } + return *this; + } + _Rope_iterator operator++(int) { + size_t __old_pos = _M_current_pos; + _M_incr(1); + return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos); + } + _Rope_iterator operator--(int) { + size_t __old_pos = _M_current_pos; + _M_decr(1); + return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos); + } + reference operator[](ptrdiff_t __n) { + return _Rope_char_ref_proxy<_CharT,_Alloc>( + _M_root_rope, _M_current_pos + __n); + } + +#if defined(__STL_MEMBER_TEMPLATES) && defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER) + template<class _CharT2, class _Alloc2> + friend bool operator== + (const _Rope_iterator<_CharT2,_Alloc2>& __x, + const _Rope_iterator<_CharT2,_Alloc2>& __y); + template<class _CharT2, class _Alloc2> + friend bool operator< + (const _Rope_iterator<_CharT2,_Alloc2>& __x, + const _Rope_iterator<_CharT2,_Alloc2>& __y); + template<class _CharT2, class _Alloc2> + friend ptrdiff_t operator- + (const _Rope_iterator<_CharT2,_Alloc2>& __x, + const _Rope_iterator<_CharT2,_Alloc2>& __y); + template<class _CharT2, class _Alloc2> + friend _Rope_iterator<_CharT2,_Alloc2> operator- + (const _Rope_iterator<_CharT2,_Alloc2>& __x, + ptrdiff_t __n); + template<class _CharT2, class _Alloc2> + friend _Rope_iterator<_CharT2,_Alloc2> operator+ + (const _Rope_iterator<_CharT2,_Alloc2>& __x, + ptrdiff_t __n); + template<class _CharT2, class _Alloc2> + friend _Rope_iterator<_CharT2,_Alloc2> operator+ + (ptrdiff_t __n, + const _Rope_iterator<_CharT2,_Alloc2>& __x); +#else + friend bool operator== __STL_NULL_TMPL_ARGS + (const _Rope_iterator<_CharT,_Alloc>& __x, + const _Rope_iterator<_CharT,_Alloc>& __y); + friend bool operator< __STL_NULL_TMPL_ARGS + (const _Rope_iterator<_CharT,_Alloc>& __x, + const _Rope_iterator<_CharT,_Alloc>& __y); + friend ptrdiff_t operator- __STL_NULL_TMPL_ARGS + (const _Rope_iterator<_CharT,_Alloc>& __x, + const _Rope_iterator<_CharT,_Alloc>& __y); + friend _Rope_iterator<_CharT,_Alloc> operator- __STL_NULL_TMPL_ARGS + (const _Rope_iterator<_CharT,_Alloc>& __x, + ptrdiff_t __n); + friend _Rope_iterator<_CharT,_Alloc> operator+ __STL_NULL_TMPL_ARGS + (const _Rope_iterator<_CharT,_Alloc>& __x, + ptrdiff_t __n); + friend _Rope_iterator<_CharT,_Alloc> operator+ __STL_NULL_TMPL_ARGS + (ptrdiff_t __n, + const _Rope_iterator<_CharT,_Alloc>& __x); +#endif +}; + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1375 +#endif + +// The rope base class encapsulates +// the differences between SGI-style allocators and standard-conforming +// allocators. + +#ifdef __STL_USE_STD_ALLOCATORS + +// Base class for ordinary allocators. +template <class _CharT, class _Allocator, bool _IsStatic> +class _Rope_alloc_base { +public: + typedef _Rope_RopeRep<_CharT,_Allocator> _RopeRep; + typedef typename _Alloc_traits<_CharT,_Allocator>::allocator_type + allocator_type; + allocator_type get_allocator() const { return _M_data_allocator; } + _Rope_alloc_base(_RopeRep *__t, const allocator_type& __a) + : _M_tree_ptr(__t), _M_data_allocator(__a) {} + _Rope_alloc_base(const allocator_type& __a) + : _M_data_allocator(__a) {} + +protected: + // The only data members of a rope: + allocator_type _M_data_allocator; + _RopeRep* _M_tree_ptr; + +# define __ROPE_DEFINE_ALLOC(_Tp, __name) \ + typedef typename \ + _Alloc_traits<_Tp,_Allocator>::allocator_type __name##Allocator; \ + _Tp* __name##_allocate(size_t __n) const \ + { return __name##Allocator(_M_data_allocator).allocate(__n); } \ + void __name##_deallocate(_Tp *__p, size_t __n) const \ + { __name##Allocator(_M_data_allocator).deallocate(__p, __n); } + __ROPE_DEFINE_ALLOCS(_Allocator) +# undef __ROPE_DEFINE_ALLOC +}; + +// Specialization for allocators that have the property that we don't +// actually have to store an allocator object. +template <class _CharT, class _Allocator> +class _Rope_alloc_base<_CharT,_Allocator,true> { +public: + typedef _Rope_RopeRep<_CharT,_Allocator> _RopeRep; + typedef typename _Alloc_traits<_CharT,_Allocator>::allocator_type + allocator_type; + allocator_type get_allocator() const { return allocator_type(); } + _Rope_alloc_base(_RopeRep *__t, const allocator_type&) + : _M_tree_ptr(__t) {} + _Rope_alloc_base(const allocator_type&) {} + +protected: + // The only data member of a rope: + _RopeRep *_M_tree_ptr; + +# define __ROPE_DEFINE_ALLOC(_Tp, __name) \ + typedef typename \ + _Alloc_traits<_Tp,_Allocator>::_Alloc_type __name##Alloc; \ + typedef typename \ + _Alloc_traits<_Tp,_Allocator>::allocator_type __name##Allocator; \ + static _Tp* __name##_allocate(size_t __n) \ + { return __name##Alloc::allocate(__n); } \ + static void __name##_deallocate(_Tp *__p, size_t __n) \ + { __name##Alloc::deallocate(__p, __n); } + __ROPE_DEFINE_ALLOCS(_Allocator) +# undef __ROPE_DEFINE_ALLOC +}; + +template <class _CharT, class _Alloc> +struct _Rope_base + : public _Rope_alloc_base<_CharT,_Alloc, + _Alloc_traits<_CharT,_Alloc>::_S_instanceless> +{ + typedef _Rope_alloc_base<_CharT,_Alloc, + _Alloc_traits<_CharT,_Alloc>::_S_instanceless> + _Base; + typedef typename _Base::allocator_type allocator_type; + typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; + // The one in _Base may not be visible due to template rules. + _Rope_base(_RopeRep* __t, const allocator_type& __a) : _Base(__t, __a) {} + _Rope_base(const allocator_type& __a) : _Base(__a) {} +}; + +#else /* !__STL_USE_STD_ALLOCATORS */ + +template <class _CharT, class _Alloc> +class _Rope_base { +public: + typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep; + typedef _Alloc allocator_type; + static allocator_type get_allocator() { return allocator_type(); } + _Rope_base(_RopeRep * __t, const allocator_type&) : _M_tree_ptr(__t) {} + _Rope_base(const allocator_type&) {} + +protected: + // The only data member of a rope: + _RopeRep* _M_tree_ptr; + +# define __ROPE_DEFINE_ALLOC(_Tp, __name) \ + typedef simple_alloc<_Tp, _Alloc> __name##Alloc; \ + static _Tp* __name##_allocate(size_t __n) \ + { return __name##Alloc::allocate(__n); } \ + static void __name##_deallocate(_Tp *__p, size_t __n) \ + { __name##Alloc::deallocate(__p, __n); } + __ROPE_DEFINE_ALLOCS(_Alloc) +# undef __ROPE_DEFINE_ALLOC +}; + +#endif /* __STL_USE_STD_ALLOCATORS */ + + +template <class _CharT, class _Alloc> +class rope : public _Rope_base<_CharT,_Alloc> { + public: + typedef _CharT value_type; + typedef ptrdiff_t difference_type; + typedef size_t size_type; + typedef _CharT const_reference; + typedef const _CharT* const_pointer; + typedef _Rope_iterator<_CharT,_Alloc> iterator; + typedef _Rope_const_iterator<_CharT,_Alloc> const_iterator; + typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference; + typedef _Rope_char_ptr_proxy<_CharT,_Alloc> pointer; + + friend class _Rope_iterator<_CharT,_Alloc>; + friend class _Rope_const_iterator<_CharT,_Alloc>; + friend struct _Rope_RopeRep<_CharT,_Alloc>; + friend class _Rope_iterator_base<_CharT,_Alloc>; + friend class _Rope_char_ptr_proxy<_CharT,_Alloc>; + friend class _Rope_char_ref_proxy<_CharT,_Alloc>; + friend struct _Rope_RopeSubstring<_CharT,_Alloc>; + + protected: + typedef _Rope_base<_CharT,_Alloc> _Base; + typedef typename _Base::allocator_type allocator_type; +# ifdef __STL_USE_NAMESPACES + using _Base::_M_tree_ptr; +# endif + typedef __GC_CONST _CharT* _Cstrptr; + + static _CharT _S_empty_c_str[1]; + + static bool _S_is0(_CharT __c) { return __c == _S_eos((_CharT*)0); } + enum { _S_copy_max = 23 }; + // For strings shorter than _S_copy_max, we copy to + // concatenate. + + typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; + typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcatenation; + typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf; + typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction; + typedef _Rope_RopeSubstring<_CharT,_Alloc> _RopeSubstring; + + // Retrieve a character at the indicated position. + static _CharT _S_fetch(_RopeRep* __r, size_type __pos); + +# ifndef __GC + // Obtain a pointer to the character at the indicated position. + // The pointer can be used to change the character. + // If such a pointer cannot be produced, as is frequently the + // case, 0 is returned instead. + // (Returns nonzero only if all nodes in the path have a refcount + // of 1.) + static _CharT* _S_fetch_ptr(_RopeRep* __r, size_type __pos); +# endif + + static bool _S_apply_to_pieces( + // should be template parameter + _Rope_char_consumer<_CharT>& __c, + const _RopeRep* __r, + size_t __begin, size_t __end); + // begin and end are assumed to be in range. + +# ifndef __GC + static void _S_unref(_RopeRep* __t) + { + _RopeRep::_S_unref(__t); + } + static void _S_ref(_RopeRep* __t) + { + _RopeRep::_S_ref(__t); + } +# else /* __GC */ + static void _S_unref(_RopeRep*) {} + static void _S_ref(_RopeRep*) {} +# endif + + +# ifdef __GC + typedef _Rope_RopeRep<_CharT,_Alloc>* _Self_destruct_ptr; +# else + typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr; +# endif + + // _Result is counted in refcount. + static _RopeRep* _S_substring(_RopeRep* __base, + size_t __start, size_t __endp1); + + static _RopeRep* _S_concat_char_iter(_RopeRep* __r, + const _CharT* __iter, size_t __slen); + // Concatenate rope and char ptr, copying __s. + // Should really take an arbitrary iterator. + // Result is counted in refcount. + static _RopeRep* _S_destr_concat_char_iter(_RopeRep* __r, + const _CharT* __iter, size_t __slen) + // As above, but one reference to __r is about to be + // destroyed. Thus the pieces may be recycled if all + // relevent reference counts are 1. +# ifdef __GC + // We can't really do anything since refcounts are unavailable. + { return _S_concat_char_iter(__r, __iter, __slen); } +# else + ; +# endif + + static _RopeRep* _S_concat(_RopeRep* __left, _RopeRep* __right); + // General concatenation on _RopeRep. _Result + // has refcount of 1. Adjusts argument refcounts. + + public: + void apply_to_pieces( size_t __begin, size_t __end, + _Rope_char_consumer<_CharT>& __c) const { + _S_apply_to_pieces(__c, _M_tree_ptr, __begin, __end); + } + + + protected: + + static size_t _S_rounded_up_size(size_t __n) { + return _RopeLeaf::_S_rounded_up_size(__n); + } + + static size_t _S_allocated_capacity(size_t __n) { + if (_S_is_basic_char_type((_CharT*)0)) { + return _S_rounded_up_size(__n) - 1; + } else { + return _S_rounded_up_size(__n); + } + } + + // Allocate and construct a RopeLeaf using the supplied allocator + // Takes ownership of s instead of copying. + static _RopeLeaf* _S_new_RopeLeaf(__GC_CONST _CharT *__s, + size_t __size, allocator_type __a) + { +# ifdef __STL_USE_STD_ALLOCATORS + _RopeLeaf* __space = _LAllocator(__a).allocate(1); +# else + _RopeLeaf* __space = _L_allocate(1); +# endif + return new(__space) _RopeLeaf(__s, __size, __a); + } + + static _RopeConcatenation* _S_new_RopeConcatenation( + _RopeRep* __left, _RopeRep* __right, + allocator_type __a) + { +# ifdef __STL_USE_STD_ALLOCATORS + _RopeConcatenation* __space = _CAllocator(__a).allocate(1); +# else + _RopeConcatenation* __space = _C_allocate(1); +# endif + return new(__space) _RopeConcatenation(__left, __right, __a); + } + + static _RopeFunction* _S_new_RopeFunction(char_producer<_CharT>* __f, + size_t __size, bool __d, allocator_type __a) + { +# ifdef __STL_USE_STD_ALLOCATORS + _RopeFunction* __space = _FAllocator(__a).allocate(1); +# else + _RopeFunction* __space = _F_allocate(1); +# endif + return new(__space) _RopeFunction(__f, __size, __d, __a); + } + + static _RopeSubstring* _S_new_RopeSubstring( + _Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s, + size_t __l, allocator_type __a) + { +# ifdef __STL_USE_STD_ALLOCATORS + _RopeSubstring* __space = _SAllocator(__a).allocate(1); +# else + _RopeSubstring* __space = _S_allocate(1); +# endif + return new(__space) _RopeSubstring(__b, __s, __l, __a); + } + +# ifdef __STL_USE_STD_ALLOCATORS + static + _RopeLeaf* _S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s, + size_t __size, allocator_type __a) +# define __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __size, __a) \ + _S_RopeLeaf_from_unowned_char_ptr(__s, __size, __a) +# else + static + _RopeLeaf* _S_RopeLeaf_from_unowned_char_ptr2(const _CharT* __s, + size_t __size) +# define __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __size, __a) \ + _S_RopeLeaf_from_unowned_char_ptr2(__s, __size) +# endif + { + if (0 == __size) return 0; +# ifdef __STL_USE_STD_ALLOCATORS + _CharT* __buf = __a.allocate(_S_rounded_up_size(__size)); +# else + _CharT* __buf = _Data_allocate(_S_rounded_up_size(__size)); + allocator_type __a = allocator_type(); +# endif + + uninitialized_copy_n(__s, __size, __buf); + _S_cond_store_eos(__buf[__size]); + __STL_TRY { + return _S_new_RopeLeaf(__buf, __size, __a); + } + __STL_UNWIND(_RopeRep::__STL_FREE_STRING(__buf, __size, __a)) + } + + + // Concatenation of nonempty strings. + // Always builds a concatenation node. + // Rebalances if the result is too deep. + // Result has refcount 1. + // Does not increment left and right ref counts even though + // they are referenced. + static _RopeRep* + _S_tree_concat(_RopeRep* __left, _RopeRep* __right); + + // Concatenation helper functions + static _RopeLeaf* + _S_leaf_concat_char_iter(_RopeLeaf* __r, + const _CharT* __iter, size_t __slen); + // Concatenate by copying leaf. + // should take an arbitrary iterator + // result has refcount 1. +# ifndef __GC + static _RopeLeaf* _S_destr_leaf_concat_char_iter + (_RopeLeaf* __r, const _CharT* __iter, size_t __slen); + // A version that potentially clobbers __r if __r->_M_ref_count == 1. +# endif + + private: + + static size_t _S_char_ptr_len(const _CharT* __s); + // slightly generalized strlen + + rope(_RopeRep* __t, const allocator_type& __a = allocator_type()) + : _Base(__t,__a) { } + + + // Copy __r to the _CharT buffer. + // Returns __buffer + __r->_M_size. + // Assumes that buffer is uninitialized. + static _CharT* _S_flatten(_RopeRep* __r, _CharT* __buffer); + + // Again, with explicit starting position and length. + // Assumes that buffer is uninitialized. + static _CharT* _S_flatten(_RopeRep* __r, + size_t __start, size_t __len, + _CharT* __buffer); + + static const unsigned long + _S_min_len[_RopeRep::_S_max_rope_depth + 1]; + + static bool _S_is_balanced(_RopeRep* __r) + { return (__r->_M_size >= _S_min_len[__r->_M_depth]); } + + static bool _S_is_almost_balanced(_RopeRep* __r) + { return (__r->_M_depth == 0 || + __r->_M_size >= _S_min_len[__r->_M_depth - 1]); } + + static bool _S_is_roughly_balanced(_RopeRep* __r) + { return (__r->_M_depth <= 1 || + __r->_M_size >= _S_min_len[__r->_M_depth - 2]); } + + // Assumes the result is not empty. + static _RopeRep* _S_concat_and_set_balanced(_RopeRep* __left, + _RopeRep* __right) + { + _RopeRep* __result = _S_concat(__left, __right); + if (_S_is_balanced(__result)) __result->_M_is_balanced = true; + return __result; + } + + // The basic rebalancing operation. Logically copies the + // rope. The result has refcount of 1. The client will + // usually decrement the reference count of __r. + // The result is within height 2 of balanced by the above + // definition. + static _RopeRep* _S_balance(_RopeRep* __r); + + // Add all unbalanced subtrees to the forest of balanceed trees. + // Used only by balance. + static void _S_add_to_forest(_RopeRep*__r, _RopeRep** __forest); + + // Add __r to forest, assuming __r is already balanced. + static void _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest); + + // Print to stdout, exposing structure + static void _S_dump(_RopeRep* __r, int __indent = 0); + + // Return -1, 0, or 1 if __x < __y, __x == __y, or __x > __y resp. + static int _S_compare(const _RopeRep* __x, const _RopeRep* __y); + + public: + bool empty() const { return 0 == _M_tree_ptr; } + + // Comparison member function. This is public only for those + // clients that need a ternary comparison. Others + // should use the comparison operators below. + int compare(const rope& __y) const { + return _S_compare(_M_tree_ptr, __y._M_tree_ptr); + } + + rope(const _CharT* __s, const allocator_type& __a = allocator_type()) + : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, _S_char_ptr_len(__s), + __a),__a) + { } + + rope(const _CharT* __s, size_t __len, + const allocator_type& __a = allocator_type()) + : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __len, __a), __a) + { } + + // Should perhaps be templatized with respect to the iterator type + // and use Sequence_buffer. (It should perhaps use sequence_buffer + // even now.) + rope(const _CharT *__s, const _CharT *__e, + const allocator_type& __a = allocator_type()) + : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __e - __s, __a), __a) + { } + + rope(const const_iterator& __s, const const_iterator& __e, + const allocator_type& __a = allocator_type()) + : _Base(_S_substring(__s._M_root, __s._M_current_pos, + __e._M_current_pos), __a) + { } + + rope(const iterator& __s, const iterator& __e, + const allocator_type& __a = allocator_type()) + : _Base(_S_substring(__s._M_root, __s._M_current_pos, + __e._M_current_pos), __a) + { } + + rope(_CharT __c, const allocator_type& __a = allocator_type()) + : _Base(__a) + { + _CharT* __buf = _Data_allocate(_S_rounded_up_size(1)); + + construct(__buf, __c); + __STL_TRY { + _M_tree_ptr = _S_new_RopeLeaf(__buf, 1, __a); + } + __STL_UNWIND(_RopeRep::__STL_FREE_STRING(__buf, 1, __a)) + } + + rope(size_t __n, _CharT __c, + const allocator_type& __a = allocator_type()); + + rope(const allocator_type& __a = allocator_type()) + : _Base(0, __a) {} + + // Construct a rope from a function that can compute its members + rope(char_producer<_CharT> *__fn, size_t __len, bool __delete_fn, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { + _M_tree_ptr = (0 == __len) ? + 0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a); + } + + rope(const rope& __x, const allocator_type& __a = allocator_type()) + : _Base(__x._M_tree_ptr, __a) + { + _S_ref(_M_tree_ptr); + } + + ~rope() + { + _S_unref(_M_tree_ptr); + } + + rope& operator=(const rope& __x) + { + _RopeRep* __old = _M_tree_ptr; +# ifdef __STL_USE_STD_ALLOCATORS + __stl_assert(get_allocator() == __x.get_allocator()); +# endif + _M_tree_ptr = __x._M_tree_ptr; + _S_ref(_M_tree_ptr); + _S_unref(__old); + return(*this); + } + + void clear() + { + _S_unref(_M_tree_ptr); + _M_tree_ptr = 0; + } + + void push_back(_CharT __x) + { + _RopeRep* __old = _M_tree_ptr; + _M_tree_ptr = _S_destr_concat_char_iter(_M_tree_ptr, &__x, 1); + _S_unref(__old); + } + + void pop_back() + { + _RopeRep* __old = _M_tree_ptr; + _M_tree_ptr = + _S_substring(_M_tree_ptr, 0, _M_tree_ptr->_M_size - 1); + _S_unref(__old); + } + + _CharT back() const + { + return _S_fetch(_M_tree_ptr, _M_tree_ptr->_M_size - 1); + } + + void push_front(_CharT __x) + { + _RopeRep* __old = _M_tree_ptr; + _RopeRep* __left = + __STL_ROPE_FROM_UNOWNED_CHAR_PTR(&__x, 1, get_allocator()); + __STL_TRY { + _M_tree_ptr = _S_concat(__left, _M_tree_ptr); + _S_unref(__old); + _S_unref(__left); + } + __STL_UNWIND(_S_unref(__left)) + } + + void pop_front() + { + _RopeRep* __old = _M_tree_ptr; + _M_tree_ptr = _S_substring(_M_tree_ptr, 1, _M_tree_ptr->_M_size); + _S_unref(__old); + } + + _CharT front() const + { + return _S_fetch(_M_tree_ptr, 0); + } + + void balance() + { + _RopeRep* __old = _M_tree_ptr; + _M_tree_ptr = _S_balance(_M_tree_ptr); + _S_unref(__old); + } + + void copy(_CharT* __buffer) const { + destroy(__buffer, __buffer + size()); + _S_flatten(_M_tree_ptr, __buffer); + } + + // This is the copy function from the standard, but + // with the arguments reordered to make it consistent with the + // rest of the interface. + // Note that this guaranteed not to compile if the draft standard + // order is assumed. + size_type copy(size_type __pos, size_type __n, _CharT* __buffer) const + { + size_t __size = size(); + size_t __len = (__pos + __n > __size? __size - __pos : __n); + + destroy(__buffer, __buffer + __len); + _S_flatten(_M_tree_ptr, __pos, __len, __buffer); + return __len; + } + + // Print to stdout, exposing structure. May be useful for + // performance debugging. + void dump() { + _S_dump(_M_tree_ptr); + } + + // Convert to 0 terminated string in new allocated memory. + // Embedded 0s in the input do not terminate the copy. + const _CharT* c_str() const; + + // As above, but lso use the flattened representation as the + // the new rope representation. + const _CharT* replace_with_c_str(); + + // Reclaim memory for the c_str generated flattened string. + // Intentionally undocumented, since it's hard to say when this + // is safe for multiple threads. + void delete_c_str () { + if (0 == _M_tree_ptr) return; + if (_RopeRep::_S_leaf == _M_tree_ptr->_M_tag && + ((_RopeLeaf*)_M_tree_ptr)->_M_data == + _M_tree_ptr->_M_c_string) { + // Representation shared + return; + } +# ifndef __GC + _M_tree_ptr->_M_free_c_string(); +# endif + _M_tree_ptr->_M_c_string = 0; + } + + _CharT operator[] (size_type __pos) const { + return _S_fetch(_M_tree_ptr, __pos); + } + + _CharT at(size_type __pos) const { + // if (__pos >= size()) throw out_of_range; // XXX + return (*this)[__pos]; + } + + const_iterator begin() const { + return(const_iterator(_M_tree_ptr, 0)); + } + + // An easy way to get a const iterator from a non-const container. + const_iterator const_begin() const { + return(const_iterator(_M_tree_ptr, 0)); + } + + const_iterator end() const { + return(const_iterator(_M_tree_ptr, size())); + } + + const_iterator const_end() const { + return(const_iterator(_M_tree_ptr, size())); + } + + size_type size() const { + return(0 == _M_tree_ptr? 0 : _M_tree_ptr->_M_size); + } + + size_type length() const { + return size(); + } + + size_type max_size() const { + return _S_min_len[_RopeRep::_S_max_rope_depth-1] - 1; + // Guarantees that the result can be sufficirntly + // balanced. Longer ropes will probably still work, + // but it's harder to make guarantees. + } + +# ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + typedef reverse_iterator<const_iterator> const_reverse_iterator; +# else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + typedef reverse_iterator<const_iterator, value_type, const_reference, + difference_type> const_reverse_iterator; +# endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + + const_reverse_iterator rbegin() const { + return const_reverse_iterator(end()); + } + + const_reverse_iterator const_rbegin() const { + return const_reverse_iterator(end()); + } + + const_reverse_iterator rend() const { + return const_reverse_iterator(begin()); + } + + const_reverse_iterator const_rend() const { + return const_reverse_iterator(begin()); + } + +#if defined(__STL_MEMBER_TEMPLATES) && defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER) + template<class _CharT2, class _Alloc2> + friend rope<_CharT2,_Alloc2> + operator+ (const rope<_CharT2,_Alloc2>& __left, + const rope<_CharT2,_Alloc2>& __right); + + template<class _CharT2, class _Alloc2> + friend rope<_CharT2,_Alloc2> + operator+ (const rope<_CharT2,_Alloc2>& __left, + const _CharT2* __right); + + template<class _CharT2, class _Alloc2> + friend rope<_CharT2,_Alloc2> + operator+ (const rope<_CharT2,_Alloc2>& __left, _CharT2 __right); +#else + friend rope<_CharT,_Alloc> __STD_QUALIFIER + operator+ __STL_NULL_TMPL_ARGS (const rope<_CharT,_Alloc>& __left, + const rope<_CharT,_Alloc>& __right); + + friend rope<_CharT,_Alloc> __STD_QUALIFIER + operator+ __STL_NULL_TMPL_ARGS (const rope<_CharT,_Alloc>& __left, + const _CharT* __right); + + friend rope<_CharT,_Alloc> __STD_QUALIFIER + operator+ __STL_NULL_TMPL_ARGS (const rope<_CharT,_Alloc>& __left, + _CharT __right); +#endif + // The symmetric cases are intentionally omitted, since they're presumed + // to be less common, and we don't handle them as well. + + // The following should really be templatized. + // The first argument should be an input iterator or + // forward iterator with value_type _CharT. + rope& append(const _CharT* __iter, size_t __n) { + _RopeRep* __result = + _S_destr_concat_char_iter(_M_tree_ptr, __iter, __n); + _S_unref(_M_tree_ptr); + _M_tree_ptr = __result; + return *this; + } + + rope& append(const _CharT* __c_string) { + size_t __len = _S_char_ptr_len(__c_string); + append(__c_string, __len); + return(*this); + } + + rope& append(const _CharT* __s, const _CharT* __e) { + _RopeRep* __result = + _S_destr_concat_char_iter(_M_tree_ptr, __s, __e - __s); + _S_unref(_M_tree_ptr); + _M_tree_ptr = __result; + return *this; + } + + rope& append(const_iterator __s, const_iterator __e) { + __stl_assert(__s._M_root == __e._M_root); +# ifdef __STL_USE_STD_ALLOCATORS + __stl_assert(get_allocator() == __s._M_root->get_allocator()); +# endif + _Self_destruct_ptr __appendee(_S_substring( + __s._M_root, __s._M_current_pos, __e._M_current_pos)); + _RopeRep* __result = + _S_concat(_M_tree_ptr, (_RopeRep*)__appendee); + _S_unref(_M_tree_ptr); + _M_tree_ptr = __result; + return *this; + } + + rope& append(_CharT __c) { + _RopeRep* __result = + _S_destr_concat_char_iter(_M_tree_ptr, &__c, 1); + _S_unref(_M_tree_ptr); + _M_tree_ptr = __result; + return *this; + } + + rope& append() { return append(_CharT()); } // XXX why? + + rope& append(const rope& __y) { +# ifdef __STL_USE_STD_ALLOCATORS + __stl_assert(__y.get_allocator() == get_allocator()); +# endif + _RopeRep* __result = _S_concat(_M_tree_ptr, __y._M_tree_ptr); + _S_unref(_M_tree_ptr); + _M_tree_ptr = __result; + return *this; + } + + rope& append(size_t __n, _CharT __c) { + rope<_CharT,_Alloc> __last(__n, __c); + return append(__last); + } + + void swap(rope& __b) { +# ifdef __STL_USE_STD_ALLOCATORS + __stl_assert(get_allocator() == __b.get_allocator()); +# endif + _RopeRep* __tmp = _M_tree_ptr; + _M_tree_ptr = __b._M_tree_ptr; + __b._M_tree_ptr = __tmp; + } + + + protected: + // Result is included in refcount. + static _RopeRep* replace(_RopeRep* __old, size_t __pos1, + size_t __pos2, _RopeRep* __r) { + if (0 == __old) { _S_ref(__r); return __r; } + _Self_destruct_ptr __left( + _S_substring(__old, 0, __pos1)); + _Self_destruct_ptr __right( + _S_substring(__old, __pos2, __old->_M_size)); + _RopeRep* __result; + +# ifdef __STL_USE_STD_ALLOCATORS + __stl_assert(__old->get_allocator() == __r->get_allocator()); +# endif + if (0 == __r) { + __result = _S_concat(__left, __right); + } else { + _Self_destruct_ptr __left_result(_S_concat(__left, __r)); + __result = _S_concat(__left_result, __right); + } + return __result; + } + + public: + void insert(size_t __p, const rope& __r) { + _RopeRep* __result = + replace(_M_tree_ptr, __p, __p, __r._M_tree_ptr); +# ifdef __STL_USE_STD_ALLOCATORS + __stl_assert(get_allocator() == __r.get_allocator()); +# endif + _S_unref(_M_tree_ptr); + _M_tree_ptr = __result; + } + + void insert(size_t __p, size_t __n, _CharT __c) { + rope<_CharT,_Alloc> __r(__n,__c); + insert(__p, __r); + } + + void insert(size_t __p, const _CharT* __i, size_t __n) { + _Self_destruct_ptr __left(_S_substring(_M_tree_ptr, 0, __p)); + _Self_destruct_ptr __right(_S_substring(_M_tree_ptr, __p, size())); + _Self_destruct_ptr __left_result( + _S_concat_char_iter(__left, __i, __n)); + // _S_ destr_concat_char_iter should be safe here. + // But as it stands it's probably not a win, since __left + // is likely to have additional references. + _RopeRep* __result = _S_concat(__left_result, __right); + _S_unref(_M_tree_ptr); + _M_tree_ptr = __result; + } + + void insert(size_t __p, const _CharT* __c_string) { + insert(__p, __c_string, _S_char_ptr_len(__c_string)); + } + + void insert(size_t __p, _CharT __c) { + insert(__p, &__c, 1); + } + + void insert(size_t __p) { + _CharT __c = _CharT(); + insert(__p, &__c, 1); + } + + void insert(size_t __p, const _CharT* __i, const _CharT* __j) { + rope __r(__i, __j); + insert(__p, __r); + } + + void insert(size_t __p, const const_iterator& __i, + const const_iterator& __j) { + rope __r(__i, __j); + insert(__p, __r); + } + + void insert(size_t __p, const iterator& __i, + const iterator& __j) { + rope __r(__i, __j); + insert(__p, __r); + } + + // (position, length) versions of replace operations: + + void replace(size_t __p, size_t __n, const rope& __r) { + _RopeRep* __result = + replace(_M_tree_ptr, __p, __p + __n, __r._M_tree_ptr); + _S_unref(_M_tree_ptr); + _M_tree_ptr = __result; + } + + void replace(size_t __p, size_t __n, + const _CharT* __i, size_t __i_len) { + rope __r(__i, __i_len); + replace(__p, __n, __r); + } + + void replace(size_t __p, size_t __n, _CharT __c) { + rope __r(__c); + replace(__p, __n, __r); + } + + void replace(size_t __p, size_t __n, const _CharT* __c_string) { + rope __r(__c_string); + replace(__p, __n, __r); + } + + void replace(size_t __p, size_t __n, + const _CharT* __i, const _CharT* __j) { + rope __r(__i, __j); + replace(__p, __n, __r); + } + + void replace(size_t __p, size_t __n, + const const_iterator& __i, const const_iterator& __j) { + rope __r(__i, __j); + replace(__p, __n, __r); + } + + void replace(size_t __p, size_t __n, + const iterator& __i, const iterator& __j) { + rope __r(__i, __j); + replace(__p, __n, __r); + } + + // Single character variants: + void replace(size_t __p, _CharT __c) { + iterator __i(this, __p); + *__i = __c; + } + + void replace(size_t __p, const rope& __r) { + replace(__p, 1, __r); + } + + void replace(size_t __p, const _CharT* __i, size_t __i_len) { + replace(__p, 1, __i, __i_len); + } + + void replace(size_t __p, const _CharT* __c_string) { + replace(__p, 1, __c_string); + } + + void replace(size_t __p, const _CharT* __i, const _CharT* __j) { + replace(__p, 1, __i, __j); + } + + void replace(size_t __p, const const_iterator& __i, + const const_iterator& __j) { + replace(__p, 1, __i, __j); + } + + void replace(size_t __p, const iterator& __i, + const iterator& __j) { + replace(__p, 1, __i, __j); + } + + // Erase, (position, size) variant. + void erase(size_t __p, size_t __n) { + _RopeRep* __result = replace(_M_tree_ptr, __p, __p + __n, 0); + _S_unref(_M_tree_ptr); + _M_tree_ptr = __result; + } + + // Erase, single character + void erase(size_t __p) { + erase(__p, __p + 1); + } + + // Insert, iterator variants. + iterator insert(const iterator& __p, const rope& __r) + { insert(__p.index(), __r); return __p; } + iterator insert(const iterator& __p, size_t __n, _CharT __c) + { insert(__p.index(), __n, __c); return __p; } + iterator insert(const iterator& __p, _CharT __c) + { insert(__p.index(), __c); return __p; } + iterator insert(const iterator& __p ) + { insert(__p.index()); return __p; } + iterator insert(const iterator& __p, const _CharT* c_string) + { insert(__p.index(), c_string); return __p; } + iterator insert(const iterator& __p, const _CharT* __i, size_t __n) + { insert(__p.index(), __i, __n); return __p; } + iterator insert(const iterator& __p, const _CharT* __i, + const _CharT* __j) + { insert(__p.index(), __i, __j); return __p; } + iterator insert(const iterator& __p, + const const_iterator& __i, const const_iterator& __j) + { insert(__p.index(), __i, __j); return __p; } + iterator insert(const iterator& __p, + const iterator& __i, const iterator& __j) + { insert(__p.index(), __i, __j); return __p; } + + // Replace, range variants. + void replace(const iterator& __p, const iterator& __q, + const rope& __r) + { replace(__p.index(), __q.index() - __p.index(), __r); } + void replace(const iterator& __p, const iterator& __q, _CharT __c) + { replace(__p.index(), __q.index() - __p.index(), __c); } + void replace(const iterator& __p, const iterator& __q, + const _CharT* __c_string) + { replace(__p.index(), __q.index() - __p.index(), __c_string); } + void replace(const iterator& __p, const iterator& __q, + const _CharT* __i, size_t __n) + { replace(__p.index(), __q.index() - __p.index(), __i, __n); } + void replace(const iterator& __p, const iterator& __q, + const _CharT* __i, const _CharT* __j) + { replace(__p.index(), __q.index() - __p.index(), __i, __j); } + void replace(const iterator& __p, const iterator& __q, + const const_iterator& __i, const const_iterator& __j) + { replace(__p.index(), __q.index() - __p.index(), __i, __j); } + void replace(const iterator& __p, const iterator& __q, + const iterator& __i, const iterator& __j) + { replace(__p.index(), __q.index() - __p.index(), __i, __j); } + + // Replace, iterator variants. + void replace(const iterator& __p, const rope& __r) + { replace(__p.index(), __r); } + void replace(const iterator& __p, _CharT __c) + { replace(__p.index(), __c); } + void replace(const iterator& __p, const _CharT* __c_string) + { replace(__p.index(), __c_string); } + void replace(const iterator& __p, const _CharT* __i, size_t __n) + { replace(__p.index(), __i, __n); } + void replace(const iterator& __p, const _CharT* __i, const _CharT* __j) + { replace(__p.index(), __i, __j); } + void replace(const iterator& __p, const_iterator __i, + const_iterator __j) + { replace(__p.index(), __i, __j); } + void replace(const iterator& __p, iterator __i, iterator __j) + { replace(__p.index(), __i, __j); } + + // Iterator and range variants of erase + iterator erase(const iterator& __p, const iterator& __q) { + size_t __p_index = __p.index(); + erase(__p_index, __q.index() - __p_index); + return iterator(this, __p_index); + } + iterator erase(const iterator& __p) { + size_t __p_index = __p.index(); + erase(__p_index, 1); + return iterator(this, __p_index); + } + + rope substr(size_t __start, size_t __len = 1) const { + return rope<_CharT,_Alloc>( + _S_substring(_M_tree_ptr, __start, __start + __len)); + } + + rope substr(iterator __start, iterator __end) const { + return rope<_CharT,_Alloc>( + _S_substring(_M_tree_ptr, __start.index(), __end.index())); + } + + rope substr(iterator __start) const { + size_t __pos = __start.index(); + return rope<_CharT,_Alloc>( + _S_substring(_M_tree_ptr, __pos, __pos + 1)); + } + + rope substr(const_iterator __start, const_iterator __end) const { + // This might eventually take advantage of the cache in the + // iterator. + return rope<_CharT,_Alloc>( + _S_substring(_M_tree_ptr, __start.index(), __end.index())); + } + + rope<_CharT,_Alloc> substr(const_iterator __start) { + size_t __pos = __start.index(); + return rope<_CharT,_Alloc>( + _S_substring(_M_tree_ptr, __pos, __pos + 1)); + } + + static const size_type npos; + + size_type find(_CharT __c, size_type __pos = 0) const; + size_type find(const _CharT* __s, size_type __pos = 0) const { + size_type __result_pos; + const_iterator __result = search(const_begin() + __pos, const_end(), + __s, __s + _S_char_ptr_len(__s)); + __result_pos = __result.index(); +# ifndef __STL_OLD_ROPE_SEMANTICS + if (__result_pos == size()) __result_pos = npos; +# endif + return __result_pos; + } + + iterator mutable_begin() { + return(iterator(this, 0)); + } + + iterator mutable_end() { + return(iterator(this, size())); + } + +# ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + typedef reverse_iterator<iterator> reverse_iterator; +# else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + typedef reverse_iterator<iterator, value_type, reference, + difference_type> reverse_iterator; +# endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + + reverse_iterator mutable_rbegin() { + return reverse_iterator(mutable_end()); + } + + reverse_iterator mutable_rend() { + return reverse_iterator(mutable_begin()); + } + + reference mutable_reference_at(size_type __pos) { + return reference(this, __pos); + } + +# ifdef __STD_STUFF + reference operator[] (size_type __pos) { + return _char_ref_proxy(this, __pos); + } + + reference at(size_type __pos) { + // if (__pos >= size()) throw out_of_range; // XXX + return (*this)[__pos]; + } + + void resize(size_type __n, _CharT __c) {} + void resize(size_type __n) {} + void reserve(size_type __res_arg = 0) {} + size_type capacity() const { + return max_size(); + } + + // Stuff below this line is dangerous because it's error prone. + // I would really like to get rid of it. + // copy function with funny arg ordering. + size_type copy(_CharT* __buffer, size_type __n, + size_type __pos = 0) const { + return copy(__pos, __n, __buffer); + } + + iterator end() { return mutable_end(); } + + iterator begin() { return mutable_begin(); } + + reverse_iterator rend() { return mutable_rend(); } + + reverse_iterator rbegin() { return mutable_rbegin(); } + +# else + + const_iterator end() { return const_end(); } + + const_iterator begin() { return const_begin(); } + + const_reverse_iterator rend() { return const_rend(); } + + const_reverse_iterator rbegin() { return const_rbegin(); } + +# endif + +}; + +template <class _CharT, class _Alloc> +const rope<_CharT, _Alloc>::size_type rope<_CharT, _Alloc>::npos = + (size_type)(-1); + +template <class _CharT, class _Alloc> +inline bool operator== (const _Rope_const_iterator<_CharT,_Alloc>& __x, + const _Rope_const_iterator<_CharT,_Alloc>& __y) { + return (__x._M_current_pos == __y._M_current_pos && + __x._M_root == __y._M_root); +} + +template <class _CharT, class _Alloc> +inline bool operator< (const _Rope_const_iterator<_CharT,_Alloc>& __x, + const _Rope_const_iterator<_CharT,_Alloc>& __y) { + return (__x._M_current_pos < __y._M_current_pos); +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _CharT, class _Alloc> +inline bool operator!= (const _Rope_const_iterator<_CharT,_Alloc>& __x, + const _Rope_const_iterator<_CharT,_Alloc>& __y) { + return !(__x == __y); +} + +template <class _CharT, class _Alloc> +inline bool operator> (const _Rope_const_iterator<_CharT,_Alloc>& __x, + const _Rope_const_iterator<_CharT,_Alloc>& __y) { + return __y < __x; +} + +template <class _CharT, class _Alloc> +inline bool operator<= (const _Rope_const_iterator<_CharT,_Alloc>& __x, + const _Rope_const_iterator<_CharT,_Alloc>& __y) { + return !(__y < __x); +} + +template <class _CharT, class _Alloc> +inline bool operator>= (const _Rope_const_iterator<_CharT,_Alloc>& __x, + const _Rope_const_iterator<_CharT,_Alloc>& __y) { + return !(__x < __y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +template <class _CharT, class _Alloc> +inline ptrdiff_t operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x, + const _Rope_const_iterator<_CharT,_Alloc>& __y) { + return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; +} + +template <class _CharT, class _Alloc> +inline _Rope_const_iterator<_CharT,_Alloc> +operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x, ptrdiff_t __n) { + return _Rope_const_iterator<_CharT,_Alloc>( + __x._M_root, __x._M_current_pos - __n); +} + +template <class _CharT, class _Alloc> +inline _Rope_const_iterator<_CharT,_Alloc> +operator+(const _Rope_const_iterator<_CharT,_Alloc>& __x, ptrdiff_t __n) { + return _Rope_const_iterator<_CharT,_Alloc>( + __x._M_root, __x._M_current_pos + __n); +} + +template <class _CharT, class _Alloc> +inline _Rope_const_iterator<_CharT,_Alloc> +operator+(ptrdiff_t __n, const _Rope_const_iterator<_CharT,_Alloc>& __x) { + return _Rope_const_iterator<_CharT,_Alloc>( + __x._M_root, __x._M_current_pos + __n); +} + +template <class _CharT, class _Alloc> +inline bool operator== (const _Rope_iterator<_CharT,_Alloc>& __x, + const _Rope_iterator<_CharT,_Alloc>& __y) { + return (__x._M_current_pos == __y._M_current_pos && + __x._M_root_rope == __y._M_root_rope); +} + +template <class _CharT, class _Alloc> +inline bool operator< (const _Rope_iterator<_CharT,_Alloc>& __x, + const _Rope_iterator<_CharT,_Alloc>& __y) { + return (__x._M_current_pos < __y._M_current_pos); +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _CharT, class _Alloc> +inline bool operator!= (const _Rope_iterator<_CharT,_Alloc>& __x, + const _Rope_iterator<_CharT,_Alloc>& __y) { + return !(__x == __y); +} + +template <class _CharT, class _Alloc> +inline bool operator> (const _Rope_iterator<_CharT,_Alloc>& __x, + const _Rope_iterator<_CharT,_Alloc>& __y) { + return __y < __x; +} + +template <class _CharT, class _Alloc> +inline bool operator<= (const _Rope_iterator<_CharT,_Alloc>& __x, + const _Rope_iterator<_CharT,_Alloc>& __y) { + return !(__y < __x); +} + +template <class _CharT, class _Alloc> +inline bool operator>= (const _Rope_iterator<_CharT,_Alloc>& __x, + const _Rope_iterator<_CharT,_Alloc>& __y) { + return !(__x < __y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +template <class _CharT, class _Alloc> +inline ptrdiff_t operator-(const _Rope_iterator<_CharT,_Alloc>& __x, + const _Rope_iterator<_CharT,_Alloc>& __y) { + return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; +} + +template <class _CharT, class _Alloc> +inline _Rope_iterator<_CharT,_Alloc> +operator-(const _Rope_iterator<_CharT,_Alloc>& __x, + ptrdiff_t __n) { + return _Rope_iterator<_CharT,_Alloc>( + __x._M_root_rope, __x._M_current_pos - __n); +} + +template <class _CharT, class _Alloc> +inline _Rope_iterator<_CharT,_Alloc> +operator+(const _Rope_iterator<_CharT,_Alloc>& __x, + ptrdiff_t __n) { + return _Rope_iterator<_CharT,_Alloc>( + __x._M_root_rope, __x._M_current_pos + __n); +} + +template <class _CharT, class _Alloc> +inline _Rope_iterator<_CharT,_Alloc> +operator+(ptrdiff_t __n, const _Rope_iterator<_CharT,_Alloc>& __x) { + return _Rope_iterator<_CharT,_Alloc>( + __x._M_root_rope, __x._M_current_pos + __n); +} + +template <class _CharT, class _Alloc> +inline +rope<_CharT,_Alloc> +operator+ (const rope<_CharT,_Alloc>& __left, + const rope<_CharT,_Alloc>& __right) +{ +# ifdef __STL_USE_STD_ALLOCATORS + __stl_assert(__left.get_allocator() == __right.get_allocator()); +# endif + return rope<_CharT,_Alloc>( + rope<_CharT,_Alloc>::_S_concat(__left._M_tree_ptr, __right._M_tree_ptr)); + // Inlining this should make it possible to keep __left and + // __right in registers. +} + +template <class _CharT, class _Alloc> +inline +rope<_CharT,_Alloc>& +operator+= (rope<_CharT,_Alloc>& __left, + const rope<_CharT,_Alloc>& __right) +{ + __left.append(__right); + return __left; +} + +template <class _CharT, class _Alloc> +inline +rope<_CharT,_Alloc> +operator+ (const rope<_CharT,_Alloc>& __left, + const _CharT* __right) { + size_t __rlen = rope<_CharT,_Alloc>::_S_char_ptr_len(__right); + return rope<_CharT,_Alloc>( + rope<_CharT,_Alloc>::_S_concat_char_iter( + __left._M_tree_ptr, __right, __rlen)); +} + +template <class _CharT, class _Alloc> +inline +rope<_CharT,_Alloc>& +operator+= (rope<_CharT,_Alloc>& __left, + const _CharT* __right) { + __left.append(__right); + return __left; +} + +template <class _CharT, class _Alloc> +inline +rope<_CharT,_Alloc> +operator+ (const rope<_CharT,_Alloc>& __left, _CharT __right) { + return rope<_CharT,_Alloc>( + rope<_CharT,_Alloc>::_S_concat_char_iter( + __left._M_tree_ptr, &__right, 1)); +} + +template <class _CharT, class _Alloc> +inline +rope<_CharT,_Alloc>& +operator+= (rope<_CharT,_Alloc>& __left, _CharT __right) { + __left.append(__right); + return __left; +} + +template <class _CharT, class _Alloc> +bool +operator< (const rope<_CharT,_Alloc>& __left, + const rope<_CharT,_Alloc>& __right) { + return __left.compare(__right) < 0; +} + +template <class _CharT, class _Alloc> +bool +operator== (const rope<_CharT,_Alloc>& __left, + const rope<_CharT,_Alloc>& __right) { + return __left.compare(__right) == 0; +} + +template <class _CharT, class _Alloc> +inline bool operator== (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x, + const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y) { + return (__x._M_pos == __y._M_pos && __x._M_root == __y._M_root); +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _CharT, class _Alloc> +inline bool +operator!= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) { + return !(__x == __y); +} + +template <class _CharT, class _Alloc> +inline bool +operator> (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) { + return __y < __x; +} + +template <class _CharT, class _Alloc> +inline bool +operator<= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) { + return !(__y < __x); +} + +template <class _CharT, class _Alloc> +inline bool +operator>= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) { + return !(__x < __y); +} + +template <class _CharT, class _Alloc> +inline bool operator!= (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x, + const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y) { + return !(__x == __y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +#ifdef __STL_USE_NEW_IOSTREAMS + template<class _CharT, class _Traits, class _Alloc> + basic_ostream<_CharT, _Traits>& operator<< + (basic_ostream<_CharT, _Traits>& __o, + const rope<_CharT, _Alloc>& __r); +#else + template<class _CharT, class _Alloc> + ostream& operator<< (ostream& __o, const rope<_CharT, _Alloc>& __r); +#endif + +typedef rope<char> crope; +typedef rope<wchar_t> wrope; + +inline crope::reference __mutable_reference_at(crope& __c, size_t __i) +{ + return __c.mutable_reference_at(__i); +} + +inline wrope::reference __mutable_reference_at(wrope& __c, size_t __i) +{ + return __c.mutable_reference_at(__i); +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _CharT, class _Alloc> +inline void swap(rope<_CharT,_Alloc>& __x, rope<_CharT,_Alloc>& __y) { + __x.swap(__y); +} + +#else + +inline void swap(crope __x, crope __y) { __x.swap(__y); } +inline void swap(wrope __x, wrope __y) { __x.swap(__y); } + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +// Hash functions should probably be revisited later: +__STL_TEMPLATE_NULL struct hash<crope> +{ + size_t operator()(const crope& __str) const + { + size_t __size = __str.size(); + + if (0 == __size) return 0; + return 13*__str[0] + 5*__str[__size - 1] + __size; + } +}; + + +__STL_TEMPLATE_NULL struct hash<wrope> +{ + size_t operator()(const wrope& __str) const + { + size_t __size = __str.size(); + + if (0 == __size) return 0; + return 13*__str[0] + 5*__str[__size - 1] + __size; + } +}; + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1174 +#endif + +__STL_END_NAMESPACE + +# include <ropeimpl.h> + +# endif /* __SGI_STL_INTERNAL_ROPE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_set.h b/dtm_release/local/include/stl/stl_set.h new file mode 100644 index 0000000000000000000000000000000000000000..1916d216a6359801bc4e861ab95e9f1f73e41dbb --- /dev/null +++ b/dtm_release/local/include/stl/stl_set.h @@ -0,0 +1,268 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_SET_H +#define __SGI_STL_INTERNAL_SET_H + +#include <concept_checks.h> + +__STL_BEGIN_NAMESPACE + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1174 +#pragma set woff 1375 +#endif + +// Forward declarations of operators < and ==, needed for friend declaration. + +template <class _Key, class _Compare __STL_DEPENDENT_DEFAULT_TMPL(less<_Key>), + class _Alloc = __STL_DEFAULT_ALLOCATOR(_Key) > +class set; + +template <class _Key, class _Compare, class _Alloc> +inline bool operator==(const set<_Key,_Compare,_Alloc>& __x, + const set<_Key,_Compare,_Alloc>& __y); + +template <class _Key, class _Compare, class _Alloc> +inline bool operator<(const set<_Key,_Compare,_Alloc>& __x, + const set<_Key,_Compare,_Alloc>& __y); + + +template <class _Key, class _Compare, class _Alloc> +class set { + // requirements: + + __STL_CLASS_REQUIRES(_Key, _Assignable); + __STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Key, _Key); + +public: + // typedefs: + + typedef _Key key_type; + typedef _Key value_type; + typedef _Compare key_compare; + typedef _Compare value_compare; +private: + typedef _Rb_tree<key_type, value_type, + _Identity<value_type>, key_compare, _Alloc> _Rep_type; + _Rep_type _M_t; // red-black tree representing set +public: + typedef typename _Rep_type::const_pointer pointer; + typedef typename _Rep_type::const_pointer const_pointer; + typedef typename _Rep_type::const_reference reference; + typedef typename _Rep_type::const_reference const_reference; + typedef typename _Rep_type::const_iterator iterator; + typedef typename _Rep_type::const_iterator const_iterator; + typedef typename _Rep_type::const_reverse_iterator reverse_iterator; + typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; + typedef typename _Rep_type::size_type size_type; + typedef typename _Rep_type::difference_type difference_type; + typedef typename _Rep_type::allocator_type allocator_type; + + // allocation/deallocation + + set() : _M_t(_Compare(), allocator_type()) {} + explicit set(const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) {} + +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + set(_InputIterator __first, _InputIterator __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_unique(__first, __last); } + + template <class _InputIterator> + set(_InputIterator __first, _InputIterator __last, const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); } +#else + set(const value_type* __first, const value_type* __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_unique(__first, __last); } + + set(const value_type* __first, + const value_type* __last, const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); } + + set(const_iterator __first, const_iterator __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_unique(__first, __last); } + + set(const_iterator __first, const_iterator __last, const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); } +#endif /* __STL_MEMBER_TEMPLATES */ + + set(const set<_Key,_Compare,_Alloc>& __x) : _M_t(__x._M_t) {} + set<_Key,_Compare,_Alloc>& operator=(const set<_Key, _Compare, _Alloc>& __x) + { + _M_t = __x._M_t; + return *this; + } + + // accessors: + + key_compare key_comp() const { return _M_t.key_comp(); } + value_compare value_comp() const { return _M_t.key_comp(); } + allocator_type get_allocator() const { return _M_t.get_allocator(); } + + iterator begin() const { return _M_t.begin(); } + iterator end() const { return _M_t.end(); } + reverse_iterator rbegin() const { return _M_t.rbegin(); } + reverse_iterator rend() const { return _M_t.rend(); } + bool empty() const { return _M_t.empty(); } + size_type size() const { return _M_t.size(); } + size_type max_size() const { return _M_t.max_size(); } + void swap(set<_Key,_Compare,_Alloc>& __x) { _M_t.swap(__x._M_t); } + + // insert/erase + pair<iterator,bool> insert(const value_type& __x) { + pair<typename _Rep_type::iterator, bool> __p = _M_t.insert_unique(__x); + return pair<iterator, bool>(__p.first, __p.second); + } + iterator insert(iterator __position, const value_type& __x) { + typedef typename _Rep_type::iterator _Rep_iterator; + return _M_t.insert_unique((_Rep_iterator&)__position, __x); + } +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + void insert(_InputIterator __first, _InputIterator __last) { + _M_t.insert_unique(__first, __last); + } +#else + void insert(const_iterator __first, const_iterator __last) { + _M_t.insert_unique(__first, __last); + } + void insert(const value_type* __first, const value_type* __last) { + _M_t.insert_unique(__first, __last); + } +#endif /* __STL_MEMBER_TEMPLATES */ + void erase(iterator __position) { + typedef typename _Rep_type::iterator _Rep_iterator; + _M_t.erase((_Rep_iterator&)__position); + } + size_type erase(const key_type& __x) { + return _M_t.erase(__x); + } + void erase(iterator __first, iterator __last) { + typedef typename _Rep_type::iterator _Rep_iterator; + _M_t.erase((_Rep_iterator&)__first, (_Rep_iterator&)__last); + } + void clear() { _M_t.clear(); } + + // set operations: + + iterator find(const key_type& __x) const { return _M_t.find(__x); } + size_type count(const key_type& __x) const { + return _M_t.find(__x) == _M_t.end() ? 0 : 1; + } + iterator lower_bound(const key_type& __x) const { + return _M_t.lower_bound(__x); + } + iterator upper_bound(const key_type& __x) const { + return _M_t.upper_bound(__x); + } + pair<iterator,iterator> equal_range(const key_type& __x) const { + return _M_t.equal_range(__x); + } + +#ifdef __STL_TEMPLATE_FRIENDS + template <class _K1, class _C1, class _A1> + friend bool operator== (const set<_K1,_C1,_A1>&, const set<_K1,_C1,_A1>&); + template <class _K1, class _C1, class _A1> + friend bool operator< (const set<_K1,_C1,_A1>&, const set<_K1,_C1,_A1>&); +#else /* __STL_TEMPLATE_FRIENDS */ + friend bool __STD_QUALIFIER + operator== __STL_NULL_TMPL_ARGS (const set&, const set&); + friend bool __STD_QUALIFIER + operator< __STL_NULL_TMPL_ARGS (const set&, const set&); +#endif /* __STL_TEMPLATE_FRIENDS */ +}; + +template <class _Key, class _Compare, class _Alloc> +inline bool operator==(const set<_Key,_Compare,_Alloc>& __x, + const set<_Key,_Compare,_Alloc>& __y) { + return __x._M_t == __y._M_t; +} + +template <class _Key, class _Compare, class _Alloc> +inline bool operator<(const set<_Key,_Compare,_Alloc>& __x, + const set<_Key,_Compare,_Alloc>& __y) { + return __x._M_t < __y._M_t; +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Key, class _Compare, class _Alloc> +inline bool operator!=(const set<_Key,_Compare,_Alloc>& __x, + const set<_Key,_Compare,_Alloc>& __y) { + return !(__x == __y); +} + +template <class _Key, class _Compare, class _Alloc> +inline bool operator>(const set<_Key,_Compare,_Alloc>& __x, + const set<_Key,_Compare,_Alloc>& __y) { + return __y < __x; +} + +template <class _Key, class _Compare, class _Alloc> +inline bool operator<=(const set<_Key,_Compare,_Alloc>& __x, + const set<_Key,_Compare,_Alloc>& __y) { + return !(__y < __x); +} + +template <class _Key, class _Compare, class _Alloc> +inline bool operator>=(const set<_Key,_Compare,_Alloc>& __x, + const set<_Key,_Compare,_Alloc>& __y) { + return !(__x < __y); +} + +template <class _Key, class _Compare, class _Alloc> +inline void swap(set<_Key,_Compare,_Alloc>& __x, + set<_Key,_Compare,_Alloc>& __y) { + __x.swap(__y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1174 +#pragma reset woff 1375 +#endif + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_SET_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_slist.h b/dtm_release/local/include/stl/stl_slist.h new file mode 100644 index 0000000000000000000000000000000000000000..a748d1ac1ac6e080bf0f56d0f9e52c072da11380 --- /dev/null +++ b/dtm_release/local/include/stl/stl_slist.h @@ -0,0 +1,1048 @@ +/* + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_SLIST_H +#define __SGI_STL_INTERNAL_SLIST_H + +#include <concept_checks.h> + +__STL_BEGIN_NAMESPACE + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1174 +#pragma set woff 1375 +#endif + +struct _Slist_node_base +{ + _Slist_node_base* _M_next; +}; + +inline _Slist_node_base* +__slist_make_link(_Slist_node_base* __prev_node, + _Slist_node_base* __new_node) +{ + __new_node->_M_next = __prev_node->_M_next; + __prev_node->_M_next = __new_node; + return __new_node; +} + +inline _Slist_node_base* +__slist_previous(_Slist_node_base* __head, + const _Slist_node_base* __node) +{ + while (__head && __head->_M_next != __node) + __head = __head->_M_next; + return __head; +} + +inline const _Slist_node_base* +__slist_previous(const _Slist_node_base* __head, + const _Slist_node_base* __node) +{ + while (__head && __head->_M_next != __node) + __head = __head->_M_next; + return __head; +} + +inline void __slist_splice_after(_Slist_node_base* __pos, + _Slist_node_base* __before_first, + _Slist_node_base* __before_last) +{ + if (__pos != __before_first && __pos != __before_last) { + _Slist_node_base* __first = __before_first->_M_next; + _Slist_node_base* __after = __pos->_M_next; + __before_first->_M_next = __before_last->_M_next; + __pos->_M_next = __first; + __before_last->_M_next = __after; + } +} + +inline void +__slist_splice_after(_Slist_node_base* __pos, _Slist_node_base* __head) +{ + _Slist_node_base* __before_last = __slist_previous(__head, 0); + if (__before_last != __head) { + _Slist_node_base* __after = __pos->_M_next; + __pos->_M_next = __head->_M_next; + __head->_M_next = 0; + __before_last->_M_next = __after; + } +} + +inline _Slist_node_base* __slist_reverse(_Slist_node_base* __node) +{ + _Slist_node_base* __result = __node; + __node = __node->_M_next; + __result->_M_next = 0; + while(__node) { + _Slist_node_base* __next = __node->_M_next; + __node->_M_next = __result; + __result = __node; + __node = __next; + } + return __result; +} + +inline size_t __slist_size(_Slist_node_base* __node) +{ + size_t __result = 0; + for ( ; __node != 0; __node = __node->_M_next) + ++__result; + return __result; +} + +template <class _Tp> +struct _Slist_node : public _Slist_node_base +{ + _Tp _M_data; +}; + +struct _Slist_iterator_base +{ + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef forward_iterator_tag iterator_category; + + _Slist_node_base* _M_node; + + _Slist_iterator_base(_Slist_node_base* __x) : _M_node(__x) {} + void _M_incr() { _M_node = _M_node->_M_next; } + + bool operator==(const _Slist_iterator_base& __x) const { + return _M_node == __x._M_node; + } + bool operator!=(const _Slist_iterator_base& __x) const { + return _M_node != __x._M_node; + } +}; + +template <class _Tp, class _Ref, class _Ptr> +struct _Slist_iterator : public _Slist_iterator_base +{ + typedef _Slist_iterator<_Tp, _Tp&, _Tp*> iterator; + typedef _Slist_iterator<_Tp, const _Tp&, const _Tp*> const_iterator; + typedef _Slist_iterator<_Tp, _Ref, _Ptr> _Self; + + typedef _Tp value_type; + typedef _Ptr pointer; + typedef _Ref reference; + typedef _Slist_node<_Tp> _Node; + + _Slist_iterator(_Node* __x) : _Slist_iterator_base(__x) {} + _Slist_iterator() : _Slist_iterator_base(0) {} + _Slist_iterator(const iterator& __x) : _Slist_iterator_base(__x._M_node) {} + + reference operator*() const { return ((_Node*) _M_node)->_M_data; } +#ifndef __SGI_STL_NO_ARROW_OPERATOR + pointer operator->() const { return &(operator*()); } +#endif /* __SGI_STL_NO_ARROW_OPERATOR */ + + _Self& operator++() + { + _M_incr(); + return *this; + } + _Self operator++(int) + { + _Self __tmp = *this; + _M_incr(); + return __tmp; + } +}; + +#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION + +inline ptrdiff_t* distance_type(const _Slist_iterator_base&) { + return 0; +} + +inline forward_iterator_tag iterator_category(const _Slist_iterator_base&) { + return forward_iterator_tag(); +} + +template <class _Tp, class _Ref, class _Ptr> +inline _Tp* value_type(const _Slist_iterator<_Tp, _Ref, _Ptr>&) { + return 0; +} + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +// Base class that encapsulates details of allocators. Three cases: +// an ordinary standard-conforming allocator, a standard-conforming +// allocator with no non-static data, and an SGI-style allocator. +// This complexity is necessary only because we're worrying about backward +// compatibility and because we want to avoid wasting storage on an +// allocator instance if it isn't necessary. + +#ifdef __STL_USE_STD_ALLOCATORS + +// Base for general standard-conforming allocators. +template <class _Tp, class _Allocator, bool _IsStatic> +class _Slist_alloc_base { +public: + typedef typename _Alloc_traits<_Tp,_Allocator>::allocator_type + allocator_type; + allocator_type get_allocator() const { return _M_node_allocator; } + + _Slist_alloc_base(const allocator_type& __a) : _M_node_allocator(__a) {} + +protected: + _Slist_node<_Tp>* _M_get_node() + { return _M_node_allocator.allocate(1); } + void _M_put_node(_Slist_node<_Tp>* __p) + { _M_node_allocator.deallocate(__p, 1); } + +protected: + typename _Alloc_traits<_Slist_node<_Tp>,_Allocator>::allocator_type + _M_node_allocator; + _Slist_node_base _M_head; +}; + +// Specialization for instanceless allocators. +template <class _Tp, class _Allocator> +class _Slist_alloc_base<_Tp,_Allocator, true> { +public: + typedef typename _Alloc_traits<_Tp,_Allocator>::allocator_type + allocator_type; + allocator_type get_allocator() const { return allocator_type(); } + + _Slist_alloc_base(const allocator_type&) {} + +protected: + typedef typename _Alloc_traits<_Slist_node<_Tp>, _Allocator>::_Alloc_type + _Alloc_type; + _Slist_node<_Tp>* _M_get_node() { return _Alloc_type::allocate(1); } + void _M_put_node(_Slist_node<_Tp>* __p) { _Alloc_type::deallocate(__p, 1); } + +protected: + _Slist_node_base _M_head; +}; + + +template <class _Tp, class _Alloc> +struct _Slist_base + : public _Slist_alloc_base<_Tp, _Alloc, + _Alloc_traits<_Tp, _Alloc>::_S_instanceless> +{ + typedef _Slist_alloc_base<_Tp, _Alloc, + _Alloc_traits<_Tp, _Alloc>::_S_instanceless> + _Base; + typedef typename _Base::allocator_type allocator_type; + + _Slist_base(const allocator_type& __a) + : _Base(__a) { this->_M_head._M_next = 0; } + ~_Slist_base() { _M_erase_after(&this->_M_head, 0); } + +protected: + + _Slist_node_base* _M_erase_after(_Slist_node_base* __pos) + { + _Slist_node<_Tp>* __next = (_Slist_node<_Tp>*) (__pos->_M_next); + _Slist_node_base* __next_next = __next->_M_next; + __pos->_M_next = __next_next; + destroy(&__next->_M_data); + _M_put_node(__next); + return __next_next; + } + _Slist_node_base* _M_erase_after(_Slist_node_base*, _Slist_node_base*); +}; + +#else /* __STL_USE_STD_ALLOCATORS */ + +template <class _Tp, class _Alloc> +struct _Slist_base { + typedef _Alloc allocator_type; + allocator_type get_allocator() const { return allocator_type(); } + + _Slist_base(const allocator_type&) { _M_head._M_next = 0; } + ~_Slist_base() { _M_erase_after(&_M_head, 0); } + +protected: + typedef simple_alloc<_Slist_node<_Tp>, _Alloc> _Alloc_type; + _Slist_node<_Tp>* _M_get_node() { return _Alloc_type::allocate(1); } + void _M_put_node(_Slist_node<_Tp>* __p) { _Alloc_type::deallocate(__p, 1); } + + _Slist_node_base* _M_erase_after(_Slist_node_base* __pos) + { + _Slist_node<_Tp>* __next = (_Slist_node<_Tp>*) (__pos->_M_next); + _Slist_node_base* __next_next = __next->_M_next; + __pos->_M_next = __next_next; + destroy(&__next->_M_data); + _M_put_node(__next); + return __next_next; + } + _Slist_node_base* _M_erase_after(_Slist_node_base*, _Slist_node_base*); + +protected: + _Slist_node_base _M_head; +}; + +#endif /* __STL_USE_STD_ALLOCATORS */ + +template <class _Tp, class _Alloc> +_Slist_node_base* +_Slist_base<_Tp,_Alloc>::_M_erase_after(_Slist_node_base* __before_first, + _Slist_node_base* __last_node) { + _Slist_node<_Tp>* __cur = (_Slist_node<_Tp>*) (__before_first->_M_next); + while (__cur != __last_node) { + _Slist_node<_Tp>* __tmp = __cur; + __cur = (_Slist_node<_Tp>*) __cur->_M_next; + destroy(&__tmp->_M_data); + _M_put_node(__tmp); + } + __before_first->_M_next = __last_node; + return __last_node; +} + +template <class _Tp, class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) > +class slist : private _Slist_base<_Tp,_Alloc> +{ + // requirements: + + __STL_CLASS_REQUIRES(_Tp, _Assignable); + +private: + typedef _Slist_base<_Tp,_Alloc> _Base; +public: + typedef _Tp value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + + typedef _Slist_iterator<_Tp, _Tp&, _Tp*> iterator; + typedef _Slist_iterator<_Tp, const _Tp&, const _Tp*> const_iterator; + + typedef typename _Base::allocator_type allocator_type; + allocator_type get_allocator() const { return _Base::get_allocator(); } + +private: + typedef _Slist_node<_Tp> _Node; + typedef _Slist_node_base _Node_base; + typedef _Slist_iterator_base _Iterator_base; + + _Node* _M_create_node(const value_type& __x) { + _Node* __node = this->_M_get_node(); + __STL_TRY { + construct(&__node->_M_data, __x); + __node->_M_next = 0; + } + __STL_UNWIND(this->_M_put_node(__node)); + return __node; + } + + _Node* _M_create_node() { + _Node* __node = this->_M_get_node(); + __STL_TRY { + construct(&__node->_M_data); + __node->_M_next = 0; + } + __STL_UNWIND(this->_M_put_node(__node)); + return __node; + } + +public: + explicit slist(const allocator_type& __a = allocator_type()) : _Base(__a) {} + + slist(size_type __n, const value_type& __x, + const allocator_type& __a = allocator_type()) : _Base(__a) + { _M_insert_after_fill(&this->_M_head, __n, __x); } + + explicit slist(size_type __n) : _Base(allocator_type()) + { _M_insert_after_fill(&this->_M_head, __n, value_type()); } + +#ifdef __STL_MEMBER_TEMPLATES + // We don't need any dispatching tricks here, because _M_insert_after_range + // already does them. + template <class _InputIterator> + slist(_InputIterator __first, _InputIterator __last, + const allocator_type& __a = allocator_type()) : _Base(__a) + { _M_insert_after_range(&this->_M_head, __first, __last); } + +#else /* __STL_MEMBER_TEMPLATES */ + slist(const_iterator __first, const_iterator __last, + const allocator_type& __a = allocator_type()) : _Base(__a) + { _M_insert_after_range(&this->_M_head, __first, __last); } + slist(const value_type* __first, const value_type* __last, + const allocator_type& __a = allocator_type()) : _Base(__a) + { _M_insert_after_range(&this->_M_head, __first, __last); } +#endif /* __STL_MEMBER_TEMPLATES */ + + slist(const slist& __x) : _Base(__x.get_allocator()) + { _M_insert_after_range(&this->_M_head, __x.begin(), __x.end()); } + + slist& operator= (const slist& __x); + + ~slist() {} + +public: + // assign(), a generalized assignment member function. Two + // versions: one that takes a count, and one that takes a range. + // The range version is a member template, so we dispatch on whether + // or not the type is an integer. + + void assign(size_type __n, const _Tp& __val) + { _M_fill_assign(__n, __val); } + + void _M_fill_assign(size_type __n, const _Tp& __val); + + +#ifdef __STL_MEMBER_TEMPLATES + + template <class _InputIterator> + void assign(_InputIterator __first, _InputIterator __last) { + typedef typename _Is_integer<_InputIterator>::_Integral _Integral; + _M_assign_dispatch(__first, __last, _Integral()); + } + + template <class _Integer> + void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) + { _M_fill_assign((size_type) __n, (_Tp) __val); } + + template <class _InputIterator> + void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, + __false_type); + +#endif /* __STL_MEMBER_TEMPLATES */ + +public: + + iterator begin() { return iterator((_Node*)this->_M_head._M_next); } + const_iterator begin() const + { return const_iterator((_Node*)this->_M_head._M_next);} + + iterator end() { return iterator(0); } + const_iterator end() const { return const_iterator(0); } + + // Experimental new feature: before_begin() returns a + // non-dereferenceable iterator that, when incremented, yields + // begin(). This iterator may be used as the argument to + // insert_after, erase_after, etc. Note that even for an empty + // slist, before_begin() is not the same iterator as end(). It + // is always necessary to increment before_begin() at least once to + // obtain end(). + iterator before_begin() { return iterator((_Node*) &this->_M_head); } + const_iterator before_begin() const + { return const_iterator((_Node*) &this->_M_head); } + + size_type size() const { return __slist_size(this->_M_head._M_next); } + + size_type max_size() const { return size_type(-1); } + + bool empty() const { return this->_M_head._M_next == 0; } + + void swap(slist& __x) + { __STD::swap(this->_M_head._M_next, __x._M_head._M_next); } + +public: + + reference front() { return ((_Node*) this->_M_head._M_next)->_M_data; } + const_reference front() const + { return ((_Node*) this->_M_head._M_next)->_M_data; } + void push_front(const value_type& __x) { + __slist_make_link(&this->_M_head, _M_create_node(__x)); + } + void push_front() { __slist_make_link(&this->_M_head, _M_create_node()); } + void pop_front() { + _Node* __node = (_Node*) this->_M_head._M_next; + this->_M_head._M_next = __node->_M_next; + destroy(&__node->_M_data); + this->_M_put_node(__node); + } + + iterator previous(const_iterator __pos) { + return iterator((_Node*) __slist_previous(&this->_M_head, __pos._M_node)); + } + const_iterator previous(const_iterator __pos) const { + return const_iterator((_Node*) __slist_previous(&this->_M_head, + __pos._M_node)); + } + +private: + _Node* _M_insert_after(_Node_base* __pos, const value_type& __x) { + return (_Node*) (__slist_make_link(__pos, _M_create_node(__x))); + } + + _Node* _M_insert_after(_Node_base* __pos) { + return (_Node*) (__slist_make_link(__pos, _M_create_node())); + } + + void _M_insert_after_fill(_Node_base* __pos, + size_type __n, const value_type& __x) { + for (size_type __i = 0; __i < __n; ++__i) + __pos = __slist_make_link(__pos, _M_create_node(__x)); + } + +#ifdef __STL_MEMBER_TEMPLATES + + // Check whether it's an integral type. If so, it's not an iterator. + template <class _InIter> + void _M_insert_after_range(_Node_base* __pos, + _InIter __first, _InIter __last) { + typedef typename _Is_integer<_InIter>::_Integral _Integral; + _M_insert_after_range(__pos, __first, __last, _Integral()); + } + + template <class _Integer> + void _M_insert_after_range(_Node_base* __pos, _Integer __n, _Integer __x, + __true_type) { + _M_insert_after_fill(__pos, __n, __x); + } + + template <class _InIter> + void _M_insert_after_range(_Node_base* __pos, + _InIter __first, _InIter __last, + __false_type) { + while (__first != __last) { + __pos = __slist_make_link(__pos, _M_create_node(*__first)); + ++__first; + } + } + +#else /* __STL_MEMBER_TEMPLATES */ + + void _M_insert_after_range(_Node_base* __pos, + const_iterator __first, const_iterator __last) { + while (__first != __last) { + __pos = __slist_make_link(__pos, _M_create_node(*__first)); + ++__first; + } + } + void _M_insert_after_range(_Node_base* __pos, + const value_type* __first, + const value_type* __last) { + while (__first != __last) { + __pos = __slist_make_link(__pos, _M_create_node(*__first)); + ++__first; + } + } + +#endif /* __STL_MEMBER_TEMPLATES */ + +public: + + iterator insert_after(iterator __pos, const value_type& __x) { + return iterator(_M_insert_after(__pos._M_node, __x)); + } + + iterator insert_after(iterator __pos) { + return insert_after(__pos, value_type()); + } + + void insert_after(iterator __pos, size_type __n, const value_type& __x) { + _M_insert_after_fill(__pos._M_node, __n, __x); + } + +#ifdef __STL_MEMBER_TEMPLATES + + // We don't need any dispatching tricks here, because _M_insert_after_range + // already does them. + template <class _InIter> + void insert_after(iterator __pos, _InIter __first, _InIter __last) { + _M_insert_after_range(__pos._M_node, __first, __last); + } + +#else /* __STL_MEMBER_TEMPLATES */ + + void insert_after(iterator __pos, + const_iterator __first, const_iterator __last) { + _M_insert_after_range(__pos._M_node, __first, __last); + } + void insert_after(iterator __pos, + const value_type* __first, const value_type* __last) { + _M_insert_after_range(__pos._M_node, __first, __last); + } + +#endif /* __STL_MEMBER_TEMPLATES */ + + iterator insert(iterator __pos, const value_type& __x) { + return iterator(_M_insert_after(__slist_previous(&this->_M_head, + __pos._M_node), + __x)); + } + + iterator insert(iterator __pos) { + return iterator(_M_insert_after(__slist_previous(&this->_M_head, + __pos._M_node), + value_type())); + } + + void insert(iterator __pos, size_type __n, const value_type& __x) { + _M_insert_after_fill(__slist_previous(&this->_M_head, __pos._M_node), + __n, __x); + } + +#ifdef __STL_MEMBER_TEMPLATES + + // We don't need any dispatching tricks here, because _M_insert_after_range + // already does them. + template <class _InIter> + void insert(iterator __pos, _InIter __first, _InIter __last) { + _M_insert_after_range(__slist_previous(&this->_M_head, __pos._M_node), + __first, __last); + } + +#else /* __STL_MEMBER_TEMPLATES */ + + void insert(iterator __pos, const_iterator __first, const_iterator __last) { + _M_insert_after_range(__slist_previous(&this->_M_head, __pos._M_node), + __first, __last); + } + void insert(iterator __pos, const value_type* __first, + const value_type* __last) { + _M_insert_after_range(__slist_previous(&this->_M_head, __pos._M_node), + __first, __last); + } + +#endif /* __STL_MEMBER_TEMPLATES */ + + +public: + iterator erase_after(iterator __pos) { + return iterator((_Node*) this->_M_erase_after(__pos._M_node)); + } + iterator erase_after(iterator __before_first, iterator __last) { + return iterator((_Node*) this->_M_erase_after(__before_first._M_node, + __last._M_node)); + } + + iterator erase(iterator __pos) { + return (_Node*) this->_M_erase_after(__slist_previous(&this->_M_head, + __pos._M_node)); + } + iterator erase(iterator __first, iterator __last) { + return (_Node*) this->_M_erase_after( + __slist_previous(&this->_M_head, __first._M_node), __last._M_node); + } + + void resize(size_type new_size, const _Tp& __x); + void resize(size_type new_size) { resize(new_size, _Tp()); } + void clear() { this->_M_erase_after(&this->_M_head, 0); } + +public: + // Moves the range [__before_first + 1, __before_last + 1) to *this, + // inserting it immediately after __pos. This is constant time. + void splice_after(iterator __pos, + iterator __before_first, iterator __before_last) + { + if (__before_first != __before_last) + __slist_splice_after(__pos._M_node, __before_first._M_node, + __before_last._M_node); + } + + // Moves the element that follows __prev to *this, inserting it immediately + // after __pos. This is constant time. + void splice_after(iterator __pos, iterator __prev) + { + __slist_splice_after(__pos._M_node, + __prev._M_node, __prev._M_node->_M_next); + } + + + // Removes all of the elements from the list __x to *this, inserting + // them immediately after __pos. __x must not be *this. Complexity: + // linear in __x.size(). + void splice_after(iterator __pos, slist& __x) + { + __slist_splice_after(__pos._M_node, &__x._M_head); + } + + // Linear in distance(begin(), __pos), and linear in __x.size(). + void splice(iterator __pos, slist& __x) { + if (__x._M_head._M_next) + __slist_splice_after(__slist_previous(&this->_M_head, __pos._M_node), + &__x._M_head, __slist_previous(&__x._M_head, 0)); + } + + // Linear in distance(begin(), __pos), and in distance(__x.begin(), __i). + void splice(iterator __pos, slist& __x, iterator __i) { + __slist_splice_after(__slist_previous(&this->_M_head, __pos._M_node), + __slist_previous(&__x._M_head, __i._M_node), + __i._M_node); + } + + // Linear in distance(begin(), __pos), in distance(__x.begin(), __first), + // and in distance(__first, __last). + void splice(iterator __pos, slist& __x, iterator __first, iterator __last) + { + if (__first != __last) + __slist_splice_after(__slist_previous(&this->_M_head, __pos._M_node), + __slist_previous(&__x._M_head, __first._M_node), + __slist_previous(__first._M_node, __last._M_node)); + } + +public: + void reverse() { + if (this->_M_head._M_next) + this->_M_head._M_next = __slist_reverse(this->_M_head._M_next); + } + + void remove(const _Tp& __val); + void unique(); + void merge(slist& __x); + void sort(); + +#ifdef __STL_MEMBER_TEMPLATES + template <class _Predicate> + void remove_if(_Predicate __pred); + + template <class _BinaryPredicate> + void unique(_BinaryPredicate __pred); + + template <class _StrictWeakOrdering> + void merge(slist&, _StrictWeakOrdering); + + template <class _StrictWeakOrdering> + void sort(_StrictWeakOrdering __comp); +#endif /* __STL_MEMBER_TEMPLATES */ +}; + +template <class _Tp, class _Alloc> +slist<_Tp,_Alloc>& slist<_Tp,_Alloc>::operator=(const slist<_Tp,_Alloc>& __x) +{ + if (&__x != this) { + _Node_base* __p1 = &this->_M_head; + _Node* __n1 = (_Node*) this->_M_head._M_next; + const _Node* __n2 = (const _Node*) __x._M_head._M_next; + while (__n1 && __n2) { + __n1->_M_data = __n2->_M_data; + __p1 = __n1; + __n1 = (_Node*) __n1->_M_next; + __n2 = (const _Node*) __n2->_M_next; + } + if (__n2 == 0) + this->_M_erase_after(__p1, 0); + else + _M_insert_after_range(__p1, const_iterator((_Node*)__n2), + const_iterator(0)); + } + return *this; +} + +template <class _Tp, class _Alloc> +void slist<_Tp, _Alloc>::_M_fill_assign(size_type __n, const _Tp& __val) { + _Node_base* __prev = &this->_M_head; + _Node* __node = (_Node*) this->_M_head._M_next; + for ( ; __node != 0 && __n > 0 ; --__n) { + __node->_M_data = __val; + __prev = __node; + __node = (_Node*) __node->_M_next; + } + if (__n > 0) + _M_insert_after_fill(__prev, __n, __val); + else + this->_M_erase_after(__prev, 0); +} + +#ifdef __STL_MEMBER_TEMPLATES + +template <class _Tp, class _Alloc> template <class _InputIter> +void +slist<_Tp, _Alloc>::_M_assign_dispatch(_InputIter __first, _InputIter __last, + __false_type) +{ + _Node_base* __prev = &this->_M_head; + _Node* __node = (_Node*) this->_M_head._M_next; + while (__node != 0 && __first != __last) { + __node->_M_data = *__first; + __prev = __node; + __node = (_Node*) __node->_M_next; + ++__first; + } + if (__first != __last) + _M_insert_after_range(__prev, __first, __last); + else + this->_M_erase_after(__prev, 0); +} + +#endif /* __STL_MEMBER_TEMPLATES */ + +template <class _Tp, class _Alloc> +inline bool +operator==(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) +{ + typedef typename slist<_Tp,_Alloc>::const_iterator const_iterator; + const_iterator __end1 = _SL1.end(); + const_iterator __end2 = _SL2.end(); + + const_iterator __i1 = _SL1.begin(); + const_iterator __i2 = _SL2.begin(); + while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) { + ++__i1; + ++__i2; + } + return __i1 == __end1 && __i2 == __end2; +} + + +template <class _Tp, class _Alloc> +inline bool +operator<(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) +{ + return lexicographical_compare(_SL1.begin(), _SL1.end(), + _SL2.begin(), _SL2.end()); +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Tp, class _Alloc> +inline bool +operator!=(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) { + return !(_SL1 == _SL2); +} + +template <class _Tp, class _Alloc> +inline bool +operator>(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) { + return _SL2 < _SL1; +} + +template <class _Tp, class _Alloc> +inline bool +operator<=(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) { + return !(_SL2 < _SL1); +} + +template <class _Tp, class _Alloc> +inline bool +operator>=(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) { + return !(_SL1 < _SL2); +} + +template <class _Tp, class _Alloc> +inline void swap(slist<_Tp,_Alloc>& __x, slist<_Tp,_Alloc>& __y) { + __x.swap(__y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + + +template <class _Tp, class _Alloc> +void slist<_Tp,_Alloc>::resize(size_type __len, const _Tp& __x) +{ + _Node_base* __cur = &this->_M_head; + while (__cur->_M_next != 0 && __len > 0) { + --__len; + __cur = __cur->_M_next; + } + if (__cur->_M_next) + this->_M_erase_after(__cur, 0); + else + _M_insert_after_fill(__cur, __len, __x); +} + +template <class _Tp, class _Alloc> +void slist<_Tp,_Alloc>::remove(const _Tp& __val) +{ + _Node_base* __cur = &this->_M_head; + while (__cur && __cur->_M_next) { + if (((_Node*) __cur->_M_next)->_M_data == __val) + this->_M_erase_after(__cur); + else + __cur = __cur->_M_next; + } +} + +template <class _Tp, class _Alloc> +void slist<_Tp,_Alloc>::unique() +{ + _Node_base* __cur = this->_M_head._M_next; + if (__cur) { + while (__cur->_M_next) { + if (((_Node*)__cur)->_M_data == + ((_Node*)(__cur->_M_next))->_M_data) + this->_M_erase_after(__cur); + else + __cur = __cur->_M_next; + } + } +} + +template <class _Tp, class _Alloc> +void slist<_Tp,_Alloc>::merge(slist<_Tp,_Alloc>& __x) +{ + _Node_base* __n1 = &this->_M_head; + while (__n1->_M_next && __x._M_head._M_next) { + if (((_Node*) __x._M_head._M_next)->_M_data < + ((_Node*) __n1->_M_next)->_M_data) + __slist_splice_after(__n1, &__x._M_head, __x._M_head._M_next); + __n1 = __n1->_M_next; + } + if (__x._M_head._M_next) { + __n1->_M_next = __x._M_head._M_next; + __x._M_head._M_next = 0; + } +} + +template <class _Tp, class _Alloc> +void slist<_Tp,_Alloc>::sort() +{ + if (this->_M_head._M_next && this->_M_head._M_next->_M_next) { + slist __carry; + slist __counter[64]; + int __fill = 0; + while (!empty()) { + __slist_splice_after(&__carry._M_head, + &this->_M_head, this->_M_head._M_next); + int __i = 0; + while (__i < __fill && !__counter[__i].empty()) { + __counter[__i].merge(__carry); + __carry.swap(__counter[__i]); + ++__i; + } + __carry.swap(__counter[__i]); + if (__i == __fill) + ++__fill; + } + + for (int __i = 1; __i < __fill; ++__i) + __counter[__i].merge(__counter[__i-1]); + this->swap(__counter[__fill-1]); + } +} + +#ifdef __STL_MEMBER_TEMPLATES + +template <class _Tp, class _Alloc> +template <class _Predicate> +void slist<_Tp,_Alloc>::remove_if(_Predicate __pred) +{ + _Node_base* __cur = &this->_M_head; + while (__cur->_M_next) { + if (__pred(((_Node*) __cur->_M_next)->_M_data)) + this->_M_erase_after(__cur); + else + __cur = __cur->_M_next; + } +} + +template <class _Tp, class _Alloc> template <class _BinaryPredicate> +void slist<_Tp,_Alloc>::unique(_BinaryPredicate __pred) +{ + _Node* __cur = (_Node*) this->_M_head._M_next; + if (__cur) { + while (__cur->_M_next) { + if (__pred(((_Node*)__cur)->_M_data, + ((_Node*)(__cur->_M_next))->_M_data)) + this->_M_erase_after(__cur); + else + __cur = (_Node*) __cur->_M_next; + } + } +} + +template <class _Tp, class _Alloc> template <class _StrictWeakOrdering> +void slist<_Tp,_Alloc>::merge(slist<_Tp,_Alloc>& __x, + _StrictWeakOrdering __comp) +{ + _Node_base* __n1 = &this->_M_head; + while (__n1->_M_next && __x._M_head._M_next) { + if (__comp(((_Node*) __x._M_head._M_next)->_M_data, + ((_Node*) __n1->_M_next)->_M_data)) + __slist_splice_after(__n1, &__x._M_head, __x._M_head._M_next); + __n1 = __n1->_M_next; + } + if (__x._M_head._M_next) { + __n1->_M_next = __x._M_head._M_next; + __x._M_head._M_next = 0; + } +} + +template <class _Tp, class _Alloc> template <class _StrictWeakOrdering> +void slist<_Tp,_Alloc>::sort(_StrictWeakOrdering __comp) +{ + if (this->_M_head._M_next && this->_M_head._M_next->_M_next) { + slist __carry; + slist __counter[64]; + int __fill = 0; + while (!empty()) { + __slist_splice_after(&__carry._M_head, + &this->_M_head, this->_M_head._M_next); + int __i = 0; + while (__i < __fill && !__counter[__i].empty()) { + __counter[__i].merge(__carry, __comp); + __carry.swap(__counter[__i]); + ++__i; + } + __carry.swap(__counter[__i]); + if (__i == __fill) + ++__fill; + } + + for (int __i = 1; __i < __fill; ++__i) + __counter[__i].merge(__counter[__i-1], __comp); + this->swap(__counter[__fill-1]); + } +} + +#endif /* __STL_MEMBER_TEMPLATES */ + +// Specialization of insert_iterator so that insertions will be constant +// time rather than linear time. + +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + +template <class _Tp, class _Alloc> +class insert_iterator<slist<_Tp, _Alloc> > { +protected: + typedef slist<_Tp, _Alloc> _Container; + _Container* container; + typename _Container::iterator iter; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + insert_iterator(_Container& __x, typename _Container::iterator __i) + : container(&__x) { + if (__i == __x.begin()) + iter = __x.before_begin(); + else + iter = __x.previous(__i); + } + + insert_iterator<_Container>& + operator=(const typename _Container::value_type& __value) { + iter = container->insert_after(iter, __value); + return *this; + } + insert_iterator<_Container>& operator*() { return *this; } + insert_iterator<_Container>& operator++() { return *this; } + insert_iterator<_Container>& operator++(int) { return *this; } +}; + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1174 +#pragma reset woff 1375 +#endif + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_SLIST_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_stack.h b/dtm_release/local/include/stl/stl_stack.h new file mode 100644 index 0000000000000000000000000000000000000000..0693e57fa14cfa4368ec072a07148f4cb1235940 --- /dev/null +++ b/dtm_release/local/include/stl/stl_stack.h @@ -0,0 +1,143 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_STACK_H +#define __SGI_STL_INTERNAL_STACK_H + +#include <sequence_concepts.h> + +__STL_BEGIN_NAMESPACE + +// Forward declarations of operators == and <, needed for friend declaration. + +template <class _Tp, + class _Sequence __STL_DEPENDENT_DEFAULT_TMPL(deque<_Tp>) > +class stack; + +template <class _Tp, class _Seq> +bool operator==(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y); + +template <class _Tp, class _Seq> +bool operator<(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y); + + +template <class _Tp, class _Sequence> +class stack { + + // requirements: + + __STL_CLASS_REQUIRES(_Tp, _Assignable); + __STL_CLASS_REQUIRES(_Sequence, _BackInsertionSequence); + typedef typename _Sequence::value_type _Sequence_value_type; + __STL_CLASS_REQUIRES_SAME_TYPE(_Tp, _Sequence_value_type); + + +#ifdef __STL_MEMBER_TEMPLATES + template <class _Tp1, class _Seq1> + friend bool operator== (const stack<_Tp1, _Seq1>&, + const stack<_Tp1, _Seq1>&); + template <class _Tp1, class _Seq1> + friend bool operator< (const stack<_Tp1, _Seq1>&, + const stack<_Tp1, _Seq1>&); +#else /* __STL_MEMBER_TEMPLATES */ + friend bool __STD_QUALIFIER + operator== __STL_NULL_TMPL_ARGS (const stack&, const stack&); + friend bool __STD_QUALIFIER + operator< __STL_NULL_TMPL_ARGS (const stack&, const stack&); +#endif /* __STL_MEMBER_TEMPLATES */ + +public: + typedef typename _Sequence::value_type value_type; + typedef typename _Sequence::size_type size_type; + typedef _Sequence container_type; + + typedef typename _Sequence::reference reference; + typedef typename _Sequence::const_reference const_reference; +protected: + _Sequence c; +public: + stack() : c() {} + explicit stack(const _Sequence& __s) : c(__s) {} + + bool empty() const { return c.empty(); } + size_type size() const { return c.size(); } + reference top() { return c.back(); } + const_reference top() const { return c.back(); } + void push(const value_type& __x) { c.push_back(__x); } + void pop() { c.pop_back(); } +}; + +template <class _Tp, class _Seq> +bool operator==(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) +{ + return __x.c == __y.c; +} + +template <class _Tp, class _Seq> +bool operator<(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) +{ + return __x.c < __y.c; +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Tp, class _Seq> +bool operator!=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) +{ + return !(__x == __y); +} + +template <class _Tp, class _Seq> +bool operator>(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) +{ + return __y < __x; +} + +template <class _Tp, class _Seq> +bool operator<=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) +{ + return !(__y < __x); +} + +template <class _Tp, class _Seq> +bool operator>=(const stack<_Tp,_Seq>& __x, const stack<_Tp,_Seq>& __y) +{ + return !(__x < __y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_STACK_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_string_fwd.h b/dtm_release/local/include/stl/stl_string_fwd.h new file mode 100644 index 0000000000000000000000000000000000000000..8e59de75084de7e7fd7506ccc2ca1eff1c9609ad --- /dev/null +++ b/dtm_release/local/include/stl/stl_string_fwd.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_STRING_FWD_H +#define __SGI_STL_STRING_FWD_H + +#include <stddef.h> +#include <stl_config.h> +#include <stl_alloc.h> +#include <char_traits.h> + +__STL_BEGIN_NAMESPACE + +template <class _CharT, + class _Traits = char_traits<_CharT>, + class _Alloc = __STL_DEFAULT_ALLOCATOR(_CharT) > +class basic_string; + +typedef basic_string<char> string; +typedef basic_string<wchar_t> wstring; + +static const char* __get_c_string(const string&); + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_STRING_FWD_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_tempbuf.h b/dtm_release/local/include/stl/stl_tempbuf.h new file mode 100644 index 0000000000000000000000000000000000000000..0fc68d62d93aed2b9cadf05c040772c83bbd2a4d --- /dev/null +++ b/dtm_release/local/include/stl/stl_tempbuf.h @@ -0,0 +1,162 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_TEMPBUF_H +#define __SGI_STL_INTERNAL_TEMPBUF_H + + +__STL_BEGIN_NAMESPACE + +template <class _Tp> +pair<_Tp*, ptrdiff_t> +__get_temporary_buffer(ptrdiff_t __len, _Tp*) +{ + if (__len > ptrdiff_t(INT_MAX / sizeof(_Tp))) + __len = INT_MAX / sizeof(_Tp); + + while (__len > 0) { + _Tp* __tmp = (_Tp*) malloc((size_t)__len * sizeof(_Tp)); + if (__tmp != 0) + return pair<_Tp*, ptrdiff_t>(__tmp, __len); + __len /= 2; + } + + return pair<_Tp*, ptrdiff_t>((_Tp*)0, 0); +} + +#ifdef __STL_EXPLICIT_FUNCTION_TMPL_ARGS + +template <class _Tp> +inline pair<_Tp*, ptrdiff_t> get_temporary_buffer(ptrdiff_t __len) { + return __get_temporary_buffer(__len, (_Tp*) 0); +} + +#endif /* __STL_EXPLICIT_FUNCTION_TMPL_ARGS */ + +// This overload is not required by the standard; it is an extension. +// It is supported for backward compatibility with the HP STL, and +// because not all compilers support the language feature (explicit +// function template arguments) that is required for the standard +// version of get_temporary_buffer. +template <class _Tp> +inline pair<_Tp*, ptrdiff_t> get_temporary_buffer(ptrdiff_t __len, _Tp*) { + return __get_temporary_buffer(__len, (_Tp*) 0); +} + +template <class _Tp> +void return_temporary_buffer(_Tp* __p) { + free(__p); +} + +template <class _ForwardIterator, class _Tp> +class _Temporary_buffer { +private: + ptrdiff_t _M_original_len; + ptrdiff_t _M_len; + _Tp* _M_buffer; + + void _M_allocate_buffer() { + _M_original_len = _M_len; + _M_buffer = 0; + + if (_M_len > (ptrdiff_t)(INT_MAX / sizeof(_Tp))) + _M_len = INT_MAX / sizeof(_Tp); + + while (_M_len > 0) { + _M_buffer = (_Tp*) malloc(_M_len * sizeof(_Tp)); + if (_M_buffer) + break; + _M_len /= 2; + } + } + + void _M_initialize_buffer(const _Tp&, __true_type) {} + void _M_initialize_buffer(const _Tp& val, __false_type) { + uninitialized_fill_n(_M_buffer, _M_len, val); + } + +public: + ptrdiff_t size() const { return _M_len; } + ptrdiff_t requested_size() const { return _M_original_len; } + _Tp* begin() { return _M_buffer; } + _Tp* end() { return _M_buffer + _M_len; } + + _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) { + // Workaround for a __type_traits bug in the pre-7.3 compiler. +# if defined(__sgi) && !defined(__GNUC__) && _COMPILER_VERSION < 730 + typedef typename __type_traits<_Tp>::is_POD_type _Trivial; +# else + typedef typename __type_traits<_Tp>::has_trivial_default_constructor + _Trivial; +# endif + + __STL_TRY { + _M_len = 0; + distance(__first, __last, _M_len); + _M_allocate_buffer(); + if (_M_len > 0) + _M_initialize_buffer(*__first, _Trivial()); + } + __STL_UNWIND(free(_M_buffer); _M_buffer = 0; _M_len = 0); + } + + ~_Temporary_buffer() { + destroy(_M_buffer, _M_buffer + _M_len); + free(_M_buffer); + } + +private: + // Disable copy constructor and assignment operator. + _Temporary_buffer(const _Temporary_buffer&) {} + void operator=(const _Temporary_buffer&) {} +}; + +// Class temporary_buffer is not part of the standard. It is an extension. + +template <class _ForwardIterator, + class _Tp +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + = typename iterator_traits<_ForwardIterator>::value_type +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + > +struct temporary_buffer : public _Temporary_buffer<_ForwardIterator, _Tp> +{ + temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) + : _Temporary_buffer<_ForwardIterator, _Tp>(__first, __last) {} + ~temporary_buffer() {} +}; + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_TEMPBUF_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_threads.h b/dtm_release/local/include/stl/stl_threads.h new file mode 100644 index 0000000000000000000000000000000000000000..4b0a6431e15edeb241a8e16be757232571a7746a --- /dev/null +++ b/dtm_release/local/include/stl/stl_threads.h @@ -0,0 +1,374 @@ +/* + * Copyright (c) 1997-1999 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +// WARNING: This is an internal header file, included by other C++ +// standard library headers. You should not attempt to use this header +// file directly. +// Stl_config.h should be included before this file. + +#ifndef __SGI_STL_INTERNAL_THREADS_H +#define __SGI_STL_INTERNAL_THREADS_H + +// Supported threading models are native SGI, pthreads, uithreads +// (similar to pthreads, but based on an earlier draft of the Posix +// threads standard), and Win32 threads. Uithread support by Jochen +// Schlick, 1999. + +#if defined(__STL_SGI_THREADS) +#include <mutex.h> +#include <time.h> +#elif defined(__STL_PTHREADS) +#include <pthread.h> +#elif defined(__STL_UITHREADS) +#include <thread.h> +#include <synch.h> +#elif defined(__STL_WIN32THREADS) +#include <windows.h> +#endif + +__STL_BEGIN_NAMESPACE + + +// Class _Refcount_Base provides a type, _RC_t, a data member, +// _M_ref_count, and member functions _M_incr and _M_decr, which perform +// atomic preincrement/predecrement. The constructor initializes +// _M_ref_count. + +// Hack for SGI o32 compilers. +#if defined(__STL_SGI_THREADS) && !defined(__add_and_fetch) && \ + (__mips < 3 || !(defined (_ABIN32) || defined(_ABI64))) +# define __add_and_fetch(__l,__v) add_then_test((unsigned long*)__l,__v) +# define __test_and_set(__l,__v) test_and_set(__l,__v) +#endif /* o32 */ + +struct _Refcount_Base +{ + // The type _RC_t +# ifdef __STL_WIN32THREADS + typedef long _RC_t; +# else + typedef size_t _RC_t; +#endif + + // The data member _M_ref_count + volatile _RC_t _M_ref_count; + + // Constructor +# ifdef __STL_PTHREADS + pthread_mutex_t _M_ref_count_lock; + _Refcount_Base(_RC_t __n) : _M_ref_count(__n) + { pthread_mutex_init(&_M_ref_count_lock, 0); } +# elif defined(__STL_UITHREADS) + mutex_t _M_ref_count_lock; + _Refcount_Base(_RC_t __n) : _M_ref_count(__n) + { mutex_init(&_M_ref_count_lock, USYNC_THREAD, 0); } +# else + _Refcount_Base(_RC_t __n) : _M_ref_count(__n) {} +# endif + + // _M_incr and _M_decr +# ifdef __STL_SGI_THREADS + void _M_incr() { __add_and_fetch(&_M_ref_count, 1); } + _RC_t _M_decr() { return __add_and_fetch(&_M_ref_count, (size_t) -1); } +# elif defined (__STL_WIN32THREADS) + void _M_incr() { InterlockedIncrement((_RC_t*)&_M_ref_count); } + _RC_t _M_decr() { return InterlockedDecrement((_RC_t*)&_M_ref_count); } +# elif defined(__STL_PTHREADS) + void _M_incr() { + pthread_mutex_lock(&_M_ref_count_lock); + ++_M_ref_count; + pthread_mutex_unlock(&_M_ref_count_lock); + } + _RC_t _M_decr() { + pthread_mutex_lock(&_M_ref_count_lock); + volatile _RC_t __tmp = --_M_ref_count; + pthread_mutex_unlock(&_M_ref_count_lock); + return __tmp; + } +# elif defined(__STL_UITHREADS) + void _M_incr() { + mutex_lock(&_M_ref_count_lock); + ++_M_ref_count; + mutex_unlock(&_M_ref_count_lock); + } + _RC_t _M_decr() { + mutex_lock(&_M_ref_count_lock); + /*volatile*/ _RC_t __tmp = --_M_ref_count; + mutex_unlock(&_M_ref_count_lock); + return __tmp; + } +# else /* No threads */ + void _M_incr() { ++_M_ref_count; } + _RC_t _M_decr() { return --_M_ref_count; } +# endif +}; + +// Atomic swap on unsigned long +// This is guaranteed to behave as though it were atomic only if all +// possibly concurrent updates use _Atomic_swap. +// In some cases the operation is emulated with a lock. +# ifdef __STL_SGI_THREADS + inline unsigned long _Atomic_swap(unsigned long * __p, unsigned long __q) { +# if __mips < 3 || !(defined (_ABIN32) || defined(_ABI64)) + return test_and_set(__p, __q); +# else + return __test_and_set(__p, (unsigned long)__q); +# endif + } +# elif defined(__STL_WIN32THREADS) + inline unsigned long _Atomic_swap(unsigned long * __p, unsigned long __q) { + return (unsigned long) InterlockedExchange((LPLONG)__p, (LONG)__q); + } +# elif defined(__STL_PTHREADS) + // We use a template here only to get a unique initialized instance. + template<int __dummy> + struct _Swap_lock_struct { + static pthread_mutex_t _S_swap_lock; + }; + + template<int __dummy> + pthread_mutex_t + _Swap_lock_struct<__dummy>::_S_swap_lock = PTHREAD_MUTEX_INITIALIZER; + + // This should be portable, but performance is expected + // to be quite awful. This really needs platform specific + // code. + inline unsigned long _Atomic_swap(unsigned long * __p, unsigned long __q) { + pthread_mutex_lock(&_Swap_lock_struct<0>::_S_swap_lock); + unsigned long __result = *__p; + *__p = __q; + pthread_mutex_unlock(&_Swap_lock_struct<0>::_S_swap_lock); + return __result; + } +# elif defined(__STL_UITHREADS) + // We use a template here only to get a unique initialized instance. + template<int __dummy> + struct _Swap_lock_struct { + static mutex_t _S_swap_lock; + }; + + template<int __dummy> + mutex_t + _Swap_lock_struct<__dummy>::_S_swap_lock = DEFAULTMUTEX; + + // This should be portable, but performance is expected + // to be quite awful. This really needs platform specific + // code. + inline unsigned long _Atomic_swap(unsigned long * __p, unsigned long __q) { + mutex_lock(&_Swap_lock_struct<0>::_S_swap_lock); + unsigned long __result = *__p; + *__p = __q; + mutex_unlock(&_Swap_lock_struct<0>::_S_swap_lock); + return __result; + } +# elif defined (__STL_SOLARIS_THREADS) + // any better solutions ? + // We use a template here only to get a unique initialized instance. + template<int __dummy> + struct _Swap_lock_struct { + static mutex_t _S_swap_lock; + }; + +# if ( __STL_STATIC_TEMPLATE_DATA > 0 ) + template<int __dummy> + mutex_t + _Swap_lock_struct<__dummy>::_S_swap_lock = DEFAULTMUTEX; +# else + __DECLARE_INSTANCE(mutex_t, _Swap_lock_struct<__dummy>::_S_swap_lock, + =DEFAULTMUTEX); +# endif /* ( __STL_STATIC_TEMPLATE_DATA > 0 ) */ + + // This should be portable, but performance is expected + // to be quite awful. This really needs platform specific + // code. + inline unsigned long _Atomic_swap(unsigned long * __p, unsigned long __q) { + mutex_lock(&_Swap_lock_struct<0>::_S_swap_lock); + unsigned long __result = *__p; + *__p = __q; + mutex_unlock(&_Swap_lock_struct<0>::_S_swap_lock); + return __result; + } +# else + static inline unsigned long _Atomic_swap(unsigned long * __p, unsigned long __q) { + unsigned long __result = *__p; + *__p = __q; + return __result; + } +# endif + +// Locking class. Note that this class *does not have a constructor*. +// It must be initialized either statically, with __STL_MUTEX_INITIALIZER, +// or dynamically, by explicitly calling the _M_initialize member function. +// (This is similar to the ways that a pthreads mutex can be initialized.) +// There are explicit member functions for acquiring and releasing the lock. + +// There is no constructor because static initialization is essential for +// some uses, and only a class aggregate (see section 8.5.1 of the C++ +// standard) can be initialized that way. That means we must have no +// constructors, no base classes, no virtual functions, and no private or +// protected members. + +// Helper struct. This is a workaround for various compilers that don't +// handle static variables in inline functions properly. +template <int __inst> +struct _STL_mutex_spin { + enum { __low_max = 30, __high_max = 1000 }; + // Low if we suspect uniprocessor, high for multiprocessor. + + static unsigned __max; + static unsigned __last; +}; + +template <int __inst> +unsigned _STL_mutex_spin<__inst>::__max = _STL_mutex_spin<__inst>::__low_max; + +template <int __inst> +unsigned _STL_mutex_spin<__inst>::__last = 0; + +struct _STL_mutex_lock +{ +#if defined(__STL_SGI_THREADS) || defined(__STL_WIN32THREADS) + // It should be relatively easy to get this to work on any modern Unix. + volatile unsigned long _M_lock; + void _M_initialize() { _M_lock = 0; } + static void _S_nsec_sleep(int __log_nsec) { +# ifdef __STL_SGI_THREADS + struct timespec __ts; + /* Max sleep is 2**27nsec ~ 60msec */ + __ts.tv_sec = 0; + __ts.tv_nsec = 1 << __log_nsec; + nanosleep(&__ts, 0); +# elif defined(__STL_WIN32THREADS) + if (__log_nsec <= 20) { + Sleep(0); + } else { + Sleep(1 << (__log_nsec - 20)); + } +# else +# error unimplemented +# endif + } + void _M_acquire_lock() { + volatile unsigned long* __lock = &this->_M_lock; + + if (!_Atomic_swap((unsigned long*)__lock, 1)) { + return; + } + unsigned __my_spin_max = _STL_mutex_spin<0>::__max; + unsigned __my_last_spins = _STL_mutex_spin<0>::__last; + volatile unsigned __junk = 17; // Value doesn't matter. + unsigned __i; + for (__i = 0; __i < __my_spin_max; __i++) { + if (__i < __my_last_spins/2 || *__lock) { + __junk *= __junk; __junk *= __junk; + __junk *= __junk; __junk *= __junk; + continue; + } + if (!_Atomic_swap((unsigned long*)__lock, 1)) { + // got it! + // Spinning worked. Thus we're probably not being scheduled + // against the other process with which we were contending. + // Thus it makes sense to spin longer the next time. + _STL_mutex_spin<0>::__last = __i; + _STL_mutex_spin<0>::__max = _STL_mutex_spin<0>::__high_max; + return; + } + } + // We are probably being scheduled against the other process. Sleep. + _STL_mutex_spin<0>::__max = _STL_mutex_spin<0>::__low_max; + for (__i = 0 ;; ++__i) { + int __log_nsec = __i + 6; + + if (__log_nsec > 27) __log_nsec = 27; + if (!_Atomic_swap((unsigned long *)__lock, 1)) { + return; + } + _S_nsec_sleep(__log_nsec); + } + } + void _M_release_lock() { + volatile unsigned long* __lock = &_M_lock; +# if defined(__STL_SGI_THREADS) && defined(__GNUC__) && __mips >= 3 + asm("sync"); + *__lock = 0; +# elif defined(__STL_SGI_THREADS) && __mips >= 3 \ + && (defined (_ABIN32) || defined(_ABI64)) + __lock_release(__lock); +# else + *__lock = 0; + // This is not sufficient on many multiprocessors, since + // writes to protected variables and the lock may be reordered. +# endif + } + +// We no longer use win32 critical sections. +// They appear to be slower in the contention-free case, +// and they appear difficult to initialize without introducing a race. + +#elif defined(__STL_PTHREADS) + pthread_mutex_t _M_lock; + void _M_initialize() { pthread_mutex_init(&_M_lock, NULL); } + void _M_acquire_lock() { pthread_mutex_lock(&_M_lock); } + void _M_release_lock() { pthread_mutex_unlock(&_M_lock); } +#elif defined(__STL_UITHREADS) + mutex_t _M_lock; + void _M_initialize() { mutex_init(&_M_lock, USYNC_THREAD, 0); } + void _M_acquire_lock() { mutex_lock(&_M_lock); } + void _M_release_lock() { mutex_unlock(&_M_lock); } +#else /* No threads */ + void _M_initialize() {} + void _M_acquire_lock() {} + void _M_release_lock() {} +#endif +}; + +#ifdef __STL_PTHREADS +// Pthreads locks must be statically initialized to something other than +// the default value of zero. +# define __STL_MUTEX_INITIALIZER = { PTHREAD_MUTEX_INITIALIZER } +#elif defined(__STL_UITHREADS) +// UIthreads locks must be statically initialized to something other than +// the default value of zero. +# define __STL_MUTEX_INITIALIZER = { DEFAULTMUTEX } +#elif defined(__STL_SGI_THREADS) || defined(__STL_WIN32THREADS) +# define __STL_MUTEX_INITIALIZER = { 0 } +#else +# define __STL_MUTEX_INITIALIZER +#endif + + +// A locking class that uses _STL_mutex_lock. The constructor takes a +// reference to an _STL_mutex_lock, and acquires a lock. The +// destructor releases the lock. It's not clear that this is exactly +// the right functionality. It will probably change in the future. + +struct _STL_auto_lock +{ + _STL_mutex_lock& _M_lock; + + _STL_auto_lock(_STL_mutex_lock& __lock) : _M_lock(__lock) + { _M_lock._M_acquire_lock(); } + ~_STL_auto_lock() { _M_lock._M_release_lock(); } + +private: + void operator=(const _STL_auto_lock&); + _STL_auto_lock(const _STL_auto_lock&); +}; + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_THREADS_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_tree.h b/dtm_release/local/include/stl/stl_tree.h new file mode 100644 index 0000000000000000000000000000000000000000..1049ba33e79f27201c07fe3fcb6d1870666af94f --- /dev/null +++ b/dtm_release/local/include/stl/stl_tree.h @@ -0,0 +1,1366 @@ +/* + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_TREE_H +#define __SGI_STL_INTERNAL_TREE_H + +/* + +Red-black tree class, designed for use in implementing STL +associative containers (set, multiset, map, and multimap). The +insertion and deletion algorithms are based on those in Cormen, +Leiserson, and Rivest, Introduction to Algorithms (MIT Press, 1990), +except that + +(1) the header cell is maintained with links not only to the root +but also to the leftmost node of the tree, to enable constant time +begin(), and to the rightmost node of the tree, to enable linear time +performance when used with the generic set algorithms (set_union, +etc.); + +(2) when a node being deleted has two children its successor node is +relinked into its place, rather than copied, so that the only +iterators invalidated are those referring to the deleted node. + +*/ + +#include <stl_algobase.h> +#include <stl_alloc.h> +#include <stl_construct.h> +#include <stl_function.h> + +__STL_BEGIN_NAMESPACE + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1375 +#endif + +typedef bool _Rb_tree_Color_type; +const _Rb_tree_Color_type _S_rb_tree_red = false; +const _Rb_tree_Color_type _S_rb_tree_black = true; + +struct _Rb_tree_node_base +{ + typedef _Rb_tree_Color_type _Color_type; + typedef _Rb_tree_node_base* _Base_ptr; + + _Color_type _M_color; + _Base_ptr _M_parent; + _Base_ptr _M_left; + _Base_ptr _M_right; + + static _Base_ptr _S_minimum(_Base_ptr __x) + { + while (__x->_M_left != 0) __x = __x->_M_left; + return __x; + } + + static _Base_ptr _S_maximum(_Base_ptr __x) + { + while (__x->_M_right != 0) __x = __x->_M_right; + return __x; + } +}; + +template <class _Value> +struct _Rb_tree_node : public _Rb_tree_node_base +{ + typedef _Rb_tree_node<_Value>* _Link_type; + _Value _M_value_field; +}; + + +struct _Rb_tree_base_iterator +{ + typedef _Rb_tree_node_base::_Base_ptr _Base_ptr; + typedef bidirectional_iterator_tag iterator_category; + typedef ptrdiff_t difference_type; + _Base_ptr _M_node; + + void _M_increment() + { + if (_M_node->_M_right != 0) { + _M_node = _M_node->_M_right; + while (_M_node->_M_left != 0) + _M_node = _M_node->_M_left; + } + else { + _Base_ptr __y = _M_node->_M_parent; + while (_M_node == __y->_M_right) { + _M_node = __y; + __y = __y->_M_parent; + } + if (_M_node->_M_right != __y) + _M_node = __y; + } + } + + void _M_decrement() + { + if (_M_node->_M_color == _S_rb_tree_red && + _M_node->_M_parent->_M_parent == _M_node) + _M_node = _M_node->_M_right; + else if (_M_node->_M_left != 0) { + _Base_ptr __y = _M_node->_M_left; + while (__y->_M_right != 0) + __y = __y->_M_right; + _M_node = __y; + } + else { + _Base_ptr __y = _M_node->_M_parent; + while (_M_node == __y->_M_left) { + _M_node = __y; + __y = __y->_M_parent; + } + _M_node = __y; + } + } +}; + +template <class _Value, class _Ref, class _Ptr> +struct _Rb_tree_iterator : public _Rb_tree_base_iterator +{ + typedef _Value value_type; + typedef _Ref reference; + typedef _Ptr pointer; + typedef _Rb_tree_iterator<_Value, _Value&, _Value*> + iterator; + typedef _Rb_tree_iterator<_Value, const _Value&, const _Value*> + const_iterator; + typedef _Rb_tree_iterator<_Value, _Ref, _Ptr> + _Self; + typedef _Rb_tree_node<_Value>* _Link_type; + + _Rb_tree_iterator() {} + _Rb_tree_iterator(_Link_type __x) { _M_node = __x; } + _Rb_tree_iterator(const iterator& __it) { _M_node = __it._M_node; } + + reference operator*() const { return _Link_type(_M_node)->_M_value_field; } +#ifndef __SGI_STL_NO_ARROW_OPERATOR + pointer operator->() const { return &(operator*()); } +#endif /* __SGI_STL_NO_ARROW_OPERATOR */ + + _Self& operator++() { _M_increment(); return *this; } + _Self operator++(int) { + _Self __tmp = *this; + _M_increment(); + return __tmp; + } + + _Self& operator--() { _M_decrement(); return *this; } + _Self operator--(int) { + _Self __tmp = *this; + _M_decrement(); + return __tmp; + } +}; + +inline bool operator==(const _Rb_tree_base_iterator& __x, + const _Rb_tree_base_iterator& __y) { + return __x._M_node == __y._M_node; +} + +inline bool operator!=(const _Rb_tree_base_iterator& __x, + const _Rb_tree_base_iterator& __y) { + return __x._M_node != __y._M_node; +} + +#ifndef __STL_CLASS_PARTIAL_SPECIALIZATION + +inline bidirectional_iterator_tag +iterator_category(const _Rb_tree_base_iterator&) { + return bidirectional_iterator_tag(); +} + +inline _Rb_tree_base_iterator::difference_type* +distance_type(const _Rb_tree_base_iterator&) { + return (_Rb_tree_base_iterator::difference_type*) 0; +} + +template <class _Value, class _Ref, class _Ptr> +inline _Value* value_type(const _Rb_tree_iterator<_Value, _Ref, _Ptr>&) { + return (_Value*) 0; +} + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +inline void +_Rb_tree_rotate_left(_Rb_tree_node_base* __x, _Rb_tree_node_base*& __root) +{ + _Rb_tree_node_base* __y = __x->_M_right; + __x->_M_right = __y->_M_left; + if (__y->_M_left !=0) + __y->_M_left->_M_parent = __x; + __y->_M_parent = __x->_M_parent; + + if (__x == __root) + __root = __y; + else if (__x == __x->_M_parent->_M_left) + __x->_M_parent->_M_left = __y; + else + __x->_M_parent->_M_right = __y; + __y->_M_left = __x; + __x->_M_parent = __y; +} + +inline void +_Rb_tree_rotate_right(_Rb_tree_node_base* __x, _Rb_tree_node_base*& __root) +{ + _Rb_tree_node_base* __y = __x->_M_left; + __x->_M_left = __y->_M_right; + if (__y->_M_right != 0) + __y->_M_right->_M_parent = __x; + __y->_M_parent = __x->_M_parent; + + if (__x == __root) + __root = __y; + else if (__x == __x->_M_parent->_M_right) + __x->_M_parent->_M_right = __y; + else + __x->_M_parent->_M_left = __y; + __y->_M_right = __x; + __x->_M_parent = __y; +} + +inline void +_Rb_tree_rebalance(_Rb_tree_node_base* __x, _Rb_tree_node_base*& __root) +{ + __x->_M_color = _S_rb_tree_red; + while (__x != __root && __x->_M_parent->_M_color == _S_rb_tree_red) { + if (__x->_M_parent == __x->_M_parent->_M_parent->_M_left) { + _Rb_tree_node_base* __y = __x->_M_parent->_M_parent->_M_right; + if (__y && __y->_M_color == _S_rb_tree_red) { + __x->_M_parent->_M_color = _S_rb_tree_black; + __y->_M_color = _S_rb_tree_black; + __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red; + __x = __x->_M_parent->_M_parent; + } + else { + if (__x == __x->_M_parent->_M_right) { + __x = __x->_M_parent; + _Rb_tree_rotate_left(__x, __root); + } + __x->_M_parent->_M_color = _S_rb_tree_black; + __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red; + _Rb_tree_rotate_right(__x->_M_parent->_M_parent, __root); + } + } + else { + _Rb_tree_node_base* __y = __x->_M_parent->_M_parent->_M_left; + if (__y && __y->_M_color == _S_rb_tree_red) { + __x->_M_parent->_M_color = _S_rb_tree_black; + __y->_M_color = _S_rb_tree_black; + __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red; + __x = __x->_M_parent->_M_parent; + } + else { + if (__x == __x->_M_parent->_M_left) { + __x = __x->_M_parent; + _Rb_tree_rotate_right(__x, __root); + } + __x->_M_parent->_M_color = _S_rb_tree_black; + __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red; + _Rb_tree_rotate_left(__x->_M_parent->_M_parent, __root); + } + } + } + __root->_M_color = _S_rb_tree_black; +} + +inline _Rb_tree_node_base* +_Rb_tree_rebalance_for_erase(_Rb_tree_node_base* __z, + _Rb_tree_node_base*& __root, + _Rb_tree_node_base*& __leftmost, + _Rb_tree_node_base*& __rightmost) +{ + _Rb_tree_node_base* __y = __z; + _Rb_tree_node_base* __x = 0; + _Rb_tree_node_base* __x_parent = 0; + if (__y->_M_left == 0) // __z has at most one non-null child. y == z. + __x = __y->_M_right; // __x might be null. + else + if (__y->_M_right == 0) // __z has exactly one non-null child. y == z. + __x = __y->_M_left; // __x is not null. + else { // __z has two non-null children. Set __y to + __y = __y->_M_right; // __z's successor. __x might be null. + while (__y->_M_left != 0) + __y = __y->_M_left; + __x = __y->_M_right; + } + if (__y != __z) { // relink y in place of z. y is z's successor + __z->_M_left->_M_parent = __y; + __y->_M_left = __z->_M_left; + if (__y != __z->_M_right) { + __x_parent = __y->_M_parent; + if (__x) __x->_M_parent = __y->_M_parent; + __y->_M_parent->_M_left = __x; // __y must be a child of _M_left + __y->_M_right = __z->_M_right; + __z->_M_right->_M_parent = __y; + } + else + __x_parent = __y; + if (__root == __z) + __root = __y; + else if (__z->_M_parent->_M_left == __z) + __z->_M_parent->_M_left = __y; + else + __z->_M_parent->_M_right = __y; + __y->_M_parent = __z->_M_parent; + __STD::swap(__y->_M_color, __z->_M_color); + __y = __z; + // __y now points to node to be actually deleted + } + else { // __y == __z + __x_parent = __y->_M_parent; + if (__x) __x->_M_parent = __y->_M_parent; + if (__root == __z) + __root = __x; + else + if (__z->_M_parent->_M_left == __z) + __z->_M_parent->_M_left = __x; + else + __z->_M_parent->_M_right = __x; + if (__leftmost == __z) + if (__z->_M_right == 0) // __z->_M_left must be null also + __leftmost = __z->_M_parent; + // makes __leftmost == _M_header if __z == __root + else + __leftmost = _Rb_tree_node_base::_S_minimum(__x); + if (__rightmost == __z) + if (__z->_M_left == 0) // __z->_M_right must be null also + __rightmost = __z->_M_parent; + // makes __rightmost == _M_header if __z == __root + else // __x == __z->_M_left + __rightmost = _Rb_tree_node_base::_S_maximum(__x); + } + if (__y->_M_color != _S_rb_tree_red) { + while (__x != __root && (__x == 0 || __x->_M_color == _S_rb_tree_black)) + if (__x == __x_parent->_M_left) { + _Rb_tree_node_base* __w = __x_parent->_M_right; + if (__w->_M_color == _S_rb_tree_red) { + __w->_M_color = _S_rb_tree_black; + __x_parent->_M_color = _S_rb_tree_red; + _Rb_tree_rotate_left(__x_parent, __root); + __w = __x_parent->_M_right; + } + if ((__w->_M_left == 0 || + __w->_M_left->_M_color == _S_rb_tree_black) && + (__w->_M_right == 0 || + __w->_M_right->_M_color == _S_rb_tree_black)) { + __w->_M_color = _S_rb_tree_red; + __x = __x_parent; + __x_parent = __x_parent->_M_parent; + } else { + if (__w->_M_right == 0 || + __w->_M_right->_M_color == _S_rb_tree_black) { + if (__w->_M_left) __w->_M_left->_M_color = _S_rb_tree_black; + __w->_M_color = _S_rb_tree_red; + _Rb_tree_rotate_right(__w, __root); + __w = __x_parent->_M_right; + } + __w->_M_color = __x_parent->_M_color; + __x_parent->_M_color = _S_rb_tree_black; + if (__w->_M_right) __w->_M_right->_M_color = _S_rb_tree_black; + _Rb_tree_rotate_left(__x_parent, __root); + break; + } + } else { // same as above, with _M_right <-> _M_left. + _Rb_tree_node_base* __w = __x_parent->_M_left; + if (__w->_M_color == _S_rb_tree_red) { + __w->_M_color = _S_rb_tree_black; + __x_parent->_M_color = _S_rb_tree_red; + _Rb_tree_rotate_right(__x_parent, __root); + __w = __x_parent->_M_left; + } + if ((__w->_M_right == 0 || + __w->_M_right->_M_color == _S_rb_tree_black) && + (__w->_M_left == 0 || + __w->_M_left->_M_color == _S_rb_tree_black)) { + __w->_M_color = _S_rb_tree_red; + __x = __x_parent; + __x_parent = __x_parent->_M_parent; + } else { + if (__w->_M_left == 0 || + __w->_M_left->_M_color == _S_rb_tree_black) { + if (__w->_M_right) __w->_M_right->_M_color = _S_rb_tree_black; + __w->_M_color = _S_rb_tree_red; + _Rb_tree_rotate_left(__w, __root); + __w = __x_parent->_M_left; + } + __w->_M_color = __x_parent->_M_color; + __x_parent->_M_color = _S_rb_tree_black; + if (__w->_M_left) __w->_M_left->_M_color = _S_rb_tree_black; + _Rb_tree_rotate_right(__x_parent, __root); + break; + } + } + if (__x) __x->_M_color = _S_rb_tree_black; + } + return __y; +} + +// Base class to encapsulate the differences between old SGI-style +// allocators and standard-conforming allocators. In order to avoid +// having an empty base class, we arbitrarily move one of rb_tree's +// data members into the base class. + +#ifdef __STL_USE_STD_ALLOCATORS + +// _Base for general standard-conforming allocators. +template <class _Tp, class _Alloc, bool _S_instanceless> +class _Rb_tree_alloc_base { +public: + typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type allocator_type; + allocator_type get_allocator() const { return _M_node_allocator; } + + _Rb_tree_alloc_base(const allocator_type& __a) + : _M_node_allocator(__a), _M_header(0) {} + +protected: + typename _Alloc_traits<_Rb_tree_node<_Tp>, _Alloc>::allocator_type + _M_node_allocator; + _Rb_tree_node<_Tp>* _M_header; + + _Rb_tree_node<_Tp>* _M_get_node() + { return _M_node_allocator.allocate(1); } + void _M_put_node(_Rb_tree_node<_Tp>* __p) + { _M_node_allocator.deallocate(__p, 1); } +}; + +// Specialization for instanceless allocators. +template <class _Tp, class _Alloc> +class _Rb_tree_alloc_base<_Tp, _Alloc, true> { +public: + typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type allocator_type; + allocator_type get_allocator() const { return allocator_type(); } + + _Rb_tree_alloc_base(const allocator_type&) : _M_header(0) {} + +protected: + _Rb_tree_node<_Tp>* _M_header; + + typedef typename _Alloc_traits<_Rb_tree_node<_Tp>, _Alloc>::_Alloc_type + _Alloc_type; + + _Rb_tree_node<_Tp>* _M_get_node() + { return _Alloc_type::allocate(1); } + void _M_put_node(_Rb_tree_node<_Tp>* __p) + { _Alloc_type::deallocate(__p, 1); } +}; + +template <class _Tp, class _Alloc> +struct _Rb_tree_base + : public _Rb_tree_alloc_base<_Tp, _Alloc, + _Alloc_traits<_Tp, _Alloc>::_S_instanceless> +{ + typedef _Rb_tree_alloc_base<_Tp, _Alloc, + _Alloc_traits<_Tp, _Alloc>::_S_instanceless> + _Base; + typedef typename _Base::allocator_type allocator_type; + + _Rb_tree_base(const allocator_type& __a) + : _Base(__a) { _M_header = _M_get_node(); } + ~_Rb_tree_base() { _M_put_node(_M_header); } + +}; + +#else /* __STL_USE_STD_ALLOCATORS */ + +template <class _Tp, class _Alloc> +struct _Rb_tree_base +{ + typedef _Alloc allocator_type; + allocator_type get_allocator() const { return allocator_type(); } + + _Rb_tree_base(const allocator_type&) + : _M_header(0) { _M_header = _M_get_node(); } + ~_Rb_tree_base() { _M_put_node(_M_header); } + +protected: + _Rb_tree_node<_Tp>* _M_header; + + typedef simple_alloc<_Rb_tree_node<_Tp>, _Alloc> _Alloc_type; + + _Rb_tree_node<_Tp>* _M_get_node() + { return _Alloc_type::allocate(1); } + void _M_put_node(_Rb_tree_node<_Tp>* __p) + { _Alloc_type::deallocate(__p, 1); } +}; + +#endif /* __STL_USE_STD_ALLOCATORS */ + +template <class _Key, class _Value, class _KeyOfValue, class _Compare, + class _Alloc = __STL_DEFAULT_ALLOCATOR(_Value) > +class _Rb_tree : protected _Rb_tree_base<_Value, _Alloc> { + typedef _Rb_tree_base<_Value, _Alloc> _Base; +protected: + typedef _Rb_tree_node_base* _Base_ptr; + typedef _Rb_tree_node<_Value> _Rb_tree_node; + typedef _Rb_tree_Color_type _Color_type; +public: + typedef _Key key_type; + typedef _Value value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef _Rb_tree_node* _Link_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + + typedef typename _Base::allocator_type allocator_type; + allocator_type get_allocator() const { return _Base::get_allocator(); } + +protected: +#ifdef __STL_USE_NAMESPACES + using _Base::_M_get_node; + using _Base::_M_put_node; + using _Base::_M_header; +#endif /* __STL_USE_NAMESPACES */ + +protected: + + _Link_type _M_create_node(const value_type& __x) + { + _Link_type __tmp = _M_get_node(); + __STL_TRY { + construct(&__tmp->_M_value_field, __x); + } + __STL_UNWIND(_M_put_node(__tmp)); + return __tmp; + } + + _Link_type _M_clone_node(_Link_type __x) + { + _Link_type __tmp = _M_create_node(__x->_M_value_field); + __tmp->_M_color = __x->_M_color; + __tmp->_M_left = 0; + __tmp->_M_right = 0; + return __tmp; + } + + void destroy_node(_Link_type __p) + { + destroy(&__p->_M_value_field); + _M_put_node(__p); + } + +protected: + size_type _M_node_count; // keeps track of size of tree + _Compare _M_key_compare; + + _Link_type& _M_root() const + { return (_Link_type&) _M_header->_M_parent; } + _Link_type& _M_leftmost() const + { return (_Link_type&) _M_header->_M_left; } + _Link_type& _M_rightmost() const + { return (_Link_type&) _M_header->_M_right; } + + static _Link_type& _S_left(_Link_type __x) + { return (_Link_type&)(__x->_M_left); } + static _Link_type& _S_right(_Link_type __x) + { return (_Link_type&)(__x->_M_right); } + static _Link_type& _S_parent(_Link_type __x) + { return (_Link_type&)(__x->_M_parent); } + static reference _S_value(_Link_type __x) + { return __x->_M_value_field; } + static const _Key& _S_key(_Link_type __x) + { return _KeyOfValue()(_S_value(__x)); } + static _Color_type& _S_color(_Link_type __x) + { return (_Color_type&)(__x->_M_color); } + + static _Link_type& _S_left(_Base_ptr __x) + { return (_Link_type&)(__x->_M_left); } + static _Link_type& _S_right(_Base_ptr __x) + { return (_Link_type&)(__x->_M_right); } + static _Link_type& _S_parent(_Base_ptr __x) + { return (_Link_type&)(__x->_M_parent); } + static reference _S_value(_Base_ptr __x) + { return ((_Link_type)__x)->_M_value_field; } + static const _Key& _S_key(_Base_ptr __x) + { return _KeyOfValue()(_S_value(_Link_type(__x)));} + static _Color_type& _S_color(_Base_ptr __x) + { return (_Color_type&)(_Link_type(__x)->_M_color); } + + static _Link_type _S_minimum(_Link_type __x) + { return (_Link_type) _Rb_tree_node_base::_S_minimum(__x); } + + static _Link_type _S_maximum(_Link_type __x) + { return (_Link_type) _Rb_tree_node_base::_S_maximum(__x); } + +public: + typedef _Rb_tree_iterator<value_type, reference, pointer> iterator; + typedef _Rb_tree_iterator<value_type, const_reference, const_pointer> + const_iterator; + +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + typedef reverse_iterator<const_iterator> const_reverse_iterator; + typedef reverse_iterator<iterator> reverse_iterator; +#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + typedef reverse_bidirectional_iterator<iterator, value_type, reference, + difference_type> + reverse_iterator; + typedef reverse_bidirectional_iterator<const_iterator, value_type, + const_reference, difference_type> + const_reverse_iterator; +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +private: + iterator _M_insert(_Base_ptr __x, _Base_ptr __y, const value_type& __v); + _Link_type _M_copy(_Link_type __x, _Link_type __p); + void _M_erase(_Link_type __x); + +public: + // allocation/deallocation + _Rb_tree() + : _Base(allocator_type()), _M_node_count(0), _M_key_compare() + { _M_empty_initialize(); } + + _Rb_tree(const _Compare& __comp) + : _Base(allocator_type()), _M_node_count(0), _M_key_compare(__comp) + { _M_empty_initialize(); } + + _Rb_tree(const _Compare& __comp, const allocator_type& __a) + : _Base(__a), _M_node_count(0), _M_key_compare(__comp) + { _M_empty_initialize(); } + + _Rb_tree(const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __x) + : _Base(__x.get_allocator()), + _M_node_count(0), _M_key_compare(__x._M_key_compare) + { + if (__x._M_root() == 0) + _M_empty_initialize(); + else { + _S_color(_M_header) = _S_rb_tree_red; + _M_root() = _M_copy(__x._M_root(), _M_header); + _M_leftmost() = _S_minimum(_M_root()); + _M_rightmost() = _S_maximum(_M_root()); + } + _M_node_count = __x._M_node_count; + } + ~_Rb_tree() { clear(); } + _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& + operator=(const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __x); + +private: + void _M_empty_initialize() { + _S_color(_M_header) = _S_rb_tree_red; // used to distinguish header from + // __root, in iterator.operator++ + _M_root() = 0; + _M_leftmost() = _M_header; + _M_rightmost() = _M_header; + } + +public: + // accessors: + _Compare key_comp() const { return _M_key_compare; } + iterator begin() { return _M_leftmost(); } + const_iterator begin() const { return _M_leftmost(); } + iterator end() { return _M_header; } + const_iterator end() const { return _M_header; } + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const { + return const_reverse_iterator(end()); + } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const { + return const_reverse_iterator(begin()); + } + bool empty() const { return _M_node_count == 0; } + size_type size() const { return _M_node_count; } + size_type max_size() const { return size_type(-1); } + + void swap(_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __t) { + __STD::swap(_M_header, __t._M_header); + __STD::swap(_M_node_count, __t._M_node_count); + __STD::swap(_M_key_compare, __t._M_key_compare); + } + +public: + // insert/erase + pair<iterator,bool> insert_unique(const value_type& __x); + iterator insert_equal(const value_type& __x); + + iterator insert_unique(iterator __position, const value_type& __x); + iterator insert_equal(iterator __position, const value_type& __x); + +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + void insert_unique(_InputIterator __first, _InputIterator __last); + template <class _InputIterator> + void insert_equal(_InputIterator __first, _InputIterator __last); +#else /* __STL_MEMBER_TEMPLATES */ + void insert_unique(const_iterator __first, const_iterator __last); + void insert_unique(const value_type* __first, const value_type* __last); + void insert_equal(const_iterator __first, const_iterator __last); + void insert_equal(const value_type* __first, const value_type* __last); +#endif /* __STL_MEMBER_TEMPLATES */ + + void erase(iterator __position); + size_type erase(const key_type& __x); + void erase(iterator __first, iterator __last); + void erase(const key_type* __first, const key_type* __last); + void clear() { + if (_M_node_count != 0) { + _M_erase(_M_root()); + _M_leftmost() = _M_header; + _M_root() = 0; + _M_rightmost() = _M_header; + _M_node_count = 0; + } + } + +public: + // set operations: + iterator find(const key_type& __x); + const_iterator find(const key_type& __x) const; + size_type count(const key_type& __x) const; + iterator lower_bound(const key_type& __x); + const_iterator lower_bound(const key_type& __x) const; + iterator upper_bound(const key_type& __x); + const_iterator upper_bound(const key_type& __x) const; + pair<iterator,iterator> equal_range(const key_type& __x); + pair<const_iterator, const_iterator> equal_range(const key_type& __x) const; + +public: + // Debugging. + bool __rb_verify() const; +}; + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +inline bool +operator==(const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __x, + const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __y) +{ + return __x.size() == __y.size() && + equal(__x.begin(), __x.end(), __y.begin()); +} + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +inline bool +operator<(const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __x, + const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __y) +{ + return lexicographical_compare(__x.begin(), __x.end(), + __y.begin(), __y.end()); +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +inline bool +operator!=(const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __x, + const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __y) { + return !(__x == __y); +} + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +inline bool +operator>(const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __x, + const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __y) { + return __y < __x; +} + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +inline bool +operator<=(const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __x, + const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __y) { + return !(__y < __x); +} + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +inline bool +operator>=(const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __x, + const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __y) { + return !(__x < __y); +} + + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +inline void +swap(_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __x, + _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __y) +{ + __x.swap(__y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& +_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc> + ::operator=(const _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>& __x) +{ + if (this != &__x) { + // Note that _Key may be a constant type. + clear(); + _M_node_count = 0; + _M_key_compare = __x._M_key_compare; + if (__x._M_root() == 0) { + _M_root() = 0; + _M_leftmost() = _M_header; + _M_rightmost() = _M_header; + } + else { + _M_root() = _M_copy(__x._M_root(), _M_header); + _M_leftmost() = _S_minimum(_M_root()); + _M_rightmost() = _S_maximum(_M_root()); + _M_node_count = __x._M_node_count; + } + } + return *this; +} + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::iterator +_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc> + ::_M_insert(_Base_ptr __x_, _Base_ptr __y_, const _Value& __v) +{ + _Link_type __x = (_Link_type) __x_; + _Link_type __y = (_Link_type) __y_; + _Link_type __z; + + if (__y == _M_header || __x != 0 || + _M_key_compare(_KeyOfValue()(__v), _S_key(__y))) { + __z = _M_create_node(__v); + _S_left(__y) = __z; // also makes _M_leftmost() = __z + // when __y == _M_header + if (__y == _M_header) { + _M_root() = __z; + _M_rightmost() = __z; + } + else if (__y == _M_leftmost()) + _M_leftmost() = __z; // maintain _M_leftmost() pointing to min node + } + else { + __z = _M_create_node(__v); + _S_right(__y) = __z; + if (__y == _M_rightmost()) + _M_rightmost() = __z; // maintain _M_rightmost() pointing to max node + } + _S_parent(__z) = __y; + _S_left(__z) = 0; + _S_right(__z) = 0; + _Rb_tree_rebalance(__z, _M_header->_M_parent); + ++_M_node_count; + return iterator(__z); +} + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::iterator +_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc> + ::insert_equal(const _Value& __v) +{ + _Link_type __y = _M_header; + _Link_type __x = _M_root(); + while (__x != 0) { + __y = __x; + __x = _M_key_compare(_KeyOfValue()(__v), _S_key(__x)) ? + _S_left(__x) : _S_right(__x); + } + return _M_insert(__x, __y, __v); +} + + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +pair<typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::iterator, + bool> +_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc> + ::insert_unique(const _Value& __v) +{ + _Link_type __y = _M_header; + _Link_type __x = _M_root(); + bool __comp = true; + while (__x != 0) { + __y = __x; + __comp = _M_key_compare(_KeyOfValue()(__v), _S_key(__x)); + __x = __comp ? _S_left(__x) : _S_right(__x); + } + iterator __j = iterator(__y); + if (__comp) + if (__j == begin()) + return pair<iterator,bool>(_M_insert(__x, __y, __v), true); + else + --__j; + if (_M_key_compare(_S_key(__j._M_node), _KeyOfValue()(__v))) + return pair<iterator,bool>(_M_insert(__x, __y, __v), true); + return pair<iterator,bool>(__j, false); +} + + +template <class _Key, class _Val, class _KeyOfValue, + class _Compare, class _Alloc> +typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator +_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc> + ::insert_unique(iterator __position, const _Val& __v) +{ + if (__position._M_node == _M_header->_M_left) { // begin() + if (size() > 0 && + _M_key_compare(_KeyOfValue()(__v), _S_key(__position._M_node))) + return _M_insert(__position._M_node, __position._M_node, __v); + // first argument just needs to be non-null + else + return insert_unique(__v).first; + } else if (__position._M_node == _M_header) { // end() + if (_M_key_compare(_S_key(_M_rightmost()), _KeyOfValue()(__v))) + return _M_insert(0, _M_rightmost(), __v); + else + return insert_unique(__v).first; + } else { + iterator __before = __position; + --__before; + if (_M_key_compare(_S_key(__before._M_node), _KeyOfValue()(__v)) + && _M_key_compare(_KeyOfValue()(__v), _S_key(__position._M_node))) { + if (_S_right(__before._M_node) == 0) + return _M_insert(0, __before._M_node, __v); + else + return _M_insert(__position._M_node, __position._M_node, __v); + // first argument just needs to be non-null + } else + return insert_unique(__v).first; + } +} + +template <class _Key, class _Val, class _KeyOfValue, + class _Compare, class _Alloc> +typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::iterator +_Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc> + ::insert_equal(iterator __position, const _Val& __v) +{ + if (__position._M_node == _M_header->_M_left) { // begin() + if (size() > 0 && + !_M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__v))) + return _M_insert(__position._M_node, __position._M_node, __v); + // first argument just needs to be non-null + else + return insert_equal(__v); + } else if (__position._M_node == _M_header) {// end() + if (!_M_key_compare(_KeyOfValue()(__v), _S_key(_M_rightmost()))) + return _M_insert(0, _M_rightmost(), __v); + else + return insert_equal(__v); + } else { + iterator __before = __position; + --__before; + if (!_M_key_compare(_KeyOfValue()(__v), _S_key(__before._M_node)) + && !_M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__v))) { + if (_S_right(__before._M_node) == 0) + return _M_insert(0, __before._M_node, __v); + else + return _M_insert(__position._M_node, __position._M_node, __v); + // first argument just needs to be non-null + } else + return insert_equal(__v); + } +} + +#ifdef __STL_MEMBER_TEMPLATES + +template <class _Key, class _Val, class _KoV, class _Cmp, class _Alloc> + template<class _II> +void _Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc> + ::insert_equal(_II __first, _II __last) +{ + for ( ; __first != __last; ++__first) + insert_equal(*__first); +} + +template <class _Key, class _Val, class _KoV, class _Cmp, class _Alloc> + template<class _II> +void _Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc> + ::insert_unique(_II __first, _II __last) { + for ( ; __first != __last; ++__first) + insert_unique(*__first); +} + +#else /* __STL_MEMBER_TEMPLATES */ + +template <class _Key, class _Val, class _KoV, class _Cmp, class _Alloc> +void +_Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc> + ::insert_equal(const _Val* __first, const _Val* __last) +{ + for ( ; __first != __last; ++__first) + insert_equal(*__first); +} + +template <class _Key, class _Val, class _KoV, class _Cmp, class _Alloc> +void +_Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc> + ::insert_equal(const_iterator __first, const_iterator __last) +{ + for ( ; __first != __last; ++__first) + insert_equal(*__first); +} + +template <class _Key, class _Val, class _KoV, class _Cmp, class _Alloc> +void +_Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc> + ::insert_unique(const _Val* __first, const _Val* __last) +{ + for ( ; __first != __last; ++__first) + insert_unique(*__first); +} + +template <class _Key, class _Val, class _KoV, class _Cmp, class _Alloc> +void _Rb_tree<_Key,_Val,_KoV,_Cmp,_Alloc> + ::insert_unique(const_iterator __first, const_iterator __last) +{ + for ( ; __first != __last; ++__first) + insert_unique(*__first); +} + +#endif /* __STL_MEMBER_TEMPLATES */ + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +inline void _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc> + ::erase(iterator __position) +{ + _Link_type __y = + (_Link_type) _Rb_tree_rebalance_for_erase(__position._M_node, + _M_header->_M_parent, + _M_header->_M_left, + _M_header->_M_right); + destroy_node(__y); + --_M_node_count; +} + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::size_type +_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::erase(const _Key& __x) +{ + pair<iterator,iterator> __p = equal_range(__x); + size_type __n = 0; + distance(__p.first, __p.second, __n); + erase(__p.first, __p.second); + return __n; +} + +template <class _Key, class _Val, class _KoV, class _Compare, class _Alloc> +typename _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::_Link_type +_Rb_tree<_Key,_Val,_KoV,_Compare,_Alloc> + ::_M_copy(_Link_type __x, _Link_type __p) +{ + // structural copy. __x and __p must be non-null. + _Link_type __top = _M_clone_node(__x); + __top->_M_parent = __p; + + __STL_TRY { + if (__x->_M_right) + __top->_M_right = _M_copy(_S_right(__x), __top); + __p = __top; + __x = _S_left(__x); + + while (__x != 0) { + _Link_type __y = _M_clone_node(__x); + __p->_M_left = __y; + __y->_M_parent = __p; + if (__x->_M_right) + __y->_M_right = _M_copy(_S_right(__x), __y); + __p = __y; + __x = _S_left(__x); + } + } + __STL_UNWIND(_M_erase(__top)); + + return __top; +} + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +void _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc> + ::_M_erase(_Link_type __x) +{ + // erase without rebalancing + while (__x != 0) { + _M_erase(_S_right(__x)); + _Link_type __y = _S_left(__x); + destroy_node(__x); + __x = __y; + } +} + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +void _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc> + ::erase(iterator __first, iterator __last) +{ + if (__first == begin() && __last == end()) + clear(); + else + while (__first != __last) erase(__first++); +} + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +void _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc> + ::erase(const _Key* __first, const _Key* __last) +{ + while (__first != __last) erase(*__first++); +} + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::iterator +_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::find(const _Key& __k) +{ + _Link_type __y = _M_header; // Last node which is not less than __k. + _Link_type __x = _M_root(); // Current node. + + while (__x != 0) + if (!_M_key_compare(_S_key(__x), __k)) + __y = __x, __x = _S_left(__x); + else + __x = _S_right(__x); + + iterator __j = iterator(__y); + return (__j == end() || _M_key_compare(__k, _S_key(__j._M_node))) ? + end() : __j; +} + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::const_iterator +_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::find(const _Key& __k) const +{ + _Link_type __y = _M_header; /* Last node which is not less than __k. */ + _Link_type __x = _M_root(); /* Current node. */ + + while (__x != 0) { + if (!_M_key_compare(_S_key(__x), __k)) + __y = __x, __x = _S_left(__x); + else + __x = _S_right(__x); + } + const_iterator __j = const_iterator(__y); + return (__j == end() || _M_key_compare(__k, _S_key(__j._M_node))) ? + end() : __j; +} + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::size_type +_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc> + ::count(const _Key& __k) const +{ + pair<const_iterator, const_iterator> __p = equal_range(__k); + size_type __n = 0; + distance(__p.first, __p.second, __n); + return __n; +} + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::iterator +_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc> + ::lower_bound(const _Key& __k) +{ + _Link_type __y = _M_header; /* Last node which is not less than __k. */ + _Link_type __x = _M_root(); /* Current node. */ + + while (__x != 0) + if (!_M_key_compare(_S_key(__x), __k)) + __y = __x, __x = _S_left(__x); + else + __x = _S_right(__x); + + return iterator(__y); +} + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::const_iterator +_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc> + ::lower_bound(const _Key& __k) const +{ + _Link_type __y = _M_header; /* Last node which is not less than __k. */ + _Link_type __x = _M_root(); /* Current node. */ + + while (__x != 0) + if (!_M_key_compare(_S_key(__x), __k)) + __y = __x, __x = _S_left(__x); + else + __x = _S_right(__x); + + return const_iterator(__y); +} + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::iterator +_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc> + ::upper_bound(const _Key& __k) +{ + _Link_type __y = _M_header; /* Last node which is greater than __k. */ + _Link_type __x = _M_root(); /* Current node. */ + + while (__x != 0) + if (_M_key_compare(__k, _S_key(__x))) + __y = __x, __x = _S_left(__x); + else + __x = _S_right(__x); + + return iterator(__y); +} + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::const_iterator +_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc> + ::upper_bound(const _Key& __k) const +{ + _Link_type __y = _M_header; /* Last node which is greater than __k. */ + _Link_type __x = _M_root(); /* Current node. */ + + while (__x != 0) + if (_M_key_compare(__k, _S_key(__x))) + __y = __x, __x = _S_left(__x); + else + __x = _S_right(__x); + + return const_iterator(__y); +} + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +inline +pair<typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::iterator, + typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::iterator> +_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc> + ::equal_range(const _Key& __k) +{ + return pair<iterator, iterator>(lower_bound(__k), upper_bound(__k)); +} + +template <class _Key, class _Value, class _KoV, class _Compare, class _Alloc> +inline +pair<typename _Rb_tree<_Key, _Value, _KoV, _Compare, _Alloc>::const_iterator, + typename _Rb_tree<_Key, _Value, _KoV, _Compare, _Alloc>::const_iterator> +_Rb_tree<_Key, _Value, _KoV, _Compare, _Alloc> + ::equal_range(const _Key& __k) const +{ + return pair<const_iterator,const_iterator>(lower_bound(__k), + upper_bound(__k)); +} + +inline int +__black_count(_Rb_tree_node_base* __node, _Rb_tree_node_base* __root) +{ + if (__node == 0) + return 0; + else { + int __bc = __node->_M_color == _S_rb_tree_black ? 1 : 0; + if (__node == __root) + return __bc; + else + return __bc + __black_count(__node->_M_parent, __root); + } +} + +template <class _Key, class _Value, class _KeyOfValue, + class _Compare, class _Alloc> +bool _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::__rb_verify() const +{ + if (_M_node_count == 0 || begin() == end()) + return _M_node_count == 0 && begin() == end() && + _M_header->_M_left == _M_header && _M_header->_M_right == _M_header; + + int __len = __black_count(_M_leftmost(), _M_root()); + for (const_iterator __it = begin(); __it != end(); ++__it) { + _Link_type __x = (_Link_type) __it._M_node; + _Link_type __L = _S_left(__x); + _Link_type __R = _S_right(__x); + + if (__x->_M_color == _S_rb_tree_red) + if ((__L && __L->_M_color == _S_rb_tree_red) || + (__R && __R->_M_color == _S_rb_tree_red)) + return false; + + if (__L && _M_key_compare(_S_key(__x), _S_key(__L))) + return false; + if (__R && _M_key_compare(_S_key(__R), _S_key(__x))) + return false; + + if (!__L && !__R && __black_count(__x, _M_root()) != __len) + return false; + } + + if (_M_leftmost() != _Rb_tree_node_base::_S_minimum(_M_root())) + return false; + if (_M_rightmost() != _Rb_tree_node_base::_S_maximum(_M_root())) + return false; + + return true; +} + +// Class rb_tree is not part of the C++ standard. It is provided for +// compatibility with the HP STL. + +template <class _Key, class _Value, class _KeyOfValue, class _Compare, + class _Alloc = __STL_DEFAULT_ALLOCATOR(_Value) > +struct rb_tree : public _Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc> +{ + typedef _Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc> _Base; + typedef typename _Base::allocator_type allocator_type; + + rb_tree(const _Compare& __comp = _Compare(), + const allocator_type& __a = allocator_type()) + : _Base(__comp, __a) {} + + ~rb_tree() {} +}; + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1375 +#endif + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_TREE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_uninitialized.h b/dtm_release/local/include/stl/stl_uninitialized.h new file mode 100644 index 0000000000000000000000000000000000000000..d367fbea4d17cbe944fb728e644905aa841afc01 --- /dev/null +++ b/dtm_release/local/include/stl/stl_uninitialized.h @@ -0,0 +1,279 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_UNINITIALIZED_H +#define __SGI_STL_INTERNAL_UNINITIALIZED_H + +__STL_BEGIN_NAMESPACE + +// uninitialized_copy + +// Valid if copy construction is equivalent to assignment, and if the +// destructor is trivial. +template <class _InputIter, class _ForwardIter> +inline _ForwardIter +__uninitialized_copy_aux(_InputIter __first, _InputIter __last, + _ForwardIter __result, + __true_type) +{ + return copy(__first, __last, __result); +} + +template <class _InputIter, class _ForwardIter> +_ForwardIter +__uninitialized_copy_aux(_InputIter __first, _InputIter __last, + _ForwardIter __result, + __false_type) +{ + _ForwardIter __cur = __result; + __STL_TRY { + for ( ; __first != __last; ++__first, ++__cur) + _Construct(&*__cur, *__first); + return __cur; + } + __STL_UNWIND(_Destroy(__result, __cur)); +} + + +template <class _InputIter, class _ForwardIter, class _Tp> +inline _ForwardIter +__uninitialized_copy(_InputIter __first, _InputIter __last, + _ForwardIter __result, _Tp*) +{ + typedef typename __type_traits<_Tp>::is_POD_type _Is_POD; + return __uninitialized_copy_aux(__first, __last, __result, _Is_POD()); +} + +template <class _InputIter, class _ForwardIter> +inline _ForwardIter + uninitialized_copy(_InputIter __first, _InputIter __last, + _ForwardIter __result) +{ + return __uninitialized_copy(__first, __last, __result, + __VALUE_TYPE(__result)); +} + +inline char* uninitialized_copy(const char* __first, const char* __last, + char* __result) { + memmove(__result, __first, __last - __first); + return __result + (__last - __first); +} + +inline wchar_t* +uninitialized_copy(const wchar_t* __first, const wchar_t* __last, + wchar_t* __result) +{ + memmove(__result, __first, sizeof(wchar_t) * (__last - __first)); + return __result + (__last - __first); +} + +// uninitialized_copy_n (not part of the C++ standard) + +template <class _InputIter, class _Size, class _ForwardIter> +pair<_InputIter, _ForwardIter> +__uninitialized_copy_n(_InputIter __first, _Size __count, + _ForwardIter __result, + input_iterator_tag) +{ + _ForwardIter __cur = __result; + __STL_TRY { + for ( ; __count > 0 ; --__count, ++__first, ++__cur) + _Construct(&*__cur, *__first); + return pair<_InputIter, _ForwardIter>(__first, __cur); + } + __STL_UNWIND(_Destroy(__result, __cur)); +} + +template <class _RandomAccessIter, class _Size, class _ForwardIter> +inline pair<_RandomAccessIter, _ForwardIter> +__uninitialized_copy_n(_RandomAccessIter __first, _Size __count, + _ForwardIter __result, + random_access_iterator_tag) { + _RandomAccessIter __last = __first + __count; + return pair<_RandomAccessIter, _ForwardIter>( + __last, + uninitialized_copy(__first, __last, __result)); +} + +template <class _InputIter, class _Size, class _ForwardIter> +inline pair<_InputIter, _ForwardIter> +__uninitialized_copy_n(_InputIter __first, _Size __count, + _ForwardIter __result) { + return __uninitialized_copy_n(__first, __count, __result, + __ITERATOR_CATEGORY(__first)); +} + +template <class _InputIter, class _Size, class _ForwardIter> +inline pair<_InputIter, _ForwardIter> +uninitialized_copy_n(_InputIter __first, _Size __count, + _ForwardIter __result) { + return __uninitialized_copy_n(__first, __count, __result, + __ITERATOR_CATEGORY(__first)); +} + +// Valid if copy construction is equivalent to assignment, and if the +// destructor is trivial. +template <class _ForwardIter, class _Tp> +inline void +__uninitialized_fill_aux(_ForwardIter __first, _ForwardIter __last, + const _Tp& __x, __true_type) +{ + fill(__first, __last, __x); +} + +template <class _ForwardIter, class _Tp> +void +__uninitialized_fill_aux(_ForwardIter __first, _ForwardIter __last, + const _Tp& __x, __false_type) +{ + _ForwardIter __cur = __first; + __STL_TRY { + for ( ; __cur != __last; ++__cur) + _Construct(&*__cur, __x); + } + __STL_UNWIND(_Destroy(__first, __cur)); +} + +template <class _ForwardIter, class _Tp, class _Tp1> +inline void __uninitialized_fill(_ForwardIter __first, + _ForwardIter __last, const _Tp& __x, _Tp1*) +{ + typedef typename __type_traits<_Tp1>::is_POD_type _Is_POD; + __uninitialized_fill_aux(__first, __last, __x, _Is_POD()); + +} + +template <class _ForwardIter, class _Tp> +inline void uninitialized_fill(_ForwardIter __first, + _ForwardIter __last, + const _Tp& __x) +{ + __uninitialized_fill(__first, __last, __x, __VALUE_TYPE(__first)); +} + +// Valid if copy construction is equivalent to assignment, and if the +// destructor is trivial. +template <class _ForwardIter, class _Size, class _Tp> +inline _ForwardIter +__uninitialized_fill_n_aux(_ForwardIter __first, _Size __n, + const _Tp& __x, __true_type) +{ + return fill_n(__first, __n, __x); +} + +template <class _ForwardIter, class _Size, class _Tp> +_ForwardIter +__uninitialized_fill_n_aux(_ForwardIter __first, _Size __n, + const _Tp& __x, __false_type) +{ + _ForwardIter __cur = __first; + __STL_TRY { + for ( ; __n > 0; --__n, ++__cur) + _Construct(&*__cur, __x); + return __cur; + } + __STL_UNWIND(_Destroy(__first, __cur)); +} + +template <class _ForwardIter, class _Size, class _Tp, class _Tp1> +inline _ForwardIter +__uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x, _Tp1*) +{ + typedef typename __type_traits<_Tp1>::is_POD_type _Is_POD; + return __uninitialized_fill_n_aux(__first, __n, __x, _Is_POD()); +} + +template <class _ForwardIter, class _Size, class _Tp> +inline _ForwardIter +uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x) +{ + return __uninitialized_fill_n(__first, __n, __x, __VALUE_TYPE(__first)); +} + +// Extensions: __uninitialized_copy_copy, __uninitialized_copy_fill, +// __uninitialized_fill_copy. + +// __uninitialized_copy_copy +// Copies [first1, last1) into [result, result + (last1 - first1)), and +// copies [first2, last2) into +// [result, result + (last1 - first1) + (last2 - first2)). + +template <class _InputIter1, class _InputIter2, class _ForwardIter> +inline _ForwardIter +__uninitialized_copy_copy(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _ForwardIter __result) +{ + _ForwardIter __mid = uninitialized_copy(__first1, __last1, __result); + __STL_TRY { + return uninitialized_copy(__first2, __last2, __mid); + } + __STL_UNWIND(_Destroy(__result, __mid)); +} + +// __uninitialized_fill_copy +// Fills [result, mid) with x, and copies [first, last) into +// [mid, mid + (last - first)). +template <class _ForwardIter, class _Tp, class _InputIter> +inline _ForwardIter +__uninitialized_fill_copy(_ForwardIter __result, _ForwardIter __mid, + const _Tp& __x, + _InputIter __first, _InputIter __last) +{ + uninitialized_fill(__result, __mid, __x); + __STL_TRY { + return uninitialized_copy(__first, __last, __mid); + } + __STL_UNWIND(_Destroy(__result, __mid)); +} + +// __uninitialized_copy_fill +// Copies [first1, last1) into [first2, first2 + (last1 - first1)), and +// fills [first2 + (last1 - first1), last2) with x. +template <class _InputIter, class _ForwardIter, class _Tp> +inline void +__uninitialized_copy_fill(_InputIter __first1, _InputIter __last1, + _ForwardIter __first2, _ForwardIter __last2, + const _Tp& __x) +{ + _ForwardIter __mid2 = uninitialized_copy(__first1, __last1, __first2); + __STL_TRY { + uninitialized_fill(__mid2, __last2, __x); + } + __STL_UNWIND(_Destroy(__first2, __mid2)); +} + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_UNINITIALIZED_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/stl_vector.h b/dtm_release/local/include/stl/stl_vector.h new file mode 100644 index 0000000000000000000000000000000000000000..883fff9be214d0f6672ec854f5c5d52a785285bd --- /dev/null +++ b/dtm_release/local/include/stl/stl_vector.h @@ -0,0 +1,869 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef __SGI_STL_INTERNAL_VECTOR_H +#define __SGI_STL_INTERNAL_VECTOR_H + +#include <concept_checks.h> + +__STL_BEGIN_NAMESPACE + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1174 +#pragma set woff 1375 +#endif + +// The vector base class serves two purposes. First, its constructor +// and destructor allocate (but don't initialize) storage. This makes +// exception safety easier. Second, the base class encapsulates all of +// the differences between SGI-style allocators and standard-conforming +// allocators. + +#ifdef __STL_USE_STD_ALLOCATORS + +// Base class for ordinary allocators. +template <class _Tp, class _Allocator, bool _IsStatic> +class _Vector_alloc_base { +public: + typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type + allocator_type; + allocator_type get_allocator() const { return _M_data_allocator; } + + _Vector_alloc_base(const allocator_type& __a) + : _M_data_allocator(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0) + {} + +protected: + allocator_type _M_data_allocator; + _Tp* _M_start; + _Tp* _M_finish; + _Tp* _M_end_of_storage; + + _Tp* _M_allocate(size_t __n) + { return _M_data_allocator.allocate(__n); } + void _M_deallocate(_Tp* __p, size_t __n) + { if (__p) _M_data_allocator.deallocate(__p, __n); } +}; + +// Specialization for allocators that have the property that we don't +// actually have to store an allocator object. +template <class _Tp, class _Allocator> +class _Vector_alloc_base<_Tp, _Allocator, true> { +public: + typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type + allocator_type; + allocator_type get_allocator() const { return allocator_type(); } + + _Vector_alloc_base(const allocator_type&) + : _M_start(0), _M_finish(0), _M_end_of_storage(0) + {} + +protected: + _Tp* _M_start; + _Tp* _M_finish; + _Tp* _M_end_of_storage; + + typedef typename _Alloc_traits<_Tp, _Allocator>::_Alloc_type _Alloc_type; + _Tp* _M_allocate(size_t __n) + { return _Alloc_type::allocate(__n); } + void _M_deallocate(_Tp* __p, size_t __n) + { _Alloc_type::deallocate(__p, __n);} +}; + +template <class _Tp, class _Alloc> +struct _Vector_base + : public _Vector_alloc_base<_Tp, _Alloc, + _Alloc_traits<_Tp, _Alloc>::_S_instanceless> +{ + typedef _Vector_alloc_base<_Tp, _Alloc, + _Alloc_traits<_Tp, _Alloc>::_S_instanceless> + _Base; + typedef typename _Base::allocator_type allocator_type; + + _Vector_base(const allocator_type& __a) : _Base(__a) {} + _Vector_base(size_t __n, const allocator_type& __a) : _Base(__a) { + _M_start = _M_allocate(__n); + _M_finish = _M_start; + _M_end_of_storage = _M_start + __n; + } + + ~_Vector_base() { _M_deallocate(_M_start, _M_end_of_storage - _M_start); } +}; + +#else /* __STL_USE_STD_ALLOCATORS */ + +template <class _Tp, class _Alloc> +class _Vector_base { +public: + typedef _Alloc allocator_type; + allocator_type get_allocator() const { return allocator_type(); } + + _Vector_base(const _Alloc&) + : _M_start(0), _M_finish(0), _M_end_of_storage(0) {} + _Vector_base(size_t __n, const _Alloc&) + : _M_start(0), _M_finish(0), _M_end_of_storage(0) + { + _M_start = _M_allocate(__n); + _M_finish = _M_start; + _M_end_of_storage = _M_start + __n; + } + + ~_Vector_base() { _M_deallocate(_M_start, _M_end_of_storage - _M_start); } + +protected: + _Tp* _M_start; + _Tp* _M_finish; + _Tp* _M_end_of_storage; + + typedef simple_alloc<_Tp, _Alloc> _M_data_allocator; + _Tp* _M_allocate(size_t __n) + { return _M_data_allocator::allocate(__n); } + void _M_deallocate(_Tp* __p, size_t __n) + { _M_data_allocator::deallocate(__p, __n); } +}; + +#endif /* __STL_USE_STD_ALLOCATORS */ + +template <class _Tp, class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) > +class vector : protected _Vector_base<_Tp, _Alloc> +{ + // requirements: + + __STL_CLASS_REQUIRES(_Tp, _Assignable); + +private: + typedef _Vector_base<_Tp, _Alloc> _Base; +public: + typedef _Tp value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type* iterator; + typedef const value_type* const_iterator; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + + typedef typename _Base::allocator_type allocator_type; + allocator_type get_allocator() const { return _Base::get_allocator(); } + +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + typedef reverse_iterator<const_iterator> const_reverse_iterator; + typedef reverse_iterator<iterator> reverse_iterator; +#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + typedef reverse_iterator<const_iterator, value_type, const_reference, + difference_type> const_reverse_iterator; + typedef reverse_iterator<iterator, value_type, reference, difference_type> + reverse_iterator; +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +protected: +#ifdef __STL_HAS_NAMESPACES + using _Base::_M_allocate; + using _Base::_M_deallocate; + using _Base::_M_start; + using _Base::_M_finish; + using _Base::_M_end_of_storage; +#endif /* __STL_HAS_NAMESPACES */ + +protected: + void _M_insert_aux(iterator __position, const _Tp& __x); + void _M_insert_aux(iterator __position); + +public: + iterator begin() { return _M_start; } + const_iterator begin() const { return _M_start; } + iterator end() { return _M_finish; } + const_iterator end() const { return _M_finish; } + + reverse_iterator rbegin() + { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const + { return const_reverse_iterator(end()); } + reverse_iterator rend() + { return reverse_iterator(begin()); } + const_reverse_iterator rend() const + { return const_reverse_iterator(begin()); } + + size_type size() const + { return size_type(end() - begin()); } + size_type max_size() const + { return size_type(-1) / sizeof(_Tp); } + size_type capacity() const + { return size_type(_M_end_of_storage - begin()); } + bool empty() const + { return begin() == end(); } + + reference operator[](size_type __n) { return *(begin() + __n); } + const_reference operator[](size_type __n) const { return *(begin() + __n); } + +#ifdef __STL_THROW_RANGE_ERRORS + void _M_range_check(size_type __n) const { + if (__n >= this->size()) + __stl_throw_range_error("vector"); + } + + reference at(size_type __n) + { _M_range_check(__n); return (*this)[__n]; } + const_reference at(size_type __n) const + { _M_range_check(__n); return (*this)[__n]; } +#endif /* __STL_THROW_RANGE_ERRORS */ + + explicit vector(const allocator_type& __a = allocator_type()) + : _Base(__a) {} + + vector(size_type __n, const _Tp& __value, + const allocator_type& __a = allocator_type()) + : _Base(__n, __a) + { _M_finish = uninitialized_fill_n(_M_start, __n, __value); } + + explicit vector(size_type __n) + : _Base(__n, allocator_type()) + { _M_finish = uninitialized_fill_n(_M_start, __n, _Tp()); } + + vector(const vector<_Tp, _Alloc>& __x) + : _Base(__x.size(), __x.get_allocator()) + { _M_finish = uninitialized_copy(__x.begin(), __x.end(), _M_start); } + +#ifdef __STL_MEMBER_TEMPLATES + // Check whether it's an integral type. If so, it's not an iterator. + template <class _InputIterator> + vector(_InputIterator __first, _InputIterator __last, + const allocator_type& __a = allocator_type()) : _Base(__a) { + typedef typename _Is_integer<_InputIterator>::_Integral _Integral; + _M_initialize_aux(__first, __last, _Integral()); + } + + template <class _Integer> + void _M_initialize_aux(_Integer __n, _Integer __value, __true_type) { + _M_start = _M_allocate(__n); + _M_end_of_storage = _M_start + __n; + _M_finish = uninitialized_fill_n(_M_start, __n, __value); + } + + template <class _InputIterator> + void _M_initialize_aux(_InputIterator __first, _InputIterator __last, + __false_type) { + _M_range_initialize(__first, __last, __ITERATOR_CATEGORY(__first)); + } + +#else + vector(const _Tp* __first, const _Tp* __last, + const allocator_type& __a = allocator_type()) + : _Base(__last - __first, __a) + { _M_finish = uninitialized_copy(__first, __last, _M_start); } +#endif /* __STL_MEMBER_TEMPLATES */ + + ~vector() { destroy(_M_start, _M_finish); } + + vector<_Tp, _Alloc>& operator=(const vector<_Tp, _Alloc>& __x); + void reserve(size_type __n) { + if (capacity() < __n) { + const size_type __old_size = size(); + iterator __tmp = _M_allocate_and_copy(__n, _M_start, _M_finish); + destroy(_M_start, _M_finish); + _M_deallocate(_M_start, _M_end_of_storage - _M_start); + _M_start = __tmp; + _M_finish = __tmp + __old_size; + _M_end_of_storage = _M_start + __n; + } + } + + // assign(), a generalized assignment member function. Two + // versions: one that takes a count, and one that takes a range. + // The range version is a member template, so we dispatch on whether + // or not the type is an integer. + + void assign(size_type __n, const _Tp& __val) { _M_fill_assign(__n, __val); } + void _M_fill_assign(size_type __n, const _Tp& __val); + +#ifdef __STL_MEMBER_TEMPLATES + + template <class _InputIterator> + void assign(_InputIterator __first, _InputIterator __last) { + typedef typename _Is_integer<_InputIterator>::_Integral _Integral; + _M_assign_dispatch(__first, __last, _Integral()); + } + + template <class _Integer> + void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) + { _M_fill_assign((size_type) __n, (_Tp) __val); } + + template <class _InputIter> + void _M_assign_dispatch(_InputIter __first, _InputIter __last, __false_type) + { _M_assign_aux(__first, __last, __ITERATOR_CATEGORY(__first)); } + + template <class _InputIterator> + void _M_assign_aux(_InputIterator __first, _InputIterator __last, + input_iterator_tag); + + template <class _ForwardIterator> + void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, + forward_iterator_tag); + +#endif /* __STL_MEMBER_TEMPLATES */ + + reference front() { return *begin(); } + const_reference front() const { return *begin(); } + reference back() { return *(end() - 1); } + const_reference back() const { return *(end() - 1); } + + void push_back(const _Tp& __x) { + if (_M_finish != _M_end_of_storage) { + construct(_M_finish, __x); + ++_M_finish; + } + else + _M_insert_aux(end(), __x); + } + void push_back() { + if (_M_finish != _M_end_of_storage) { + construct(_M_finish); + ++_M_finish; + } + else + _M_insert_aux(end()); + } + void swap(vector<_Tp, _Alloc>& __x) { + __STD::swap(_M_start, __x._M_start); + __STD::swap(_M_finish, __x._M_finish); + __STD::swap(_M_end_of_storage, __x._M_end_of_storage); + } + + iterator insert(iterator __position, const _Tp& __x) { + size_type __n = __position - begin(); + if (_M_finish != _M_end_of_storage && __position == end()) { + construct(_M_finish, __x); + ++_M_finish; + } + else + _M_insert_aux(__position, __x); + return begin() + __n; + } + iterator insert(iterator __position) { + size_type __n = __position - begin(); + if (_M_finish != _M_end_of_storage && __position == end()) { + construct(_M_finish); + ++_M_finish; + } + else + _M_insert_aux(__position); + return begin() + __n; + } +#ifdef __STL_MEMBER_TEMPLATES + // Check whether it's an integral type. If so, it's not an iterator. + template <class _InputIterator> + void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { + typedef typename _Is_integer<_InputIterator>::_Integral _Integral; + _M_insert_dispatch(__pos, __first, __last, _Integral()); + } + + template <class _Integer> + void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val, + __true_type) + { _M_fill_insert(__pos, (size_type) __n, (_Tp) __val); } + + template <class _InputIterator> + void _M_insert_dispatch(iterator __pos, + _InputIterator __first, _InputIterator __last, + __false_type) { + _M_range_insert(__pos, __first, __last, __ITERATOR_CATEGORY(__first)); + } +#else /* __STL_MEMBER_TEMPLATES */ + void insert(iterator __position, + const_iterator __first, const_iterator __last); +#endif /* __STL_MEMBER_TEMPLATES */ + + void insert (iterator __pos, size_type __n, const _Tp& __x) + { _M_fill_insert(__pos, __n, __x); } + + void _M_fill_insert (iterator __pos, size_type __n, const _Tp& __x); + + void pop_back() { + --_M_finish; + destroy(_M_finish); + } + iterator erase(iterator __position) { + if (__position + 1 != end()) + copy(__position + 1, _M_finish, __position); + --_M_finish; + destroy(_M_finish); + return __position; + } + iterator erase(iterator __first, iterator __last) { + iterator __i = copy(__last, _M_finish, __first); + destroy(__i, _M_finish); + _M_finish = _M_finish - (__last - __first); + return __first; + } + + void resize(size_type __new_size, const _Tp& __x) { + if (__new_size < size()) + erase(begin() + __new_size, end()); + else + insert(end(), __new_size - size(), __x); + } + void resize(size_type __new_size) { resize(__new_size, _Tp()); } + void clear() { erase(begin(), end()); } + +protected: + +#ifdef __STL_MEMBER_TEMPLATES + template <class _ForwardIterator> + iterator _M_allocate_and_copy(size_type __n, _ForwardIterator __first, + _ForwardIterator __last) +{ + iterator __result = _M_allocate(__n); + __STL_TRY { + uninitialized_copy(__first, __last, __result); + return __result; + } + __STL_UNWIND(_M_deallocate(__result, __n)); + } +#else /* __STL_MEMBER_TEMPLATES */ + iterator _M_allocate_and_copy(size_type __n, const_iterator __first, + const_iterator __last) + { + iterator __result = _M_allocate(__n); + __STL_TRY { + uninitialized_copy(__first, __last, __result); + return __result; + } + __STL_UNWIND(_M_deallocate(__result, __n)); + } +#endif /* __STL_MEMBER_TEMPLATES */ + + +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + void _M_range_initialize(_InputIterator __first, + _InputIterator __last, input_iterator_tag) + { + for ( ; __first != __last; ++__first) + push_back(*__first); + } + + // This function is only called by the constructor. + template <class _ForwardIterator> + void _M_range_initialize(_ForwardIterator __first, + _ForwardIterator __last, forward_iterator_tag) + { + size_type __n = 0; + distance(__first, __last, __n); + _M_start = _M_allocate(__n); + _M_end_of_storage = _M_start + __n; + _M_finish = uninitialized_copy(__first, __last, _M_start); + } + + template <class _InputIterator> + void _M_range_insert(iterator __pos, + _InputIterator __first, _InputIterator __last, + input_iterator_tag); + + template <class _ForwardIterator> + void _M_range_insert(iterator __pos, + _ForwardIterator __first, _ForwardIterator __last, + forward_iterator_tag); + +#endif /* __STL_MEMBER_TEMPLATES */ +}; + +template <class _Tp, class _Alloc> +inline bool +operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) +{ + return __x.size() == __y.size() && + equal(__x.begin(), __x.end(), __y.begin()); +} + +template <class _Tp, class _Alloc> +inline bool +operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) +{ + return lexicographical_compare(__x.begin(), __x.end(), + __y.begin(), __y.end()); +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Tp, class _Alloc> +inline void swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y) +{ + __x.swap(__y); +} + +template <class _Tp, class _Alloc> +inline bool +operator!=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) { + return !(__x == __y); +} + +template <class _Tp, class _Alloc> +inline bool +operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) { + return __y < __x; +} + +template <class _Tp, class _Alloc> +inline bool +operator<=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) { + return !(__y < __x); +} + +template <class _Tp, class _Alloc> +inline bool +operator>=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) { + return !(__x < __y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +template <class _Tp, class _Alloc> +vector<_Tp,_Alloc>& +vector<_Tp,_Alloc>::operator=(const vector<_Tp, _Alloc>& __x) +{ + if (&__x != this) { + const size_type __xlen = __x.size(); + if (__xlen > capacity()) { + iterator __tmp = _M_allocate_and_copy(__xlen, __x.begin(), __x.end()); + destroy(_M_start, _M_finish); + _M_deallocate(_M_start, _M_end_of_storage - _M_start); + _M_start = __tmp; + _M_end_of_storage = _M_start + __xlen; + } + else if (size() >= __xlen) { + iterator __i = copy(__x.begin(), __x.end(), begin()); + destroy(__i, _M_finish); + } + else { + copy(__x.begin(), __x.begin() + size(), _M_start); + uninitialized_copy(__x.begin() + size(), __x.end(), _M_finish); + } + _M_finish = _M_start + __xlen; + } + return *this; +} + +template <class _Tp, class _Alloc> +void vector<_Tp, _Alloc>::_M_fill_assign(size_t __n, const value_type& __val) +{ + if (__n > capacity()) { + vector<_Tp, _Alloc> __tmp(__n, __val, get_allocator()); + __tmp.swap(*this); + } + else if (__n > size()) { + fill(begin(), end(), __val); + _M_finish = uninitialized_fill_n(_M_finish, __n - size(), __val); + } + else + erase(fill_n(begin(), __n, __val), end()); +} + +#ifdef __STL_MEMBER_TEMPLATES + +template <class _Tp, class _Alloc> template <class _InputIter> +void vector<_Tp, _Alloc>::_M_assign_aux(_InputIter __first, _InputIter __last, + input_iterator_tag) { + iterator __cur = begin(); + for ( ; __first != __last && __cur != end(); ++__cur, ++__first) + *__cur = *__first; + if (__first == __last) + erase(__cur, end()); + else + insert(end(), __first, __last); +} + +template <class _Tp, class _Alloc> template <class _ForwardIter> +void +vector<_Tp, _Alloc>::_M_assign_aux(_ForwardIter __first, _ForwardIter __last, + forward_iterator_tag) { + size_type __len = 0; + distance(__first, __last, __len); + + if (__len > capacity()) { + iterator __tmp = _M_allocate_and_copy(__len, __first, __last); + destroy(_M_start, _M_finish); + _M_deallocate(_M_start, _M_end_of_storage - _M_start); + _M_start = __tmp; + _M_end_of_storage = _M_finish = _M_start + __len; + } + else if (size() >= __len) { + iterator __new_finish = copy(__first, __last, _M_start); + destroy(__new_finish, _M_finish); + _M_finish = __new_finish; + } + else { + _ForwardIter __mid = __first; + advance(__mid, size()); + copy(__first, __mid, _M_start); + _M_finish = uninitialized_copy(__mid, __last, _M_finish); + } +} + +#endif /* __STL_MEMBER_TEMPLATES */ + +template <class _Tp, class _Alloc> +void +vector<_Tp, _Alloc>::_M_insert_aux(iterator __position, const _Tp& __x) +{ + if (_M_finish != _M_end_of_storage) { + construct(_M_finish, *(_M_finish - 1)); + ++_M_finish; + _Tp __x_copy = __x; + copy_backward(__position, _M_finish - 2, _M_finish - 1); + *__position = __x_copy; + } + else { + const size_type __old_size = size(); + const size_type __len = __old_size != 0 ? 2 * __old_size : 1; + iterator __new_start = _M_allocate(__len); + iterator __new_finish = __new_start; + __STL_TRY { + __new_finish = uninitialized_copy(_M_start, __position, __new_start); + construct(__new_finish, __x); + ++__new_finish; + __new_finish = uninitialized_copy(__position, _M_finish, __new_finish); + } + __STL_UNWIND((destroy(__new_start,__new_finish), + _M_deallocate(__new_start,__len))); + destroy(begin(), end()); + _M_deallocate(_M_start, _M_end_of_storage - _M_start); + _M_start = __new_start; + _M_finish = __new_finish; + _M_end_of_storage = __new_start + __len; + } +} + +template <class _Tp, class _Alloc> +void +vector<_Tp, _Alloc>::_M_insert_aux(iterator __position) +{ + if (_M_finish != _M_end_of_storage) { + construct(_M_finish, *(_M_finish - 1)); + ++_M_finish; + copy_backward(__position, _M_finish - 2, _M_finish - 1); + *__position = _Tp(); + } + else { + const size_type __old_size = size(); + const size_type __len = __old_size != 0 ? 2 * __old_size : 1; + iterator __new_start = _M_allocate(__len); + iterator __new_finish = __new_start; + __STL_TRY { + __new_finish = uninitialized_copy(_M_start, __position, __new_start); + construct(__new_finish); + ++__new_finish; + __new_finish = uninitialized_copy(__position, _M_finish, __new_finish); + } + __STL_UNWIND((destroy(__new_start,__new_finish), + _M_deallocate(__new_start,__len))); + destroy(begin(), end()); + _M_deallocate(_M_start, _M_end_of_storage - _M_start); + _M_start = __new_start; + _M_finish = __new_finish; + _M_end_of_storage = __new_start + __len; + } +} + +template <class _Tp, class _Alloc> +void vector<_Tp, _Alloc>::_M_fill_insert(iterator __position, size_type __n, + const _Tp& __x) +{ + if (__n != 0) { + if (size_type(_M_end_of_storage - _M_finish) >= __n) { + _Tp __x_copy = __x; + const size_type __elems_after = _M_finish - __position; + iterator __old_finish = _M_finish; + if (__elems_after > __n) { + uninitialized_copy(_M_finish - __n, _M_finish, _M_finish); + _M_finish += __n; + copy_backward(__position, __old_finish - __n, __old_finish); + fill(__position, __position + __n, __x_copy); + } + else { + uninitialized_fill_n(_M_finish, __n - __elems_after, __x_copy); + _M_finish += __n - __elems_after; + uninitialized_copy(__position, __old_finish, _M_finish); + _M_finish += __elems_after; + fill(__position, __old_finish, __x_copy); + } + } + else { + const size_type __old_size = size(); + const size_type __len = __old_size + max(__old_size, __n); + iterator __new_start = _M_allocate(__len); + iterator __new_finish = __new_start; + __STL_TRY { + __new_finish = uninitialized_copy(_M_start, __position, __new_start); + __new_finish = uninitialized_fill_n(__new_finish, __n, __x); + __new_finish + = uninitialized_copy(__position, _M_finish, __new_finish); + } + __STL_UNWIND((destroy(__new_start,__new_finish), + _M_deallocate(__new_start,__len))); + destroy(_M_start, _M_finish); + _M_deallocate(_M_start, _M_end_of_storage - _M_start); + _M_start = __new_start; + _M_finish = __new_finish; + _M_end_of_storage = __new_start + __len; + } + } +} + +#ifdef __STL_MEMBER_TEMPLATES + +template <class _Tp, class _Alloc> template <class _InputIterator> +void +vector<_Tp, _Alloc>::_M_range_insert(iterator __pos, + _InputIterator __first, + _InputIterator __last, + input_iterator_tag) +{ + for ( ; __first != __last; ++__first) { + __pos = insert(__pos, *__first); + ++__pos; + } +} + +template <class _Tp, class _Alloc> template <class _ForwardIterator> +void +vector<_Tp, _Alloc>::_M_range_insert(iterator __position, + _ForwardIterator __first, + _ForwardIterator __last, + forward_iterator_tag) +{ + if (__first != __last) { + size_type __n = 0; + distance(__first, __last, __n); + if (size_type(_M_end_of_storage - _M_finish) >= __n) { + const size_type __elems_after = _M_finish - __position; + iterator __old_finish = _M_finish; + if (__elems_after > __n) { + uninitialized_copy(_M_finish - __n, _M_finish, _M_finish); + _M_finish += __n; + copy_backward(__position, __old_finish - __n, __old_finish); + copy(__first, __last, __position); + } + else { + _ForwardIterator __mid = __first; + advance(__mid, __elems_after); + uninitialized_copy(__mid, __last, _M_finish); + _M_finish += __n - __elems_after; + uninitialized_copy(__position, __old_finish, _M_finish); + _M_finish += __elems_after; + copy(__first, __mid, __position); + } + } + else { + const size_type __old_size = size(); + const size_type __len = __old_size + max(__old_size, __n); + iterator __new_start = _M_allocate(__len); + iterator __new_finish = __new_start; + __STL_TRY { + __new_finish = uninitialized_copy(_M_start, __position, __new_start); + __new_finish = uninitialized_copy(__first, __last, __new_finish); + __new_finish + = uninitialized_copy(__position, _M_finish, __new_finish); + } + __STL_UNWIND((destroy(__new_start,__new_finish), + _M_deallocate(__new_start,__len))); + destroy(_M_start, _M_finish); + _M_deallocate(_M_start, _M_end_of_storage - _M_start); + _M_start = __new_start; + _M_finish = __new_finish; + _M_end_of_storage = __new_start + __len; + } + } +} + +#else /* __STL_MEMBER_TEMPLATES */ + +template <class _Tp, class _Alloc> +void +vector<_Tp, _Alloc>::insert(iterator __position, + const_iterator __first, + const_iterator __last) +{ + if (__first != __last) { + size_type __n = 0; + distance(__first, __last, __n); + if (size_type(_M_end_of_storage - _M_finish) >= __n) { + const size_type __elems_after = _M_finish - __position; + iterator __old_finish = _M_finish; + if (__elems_after > __n) { + uninitialized_copy(_M_finish - __n, _M_finish, _M_finish); + _M_finish += __n; + copy_backward(__position, __old_finish - __n, __old_finish); + copy(__first, __last, __position); + } + else { + uninitialized_copy(__first + __elems_after, __last, _M_finish); + _M_finish += __n - __elems_after; + uninitialized_copy(__position, __old_finish, _M_finish); + _M_finish += __elems_after; + copy(__first, __first + __elems_after, __position); + } + } + else { + const size_type __old_size = size(); + const size_type __len = __old_size + max(__old_size, __n); + iterator __new_start = _M_allocate(__len); + iterator __new_finish = __new_start; + __STL_TRY { + __new_finish = uninitialized_copy(_M_start, __position, __new_start); + __new_finish = uninitialized_copy(__first, __last, __new_finish); + __new_finish + = uninitialized_copy(__position, _M_finish, __new_finish); + } + __STL_UNWIND((destroy(__new_start,__new_finish), + _M_deallocate(__new_start,__len))); + destroy(_M_start, _M_finish); + _M_deallocate(_M_start, _M_end_of_storage - _M_start); + _M_start = __new_start; + _M_finish = __new_finish; + _M_end_of_storage = __new_start + __len; + } + } +} + +#endif /* __STL_MEMBER_TEMPLATES */ + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1174 +#pragma reset woff 1375 +#endif + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_INTERNAL_VECTOR_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/string b/dtm_release/local/include/stl/string new file mode 100644 index 0000000000000000000000000000000000000000..1ca65218a647fc95a055236d7b571d80ec858bc9 --- /dev/null +++ b/dtm_release/local/include/stl/string @@ -0,0 +1,2413 @@ +/* + * Copyright (c) 1997-1999 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_STRING +#define __SGI_STL_STRING + +#include <stl_config.h> +#include <stl_string_fwd.h> +#include <ctype.h> +#include <functional> +#include <stl_ctraits_fns.h> +#include <stdexcept> +#include <stl_iterator_base.h> +#include <memory> +#include <algorithm> + +#ifdef __STL_USE_NEW_IOSTREAMS +#include <iosfwd> +#else /* __STL_USE_NEW_IOSTREAMS */ +#include <char_traits.h> +#endif /* __STL_USE_NEW_IOSTREAMS */ + +// Standard C++ string class. This class has performance +// characteristics very much like vector<>, meaning, for example, that +// it does not perform reference-count or copy-on-write, and that +// concatenation of two strings is an O(N) operation. + +// There are three reasons why basic_string is not identical to +// vector. First, basic_string always stores a null character at the +// end; this makes it possible for c_str to be a fast operation. +// Second, the C++ standard requires basic_string to copy elements +// using char_traits<>::assign, char_traits<>::copy, and +// char_traits<>::move. This means that all of vector<>'s low-level +// operations must be rewritten. Third, basic_string<> has a lot of +// extra functions in its interface that are convenient but, strictly +// speaking, redundant. + +// Additionally, the C++ standard imposes a major restriction: according +// to the standard, the character type _CharT must be a POD type. This +// implementation weakens that restriction, and allows _CharT to be a +// a user-defined non-POD type. However, _CharT must still have a +// default constructor. + +__STL_BEGIN_NAMESPACE + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma set woff 1174 +#pragma set woff 1375 +#endif + +// A helper class to use a char_traits as a function object. + +template <class _Traits> +struct _Not_within_traits + : public unary_function<typename _Traits::char_type, bool> +{ + typedef const typename _Traits::char_type* _Pointer; + const _Pointer _M_first; + const _Pointer _M_last; + + _Not_within_traits(_Pointer __f, _Pointer __l) + : _M_first(__f), _M_last(__l) {} + + bool operator()(const typename _Traits::char_type& __x) const { + return find_if(_M_first, _M_last, + bind1st(_Eq_traits<_Traits>(), __x)) == _M_last; + } +}; + +// ------------------------------------------------------------ +// Class _String_base. + +// _String_base is a helper class that makes it it easier to write an +// exception-safe version of basic_string. The constructor allocates, +// but does not initialize, a block of memory. The destructor +// deallocates, but does not destroy elements within, a block of +// memory. The destructor assumes that _M_start either is null, or else +// points to a block of memory that was allocated using _String_base's +// allocator and whose size is _M_end_of_storage - _M_start. + +// Additionally, _String_base encapsulates the difference between +// old SGI-style allocators and standard-conforming allocators. + +#ifdef __STL_USE_STD_ALLOCATORS + +// General base class. +template <class _Tp, class _Alloc, bool _S_instanceless> +class _String_alloc_base { +public: + typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type allocator_type; + allocator_type get_allocator() const { return _M_data_allocator; } + + _String_alloc_base(const allocator_type& __a) + : _M_data_allocator(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0) + {} + +protected: + _Tp* _M_allocate(size_t __n) + { return _M_data_allocator.allocate(__n); } + void _M_deallocate(_Tp* __p, size_t __n) { + if (__p) + _M_data_allocator.deallocate(__p, __n); + } + +protected: + allocator_type _M_data_allocator; + + _Tp* _M_start; + _Tp* _M_finish; + _Tp* _M_end_of_storage; +}; + +// Specialization for instanceless allocators. +template <class _Tp, class _Alloc> +class _String_alloc_base<_Tp,_Alloc,true> { +public: + typedef typename _Alloc_traits<_Tp, _Alloc>::allocator_type allocator_type; + allocator_type get_allocator() const { return allocator_type(); } + + _String_alloc_base(const allocator_type&) + : _M_start(0), _M_finish(0), _M_end_of_storage(0) {} + +protected: + typedef typename _Alloc_traits<_Tp, _Alloc>::_Alloc_type _Alloc_type; + _Tp* _M_allocate(size_t __n) + { return _Alloc_type::allocate(__n); } + void _M_deallocate(_Tp* __p, size_t __n) + { _Alloc_type::deallocate(__p, __n); } + +protected: + _Tp* _M_start; + _Tp* _M_finish; + _Tp* _M_end_of_storage; +}; + +template <class _Tp, class _Alloc> +class _String_base + : public _String_alloc_base<_Tp, _Alloc, + _Alloc_traits<_Tp, _Alloc>::_S_instanceless> +{ +protected: + typedef _String_alloc_base<_Tp, _Alloc, + _Alloc_traits<_Tp, _Alloc>::_S_instanceless> + _Base; + typedef typename _Base::allocator_type allocator_type; + + void _M_allocate_block(size_t __n) { + if (__n <= max_size()) { + _M_start = _M_allocate(__n); + _M_finish = _M_start; + _M_end_of_storage = _M_start + __n; + } + else + _M_throw_length_error(); + } + + void _M_deallocate_block() + { _M_deallocate(_M_start, _M_end_of_storage - _M_start); } + + size_t max_size() const { return (size_t(-1) / sizeof(_Tp)) - 1; } + + _String_base(const allocator_type& __a) : _Base(__a) { } + + _String_base(const allocator_type& __a, size_t __n) : _Base(__a) + { _M_allocate_block(__n); } + + ~_String_base() { _M_deallocate_block(); } + + void _M_throw_length_error() const; + void _M_throw_out_of_range() const; +}; + +#else /* __STL_USE_STD_ALLOCATORS */ + +template <class _Tp, class _Alloc> class _String_base { +public: + typedef _Alloc allocator_type; + allocator_type get_allocator() const { return allocator_type(); } + +protected: + typedef simple_alloc<_Tp, _Alloc> _Alloc_type; + + _Tp* _M_start; + _Tp* _M_finish; + _Tp* _M_end_of_storage; + // Precondition: 0 < __n <= max_size(). + + _Tp* _M_allocate(size_t __n) { return _Alloc_type::allocate(__n); } + void _M_deallocate(_Tp* __p, size_t __n) { + if (__p) + _Alloc_type::deallocate(__p, __n); + } + + void _M_allocate_block(size_t __n) { + if (__n <= max_size()) { + _M_start = _M_allocate(__n); + _M_finish = _M_start; + _M_end_of_storage = _M_start + __n; + } + else + _M_throw_length_error(); + } + + void _M_deallocate_block() + { _M_deallocate(_M_start, _M_end_of_storage - _M_start); } + + size_t max_size() const { return (size_t(-1) / sizeof(_Tp)) - 1; } + + _String_base(const allocator_type&) + : _M_start(0), _M_finish(0), _M_end_of_storage(0) { } + + _String_base(const allocator_type&, size_t __n) + : _M_start(0), _M_finish(0), _M_end_of_storage(0) + { _M_allocate_block(__n); } + + ~_String_base() { _M_deallocate_block(); } + + void _M_throw_length_error() const; + void _M_throw_out_of_range() const; +}; + +#endif /* __STL_USE_STD_ALLOCATORS */ + +// Helper functions for exception handling. +template <class _Tp, class _Alloc> +void _String_base<_Tp,_Alloc>::_M_throw_length_error() const { + __STL_THROW(length_error("basic_string")); +} + +template <class _Tp, class _Alloc> +void _String_base<_Tp, _Alloc>::_M_throw_out_of_range() const { + __STL_THROW(out_of_range("basic_string")); +} + + +// ------------------------------------------------------------ +// Class basic_string. + +// Class invariants: +// (1) [start, finish) is a valid range. +// (2) Each iterator in [start, finish) points to a valid object +// of type value_type. +// (3) *finish is a valid object of type value_type; in particular, +// it is value_type(). +// (4) [finish + 1, end_of_storage) is a valid range. +// (5) Each iterator in [finish + 1, end_of_storage) points to +// unininitialized memory. + +// Note one important consequence: a string of length n must manage +// a block of memory whose size is at least n + 1. + + +template <class _CharT, class _Traits, class _Alloc> +class basic_string : private _String_base<_CharT,_Alloc> { +public: + typedef _CharT value_type; + typedef _Traits traits_type; + + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + + typedef const value_type* const_iterator; + typedef value_type* iterator; + +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + typedef reverse_iterator<const_iterator> const_reverse_iterator; + typedef reverse_iterator<iterator> reverse_iterator; +#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + typedef reverse_iterator<const_iterator, value_type, const_reference, + difference_type> + const_reverse_iterator; + typedef reverse_iterator<iterator, value_type, reference, difference_type> + reverse_iterator; +#endif /* __STL_PARTIAL_SPECIALIZATION */ + + static const size_type npos; + + typedef _String_base<_CharT,_Alloc> _Base; + +public: // Constructor, destructor, assignment. + typedef typename _Base::allocator_type allocator_type; + allocator_type get_allocator() const { return _Base::get_allocator(); } + + explicit basic_string(const allocator_type& __a = allocator_type()) + : _Base(__a, 8) { _M_terminate_string(); } + + struct _Reserve_t {}; + basic_string(_Reserve_t, size_t __n, + const allocator_type& __a = allocator_type()) + : _Base(__a, __n + 1) { _M_terminate_string(); } + + basic_string(const basic_string& __s) : _Base(__s.get_allocator()) + { _M_range_initialize(__s.begin(), __s.end()); } + + basic_string(const basic_string& __s, size_type __pos, size_type __n = npos, + const allocator_type& __a = allocator_type()) + : _Base(__a) { + if (__pos > __s.size()) + _M_throw_out_of_range(); + else + _M_range_initialize(__s.begin() + __pos, + __s.begin() + __pos + min(__n, __s.size() - __pos)); + } + + basic_string(const _CharT* __s, size_type __n, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { _M_range_initialize(__s, __s + __n); } + + basic_string(const _CharT* __s, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { _M_range_initialize(__s, __s + _Traits::length(__s)); } + + basic_string(size_type __n, _CharT __c, + const allocator_type& __a = allocator_type()) + : _Base(__a, __n + 1) + { + _M_finish = uninitialized_fill_n(_M_start, __n, __c); + _M_terminate_string(); + } + + // Check to see if _InputIterator is an integer type. If so, then + // it can't be an iterator. +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIterator> + basic_string(_InputIterator __f, _InputIterator __l, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { + typedef typename _Is_integer<_InputIterator>::_Integral _Integral; + _M_initialize_dispatch(__f, __l, _Integral()); + } +#else /* __STL_MEMBER_TEMPLATES */ + basic_string(const _CharT* __f, const _CharT* __l, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { + _M_range_initialize(__f, __l); + } +#endif + + ~basic_string() { destroy(_M_start, _M_finish + 1); } + + basic_string& operator=(const basic_string& __s) { + if (&__s != this) + assign(__s.begin(), __s.end()); + return *this; + } + + basic_string& operator=(const _CharT* __s) + { return assign(__s, __s + _Traits::length(__s)); } + + basic_string& operator=(_CharT __c) + { return assign(static_cast<size_type>(1), __c); } + +protected: // Protected members inherited from base. +#ifdef __STL_HAS_NAMESPACES + using _Base::_M_allocate; + using _Base::_M_deallocate; + using _Base::_M_allocate_block; + using _Base::_M_deallocate_block; + using _Base::_M_throw_length_error; + using _Base::_M_throw_out_of_range; + + using _Base::_M_start; + using _Base::_M_finish; + using _Base::_M_end_of_storage; +#endif /* __STL_HAS_NAMESPACES */ + +private: // Helper functions used by constructors + // and elsewhere. + void _M_construct_null(_CharT* __p) { + construct(__p); +# ifdef __STL_DEFAULT_CONSTRUCTOR_BUG + __STL_TRY { + *__p = (_CharT) 0; + } + __STL_UNWIND(destroy(__p)); +# endif + } + + static _CharT _M_null() { +# ifndef __STL_DEFAULT_CONSTRUCTOR_BUG + return _CharT(); +# else + return (_CharT) 0; +# endif + } + +private: + // Helper functions used by constructors. It is a severe error for + // any of them to be called anywhere except from within constructors. + + void _M_terminate_string() { + __STL_TRY { + _M_construct_null(_M_finish); + } + __STL_UNWIND(destroy(_M_start, _M_finish)); + } + +#ifdef __STL_MEMBER_TEMPLATES + + template <class _InputIter> + void _M_range_initialize(_InputIter __f, _InputIter __l, + input_iterator_tag) { + _M_allocate_block(8); + _M_construct_null(_M_finish); + __STL_TRY { + append(__f, __l); + } + __STL_UNWIND(destroy(_M_start, _M_finish + 1)); + } + + template <class _ForwardIter> + void _M_range_initialize(_ForwardIter __f, _ForwardIter __l, + forward_iterator_tag) { + difference_type __n = 0; + distance(__f, __l, __n); + _M_allocate_block(__n + 1); + _M_finish = uninitialized_copy(__f, __l, _M_start); + _M_terminate_string(); + } + + template <class _InputIter> + void _M_range_initialize(_InputIter __f, _InputIter __l) { + typedef typename iterator_traits<_InputIter>::iterator_category _Category; + _M_range_initialize(__f, __l, _Category()); + } + + template <class _Integer> + void _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) { + _M_allocate_block(__n + 1); + _M_finish = uninitialized_fill_n(_M_start, __n, __x); + _M_terminate_string(); + } + + template <class _InputIter> + void _M_initialize_dispatch(_InputIter __f, _InputIter __l, __false_type) { + _M_range_initialize(__f, __l); + } + +#else /* __STL_MEMBER_TEMPLATES */ + + void _M_range_initialize(const _CharT* __f, const _CharT* __l) { + ptrdiff_t __n = __l - __f; + _M_allocate_block(__n + 1); + _M_finish = uninitialized_copy(__f, __l, _M_start); + _M_terminate_string(); + } + +#endif /* __STL_MEMBER_TEMPLATES */ + +public: // Iterators. + iterator begin() { return _M_start; } + iterator end() { return _M_finish; } + const_iterator begin() const { return _M_start; } + const_iterator end() const { return _M_finish; } + + reverse_iterator rbegin() + { return reverse_iterator(_M_finish); } + reverse_iterator rend() + { return reverse_iterator(_M_start); } + const_reverse_iterator rbegin() const + { return const_reverse_iterator(_M_finish); } + const_reverse_iterator rend() const + { return const_reverse_iterator(_M_start); } + +public: // Size, capacity, etc. + size_type size() const { return _M_finish - _M_start; } + size_type length() const { return size(); } + + size_t max_size() const { return _Base::max_size(); } + + + void resize(size_type __n, _CharT __c) { + if (__n <= size()) + erase(begin() + __n, end()); + else + append(__n - size(), __c); + } + + void resize(size_type __n) { resize(__n, _M_null()); } + + void reserve(size_type = 0); + + size_type capacity() const { return (_M_end_of_storage - _M_start) - 1; } + + void clear() { + if (!empty()) { + _Traits::assign(*_M_start, _M_null()); + destroy(_M_start+1, _M_finish+1); + _M_finish = _M_start; + } + } + + bool empty() const { return _M_start == _M_finish; } + +public: // Element access. + + const_reference operator[](size_type __n) const + { return *(_M_start + __n); } + reference operator[](size_type __n) + { return *(_M_start + __n); } + + const_reference at(size_type __n) const { + if (__n >= size()) + _M_throw_out_of_range(); + return *(_M_start + __n); + } + + reference at(size_type __n) { + if (__n >= size()) + _M_throw_out_of_range(); + return *(_M_start + __n); + } + +public: // Append, operator+=, push_back. + + basic_string& operator+=(const basic_string& __s) { return append(__s); } + basic_string& operator+=(const _CharT* __s) { return append(__s); } + basic_string& operator+=(_CharT __c) { push_back(__c); return *this; } + + basic_string& append(const basic_string& __s) + { return append(__s.begin(), __s.end()); } + + basic_string& append(const basic_string& __s, + size_type __pos, size_type __n) + { + if (__pos > __s.size()) + _M_throw_out_of_range(); + return append(__s.begin() + __pos, + __s.begin() + __pos + min(__n, __s.size() - __pos)); + } + + basic_string& append(const _CharT* __s, size_type __n) + { return append(__s, __s+__n); } + + basic_string& append(const _CharT* __s) + { return append(__s, __s + _Traits::length(__s)); } + + basic_string& append(size_type __n, _CharT __c); + +#ifdef __STL_MEMBER_TEMPLATES + + // Check to see if _InputIterator is an integer type. If so, then + // it can't be an iterator. + template <class _InputIter> + basic_string& append(_InputIter __first, _InputIter __last) { + typedef typename _Is_integer<_InputIter>::_Integral _Integral; + return _M_append_dispatch(__first, __last, _Integral()); + } + +#else /* __STL_MEMBER_TEMPLATES */ + + basic_string& append(const _CharT* __first, const _CharT* __last); + +#endif /* __STL_MEMBER_TEMPLATES */ + + void push_back(_CharT __c) { + if (_M_finish + 1 == _M_end_of_storage) + reserve(size() + max(size(), static_cast<size_type>(1))); + _M_construct_null(_M_finish + 1); + _Traits::assign(*_M_finish, __c); + ++_M_finish; + } + + void pop_back() { + _Traits::assign(*(_M_finish - 1), _M_null()); + destroy(_M_finish); + --_M_finish; + } + +private: // Helper functions for append. + +#ifdef __STL_MEMBER_TEMPLATES + + template <class _InputIter> + basic_string& append(_InputIter __f, _InputIter __l, input_iterator_tag); + + template <class _ForwardIter> + basic_string& append(_ForwardIter __f, _ForwardIter __l, + forward_iterator_tag); + + template <class _Integer> + basic_string& _M_append_dispatch(_Integer __n, _Integer __x, __true_type) { + return append((size_type) __n, (_CharT) __x); + } + + template <class _InputIter> + basic_string& _M_append_dispatch(_InputIter __f, _InputIter __l, + __false_type) { + typedef typename iterator_traits<_InputIter>::iterator_category _Category; + return append(__f, __l, _Category()); + } + +#endif /* __STL_MEMBER_TEMPLATES */ + +public: // Assign + + basic_string& assign(const basic_string& __s) + { return assign(__s.begin(), __s.end()); } + + basic_string& assign(const basic_string& __s, + size_type __pos, size_type __n) { + if (__pos > __s.size()) + _M_throw_out_of_range(); + return assign(__s.begin() + __pos, + __s.begin() + __pos + min(__n, __s.size() - __pos)); + } + + basic_string& assign(const _CharT* __s, size_type __n) + { return assign(__s, __s + __n); } + + basic_string& assign(const _CharT* __s) + { return assign(__s, __s + _Traits::length(__s)); } + + basic_string& assign(size_type __n, _CharT __c); + +#ifdef __STL_MEMBER_TEMPLATES + + // Check to see if _InputIterator is an integer type. If so, then + // it can't be an iterator. + template <class _InputIter> + basic_string& assign(_InputIter __first, _InputIter __last) { + typedef typename _Is_integer<_InputIter>::_Integral _Integral; + return _M_assign_dispatch(__first, __last, _Integral()); + } + +#endif /* __STL_MEMBER_TEMPLATES */ + + basic_string& assign(const _CharT* __f, const _CharT* __l); + +private: // Helper functions for assign. + +#ifdef __STL_MEMBER_TEMPLATES + + template <class _Integer> + basic_string& _M_assign_dispatch(_Integer __n, _Integer __x, __true_type) { + return assign((size_type) __n, (_CharT) __x); + } + + template <class _InputIter> + basic_string& _M_assign_dispatch(_InputIter __f, _InputIter __l, + __false_type); + +#endif /* __STL_MEMBER_TEMPLATES */ + +public: // Insert + + basic_string& insert(size_type __pos, const basic_string& __s) { + if (__pos > size()) + _M_throw_out_of_range(); + if (size() > max_size() - __s.size()) + _M_throw_length_error(); + insert(_M_start + __pos, __s.begin(), __s.end()); + return *this; + } + + basic_string& insert(size_type __pos, const basic_string& __s, + size_type __beg, size_type __n) { + if (__pos > size() || __beg > __s.size()) + _M_throw_out_of_range(); + size_type __len = min(__n, __s.size() - __beg); + if (size() > max_size() - __len) + _M_throw_length_error(); + insert(_M_start + __pos, + __s.begin() + __beg, __s.begin() + __beg + __len); + return *this; + } + + basic_string& insert(size_type __pos, const _CharT* __s, size_type __n) { + if (__pos > size()) + _M_throw_out_of_range(); + if (size() > max_size() - __n) + _M_throw_length_error(); + insert(_M_start + __pos, __s, __s + __n); + return *this; + } + + basic_string& insert(size_type __pos, const _CharT* __s) { + if (__pos > size()) + _M_throw_out_of_range(); + size_type __len = _Traits::length(__s); + if (size() > max_size() - __len) + _M_throw_length_error(); + insert(_M_start + __pos, __s, __s + __len); + return *this; + } + + basic_string& insert(size_type __pos, size_type __n, _CharT __c) { + if (__pos > size()) + _M_throw_out_of_range(); + if (size() > max_size() - __n) + _M_throw_length_error(); + insert(_M_start + __pos, __n, __c); + return *this; + } + + iterator insert(iterator __p, _CharT __c) { + if (__p == _M_finish) { + push_back(__c); + return _M_finish - 1; + } + else + return _M_insert_aux(__p, __c); + } + + void insert(iterator __p, size_t __n, _CharT __c); + +#ifdef __STL_MEMBER_TEMPLATES + + // Check to see if _InputIterator is an integer type. If so, then + // it can't be an iterator. + template <class _InputIter> + void insert(iterator __p, _InputIter __first, _InputIter __last) { + typedef typename _Is_integer<_InputIter>::_Integral _Integral; + _M_insert_dispatch(__p, __first, __last, _Integral()); + } + +#else /* __STL_MEMBER_TEMPLATES */ + + void insert(iterator __p, const _CharT* __first, const _CharT* __last); + +#endif /* __STL_MEMBER_TEMPLATES */ + +private: // Helper functions for insert. + +#ifdef __STL_MEMBER_TEMPLATES + + template <class _InputIter> + void insert(iterator __p, _InputIter, _InputIter, input_iterator_tag); + + template <class _ForwardIter> + void insert(iterator __p, _ForwardIter, _ForwardIter, forward_iterator_tag); + + + template <class _Integer> + void _M_insert_dispatch(iterator __p, _Integer __n, _Integer __x, + __true_type) { + insert(__p, (size_type) __n, (_CharT) __x); + } + + template <class _InputIter> + void _M_insert_dispatch(iterator __p, _InputIter __first, _InputIter __last, + __false_type) { + typedef typename iterator_traits<_InputIter>::iterator_category _Category; + insert(__p, __first, __last, _Category()); + } + + template <class _InputIterator> + void + _M_copy(_InputIterator __first, _InputIterator __last, iterator __result) { + for ( ; __first != __last; ++__first, ++__result) + _Traits::assign(*__result, *__first); + } + +#endif /* __STL_MEMBER_TEMPLATES */ + + iterator _M_insert_aux(iterator, _CharT); + + void + _M_copy(const _CharT* __first, const _CharT* __last, _CharT* __result) { + _Traits::copy(__result, __first, __last - __first); + } + +public: // Erase. + + basic_string& erase(size_type __pos = 0, size_type __n = npos) { + if (__pos > size()) + _M_throw_out_of_range(); + erase(_M_start + __pos, _M_start + __pos + min(__n, size() - __pos)); + return *this; + } + + iterator erase(iterator __position) { + // The move includes the terminating null. + _Traits::move(__position, __position + 1, _M_finish - __position); + destroy(_M_finish); + --_M_finish; + return __position; + } + + iterator erase(iterator __first, iterator __last) { + if (__first != __last) { + // The move includes the terminating null. + _Traits::move(__first, __last, (_M_finish - __last) + 1); + const iterator __new_finish = _M_finish - (__last - __first); + destroy(__new_finish + 1, _M_finish + 1); + _M_finish = __new_finish; + } + return __first; + } + +public: // Replace. (Conceptually equivalent + // to erase followed by insert.) + basic_string& replace(size_type __pos, size_type __n, + const basic_string& __s) { + if (__pos > size()) + _M_throw_out_of_range(); + const size_type __len = min(__n, size() - __pos); + if (size() - __len >= max_size() - __s.size()) + _M_throw_length_error(); + return replace(_M_start + __pos, _M_start + __pos + __len, + __s.begin(), __s.end()); + } + + basic_string& replace(size_type __pos1, size_type __n1, + const basic_string& __s, + size_type __pos2, size_type __n2) { + if (__pos1 > size() || __pos2 > __s.size()) + _M_throw_out_of_range(); + const size_type __len1 = min(__n1, size() - __pos1); + const size_type __len2 = min(__n2, __s.size() - __pos2); + if (size() - __len1 >= max_size() - __len2) + _M_throw_length_error(); + return replace(_M_start + __pos1, _M_start + __pos1 + __len1, + __s._M_start + __pos2, __s._M_start + __pos2 + __len2); + } + + basic_string& replace(size_type __pos, size_type __n1, + const _CharT* __s, size_type __n2) { + if (__pos > size()) + _M_throw_out_of_range(); + const size_type __len = min(__n1, size() - __pos); + if (__n2 > max_size() || size() - __len >= max_size() - __n2) + _M_throw_length_error(); + return replace(_M_start + __pos, _M_start + __pos + __len, + __s, __s + __n2); + } + + basic_string& replace(size_type __pos, size_type __n1, + const _CharT* __s) { + if (__pos > size()) + _M_throw_out_of_range(); + const size_type __len = min(__n1, size() - __pos); + const size_type __n2 = _Traits::length(__s); + if (__n2 > max_size() || size() - __len >= max_size() - __n2) + _M_throw_length_error(); + return replace(_M_start + __pos, _M_start + __pos + __len, + __s, __s + _Traits::length(__s)); + } + + basic_string& replace(size_type __pos, size_type __n1, + size_type __n2, _CharT __c) { + if (__pos > size()) + _M_throw_out_of_range(); + const size_type __len = min(__n1, size() - __pos); + if (__n2 > max_size() || size() - __len >= max_size() - __n2) + _M_throw_length_error(); + return replace(_M_start + __pos, _M_start + __pos + __len, __n2, __c); + } + + basic_string& replace(iterator __first, iterator __last, + const basic_string& __s) + { return replace(__first, __last, __s.begin(), __s.end()); } + + basic_string& replace(iterator __first, iterator __last, + const _CharT* __s, size_type __n) + { return replace(__first, __last, __s, __s + __n); } + + basic_string& replace(iterator __first, iterator __last, + const _CharT* __s) { + return replace(__first, __last, __s, __s + _Traits::length(__s)); + } + + basic_string& replace(iterator __first, iterator __last, + size_type __n, _CharT __c); + + // Check to see if _InputIterator is an integer type. If so, then + // it can't be an iterator. +#ifdef __STL_MEMBER_TEMPLATES + template <class _InputIter> + basic_string& replace(iterator __first, iterator __last, + _InputIter __f, _InputIter __l) { + typedef typename _Is_integer<_InputIter>::_Integral _Integral; + return _M_replace_dispatch(__first, __last, __f, __l, _Integral()); + } +#else /* __STL_MEMBER_TEMPLATES */ + basic_string& replace(iterator __first, iterator __last, + const _CharT* __f, const _CharT* __l); +#endif /* __STL_MEMBER_TEMPLATES */ + +private: // Helper functions for replace. + +#ifdef __STL_MEMBER_TEMPLATES + + template <class _Integer> + basic_string& _M_replace_dispatch(iterator __first, iterator __last, + _Integer __n, _Integer __x, + __true_type) { + return replace(__first, __last, (size_type) __n, (_CharT) __x); + } + + template <class _InputIter> + basic_string& _M_replace_dispatch(iterator __first, iterator __last, + _InputIter __f, _InputIter __l, + __false_type) { + typedef typename iterator_traits<_InputIter>::iterator_category _Category; + return replace(__first, __last, __f, __l, _Category()); + } + + template <class _InputIter> + basic_string& replace(iterator __first, iterator __last, + _InputIter __f, _InputIter __l, input_iterator_tag); + + template <class _ForwardIter> + basic_string& replace(iterator __first, iterator __last, + _ForwardIter __f, _ForwardIter __l, + forward_iterator_tag); + +#endif /* __STL_MEMBER_TEMPLATES */ + +public: // Other modifier member functions. + + size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const { + if (__pos > size()) + _M_throw_out_of_range(); + const size_type __len = min(__n, size() - __pos); + _Traits::copy(__s, _M_start + __pos, __len); + return __len; + } + + void swap(basic_string& __s) { + __STD::swap(_M_start, __s._M_start); + __STD::swap(_M_finish, __s._M_finish); + __STD::swap(_M_end_of_storage, __s._M_end_of_storage); + } + +public: // Conversion to C string. + + const _CharT* c_str() const { return _M_start; } + const _CharT* data() const { return _M_start; } + +public: // find. + + size_type find(const basic_string& __s, size_type __pos = 0) const + { return find(__s.begin(), __pos, __s.size()); } + + size_type find(const _CharT* __s, size_type __pos = 0) const + { return find(__s, __pos, _Traits::length(__s)); } + + size_type find(const _CharT* __s, size_type __pos, size_type __n) const; + size_type find(_CharT __c, size_type __pos = 0) const; + +public: // rfind. + + size_type rfind(const basic_string& __s, size_type __pos = npos) const + { return rfind(__s.begin(), __pos, __s.size()); } + + size_type rfind(const _CharT* __s, size_type __pos = npos) const + { return rfind(__s, __pos, _Traits::length(__s)); } + + size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const; + size_type rfind(_CharT __c, size_type __pos = npos) const; + +public: // find_first_of + + size_type find_first_of(const basic_string& __s, size_type __pos = 0) const + { return find_first_of(__s.begin(), __pos, __s.size()); } + + size_type find_first_of(const _CharT* __s, size_type __pos = 0) const + { return find_first_of(__s, __pos, _Traits::length(__s)); } + + size_type find_first_of(const _CharT* __s, size_type __pos, + size_type __n) const; + + size_type find_first_of(_CharT __c, size_type __pos = 0) const + { return find(__c, __pos); } + +public: // find_last_of + + size_type find_last_of(const basic_string& __s, + size_type __pos = npos) const + { return find_last_of(__s.begin(), __pos, __s.size()); } + + size_type find_last_of(const _CharT* __s, size_type __pos = npos) const + { return find_last_of(__s, __pos, _Traits::length(__s)); } + + size_type find_last_of(const _CharT* __s, size_type __pos, + size_type __n) const; + + size_type find_last_of(_CharT __c, size_type __pos = npos) const { + return rfind(__c, __pos); + } + +public: // find_first_not_of + + size_type find_first_not_of(const basic_string& __s, + size_type __pos = 0) const + { return find_first_not_of(__s.begin(), __pos, __s.size()); } + + size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const + { return find_first_not_of(__s, __pos, _Traits::length(__s)); } + + size_type find_first_not_of(const _CharT* __s, size_type __pos, + size_type __n) const; + + size_type find_first_not_of(_CharT __c, size_type __pos = 0) const; + +public: // find_last_not_of + + size_type find_last_not_of(const basic_string& __s, + size_type __pos = npos) const + { return find_last_not_of(__s.begin(), __pos, __s.size()); } + + size_type find_last_not_of(const _CharT* __s, size_type __pos = npos) const + { return find_last_not_of(__s, __pos, _Traits::length(__s)); } + + size_type find_last_not_of(const _CharT* __s, size_type __pos, + size_type __n) const; + + size_type find_last_not_of(_CharT __c, size_type __pos = npos) const; + +public: // Substring. + + basic_string substr(size_type __pos = 0, size_type __n = npos) const { + if (__pos > size()) + _M_throw_out_of_range(); + return basic_string(_M_start + __pos, + _M_start + __pos + min(__n, size() - __pos)); + } + +public: // Compare + + int compare(const basic_string& __s) const + { return _M_compare(_M_start, _M_finish, __s._M_start, __s._M_finish); } + + int compare(size_type __pos1, size_type __n1, + const basic_string& __s) const { + if (__pos1 > size()) + _M_throw_out_of_range(); + return _M_compare(_M_start + __pos1, + _M_start + __pos1 + min(__n1, size() - __pos1), + __s._M_start, __s._M_finish); + } + + int compare(size_type __pos1, size_type __n1, + const basic_string& __s, + size_type __pos2, size_type __n2) const { + if (__pos1 > size() || __pos2 > __s.size()) + _M_throw_out_of_range(); + return _M_compare(_M_start + __pos1, + _M_start + __pos1 + min(__n1, size() - __pos1), + __s._M_start + __pos2, + __s._M_start + __pos2 + min(__n2, size() - __pos2)); + } + + int compare(const _CharT* __s) const { + return _M_compare(_M_start, _M_finish, __s, __s + _Traits::length(__s)); + } + + int compare(size_type __pos1, size_type __n1, const _CharT* __s) const { + if (__pos1 > size()) + _M_throw_out_of_range(); + return _M_compare(_M_start + __pos1, + _M_start + __pos1 + min(__n1, size() - __pos1), + __s, __s + _Traits::length(__s)); + } + + int compare(size_type __pos1, size_type __n1, const _CharT* __s, + size_type __n2) const { + if (__pos1 > size()) + _M_throw_out_of_range(); + return _M_compare(_M_start + __pos1, + _M_start + __pos1 + min(__n1, size() - __pos1), + __s, __s + __n2); + } + +public: // Helper function for compare. + static int _M_compare(const _CharT* __f1, const _CharT* __l1, + const _CharT* __f2, const _CharT* __l2) { + const ptrdiff_t __n1 = __l1 - __f1; + const ptrdiff_t __n2 = __l2 - __f2; + const int cmp = _Traits::compare(__f1, __f2, min(__n1, __n2)); + return cmp != 0 ? cmp : (__n1 < __n2 ? -1 : (__n1 > __n2 ? 1 : 0)); + } +}; + + + +// ------------------------------------------------------------ +// Non-inline declarations. + +template <class _CharT, class _Traits, class _Alloc> +const basic_string<_CharT,_Traits,_Alloc>::size_type +basic_string<_CharT,_Traits,_Alloc>::npos + = (basic_string<_CharT,_Traits,_Alloc>::size_type) -1; + +// Change the string's capacity so that it is large enough to hold +// at least __res_arg elements, plus the terminating null. Note that, +// if __res_arg < capacity(), this member function may actually decrease +// the string's capacity. +template <class _CharT, class _Traits, class _Alloc> +void basic_string<_CharT,_Traits,_Alloc>::reserve(size_type __res_arg) { + if (__res_arg > max_size()) + _M_throw_length_error(); + + size_type __n = max(__res_arg, size()) + 1; + pointer __new_start = _M_allocate(__n); + pointer __new_finish = __new_start; + + __STL_TRY { + __new_finish = uninitialized_copy(_M_start, _M_finish, __new_start); + _M_construct_null(__new_finish); + } + __STL_UNWIND((destroy(__new_start, __new_finish), + _M_deallocate(__new_start, __n))); + + destroy(_M_start, _M_finish + 1); + _M_deallocate_block(); + _M_start = __new_start; + _M_finish = __new_finish; + _M_end_of_storage = __new_start + __n; +} + +template <class _CharT, class _Traits, class _Alloc> +basic_string<_CharT,_Traits,_Alloc>& +basic_string<_CharT,_Traits,_Alloc>::append(size_type __n, _CharT __c) { + if (__n > max_size() || size() > max_size() - __n) + _M_throw_length_error(); + if (size() + __n > capacity()) + reserve(size() + max(size(), __n)); + if (__n > 0) { + uninitialized_fill_n(_M_finish + 1, __n - 1, __c); + __STL_TRY { + _M_construct_null(_M_finish + __n); + } + __STL_UNWIND(destroy(_M_finish + 1, _M_finish + __n)); + _Traits::assign(*_M_finish, __c); + _M_finish += __n; + } + return *this; +} + +#ifdef __STL_MEMBER_TEMPLATES + +template <class _Tp, class _Traits, class _Alloc> +template <class _InputIterator> +basic_string<_Tp, _Traits, _Alloc>& +basic_string<_Tp, _Traits, _Alloc>::append(_InputIterator __first, + _InputIterator __last, + input_iterator_tag) { + for ( ; __first != __last ; ++__first) + push_back(*__first); + return *this; +} + +template <class _Tp, class _Traits, class _Alloc> +template <class _ForwardIter> +basic_string<_Tp, _Traits, _Alloc>& +basic_string<_Tp, _Traits, _Alloc>::append(_ForwardIter __first, + _ForwardIter __last, + forward_iterator_tag) { + if (__first != __last) { + const size_type __old_size = size(); + difference_type __n = 0; + distance(__first, __last, __n); + if (static_cast<size_type>(__n) > max_size() || + __old_size > max_size() - static_cast<size_type>(__n)) + _M_throw_length_error(); + if (__old_size + static_cast<size_type>(__n) > capacity()) { + const size_type __len = __old_size + + max(__old_size, static_cast<size_type>(__n)) + 1; + pointer __new_start = _M_allocate(__len); + pointer __new_finish = __new_start; + __STL_TRY { + __new_finish = uninitialized_copy(_M_start, _M_finish, __new_start); + __new_finish = uninitialized_copy(__first, __last, __new_finish); + _M_construct_null(__new_finish); + } + __STL_UNWIND((destroy(__new_start,__new_finish), + _M_deallocate(__new_start,__len))); + destroy(_M_start, _M_finish + 1); + _M_deallocate_block(); + _M_start = __new_start; + _M_finish = __new_finish; + _M_end_of_storage = __new_start + __len; + } + else { + _ForwardIter __f1 = __first; + ++__f1; + uninitialized_copy(__f1, __last, _M_finish + 1); + __STL_TRY { + _M_construct_null(_M_finish + __n); + } + __STL_UNWIND(destroy(_M_finish + 1, _M_finish + __n)); + _Traits::assign(*_M_finish, *__first); + _M_finish += __n; + } + } + return *this; +} + +#else /* __STL_MEMBER_TEMPLATES */ + +template <class _Tp, class _Traits, class _Alloc> +basic_string<_Tp, _Traits, _Alloc>& +basic_string<_Tp, _Traits, _Alloc>::append(const _Tp* __first, + const _Tp* __last) +{ + if (__first != __last) { + const size_type __old_size = size(); + ptrdiff_t __n = __last - __first; + if (__n > max_size() || __old_size > max_size() - __n) + _M_throw_length_error(); + if (__old_size + __n > capacity()) { + const size_type __len = __old_size + max(__old_size, (size_t) __n) + 1; + pointer __new_start = _M_allocate(__len); + pointer __new_finish = __new_start; + __STL_TRY { + __new_finish = uninitialized_copy(_M_start, _M_finish, __new_start); + __new_finish = uninitialized_copy(__first, __last, __new_finish); + _M_construct_null(__new_finish); + } + __STL_UNWIND((destroy(__new_start,__new_finish), + _M_deallocate(__new_start,__len))); + destroy(_M_start, _M_finish + 1); + _M_deallocate_block(); + _M_start = __new_start; + _M_finish = __new_finish; + _M_end_of_storage = __new_start + __len; + } + else { + const _Tp* __f1 = __first; + ++__f1; + uninitialized_copy(__f1, __last, _M_finish + 1); + __STL_TRY { + _M_construct_null(_M_finish + __n); + } + __STL_UNWIND(destroy(_M_finish + 1, _M_finish + __n)); + _Traits::assign(*_M_finish, *__first); + _M_finish += __n; + } + } + return *this; +} + +#endif /* __STL_MEMBER_TEMPLATES */ + +template <class _CharT, class _Traits, class _Alloc> +basic_string<_CharT,_Traits,_Alloc>& +basic_string<_CharT,_Traits,_Alloc>::assign(size_type __n, _CharT __c) { + if (__n <= size()) { + _Traits::assign(_M_start, __n, __c); + erase(_M_start + __n, _M_finish); + } + else { + _Traits::assign(_M_start, size(), __c); + append(__n - size(), __c); + } + return *this; +} + +#ifdef __STL_MEMBER_TEMPLATES + +template <class _CharT, class _Traits, class _Alloc> +template <class _InputIter> +basic_string<_CharT,_Traits,_Alloc>& basic_string<_CharT,_Traits,_Alloc> + ::_M_assign_dispatch(_InputIter __f, _InputIter __l, __false_type) +{ + pointer __cur = _M_start; + while (__f != __l && __cur != _M_finish) { + _Traits::assign(*__cur, *__f); + ++__f; + ++__cur; + } + if (__f == __l) + erase(__cur, _M_finish); + else + append(__f, __l); + return *this; +} + +#endif /* __STL_MEMBER_TEMPLATES */ + +template <class _CharT, class _Traits, class _Alloc> +basic_string<_CharT,_Traits,_Alloc>& +basic_string<_CharT,_Traits,_Alloc>::assign(const _CharT* __f, + const _CharT* __l) +{ + const ptrdiff_t __n = __l - __f; + if (static_cast<size_type>(__n) <= size()) { + _Traits::copy(_M_start, __f, __n); + erase(_M_start + __n, _M_finish); + } + else { + _Traits::copy(_M_start, __f, size()); + append(__f + size(), __l); + } + return *this; +} + +template <class _CharT, class _Traits, class _Alloc> +basic_string<_CharT,_Traits,_Alloc>::iterator +basic_string<_CharT,_Traits,_Alloc> + ::_M_insert_aux(basic_string<_CharT,_Traits,_Alloc>::iterator __p, + _CharT __c) +{ + iterator __new_pos = __p; + if (_M_finish + 1 < _M_end_of_storage) { + _M_construct_null(_M_finish + 1); + _Traits::move(__p + 1, __p, _M_finish - __p); + _Traits::assign(*__p, __c); + ++_M_finish; + } + else { + const size_type __old_len = size(); + const size_type __len = __old_len + + max(__old_len, static_cast<size_type>(1)) + 1; + iterator __new_start = _M_allocate(__len); + iterator __new_finish = __new_start; + __STL_TRY { + __new_pos = uninitialized_copy(_M_start, __p, __new_start); + construct(__new_pos, __c); + __new_finish = __new_pos + 1; + __new_finish = uninitialized_copy(__p, _M_finish, __new_finish); + _M_construct_null(__new_finish); + } + __STL_UNWIND((destroy(__new_start,__new_finish), + _M_deallocate(__new_start,__len))); + destroy(_M_start, _M_finish + 1); + _M_deallocate_block(); + _M_start = __new_start; + _M_finish = __new_finish; + _M_end_of_storage = __new_start + __len; + } + return __new_pos; +} + +template <class _CharT, class _Traits, class _Alloc> +void basic_string<_CharT,_Traits,_Alloc> + ::insert(basic_string<_CharT,_Traits,_Alloc>::iterator __position, + size_t __n, _CharT __c) +{ + if (__n != 0) { + if (size_type(_M_end_of_storage - _M_finish) >= __n + 1) { + const size_type __elems_after = _M_finish - __position; + iterator __old_finish = _M_finish; + if (__elems_after >= __n) { + uninitialized_copy((_M_finish - __n) + 1, _M_finish + 1, + _M_finish + 1); + _M_finish += __n; + _Traits::move(__position + __n, + __position, (__elems_after - __n) + 1); + _Traits::assign(__position, __n, __c); + } + else { + uninitialized_fill_n(_M_finish + 1, __n - __elems_after - 1, __c); + _M_finish += __n - __elems_after; + __STL_TRY { + uninitialized_copy(__position, __old_finish + 1, _M_finish); + _M_finish += __elems_after; + } + __STL_UNWIND((destroy(__old_finish + 1, _M_finish), + _M_finish = __old_finish)); + _Traits::assign(__position, __elems_after + 1, __c); + } + } + else { + const size_type __old_size = size(); + const size_type __len = __old_size + max(__old_size, __n) + 1; + iterator __new_start = _M_allocate(__len); + iterator __new_finish = __new_start; + __STL_TRY { + __new_finish = uninitialized_copy(_M_start, __position, __new_start); + __new_finish = uninitialized_fill_n(__new_finish, __n, __c); + __new_finish = uninitialized_copy(__position, _M_finish, + __new_finish); + _M_construct_null(__new_finish); + } + __STL_UNWIND((destroy(__new_start,__new_finish), + _M_deallocate(__new_start,__len))); + destroy(_M_start, _M_finish + 1); + _M_deallocate_block(); + _M_start = __new_start; + _M_finish = __new_finish; + _M_end_of_storage = __new_start + __len; + } + } +} + +#ifdef __STL_MEMBER_TEMPLATES + +template <class _Tp, class _Traits, class _Alloc> +template <class _InputIter> +void basic_string<_Tp, _Traits, _Alloc>::insert(iterator __p, + _InputIter __first, + _InputIter __last, + input_iterator_tag) +{ + for ( ; __first != __last; ++__first) { + __p = insert(__p, *__first); + ++__p; + } +} + +template <class _CharT, class _Traits, class _Alloc> +template <class _ForwardIter> +void +basic_string<_CharT,_Traits,_Alloc>::insert(iterator __position, + _ForwardIter __first, + _ForwardIter __last, + forward_iterator_tag) +{ + if (__first != __last) { + difference_type __n = 0; + distance(__first, __last, __n); + if (_M_end_of_storage - _M_finish >= __n + 1) { + const difference_type __elems_after = _M_finish - __position; + iterator __old_finish = _M_finish; + if (__elems_after >= __n) { + uninitialized_copy((_M_finish - __n) + 1, _M_finish + 1, + _M_finish + 1); + _M_finish += __n; + _Traits::move(__position + __n, + __position, (__elems_after - __n) + 1); + _M_copy(__first, __last, __position); + } + else { + _ForwardIter __mid = __first; + advance(__mid, __elems_after + 1); + uninitialized_copy(__mid, __last, _M_finish + 1); + _M_finish += __n - __elems_after; + __STL_TRY { + uninitialized_copy(__position, __old_finish + 1, _M_finish); + _M_finish += __elems_after; + } + __STL_UNWIND((destroy(__old_finish + 1, _M_finish), + _M_finish = __old_finish)); + _M_copy(__first, __mid, __position); + } + } + else { + const size_type __old_size = size(); + const size_type __len + = __old_size + max(__old_size, static_cast<size_type>(__n)) + 1; + pointer __new_start = _M_allocate(__len); + pointer __new_finish = __new_start; + __STL_TRY { + __new_finish = uninitialized_copy(_M_start, __position, __new_start); + __new_finish = uninitialized_copy(__first, __last, __new_finish); + __new_finish + = uninitialized_copy(__position, _M_finish, __new_finish); + _M_construct_null(__new_finish); + } + __STL_UNWIND((destroy(__new_start,__new_finish), + _M_deallocate(__new_start,__len))); + destroy(_M_start, _M_finish + 1); + _M_deallocate_block(); + _M_start = __new_start; + _M_finish = __new_finish; + _M_end_of_storage = __new_start + __len; + } + } +} + +#else /* __STL_MEMBER_TEMPLATES */ + +template <class _CharT, class _Traits, class _Alloc> +void +basic_string<_CharT,_Traits,_Alloc>::insert(iterator __position, + const _CharT* __first, + const _CharT* __last) +{ + if (__first != __last) { + const ptrdiff_t __n = __last - __first; + if (_M_end_of_storage - _M_finish >= __n + 1) { + const ptrdiff_t __elems_after = _M_finish - __position; + iterator __old_finish = _M_finish; + if (__elems_after >= __n) { + uninitialized_copy((_M_finish - __n) + 1, _M_finish + 1, + _M_finish + 1); + _M_finish += __n; + _Traits::move(__position + __n, + __position, (__elems_after - __n) + 1); + _M_copy(__first, __last, __position); + } + else { + const _CharT* __mid = __first; + advance(__mid, __elems_after + 1); + uninitialized_copy(__mid, __last, _M_finish + 1); + _M_finish += __n - __elems_after; + __STL_TRY { + uninitialized_copy(__position, __old_finish + 1, _M_finish); + _M_finish += __elems_after; + } + __STL_UNWIND((destroy(__old_finish + 1, _M_finish), + _M_finish = __old_finish)); + _M_copy(__first, __mid, __position); + } + } + else { + const size_type __old_size = size(); + const size_type __len + = __old_size + max(__old_size, static_cast<size_type>(__n)) + 1; + pointer __new_start = _M_allocate(__len); + pointer __new_finish = __new_start; + __STL_TRY { + __new_finish = uninitialized_copy(_M_start, __position, __new_start); + __new_finish = uninitialized_copy(__first, __last, __new_finish); + __new_finish + = uninitialized_copy(__position, _M_finish, __new_finish); + _M_construct_null(__new_finish); + } + __STL_UNWIND((destroy(__new_start,__new_finish), + _M_deallocate(__new_start,__len))); + destroy(_M_start, _M_finish + 1); + _M_deallocate_block(); + _M_start = __new_start; + _M_finish = __new_finish; + _M_end_of_storage = __new_start + __len; + } + } +} + +#endif /* __STL_MEMBER_TEMPLATES */ + +template <class _CharT, class _Traits, class _Alloc> +basic_string<_CharT,_Traits,_Alloc>& +basic_string<_CharT,_Traits,_Alloc> + ::replace(iterator __first, iterator __last, size_type __n, _CharT __c) +{ + const size_type __len = static_cast<size_type>(__last - __first); + if (__len >= __n) { + _Traits::assign(__first, __n, __c); + erase(__first + __n, __last); + } + else { + _Traits::assign(__first, __len, __c); + insert(__last, __n - __len, __c); + } + return *this; +} + +#ifdef __STL_MEMBER_TEMPLATES + +template <class _CharT, class _Traits, class _Alloc> +template <class _InputIter> +basic_string<_CharT,_Traits,_Alloc>& +basic_string<_CharT,_Traits,_Alloc> + ::replace(iterator __first, iterator __last, _InputIter __f, _InputIter __l, + input_iterator_tag) +{ + for ( ; __first != __last && __f != __l; ++__first, ++__f) + _Traits::assign(*__first, *__f); + + if (__f == __l) + erase(__first, __last); + else + insert(__last, __f, __l); + return *this; +} + +template <class _CharT, class _Traits, class _Alloc> +template <class _ForwardIter> +basic_string<_CharT,_Traits,_Alloc>& +basic_string<_CharT,_Traits,_Alloc> + ::replace(iterator __first, iterator __last, + _ForwardIter __f, _ForwardIter __l, + forward_iterator_tag) +{ + difference_type __n = 0; + distance(__f, __l, __n); + const difference_type __len = __last - __first; + if (__len >= __n) { + _M_copy(__f, __l, __first); + erase(__first + __n, __last); + } + else { + _ForwardIter __m = __f; + advance(__m, __len); + _M_copy(__f, __m, __first); + insert(__last, __m, __l); + } + return *this; +} + +#else /* __STL_MEMBER_TEMPLATES */ + +template <class _CharT, class _Traits, class _Alloc> +basic_string<_CharT,_Traits,_Alloc>& +basic_string<_CharT,_Traits,_Alloc> + ::replace(iterator __first, iterator __last, + const _CharT* __f, const _CharT* __l) +{ + const ptrdiff_t __n = __l - __f; + const difference_type __len = __last - __first; + if (__len >= __n) { + _M_copy(__f, __l, __first); + erase(__first + __n, __last); + } + else { + const _CharT* __m = __f + __len; + _M_copy(__f, __m, __first); + insert(__last, __m, __l); + } + return *this; +} + +#endif /* __STL_MEMBER_TEMPLATES */ + +template <class _CharT, class _Traits, class _Alloc> +basic_string<_CharT,_Traits,_Alloc>::size_type +basic_string<_CharT,_Traits,_Alloc> + ::find(const _CharT* __s, size_type __pos, size_type __n) const +{ + if (__pos + __n > size()) + return npos; + else { + const const_iterator __result = + search(_M_start + __pos, _M_finish, + __s, __s + __n, _Eq_traits<_Traits>()); + return __result != _M_finish ? __result - begin() : npos; + } +} + +template <class _CharT, class _Traits, class _Alloc> +basic_string<_CharT,_Traits,_Alloc>::size_type +basic_string<_CharT,_Traits,_Alloc> + ::find(_CharT __c, size_type __pos) const +{ + if (__pos >= size()) + return npos; + else { + const const_iterator __result = + find_if(_M_start + __pos, _M_finish, + bind2nd(_Eq_traits<_Traits>(), __c)); + return __result != _M_finish ? __result - begin() : npos; + } +} + +template <class _CharT, class _Traits, class _Alloc> +basic_string<_CharT,_Traits,_Alloc>::size_type +basic_string<_CharT,_Traits,_Alloc> + ::rfind(const _CharT* __s, size_type __pos, size_type __n) const +{ + const size_t __len = size(); + + if (__n > __len) + return npos; + else if (__n == 0) + return min(__len, __pos); + else { + const const_iterator __last = begin() + min(__len - __n, __pos) + __n; + const const_iterator __result = find_end(begin(), __last, + __s, __s + __n, + _Eq_traits<_Traits>()); + return __result != __last ? __result - begin() : npos; + } +} + +template <class _CharT, class _Traits, class _Alloc> +basic_string<_CharT,_Traits,_Alloc>::size_type +basic_string<_CharT,_Traits,_Alloc> + ::rfind(_CharT __c, size_type __pos) const +{ + const size_type __len = size(); + + if (__len < 1) + return npos; + else { + const const_iterator __last = begin() + min(__len - 1, __pos) + 1; + const_reverse_iterator __rresult = + find_if(const_reverse_iterator(__last), rend(), + bind2nd(_Eq_traits<_Traits>(), __c)); + return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos; + } +} + +template <class _CharT, class _Traits, class _Alloc> +basic_string<_CharT,_Traits,_Alloc>::size_type +basic_string<_CharT,_Traits,_Alloc> + ::find_first_of(const _CharT* __s, size_type __pos, size_type __n) const +{ + if (__pos >= size()) + return npos; + else { + const_iterator __result = __STD::find_first_of(begin() + __pos, end(), + __s, __s + __n, + _Eq_traits<_Traits>()); + return __result != _M_finish ? __result - begin() : npos; + } +} + + +template <class _CharT, class _Traits, class _Alloc> +basic_string<_CharT,_Traits,_Alloc>::size_type +basic_string<_CharT,_Traits,_Alloc> + ::find_last_of(const _CharT* __s, size_type __pos, size_type __n) const +{ + const size_type __len = size(); + + if (__len < 1) + return npos; + else { + const const_iterator __last = _M_start + min(__len - 1, __pos) + 1; + const const_reverse_iterator __rresult = + __STD::find_first_of(const_reverse_iterator(__last), rend(), + __s, __s + __n, + _Eq_traits<_Traits>()); + return __rresult != rend() ? (__rresult.base() - 1) - _M_start : npos; + } +} + + +template <class _CharT, class _Traits, class _Alloc> +basic_string<_CharT,_Traits,_Alloc>::size_type +basic_string<_CharT,_Traits,_Alloc> + ::find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const +{ + if (__pos > size()) + return npos; + else { + const_iterator __result = find_if(_M_start + __pos, _M_finish, + _Not_within_traits<_Traits>(__s, __s + __n)); + return __result != _M_finish ? __result - _M_start : npos; + } +} + +template <class _CharT, class _Traits, class _Alloc> +basic_string<_CharT,_Traits,_Alloc>::size_type +basic_string<_CharT,_Traits,_Alloc> + ::find_first_not_of(_CharT __c, size_type __pos) const +{ + if (__pos > size()) + return npos; + else { + const_iterator __result + = find_if(begin() + __pos, end(), + not1(bind2nd(_Eq_traits<_Traits>(), __c))); + return __result != _M_finish ? __result - begin() : npos; + } +} + +template <class _CharT, class _Traits, class _Alloc> +basic_string<_CharT,_Traits,_Alloc>::size_type +basic_string<_CharT,_Traits,_Alloc> + ::find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const +{ + + const size_type __len = size(); + + if (__len < 1) + return npos; + else { + const const_iterator __last = begin() + min(__len - 1, __pos) + 1; + const const_reverse_iterator __rresult = + find_if(const_reverse_iterator(__last), rend(), + _Not_within_traits<_Traits>(__s, __s + __n)); + return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos; + } +} + +template <class _Tp, class _Traits, class _Alloc> +basic_string<_Tp, _Traits, _Alloc>::size_type +basic_string<_Tp, _Traits, _Alloc> + ::find_last_not_of(_Tp __c, size_type __pos) const +{ + const size_type __len = size(); + + if (__len < 1) + return npos; + else { + const const_iterator __last = begin() + min(__len - 1, __pos) + 1; + const_reverse_iterator __rresult = + find_if(const_reverse_iterator(__last), rend(), + not1(bind2nd(_Eq_traits<_Traits>(), __c))); + return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos; + } +} + +// ------------------------------------------------------------ +// Non-member functions. + +// Operator+ + +template <class _CharT, class _Traits, class _Alloc> +inline basic_string<_CharT,_Traits,_Alloc> +operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, + const basic_string<_CharT,_Traits,_Alloc>& __y) +{ + typedef basic_string<_CharT,_Traits,_Alloc> _Str; + typedef typename _Str::_Reserve_t _Reserve_t; + _Reserve_t __reserve; + _Str __result(__reserve, __x.size() + __y.size(), __x.get_allocator()); + __result.append(__x); + __result.append(__y); + return __result; +} + +template <class _CharT, class _Traits, class _Alloc> +inline basic_string<_CharT,_Traits,_Alloc> +operator+(const _CharT* __s, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + typedef basic_string<_CharT,_Traits,_Alloc> _Str; + typedef typename _Str::_Reserve_t _Reserve_t; + _Reserve_t __reserve; + const size_t __n = _Traits::length(__s); + _Str __result(__reserve, __n + __y.size()); + __result.append(__s, __s + __n); + __result.append(__y); + return __result; +} + +template <class _CharT, class _Traits, class _Alloc> +inline basic_string<_CharT,_Traits,_Alloc> +operator+(_CharT __c, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + typedef basic_string<_CharT,_Traits,_Alloc> _Str; + typedef typename _Str::_Reserve_t _Reserve_t; + _Reserve_t __reserve; + _Str __result(__reserve, 1 + __y.size()); + __result.push_back(__c); + __result.append(__y); + return __result; +} + +template <class _CharT, class _Traits, class _Alloc> +inline basic_string<_CharT,_Traits,_Alloc> +operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, + const _CharT* __s) { + typedef basic_string<_CharT,_Traits,_Alloc> _Str; + typedef typename _Str::_Reserve_t _Reserve_t; + _Reserve_t __reserve; + const size_t __n = _Traits::length(__s); + _Str __result(__reserve, __x.size() + __n, __x.get_allocator()); + __result.append(__x); + __result.append(__s, __s + __n); + return __result; +} + +template <class _CharT, class _Traits, class _Alloc> +inline basic_string<_CharT,_Traits,_Alloc> +operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, + const _CharT __c) { + typedef basic_string<_CharT,_Traits,_Alloc> _Str; + typedef typename _Str::_Reserve_t _Reserve_t; + _Reserve_t __reserve; + _Str __result(__reserve, __x.size() + 1, __x.get_allocator()); + __result.append(__x); + __result.push_back(__c); + return __result; +} + +// Operator== and operator!= + +template <class _CharT, class _Traits, class _Alloc> +inline bool +operator==(const basic_string<_CharT,_Traits,_Alloc>& __x, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + return __x.size() == __y.size() && + _Traits::compare(__x.data(), __y.data(), __x.size()) == 0; +} + +template <class _CharT, class _Traits, class _Alloc> +inline bool +operator==(const _CharT* __s, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + size_t __n = _Traits::length(__s); + return __n == __y.size() && _Traits::compare(__s, __y.data(), __n) == 0; +} + +template <class _CharT, class _Traits, class _Alloc> +inline bool +operator==(const basic_string<_CharT,_Traits,_Alloc>& __x, + const _CharT* __s) { + size_t __n = _Traits::length(__s); + return __x.size() == __n && _Traits::compare(__x.data(), __s, __n) == 0; +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _CharT, class _Traits, class _Alloc> +inline bool +operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + return !(__x == __y); +} + +template <class _CharT, class _Traits, class _Alloc> +inline bool +operator!=(const _CharT* __s, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + return !(__s == __y); +} + +template <class _CharT, class _Traits, class _Alloc> +inline bool +operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x, + const _CharT* __s) { + return !(__x == __s); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +// Operator< (and also >, <=, and >=). + +template <class _CharT, class _Traits, class _Alloc> +inline bool +operator<(const basic_string<_CharT,_Traits,_Alloc>& __x, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + return basic_string<_CharT,_Traits,_Alloc> + ::_M_compare(__x.begin(), __x.end(), __y.begin(), __y.end()) < 0; +} + +template <class _CharT, class _Traits, class _Alloc> +inline bool +operator<(const _CharT* __s, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + size_t __n = _Traits::length(__s); + return basic_string<_CharT,_Traits,_Alloc> + ::_M_compare(__s, __s + __n, __y.begin(), __y.end()) < 0; +} + +template <class _CharT, class _Traits, class _Alloc> +inline bool +operator<(const basic_string<_CharT,_Traits,_Alloc>& __x, + const _CharT* __s) { + size_t __n = _Traits::length(__s); + return basic_string<_CharT,_Traits,_Alloc> + ::_M_compare(__x.begin(), __x.end(), __s, __s + __n) < 0; +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _CharT, class _Traits, class _Alloc> +inline bool +operator>(const basic_string<_CharT,_Traits,_Alloc>& __x, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + return __y < __x; +} + +template <class _CharT, class _Traits, class _Alloc> +inline bool +operator>(const _CharT* __s, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + return __y < __s; +} + +template <class _CharT, class _Traits, class _Alloc> +inline bool +operator>(const basic_string<_CharT,_Traits,_Alloc>& __x, + const _CharT* __s) { + return __s < __x; +} + +template <class _CharT, class _Traits, class _Alloc> +inline bool +operator<=(const basic_string<_CharT,_Traits,_Alloc>& __x, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + return !(__y < __x); +} + +template <class _CharT, class _Traits, class _Alloc> +inline bool +operator<=(const _CharT* __s, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + return !(__y < __s); +} + +template <class _CharT, class _Traits, class _Alloc> +inline bool +operator<=(const basic_string<_CharT,_Traits,_Alloc>& __x, + const _CharT* __s) { + return !(__s < __x); +} + +template <class _CharT, class _Traits, class _Alloc> +inline bool +operator>=(const basic_string<_CharT,_Traits,_Alloc>& __x, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + return !(__x < __y); +} + +template <class _CharT, class _Traits, class _Alloc> +inline bool +operator>=(const _CharT* __s, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + return !(__s < __y); +} + +template <class _CharT, class _Traits, class _Alloc> +inline bool +operator>=(const basic_string<_CharT,_Traits,_Alloc>& __x, + const _CharT* __s) { + return !(__x < __s); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +// Swap. + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _CharT, class _Traits, class _Alloc> +inline void swap(basic_string<_CharT,_Traits,_Alloc>& __x, + basic_string<_CharT,_Traits,_Alloc>& __y) { + __x.swap(__y); +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +// I/O. + +#ifndef __STL_USE_NEW_IOSTREAMS +__STL_END_NAMESPACE +#include <iostream.h> +__STL_BEGIN_NAMESPACE +#endif /* __STL_USE_NEW_IOSTREAMS */ + +#ifdef __STL_USE_NEW_IOSTREAMS + +template <class _CharT, class _Traits> +inline bool +__sgi_string_fill(basic_ostream<_CharT, _Traits>& __os, + basic_streambuf<_CharT, _Traits>* __buf, + size_t __n) +{ + _CharT __f = __os.fill(); + size_t __i; + bool __ok = true; + + for (__i = 0; __i < __n; __i++) + __ok = __ok && !_Traits::eq_int_type(__buf->sputc(__f), _Traits::eof()); + return __ok; +} + +template <class _CharT, class _Traits, class _Alloc> +basic_ostream<_CharT, _Traits>& +operator<<(basic_ostream<_CharT, _Traits>& __os, + const basic_string<_CharT,_Traits,_Alloc>& __s) +{ + typename basic_ostream<_CharT, _Traits>::sentry __sentry(__os); + bool __ok = false; + + if (__sentry) { + __ok = true; + size_t __n = __s.size(); + size_t __pad_len = 0; + const bool __left = (__os.flags() & ios::left) != 0; + const size_t __w = __os.width(0); + basic_streambuf<_CharT, _Traits>* __buf = __os.rdbuf(); + + if (__w != 0 && __n < __w) + __pad_len = __w - __n; + + if (!__left) + __ok = __sgi_string_fill(__os, __buf, __pad_len); + + __ok = __ok && + __buf->sputn(__s.data(), streamsize(__n)) == streamsize(__n); + + if (__left) + __ok = __ok && __sgi_string_fill(__os, __buf, __pad_len); + } + + if (!__ok) + __os.setstate(ios_base::failbit); + + return __os; +} + +template <class _CharT, class _Traits, class _Alloc> +basic_istream<_CharT, _Traits>& +operator>>(basic_istream<_CharT, _Traits>& __is, + basic_string<_CharT,_Traits,_Alloc>& __s) +{ + typename basic_istream<_CharT, _Traits>::sentry __sentry(__is); + + if (__sentry) { + basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf(); + const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__is.getloc()); + + __s.clear(); + size_t __n = __is.width(0); + if (__n == 0) + __n = static_cast<size_t>(-1); + else + __s.reserve(__n); + + + while (__n-- > 0) { + typename _Traits::int_type __c1 = __buf->sbumpc(); + if (_Traits::eq_int_type(__c1, _Traits::eof())) { + __is.setstate(ios_base::eofbit); + break; + } + else { + _CharT __c = _Traits::to_char_type(__c1); + + if (__ctype.is(ctype<_CharT>::space, __c)) { + if (_Traits::eq_int_type(__buf->sputbackc(__c), _Traits::eof())) + __is.setstate(ios_base::failbit); + break; + } + else + __s.push_back(__c); + } + } + + // If we have read no characters, then set failbit. + if (__s.size() == 0) + __is.setstate(ios_base::failbit); + } + else + __is.setstate(ios_base::failbit); + + return __is; +} + +template <class _CharT, class _Traits, class _Alloc> +basic_istream<_CharT, _Traits>& +getline(istream& __is, + basic_string<_CharT,_Traits,_Alloc>& __s, + _CharT __delim) +{ + size_t __nread = 0; + typename basic_istream<_CharT, _Traits>::sentry __sentry(__is, true); + if (__sentry) { + basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf(); + __s.clear(); + + int __c1; + while (__nread < __s.max_size()) { + int __c1 = __buf->sbumpc(); + if (_Traits::eq_int_type(__c1, _Traits::eof())) { + __is.setstate(ios_base::eofbit); + break; + } + else { + ++__nread; + _CharT __c = _Traits::to_char_type(__c1); + if (!_Traits::eq(__c, __delim)) + __s.push_back(__c); + else + break; // Character is extracted but not appended. + } + } + } + if (__nread == 0 || __nread >= __s.max_size()) + __is.setstate(ios_base::failbit); + + return __is; +} + +template <class _CharT, class _Traits, class _Alloc> +inline basic_istream<_CharT, _Traits>& +getline(basic_istream<_CharT, _Traits>& __is, + basic_string<_CharT,_Traits,_Alloc>& __s) +{ + return getline(__is, __s, '\n'); +} + +#else /* __STL_USE_NEW_IOSTREAMS */ + +inline void __sgi_string_fill(ostream& __os, streambuf* __buf, size_t __n) +{ + char __f = __os.fill(); + size_t __i; + + for (__i = 0; __i < __n; __i++) __buf->sputc(__f); +} + +template <class _CharT, class _Traits, class _Alloc> +ostream& operator<<(ostream& __os, + const basic_string<_CharT,_Traits,_Alloc>& __s) +{ + streambuf* __buf = __os.rdbuf(); + if (__buf) { + size_t __n = __s.size(); + size_t __pad_len = 0; + const bool __left = (__os.flags() & ios::left) != 0; + const size_t __w = __os.width(); + + if (__w > 0) { + __n = min(__w, __n); + __pad_len = __w - __n; + } + + if (!__left) + __sgi_string_fill(__os, __buf, __pad_len); + + const size_t __nwritten = __buf->sputn(__s.data(), __n); + + if (__left) + __sgi_string_fill(__os, __buf, __pad_len); + + if (__nwritten != __n) + __os.clear(__os.rdstate() | ios::failbit); + + __os.width(0); + } + else + __os.clear(__os.rdstate() | ios::badbit); + + return __os; +} + +template <class _CharT, class _Traits, class _Alloc> +istream& operator>>(istream& __is, basic_string<_CharT,_Traits,_Alloc>& __s) +{ + if (!__is) + return __is; + + streambuf* __buf = __is.rdbuf(); + if (__buf) { + +#ifdef __USLC__ +/* Jochen Schlick '1999 - operator >> modified. Work-around to get the + * output buffer flushed (necessary when using + * "cout" (without endl or flushing) followed by + * "cin >>" ...) + */ + if (__is.flags() & ios::skipws) { + _CharT __c; + do + __is.get(__c); + while (__is && isspace(__c)); + if (__is) + __is.putback(__c); + } +#else + if (__is.flags() & ios::skipws) { + int __c; + do { + __c = __buf->sbumpc(); + } + while (__c != EOF && isspace((unsigned char)__c)); + + if (__c == EOF) { + __is.clear(__is.rdstate() | ios::eofbit | ios::failbit); + } + else { + if (__buf->sputbackc(__c) == EOF) + __is.clear(__is.rdstate() | ios::failbit); + } + } +#endif + + // If we arrive at end of file (or fail for some other reason) while + // still discarding whitespace, then we don't try to read the string. + if (__is) { + __s.clear(); + + size_t __n = __is.width(); + if (__n == 0) + __n = static_cast<size_t>(-1); + else + __s.reserve(__n); + + while (__n-- > 0) { + int __c1 = __buf->sbumpc(); + if (__c1 == EOF) { + __is.clear(__is.rdstate() | ios::eofbit); + break; + } + else { + _CharT __c = _Traits::to_char_type(__c1); + + if (isspace((unsigned char) __c)) { + if (__buf->sputbackc(__c) == EOF) + __is.clear(__is.rdstate() | ios::failbit); + break; + } + else + __s.push_back(__c); + } + } + + // If we have read no characters, then set failbit. + if (__s.size() == 0) + __is.clear(__is.rdstate() | ios::failbit); + } + + __is.width(0); + } + else // We have no streambuf. + __is.clear(__is.rdstate() | ios::badbit); + + return __is; +} + +template <class _CharT, class _Traits, class _Alloc> +istream& getline(istream& __is, + basic_string<_CharT,_Traits,_Alloc>& __s, + _CharT __delim) +{ + streambuf* __buf = __is.rdbuf(); + if (__buf) { + size_t __nread = 0; + if (__is) { + __s.clear(); + + while (__nread < __s.max_size()) { + int __c1 = __buf->sbumpc(); + if (__c1 == EOF) { + __is.clear(__is.rdstate() | ios::eofbit); + break; + } + else { + ++__nread; + _CharT __c = _Traits::to_char_type(__c1); + if (!_Traits::eq(__c, __delim)) + __s.push_back(__c); + else + break; // Character is extracted but not appended. + } + } + } + + if (__nread == 0 || __nread >= __s.max_size()) + __is.clear(__is.rdstate() | ios::failbit); + } + else + __is.clear(__is.rdstate() | ios::badbit); + + return __is; +} + +template <class _CharT, class _Traits, class _Alloc> +inline istream& +getline(istream& __is, basic_string<_CharT,_Traits,_Alloc>& __s) +{ + return getline(__is, __s, '\n'); +} + +#endif /* __STL_USE_NEW_IOSTREAMS */ + +template <class _CharT, class _Traits, class _Alloc> +void _S_string_copy(const basic_string<_CharT,_Traits,_Alloc>& __s, + _CharT* __buf, + size_t __n) +{ + if (__n > 0) { + __n = min(__n - 1, __s.size()); + copy(__s.begin(), __s.begin() + __n, __buf); + _Traits::assign(__buf[__n], + basic_string<_CharT,_Traits,_Alloc>::_M_null()); + } +} + +inline const char* __get_c_string(const string& __s) { return __s.c_str(); } + +// ------------------------------------------------------------ +// Typedefs + +#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) +#pragma reset woff 1174 +#pragma reset woff 1375 +#endif + +__STL_END_NAMESPACE + +#include <stl_hash_fun.h> + +__STL_BEGIN_NAMESPACE + +template <class _CharT, class _Traits, class _Alloc> +size_t __stl_string_hash(const basic_string<_CharT,_Traits,_Alloc>& __s) { + unsigned long __h = 0; + for (basic_string<_CharT,_Traits,_Alloc>::const_iterator __i = __s.begin(); + __i != __s.end(); + ++__i) + __h = 5*__h + *__i; + return size_t(__h); +} + +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + +template <class _CharT, class _Traits, class _Alloc> +struct hash<basic_string<_CharT,_Traits,_Alloc> > { + size_t operator()(const basic_string<_CharT,_Traits,_Alloc>& __s) const + { return __stl_string_hash(__s); } +}; + +#else + +__STL_TEMPLATE_NULL struct hash<string> { + size_t operator()(const string& __s) const + { return __stl_string_hash(__s); } +}; + +__STL_TEMPLATE_NULL struct hash<wstring> { + size_t operator()(const wstring& __s) const + { return __stl_string_hash(__s); } +}; + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_STRING */ + + +// Local Variables: +// mode:C++ +// End: + diff --git a/dtm_release/local/include/stl/tempbuf.h b/dtm_release/local/include/stl/tempbuf.h new file mode 100644 index 0000000000000000000000000000000000000000..aa4f289c582bb879f3ac0febb666350f7fc2c20c --- /dev/null +++ b/dtm_release/local/include/stl/tempbuf.h @@ -0,0 +1,61 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_TEMPBUF_H +#define __SGI_STL_TEMPBUF_H + +#ifndef __SGI_STL_PAIR_H +#include <pair.h> +#endif +#include <limits.h> /* XXX should use <climits> */ +#include <stddef.h> /* XXX should use <cstddef> */ +#include <stdlib.h> /* XXX should use <cstdlib> */ +#ifndef __TYPE_TRAITS_H +#include <type_traits.h> +#endif +#ifndef __SGI_STL_INTERNAL_CONSTRUCT_H +#include <stl_construct.h> +#endif +#ifndef __SGI_STL_INTERNAL_UNINITIALIZED_H +#include <stl_uninitialized.h> +#endif +#ifndef __SGI_STL_INTERNAL_TEMPBUF_H +#include <stl_tempbuf.h> +#endif + +#ifdef __STL_USE_NAMESPACES + +using __STD::get_temporary_buffer; +using __STD::return_temporary_buffer; +using __STD::temporary_buffer; + +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_TEMPBUF_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/tree.h b/dtm_release/local/include/stl/tree.h new file mode 100644 index 0000000000000000000000000000000000000000..77c57cbbba1f4f16cb8c74a32608e9a8b38268ad --- /dev/null +++ b/dtm_release/local/include/stl/tree.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + */ + +#ifndef __SGI_STL_TREE_H +#define __SGI_STL_TREE_H + +#ifndef __SGI_STL_INTERNAL_TREE_H +#include <stl_tree.h> +#endif +#include <algobase.h> +#include <alloc.h> + +#ifdef __STL_USE_NAMESPACES +using __STD::rb_tree; +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_TREE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/type_traits.h b/dtm_release/local/include/stl/type_traits.h new file mode 100644 index 0000000000000000000000000000000000000000..b6a7dfc6de95f188e15a84d603f086bc1cca6024 --- /dev/null +++ b/dtm_release/local/include/stl/type_traits.h @@ -0,0 +1,373 @@ +/* + * + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __TYPE_TRAITS_H +#define __TYPE_TRAITS_H + +#ifndef __STL_CONFIG_H +#include <stl_config.h> +#endif + +/* +This header file provides a framework for allowing compile time dispatch +based on type attributes. This is useful when writing template code. +For example, when making a copy of an array of an unknown type, it helps +to know if the type has a trivial copy constructor or not, to help decide +if a memcpy can be used. + +The class template __type_traits provides a series of typedefs each of +which is either __true_type or __false_type. The argument to +__type_traits can be any type. The typedefs within this template will +attain their correct values by one of these means: + 1. The general instantiation contain conservative values which work + for all types. + 2. Specializations may be declared to make distinctions between types. + 3. Some compilers (such as the Silicon Graphics N32 and N64 compilers) + will automatically provide the appropriate specializations for all + types. + +EXAMPLE: + +//Copy an array of elements which have non-trivial copy constructors +template <class T> void copy(T* source, T* destination, int n, __false_type); +//Copy an array of elements which have trivial copy constructors. Use memcpy. +template <class T> void copy(T* source, T* destination, int n, __true_type); + +//Copy an array of any type by using the most efficient copy mechanism +template <class T> inline void copy(T* source,T* destination,int n) { + copy(source, destination, n, + typename __type_traits<T>::has_trivial_copy_constructor()); +} +*/ + + +struct __true_type { +}; + +struct __false_type { +}; + +template <class _Tp> +struct __type_traits { + typedef __true_type this_dummy_member_must_be_first; + /* Do not remove this member. It informs a compiler which + automatically specializes __type_traits that this + __type_traits template is special. It just makes sure that + things work if an implementation is using a template + called __type_traits for something unrelated. */ + + /* The following restrictions should be observed for the sake of + compilers which automatically produce type specific specializations + of this class: + - You may reorder the members below if you wish + - You may remove any of the members below if you wish + - You must not rename members without making the corresponding + name change in the compiler + - Members you add will be treated like regular members unless + you add the appropriate support in the compiler. */ + + + typedef __false_type has_trivial_default_constructor; + typedef __false_type has_trivial_copy_constructor; + typedef __false_type has_trivial_assignment_operator; + typedef __false_type has_trivial_destructor; + typedef __false_type is_POD_type; +}; + + + +// Provide some specializations. This is harmless for compilers that +// have built-in __types_traits support, and essential for compilers +// that don't. + +#ifndef __STL_NO_BOOL + +__STL_TEMPLATE_NULL struct __type_traits<bool> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +#endif /* __STL_NO_BOOL */ + +__STL_TEMPLATE_NULL struct __type_traits<char> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +__STL_TEMPLATE_NULL struct __type_traits<signed char> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +__STL_TEMPLATE_NULL struct __type_traits<unsigned char> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +#ifdef __STL_HAS_WCHAR_T + +__STL_TEMPLATE_NULL struct __type_traits<wchar_t> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +#endif /* __STL_HAS_WCHAR_T */ + +__STL_TEMPLATE_NULL struct __type_traits<short> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +__STL_TEMPLATE_NULL struct __type_traits<unsigned short> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +__STL_TEMPLATE_NULL struct __type_traits<int> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +__STL_TEMPLATE_NULL struct __type_traits<unsigned int> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +__STL_TEMPLATE_NULL struct __type_traits<long> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +__STL_TEMPLATE_NULL struct __type_traits<unsigned long> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +#ifdef __STL_LONG_LONG + +__STL_TEMPLATE_NULL struct __type_traits<long long> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +__STL_TEMPLATE_NULL struct __type_traits<unsigned long long> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +#endif /* __STL_LONG_LONG */ + +__STL_TEMPLATE_NULL struct __type_traits<float> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +__STL_TEMPLATE_NULL struct __type_traits<double> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +__STL_TEMPLATE_NULL struct __type_traits<long double> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION + +template <class _Tp> +struct __type_traits<_Tp*> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + +__STL_TEMPLATE_NULL struct __type_traits<char*> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +__STL_TEMPLATE_NULL struct __type_traits<signed char*> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +__STL_TEMPLATE_NULL struct __type_traits<unsigned char*> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +__STL_TEMPLATE_NULL struct __type_traits<const char*> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +__STL_TEMPLATE_NULL struct __type_traits<const signed char*> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +__STL_TEMPLATE_NULL struct __type_traits<const unsigned char*> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */ + + +// The following could be written in terms of numeric_limits. +// We're doing it separately to reduce the number of dependencies. + +template <class _Tp> struct _Is_integer { + typedef __false_type _Integral; +}; + +#ifndef __STL_NO_BOOL + +__STL_TEMPLATE_NULL struct _Is_integer<bool> { + typedef __true_type _Integral; +}; + +#endif /* __STL_NO_BOOL */ + +__STL_TEMPLATE_NULL struct _Is_integer<char> { + typedef __true_type _Integral; +}; + +__STL_TEMPLATE_NULL struct _Is_integer<signed char> { + typedef __true_type _Integral; +}; + +__STL_TEMPLATE_NULL struct _Is_integer<unsigned char> { + typedef __true_type _Integral; +}; + +#ifdef __STL_HAS_WCHAR_T + +__STL_TEMPLATE_NULL struct _Is_integer<wchar_t> { + typedef __true_type _Integral; +}; + +#endif /* __STL_HAS_WCHAR_T */ + +__STL_TEMPLATE_NULL struct _Is_integer<short> { + typedef __true_type _Integral; +}; + +__STL_TEMPLATE_NULL struct _Is_integer<unsigned short> { + typedef __true_type _Integral; +}; + +__STL_TEMPLATE_NULL struct _Is_integer<int> { + typedef __true_type _Integral; +}; + +__STL_TEMPLATE_NULL struct _Is_integer<unsigned int> { + typedef __true_type _Integral; +}; + +__STL_TEMPLATE_NULL struct _Is_integer<long> { + typedef __true_type _Integral; +}; + +__STL_TEMPLATE_NULL struct _Is_integer<unsigned long> { + typedef __true_type _Integral; +}; + +#ifdef __STL_LONG_LONG + +__STL_TEMPLATE_NULL struct _Is_integer<long long> { + typedef __true_type _Integral; +}; + +__STL_TEMPLATE_NULL struct _Is_integer<unsigned long long> { + typedef __true_type _Integral; +}; + +#endif /* __STL_LONG_LONG */ + +#endif /* __TYPE_TRAITS_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/utility b/dtm_release/local/include/stl/utility new file mode 100644 index 0000000000000000000000000000000000000000..df8c224388dba3599c92e6c58cfde7e308bb25d3 --- /dev/null +++ b/dtm_release/local/include/stl/utility @@ -0,0 +1,38 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_UTILITY +#define __SGI_STL_UTILITY + +#include <stl_config.h> +#include <stl_relops.h> +#include <stl_pair.h> + +#endif /* __SGI_STL_UTILITY */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/valarray b/dtm_release/local/include/stl/valarray new file mode 100644 index 0000000000000000000000000000000000000000..814197dce989f3e8ade5b84502ed7ee9324b3805 --- /dev/null +++ b/dtm_release/local/include/stl/valarray @@ -0,0 +1,1773 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_VALARRAY +#define __SGI_STL_VALARRAY + +#include <type_traits.h> +#include <math.h> +#include <algorithm> +#include <numeric> +#include <limits> +#include <new> + + +__STL_BEGIN_NAMESPACE + +class slice; +class gslice; + +template <class _Tp> class valarray; +template <class _Tp> class slice_array; +template <class _Tp> class gslice_array; +template <class _Tp> class mask_array; +template <class _Tp> class indirect_array; + +//---------------------------------------------------------------------- +// class valarray + +// Base class to handle memory allocation and deallocation. We can't just +// use vector<>, because vector<bool> would be unsuitable as an internal +// representation for valarray<bool>. + +template <class _Tp> +struct _Valarray_base +{ + _Tp* _M_first; + size_t _M_size; + + _Valarray_base() : _M_first(0), _M_size(0) {} + _Valarray_base(size_t __n) : _M_first(0), _M_size(0) { _M_allocate(__n); } + ~_Valarray_base() { _M_deallocate(); } + + void _M_allocate(size_t __n) { + if (__n != 0) { + _M_first = static_cast<_Tp*>(malloc(__n * sizeof(_Tp))); + _M_size = __n; +# if !defined(__STL_NO_BAD_ALLOC) && defined(__STL_USE_EXCEPTIONS) + if (_M_first == 0) { + _M_size = 0; + throw std::bad_alloc(); + } +# endif + } + else { + _M_first = 0; + _M_size = 0; + } + } + + void _M_deallocate() { + free(_M_first); + _M_first = 0; + _M_size = 0; + } +}; + +template <class _Tp> +class valarray : private _Valarray_base<_Tp> +{ + friend class gslice; + +public: + typedef _Tp value_type; + + // Basic constructors + valarray() : _Valarray_base<_Tp>() {} + valarray(size_t __n) : _Valarray_base<_Tp>(__n) + { uninitialized_fill_n(this->_M_first, this->_M_size, value_type()); } + valarray(const value_type& __x, size_t __n) : _Valarray_base<_Tp>(__n) + { uninitialized_fill_n(this->_M_first, this->_M_size, __x); } + valarray(const value_type* __p, size_t __n) : _Valarray_base<_Tp>(__n) + { uninitialized_copy(__p, __p + __n, this->_M_first); } + valarray(const valarray& __x) : _Valarray_base<_Tp>(__x._M_size) { + uninitialized_copy(__x._M_first, __x._M_first + __x._M_size, + this->_M_first); + } + + // Constructors from auxiliary array types + valarray(const slice_array<_Tp>&); + valarray(const gslice_array<_Tp>&); + valarray(const mask_array<_Tp>&); + valarray(const indirect_array<_Tp>&); + + // Destructor + ~valarray() { destroy(this->_M_first, this->_M_first + this->_M_size); } + + // Extension: constructor that doesn't initialize valarray elements to a + // specific value. This is faster for types such as int and double. +private: + void _M_initialize(__true_type) {} + void _M_initialize(__false_type) + { uninitialized_fill_n(this->_M_first, this->_M_size, value_type()); } + +public: + struct _NoInit {}; + valarray(size_t __n, _NoInit) : _Valarray_base<_Tp>(__n) { + typedef typename __type_traits<_Tp>::has_trivial_default_constructor + _Is_Trivial; + _M_initialize(_Is_Trivial()); + } + +public: // Assignment + // Basic assignment. Note that 'x = y' is undefined if x.size() != y.size() + valarray& operator=(const valarray& __x) { + if (this != &__x) + copy(__x._M_first, __x._M_first + __x._M_size, this->_M_first); + return *this; + } + + // Scalar assignment + valarray& operator=(const value_type& __x) { + fill_n(this->_M_first, this->_M_size, __x); + return *this; + } + + // Assignment of auxiliary array types + valarray& operator=(const slice_array<_Tp>&); + valarray& operator=(const gslice_array<_Tp>&); + valarray& operator=(const mask_array<_Tp>&); + valarray& operator=(const indirect_array<_Tp>&); + +public: // Element access + value_type operator[](size_t __n) const { return this->_M_first[__n]; } + value_type& operator[](size_t __n) { return this->_M_first[__n]; } + size_t size() const { return this->_M_size; } + +public: // Subsetting operations with auxiliary type + valarray operator[](slice) const; + slice_array<_Tp> operator[](slice); + valarray operator[](gslice) const; + gslice_array<_Tp> operator[](gslice); + valarray operator[](const valarray<bool>&) const; + mask_array<_Tp> operator[](const valarray<bool>&); + valarray operator[](const valarray<size_t>&) const; + indirect_array<_Tp> operator[](const valarray<size_t>&); + +public: // Unary operators. + valarray operator+() const { return *this; } + + valarray operator-() const { + valarray __tmp(this->size(), _NoInit()); + for (size_t __i = 0; __i < this->size(); ++__i) + __tmp[__i] = -(*this)[__i]; + return __tmp; + } + + valarray operator~() const { + valarray __tmp(this->size(), _NoInit()); + for (size_t __i = 0; __i < this->size(); ++__i) + __tmp[__i] = ~(*this)[__i]; + return __tmp; + } + + valarray<bool> operator!() const { + valarray<bool> __tmp(this->size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < this->size(); ++__i) + __tmp[__i] = !(*this)[__i]; + return __tmp; + } + +public: // Scalar computed assignment. + valarray& operator*= (const value_type& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] *= __x; + return *this; + } + + valarray& operator/= (const value_type& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] /= __x; + return *this; + } + + valarray& operator%= (const value_type& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] %= __x; + return *this; + } + + valarray& operator+= (const value_type& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] += __x; + return *this; + } + + valarray& operator-= (const value_type& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] -= __x; + return *this; + } + + valarray& operator^= (const value_type& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] ^= __x; + return *this; + } + + valarray& operator&= (const value_type& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] &= __x; + return *this; + } + + valarray& operator|= (const value_type& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] |= __x; + return *this; + } + + valarray& operator<<= (const value_type& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] <<= __x; + return *this; + } + + valarray& operator>>= (const value_type& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] >>= __x; + return *this; + } + +public: // Array computed assignment. + valarray& operator*= (const valarray& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] *= __x[__i]; + return *this; + } + + valarray& operator/= (const valarray& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] /= __x[__i]; + return *this; + } + + valarray& operator%= (const valarray& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] %= __x[__i]; + return *this; + } + + valarray& operator+= (const valarray& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] += __x[__i]; + return *this; + } + + valarray& operator-= (const valarray& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] -= __x[__i]; + return *this; + } + + valarray& operator^= (const valarray& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] ^= __x[__i]; + return *this; + } + + valarray& operator&= (const valarray& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] &= __x[__i]; + return *this; + } + + valarray& operator|= (const valarray& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] |= __x[__i]; + return *this; + } + + valarray& operator<<= (const valarray& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] <<= __x[__i]; + return *this; + } + + valarray& operator>>= (const valarray& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] >>= __x[__i]; + return *this; + } + +public: // Other member functions. + + // The result is undefined for zero-length arrays + value_type sum() const { + return accumulate(this->_M_first + 1, this->_M_first + this->_M_size, + (*this)[0]); + } + + // The result is undefined for zero-length arrays + value_type min() const { + return *min_element(this->_M_first + 0, this->_M_first + this->_M_size); + } + + value_type max() const { + return *max_element(this->_M_first + 0, this->_M_first + this->_M_size); + } + + valarray shift(int __n) const; + valarray cshift(int __n) const; + + valarray apply(value_type __f(value_type)) const { + valarray __tmp(this->size()); + transform(this->_M_first, this->_M_first + this->_M_size, __tmp._M_first, + __f); + return __tmp; + } + valarray apply(value_type __f(const value_type&)) const { + valarray __tmp(this->size()); + transform(this->_M_first, this->_M_first + this->_M_size, __tmp._M_first, + __f); + return __tmp; + } + + void resize(size_t __n, value_type __x = value_type()) { + destroy(this->_M_first, this->_M_first + this->_M_size); + this->_Valarray_base<_Tp>::_M_deallocate(); + this->_Valarray_base<_Tp>::_M_allocate(__n); + uninitialized_fill_n(this->_M_first, this->_M_size, __x); + } +}; + +//---------------------------------------------------------------------- +// valarray non-member functions. + +// Binary arithmetic operations between two arrays. Behavior is +// undefined if the two arrays do not have the same length. + +template <class _Tp> +inline valarray<_Tp> operator*(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] * __y[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator/(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] / __y[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator%(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] % __y[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator+(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] + __y[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator-(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] - __y[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator^(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] ^ __y[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator&(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] & __y[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator|(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] | __y[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator<<(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] << __y[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator>>(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] >> __y[__i]; + return __tmp; +} + +// Binary arithmetic operations between an array and a scalar. + +template <class _Tp> +inline valarray<_Tp> operator*(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] * __c; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator*(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c * __x[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator/(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] / __c; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator/(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c / __x[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator%(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] % __c; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator%(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c % __x[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator+(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] + __c; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator+(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c + __x[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator-(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] - __c; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator-(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c - __x[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator^(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] ^ __c; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator^(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c ^ __x[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator&(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] & __c; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator&(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c & __x[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator|(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] | __c; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator|(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c | __x[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator<<(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] << __c; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator<<(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c << __x[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator>>(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] >> __c; + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> operator>>(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c >> __x[__i]; + return __tmp; +} + +// Binary logical operations between two arrays. Behavior is undefined +// if the two arrays have different lengths. Note that operator== does +// not do what you might at first expect. + +template <class _Tp> +inline valarray<bool> operator==(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] == __y[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<bool> operator<(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] < __y[__i]; + return __tmp; +} + +#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER + +template <class _Tp> +inline valarray<bool> operator!=(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] != __y[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<bool> operator>(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] > __y[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<bool> operator<=(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] <= __y[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<bool> operator>=(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] >= __y[__i]; + return __tmp; +} + +#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */ + +template <class _Tp> +inline valarray<bool> operator&&(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] && __y[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<bool> operator||(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] || __y[__i]; + return __tmp; +} + +// Logical operations between an array and a scalar. + +template <class _Tp> +inline valarray<bool> operator==(const valarray<_Tp>& __x, const _Tp& __c) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] == __c; + return __tmp; +} + +template <class _Tp> +inline valarray<bool> operator==(const _Tp& __c, const valarray<_Tp>& __x) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c == __x[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<bool> operator!=(const valarray<_Tp>& __x, const _Tp& __c) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] != __c; + return __tmp; +} + +template <class _Tp> +inline valarray<bool> operator!=(const _Tp& __c, const valarray<_Tp>& __x) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c != __x[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<bool> operator<(const valarray<_Tp>& __x, const _Tp& __c) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] < __c; + return __tmp; +} + +template <class _Tp> +inline valarray<bool> operator<(const _Tp& __c, const valarray<_Tp>& __x) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c < __x[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<bool> operator>(const valarray<_Tp>& __x, const _Tp& __c) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] > __c; + return __tmp; +} + +template <class _Tp> +inline valarray<bool> operator>(const _Tp& __c, const valarray<_Tp>& __x) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c > __x[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<bool> operator<=(const valarray<_Tp>& __x, const _Tp& __c) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] <= __c; + return __tmp; +} + +template <class _Tp> +inline valarray<bool> operator<=(const _Tp& __c, const valarray<_Tp>& __x) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c <= __x[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<bool> operator>=(const valarray<_Tp>& __x, const _Tp& __c) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] >= __c; + return __tmp; +} + +template <class _Tp> +inline valarray<bool> operator>=(const _Tp& __c, const valarray<_Tp>& __x) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c >= __x[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<bool> operator&&(const valarray<_Tp>& __x, const _Tp& __c) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] && __c; + return __tmp; +} + +template <class _Tp> +inline valarray<bool> operator&&(const _Tp& __c, const valarray<_Tp>& __x) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c && __x[__i]; + return __tmp; +} + +template <class _Tp> +inline valarray<bool> operator||(const valarray<_Tp>& __x, const _Tp& __c) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] || __c; + return __tmp; +} + +template <class _Tp> +inline valarray<bool> operator||(const _Tp& __c, const valarray<_Tp>& __x) +{ + valarray<bool> __tmp(__x.size(), valarray<bool>::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c || __x[__i]; + return __tmp; +} + +// valarray "transcendentals" (the list includes abs and sqrt, which, +// of course, are not transcendental). + +template <class _Tp> +inline valarray<_Tp> abs(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = abs(__x[__i]); + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> acos(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = acos(__x[__i]); + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> asin(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = asin(__x[__i]); + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> atan(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = atan(__x[__i]); + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> atan2(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = atan2(__x[__i], __y[__i]); + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> atan2(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = atan2(__x[__i], __c); + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> atan2(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = atan2(__c, __x[__i]); + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> cos(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = cos(__x[__i]); + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> cosh(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = cosh(__x[__i]); + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> exp(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = exp(__x[__i]); + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> log(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = log(__x[__i]); + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> log10(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = log10(__x[__i]); + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> pow(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = pow(__x[__i], __y[__i]); + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> pow(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = pow(__x[__i], __c); + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> pow(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = pow(__c, __x[__i]); + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> sin(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = sin(__x[__i]); + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> sinh(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = sinh(__x[__i]); + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> sqrt(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = sqrt(__x[__i]); + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> tan(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = tan(__x[__i]); + return __tmp; +} + +template <class _Tp> +inline valarray<_Tp> tanh(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = tanh(__x[__i]); + return __tmp; +} + +//---------------------------------------------------------------------- +// slice and slice_array + +class slice { +public: + slice() : _M_start(0), _M_length(0), _M_stride(0) {} + slice(size_t __start, size_t __length, size_t __stride) + : _M_start(__start), _M_length(__length), _M_stride(__stride) + {} + + size_t start() const { return _M_start; } + size_t size() const { return _M_length; } + size_t stride() const { return _M_stride; } + + +private: + size_t _M_start; + size_t _M_length; + size_t _M_stride; +}; + +template <class _Tp> +class slice_array { + friend class valarray<_Tp>; +public: + typedef _Tp value_type; + + void operator=(const valarray<value_type>& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] = __x[__i]; + } + + void operator*=(const valarray<value_type>& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] *= __x[__i]; + } + + void operator/=(const valarray<value_type>& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] /= __x[__i]; + } + + void operator%=(const valarray<value_type>& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] %= __x[__i]; + } + + void operator+=(const valarray<value_type>& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] += __x[__i]; + } + + void operator-=(const valarray<value_type>& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] -= __x[__i]; + } + + void operator^=(const valarray<value_type>& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] ^= __x[__i]; + } + + void operator&=(const valarray<value_type>& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] &= __x[__i]; + } + + void operator|=(const valarray<value_type>& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] |= __x[__i]; + } + + void operator<<=(const valarray<value_type>& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] <<= __x[__i]; + } + + void operator>>=(const valarray<value_type>& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] >>= __x[__i]; + } + + void operator=(const value_type& __c) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] = __c; + } + + ~slice_array() {} + +private: + slice_array(const slice& __slice, valarray<_Tp>& __array) + : _M_slice(__slice), _M_array(__array) + {} + + slice _M_slice; + valarray<_Tp>& _M_array; + +private: // Disable assignment and default constructor + slice_array(); +}; + +// valarray member functions dealing with slice and slice_array + +template <class _Tp> +inline valarray<_Tp>::valarray(const slice_array<_Tp>& __x) + : _Valarray_base<_Tp>(__x._M_slice.size()) +{ + typedef typename __type_traits<_Tp>::has_trivial_default_constructor + _Is_Trivial; + _M_initialize(_Is_Trivial()); + *this = __x; +} + +// Behavior is undefined if __x and *this have different sizes +template <class _Tp> +valarray<_Tp>& valarray<_Tp>::operator=(const slice_array<_Tp>& __x) +{ + size_t __index = __x._M_slice.start(); + for (size_t __i = 0; + __i < __x._M_slice.size(); + ++__i, __index += __x._M_slice.stride()) + (*this)[__i] = __x._M_array[__index]; + return *this; +} + +template <class _Tp> +valarray<_Tp> valarray<_Tp>::operator[](slice __slice) const { + valarray<_Tp> __tmp(__slice.size(), _NoInit()); + size_t __index = __slice.start(); + for (size_t __i = 0; + __i < __slice.size(); + ++__i, __index += __slice.stride()) + __tmp[__i] = (*this)[__index]; + return __tmp; +} + +template <class _Tp> +inline slice_array<_Tp> valarray<_Tp>::operator[](slice __slice) { + return slice_array<_Tp>(__slice, *this); +} + +//---------------------------------------------------------------------- +// gslice and gslice_array + +struct _Gslice_Iter; + +class gslice { + friend struct _Gslice_Iter; +public: + gslice() : _M_start(0), _M_lengths(0), _M_strides(0) {} + gslice(size_t __start, + const valarray<size_t>& __lengths, const valarray<size_t>& __strides) + : _M_start(__start), _M_lengths(__lengths), _M_strides(__strides) + {} + + size_t start() const { return _M_start; } + valarray<size_t> size() const { return _M_lengths; } + valarray<size_t> stride() const { return _M_strides; } + + // Extension: check for an empty gslice. + bool _M_empty() const { return _M_lengths.size() == 0; } + + // Extension: number of indices this gslice represents. (For a degenerate + // gslice, they're not necessarily all distinct.) + size_t _M_size() const { + return !this->_M_empty() + ? accumulate(_M_lengths._M_first + 1, + _M_lengths._M_first + _M_lengths._M_size, + _M_lengths[0], + multiplies<size_t>()) + : 0; + } + +private: + size_t _M_start; + valarray<size_t> _M_lengths; + valarray<size_t> _M_strides; +}; + +// This is not an STL iterator. It is constructed from a gslice, and it +// steps through the gslice indices in sequence. See 23.3.6 of the C++ +// standard, paragraphs 2-3, for an explanation of the sequence. At +// each step we get two things: the ordinal (i.e. number of steps taken), +// and the one-dimensional index. + +struct _Gslice_Iter { + _Gslice_Iter(const gslice& __gslice) + : _M_step(0), _M_1d_idx(__gslice.start()), + _M_indices(size_t(0), __gslice._M_lengths.size()), + _M_gslice(__gslice) + {} + + bool _M_done() const { return _M_indices[0] == _M_gslice._M_lengths[0]; } + + bool _M_incr() { + size_t __dim = _M_indices.size() - 1; + ++_M_step; + while (true) { + _M_1d_idx += _M_gslice._M_strides[__dim]; + if (++_M_indices[__dim] != _M_gslice._M_lengths[__dim]) + return true; + else if (__dim != 0) { + _M_1d_idx -= + _M_gslice._M_strides[__dim] * _M_gslice._M_lengths[__dim]; + _M_indices[__dim] = 0; + --__dim; + } + else + return false; + } + } + + size_t _M_step; + size_t _M_1d_idx; + + valarray<size_t> _M_indices; + const gslice& _M_gslice; +}; + +template <class _Tp> +class gslice_array { + friend class valarray<_Tp>; +public: + typedef _Tp value_type; + + void operator= (const valarray<value_type>& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] = __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator*= (const valarray<value_type>& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] *= __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator/= (const valarray<value_type>& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] /= __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator%= (const valarray<value_type>& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] %= __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator+= (const valarray<value_type>& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] += __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator-= (const valarray<value_type>& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] -= __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator^= (const valarray<value_type>& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] ^= __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator&= (const valarray<value_type>& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] &= __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator|= (const valarray<value_type>& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] |= __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator<<= (const valarray<value_type>& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] <<= __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator>>= (const valarray<value_type>& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] >>= __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator= (const value_type& __c) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] = __c; while(__i._M_incr()); + } + } + + ~gslice_array() {} + +private: + gslice_array(gslice __gslice, valarray<_Tp>& __array) + : _M_gslice(__gslice), _M_array(__array) + {} + + gslice _M_gslice; + valarray<value_type>& _M_array; + +private: // Disable assignment + void operator=(const gslice_array&); +}; + +// valarray member functions dealing with gslice and gslice_array. Note +// that it is illegal (behavior is undefined) to construct a gslice_array +// from a degenerate gslice. + +template <class _Tp> +inline valarray<_Tp>::valarray(const gslice_array<_Tp>& __x) + : _Valarray_base<_Tp>(__x._M_gslice._M_size()) +{ + typedef typename __type_traits<_Tp>::has_trivial_default_constructor + _Is_Trivial; + _M_initialize(_Is_Trivial()); + *this = __x; +} + +// Behavior is undefined if __x and *this have different sizes, or if +// __x was constructed from a degenerate gslice. +template <class _Tp> +valarray<_Tp>& valarray<_Tp>::operator=(const gslice_array<_Tp>& __x) +{ + if (this->size() != 0) { + _Gslice_Iter __i(__x._M_gslice); + do + (*this)[__i._M_step] = __x._M_array[__i._M_1d_idx]; + while(__i._M_incr()); + } + return *this; +} + +template <class _Tp> +inline gslice_array<_Tp> valarray<_Tp>::operator[](gslice __slice) { + return gslice_array<_Tp>(__slice, *this); +} + +template <class _Tp> +valarray<_Tp> valarray<_Tp>::operator[](gslice __slice) const +{ + valarray __tmp(__slice._M_size(), _NoInit()); + if (__tmp.size() != 0) { + _Gslice_Iter __i(__slice); + do __tmp[__i._M_step] = (*this)[__i._M_1d_idx]; while(__i._M_incr()); + } + return __tmp; +} + +//---------------------------------------------------------------------- +// mask_array + +template <class _Tp> +class mask_array { + friend class valarray<_Tp>; +public: + typedef _Tp value_type; + + void operator=(const valarray<value_type>& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] = __x[__idx++]; + } + + void operator*=(const valarray<value_type>& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] *= __x[__idx++]; + } + + void operator/=(const valarray<value_type>& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] /= __x[__idx++]; + } + + void operator%=(const valarray<value_type>& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] %= __x[__idx++]; + } + + void operator+=(const valarray<value_type>& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] += __x[__idx++]; + } + + void operator-=(const valarray<value_type>& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] -= __x[__idx++]; + } + + void operator^=(const valarray<value_type>& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] ^= __x[__idx++]; + } + + void operator&=(const valarray<value_type>& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] &= __x[__idx++]; + } + + void operator|=(const valarray<value_type>& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] |= __x[__idx++]; + } + + void operator<<=(const valarray<value_type>& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] <<= __x[__idx++]; + } + + void operator>>=(const valarray<value_type>& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] >>= __x[__idx++]; + } + + void operator=(const value_type& __c) const { + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] = __c; + } + + ~mask_array() {} + + // Extension: number of true values in the mask + size_t _M_num_true() const { + size_t __result = 0; + for (size_t __i = 0; __i < _M_mask.size(); ++__i) + if (_M_mask[__i]) ++__result; + return __result; + } + +private: + mask_array(const valarray<bool>& __mask, valarray<_Tp>& __array) + : _M_mask(__mask), _M_array(__array) + {} + + valarray<bool> _M_mask; + valarray<_Tp>& _M_array; + +private: // Disable assignment + void operator=(const mask_array&); +}; + +// valarray member functions dealing with mask_array + +template <class _Tp> +inline valarray<_Tp>::valarray(const mask_array<_Tp>& __x) + : _Valarray_base<_Tp>(__x._M_num_true()) +{ + typedef typename __type_traits<_Tp>::has_trivial_default_constructor + _Is_Trivial; + _M_initialize(_Is_Trivial()); + *this = __x; +} + +// Behavior is undefined if __x._M_num_true() != this->size() +template <class _Tp> +inline valarray<_Tp>& valarray<_Tp>::operator=(const mask_array<_Tp>& __x) { + size_t __idx = 0; + for (size_t __i = 0; __i < __x._M_array.size(); ++__i) + if (__x._M_mask[__i]) (*this)[__idx++] = __x._M_array[__i]; + return *this; +} + +template <class _Tp> +inline mask_array<_Tp> valarray<_Tp>::operator[](const valarray<bool>& __mask) +{ + return mask_array<_Tp>(__mask, *this); +} + +template <class _Tp> +valarray<_Tp> valarray<_Tp>::operator[](const valarray<bool>& __mask) const +{ + size_t __size = 0; + { + for (size_t __i = 0; __i < __mask.size(); ++__i) + if (__mask[__i]) ++__size; + } + + valarray __tmp(__size, _NoInit()); + size_t __idx = 0; + { + for (size_t __i = 0; __i < __mask.size(); ++__i) + if (__mask[__i]) __tmp[__idx++] = (*this)[__i]; + } + + return __tmp; +} + +//---------------------------------------------------------------------- +// indirect_array + +template <class _Tp> +class indirect_array { + friend class valarray<_Tp>; +public: + typedef _Tp value_type; + + void operator=(const valarray<value_type>& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] = __x[__i]; + } + + void operator*=(const valarray<value_type>& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] *= __x[__i]; + } + + void operator/=(const valarray<value_type>& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] /= __x[__i]; + } + + void operator%=(const valarray<value_type>& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] %= __x[__i]; + } + + void operator+=(const valarray<value_type>& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] += __x[__i]; + } + + void operator-=(const valarray<value_type>& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] -= __x[__i]; + } + + void operator^=(const valarray<value_type>& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] ^= __x[__i]; + } + + void operator&=(const valarray<value_type>& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] &= __x[__i]; + } + + void operator|=(const valarray<value_type>& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] |= __x[__i]; + } + + void operator<<=(const valarray<value_type>& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] <<= __x[__i]; + } + + void operator>>=(const valarray<value_type>& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] >>= __x[__i]; + } + + void operator=(const value_type& __c) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] = __c; + } + + ~indirect_array() {} + +private: + indirect_array(const valarray<size_t>& __addr, valarray<_Tp>& __array) + : _M_addr(__addr), _M_array(__array) + {} + + valarray<size_t> _M_addr; + valarray<_Tp>& _M_array; + +private: // Disable assignment + void operator=(const indirect_array&); +}; + +// valarray member functions dealing with indirect_array + +template <class _Tp> +inline valarray<_Tp>::valarray(const indirect_array<_Tp>& __x) + : _Valarray_base<_Tp>(__x._M_addr.size()) +{ + typedef typename __type_traits<_Tp>::has_trivial_default_constructor + _Is_Trivial; + _M_initialize(_Is_Trivial()); + *this = __x; +} + +template <class _Tp> +valarray<_Tp>& valarray<_Tp>::operator=(const indirect_array<_Tp>& __x) { + for (size_t __i = 0; __i < __x._M_addr.size(); ++__i) + (*this)[__i] = __x._M_array[__x._M_addr[__i]]; + return *this; +} + +template <class _Tp> +inline indirect_array<_Tp> +valarray<_Tp>::operator[](const valarray<size_t>& __addr) +{ + return indirect_array<_Tp>(__addr, *this); +} + +template <class _Tp> +valarray<_Tp> +valarray<_Tp>::operator[](const valarray<size_t>& __addr) const +{ + valarray<_Tp> __tmp(__addr.size(), _NoInit()); + for (size_t __i = 0; __i < __addr.size(); ++__i) + __tmp[__i] = (*this)[__addr[__i]]; + return __tmp; +} + +//---------------------------------------------------------------------- +// Other valarray noninline member functions + +// Shift and cshift + +template <class _Tp> +valarray<_Tp> valarray<_Tp>::shift(int __n) const +{ + valarray<_Tp> __tmp(this->size()); + + if (__n >= 0) { + if (__n < this->size()) + copy(this->_M_first + __n, this->_M_first + this->size(), + __tmp._M_first); + } + else { + if (-__n < this->size()) + copy(this->_M_first, this->_M_first + this->size() + __n, + __tmp._M_first - __n); + } + return __tmp; +} + +template <class _Tp> +valarray<_Tp> valarray<_Tp>::cshift(int __m) const +{ + valarray<_Tp> __tmp(this->size()); + + // Reduce __m to an equivalent number in the range [0, size()). We + // have to be careful with negative numbers, since the sign of a % b + // is unspecified when a < 0. + long __n = __m; + if (this->size() < numeric_limits<long>::max()) + __n %= long(this->size()); + if (__n < 0) + __n += this->size(); + + copy(this->_M_first, this->_M_first + __n, + __tmp._M_first + (this->size() - __n)); + copy(this->_M_first + __n, this->_M_first + this->size(), + __tmp._M_first); + + return __tmp; +} + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_VALARRAY */ + + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/vector b/dtm_release/local/include/stl/vector new file mode 100644 index 0000000000000000000000000000000000000000..272f60fcf169c9f4d0cd4907365e4e5d7d572eec --- /dev/null +++ b/dtm_release/local/include/stl/vector @@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_VECTOR +#define __SGI_STL_VECTOR + +#include <stl_range_errors.h> +#include <stl_algobase.h> +#include <stl_alloc.h> +#include <stl_construct.h> +#include <stl_uninitialized.h> +#include <stl_vector.h> +#include <stl_bvector.h> + +#endif /* __SGI_STL_VECTOR */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/include/stl/vector.h b/dtm_release/local/include/stl/vector.h new file mode 100644 index 0000000000000000000000000000000000000000..f48d4fd2aabb2b7f424df1dfede97b271bbaac2c --- /dev/null +++ b/dtm_release/local/include/stl/vector.h @@ -0,0 +1,43 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __SGI_STL_VECTOR_H +#define __SGI_STL_VECTOR_H + +#include <stl_range_errors.h> +#include <algobase.h> +#include <alloc.h> +#include <stl_vector.h> + +#ifdef __STL_USE_NAMESPACES +using __STD::vector; +#endif /* __STL_USE_NAMESPACES */ + +#endif /* __SGI_STL_VECTOR_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/dtm_release/local/lib/Makefile.am b/dtm_release/local/lib/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..c3a5627105fda82766eb39b3835a4802a437323f --- /dev/null +++ b/dtm_release/local/lib/Makefile.am @@ -0,0 +1,5 @@ +lib_LIBRARIES = libWN.a +libWN_a_SOURCES = binsrch.c morph.c search.c wnglobal.c wnhelp.c wnrtl.c wnutil.c +libWN_a_CPPFLAGS = $(INCLUDES) +INCLUDES = -I$(top_srcdir)/include +SUBDIRS = wnres diff --git a/dtm_release/local/lib/Makefile.in b/dtm_release/local/lib/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..7ac98ae5fbb71f98b9ce5b04fe0240c90106e5e4 --- /dev/null +++ b/dtm_release/local/lib/Makefile.in @@ -0,0 +1,625 @@ +# Makefile.in generated by automake 1.9 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +SOURCES = $(libWN_a_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +subdir = lib +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" +libLIBRARIES_INSTALL = $(INSTALL_DATA) +LIBRARIES = $(lib_LIBRARIES) +AR = ar +ARFLAGS = cru +libWN_a_AR = $(AR) $(ARFLAGS) +libWN_a_LIBADD = +am_libWN_a_OBJECTS = libWN_a-binsrch.$(OBJEXT) libWN_a-morph.$(OBJEXT) \ + libWN_a-search.$(OBJEXT) libWN_a-wnglobal.$(OBJEXT) \ + libWN_a-wnhelp.$(OBJEXT) libWN_a-wnrtl.$(OBJEXT) \ + libWN_a-wnutil.$(OBJEXT) +libWN_a_OBJECTS = $(am_libWN_a_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libWN_a_SOURCES) +DIST_SOURCES = $(libWN_a_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ +TCL_LIB_SPEC = @TCL_LIB_SPEC@ +TK_LIBS = @TK_LIBS@ +TK_LIB_SPEC = @TK_LIB_SPEC@ +TK_PREFIX = @TK_PREFIX@ +TK_XINCLUDES = @TK_XINCLUDES@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +lib_LIBRARIES = libWN.a +libWN_a_SOURCES = binsrch.c morph.c search.c wnglobal.c wnhelp.c wnrtl.c wnutil.c +libWN_a_CPPFLAGS = $(INCLUDES) +INCLUDES = -I$(top_srcdir)/include +SUBDIRS = wnres +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu lib/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-libLIBRARIES: $(lib_LIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + @$(POST_INSTALL) + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + p=$(am__strip_dir) \ + echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \ + $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \ + else :; fi; \ + done + +uninstall-libLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLIBRARIES: + -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) +libWN.a: $(libWN_a_OBJECTS) $(libWN_a_DEPENDENCIES) + -rm -f libWN.a + $(libWN_a_AR) libWN.a $(libWN_a_OBJECTS) $(libWN_a_LIBADD) + $(RANLIB) libWN.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libWN_a-binsrch.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libWN_a-morph.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libWN_a-search.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libWN_a-wnglobal.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libWN_a-wnhelp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libWN_a-wnrtl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libWN_a-wnutil.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +libWN_a-binsrch.o: binsrch.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libWN_a-binsrch.o -MD -MP -MF "$(DEPDIR)/libWN_a-binsrch.Tpo" -c -o libWN_a-binsrch.o `test -f 'binsrch.c' || echo '$(srcdir)/'`binsrch.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libWN_a-binsrch.Tpo" "$(DEPDIR)/libWN_a-binsrch.Po"; else rm -f "$(DEPDIR)/libWN_a-binsrch.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='binsrch.c' object='libWN_a-binsrch.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libWN_a-binsrch.o `test -f 'binsrch.c' || echo '$(srcdir)/'`binsrch.c + +libWN_a-binsrch.obj: binsrch.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libWN_a-binsrch.obj -MD -MP -MF "$(DEPDIR)/libWN_a-binsrch.Tpo" -c -o libWN_a-binsrch.obj `if test -f 'binsrch.c'; then $(CYGPATH_W) 'binsrch.c'; else $(CYGPATH_W) '$(srcdir)/binsrch.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libWN_a-binsrch.Tpo" "$(DEPDIR)/libWN_a-binsrch.Po"; else rm -f "$(DEPDIR)/libWN_a-binsrch.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='binsrch.c' object='libWN_a-binsrch.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libWN_a-binsrch.obj `if test -f 'binsrch.c'; then $(CYGPATH_W) 'binsrch.c'; else $(CYGPATH_W) '$(srcdir)/binsrch.c'; fi` + +libWN_a-morph.o: morph.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libWN_a-morph.o -MD -MP -MF "$(DEPDIR)/libWN_a-morph.Tpo" -c -o libWN_a-morph.o `test -f 'morph.c' || echo '$(srcdir)/'`morph.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libWN_a-morph.Tpo" "$(DEPDIR)/libWN_a-morph.Po"; else rm -f "$(DEPDIR)/libWN_a-morph.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='morph.c' object='libWN_a-morph.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libWN_a-morph.o `test -f 'morph.c' || echo '$(srcdir)/'`morph.c + +libWN_a-morph.obj: morph.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libWN_a-morph.obj -MD -MP -MF "$(DEPDIR)/libWN_a-morph.Tpo" -c -o libWN_a-morph.obj `if test -f 'morph.c'; then $(CYGPATH_W) 'morph.c'; else $(CYGPATH_W) '$(srcdir)/morph.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libWN_a-morph.Tpo" "$(DEPDIR)/libWN_a-morph.Po"; else rm -f "$(DEPDIR)/libWN_a-morph.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='morph.c' object='libWN_a-morph.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libWN_a-morph.obj `if test -f 'morph.c'; then $(CYGPATH_W) 'morph.c'; else $(CYGPATH_W) '$(srcdir)/morph.c'; fi` + +libWN_a-search.o: search.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libWN_a-search.o -MD -MP -MF "$(DEPDIR)/libWN_a-search.Tpo" -c -o libWN_a-search.o `test -f 'search.c' || echo '$(srcdir)/'`search.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libWN_a-search.Tpo" "$(DEPDIR)/libWN_a-search.Po"; else rm -f "$(DEPDIR)/libWN_a-search.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='search.c' object='libWN_a-search.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libWN_a-search.o `test -f 'search.c' || echo '$(srcdir)/'`search.c + +libWN_a-search.obj: search.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libWN_a-search.obj -MD -MP -MF "$(DEPDIR)/libWN_a-search.Tpo" -c -o libWN_a-search.obj `if test -f 'search.c'; then $(CYGPATH_W) 'search.c'; else $(CYGPATH_W) '$(srcdir)/search.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libWN_a-search.Tpo" "$(DEPDIR)/libWN_a-search.Po"; else rm -f "$(DEPDIR)/libWN_a-search.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='search.c' object='libWN_a-search.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libWN_a-search.obj `if test -f 'search.c'; then $(CYGPATH_W) 'search.c'; else $(CYGPATH_W) '$(srcdir)/search.c'; fi` + +libWN_a-wnglobal.o: wnglobal.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libWN_a-wnglobal.o -MD -MP -MF "$(DEPDIR)/libWN_a-wnglobal.Tpo" -c -o libWN_a-wnglobal.o `test -f 'wnglobal.c' || echo '$(srcdir)/'`wnglobal.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libWN_a-wnglobal.Tpo" "$(DEPDIR)/libWN_a-wnglobal.Po"; else rm -f "$(DEPDIR)/libWN_a-wnglobal.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='wnglobal.c' object='libWN_a-wnglobal.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libWN_a-wnglobal.o `test -f 'wnglobal.c' || echo '$(srcdir)/'`wnglobal.c + +libWN_a-wnglobal.obj: wnglobal.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libWN_a-wnglobal.obj -MD -MP -MF "$(DEPDIR)/libWN_a-wnglobal.Tpo" -c -o libWN_a-wnglobal.obj `if test -f 'wnglobal.c'; then $(CYGPATH_W) 'wnglobal.c'; else $(CYGPATH_W) '$(srcdir)/wnglobal.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libWN_a-wnglobal.Tpo" "$(DEPDIR)/libWN_a-wnglobal.Po"; else rm -f "$(DEPDIR)/libWN_a-wnglobal.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='wnglobal.c' object='libWN_a-wnglobal.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libWN_a-wnglobal.obj `if test -f 'wnglobal.c'; then $(CYGPATH_W) 'wnglobal.c'; else $(CYGPATH_W) '$(srcdir)/wnglobal.c'; fi` + +libWN_a-wnhelp.o: wnhelp.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libWN_a-wnhelp.o -MD -MP -MF "$(DEPDIR)/libWN_a-wnhelp.Tpo" -c -o libWN_a-wnhelp.o `test -f 'wnhelp.c' || echo '$(srcdir)/'`wnhelp.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libWN_a-wnhelp.Tpo" "$(DEPDIR)/libWN_a-wnhelp.Po"; else rm -f "$(DEPDIR)/libWN_a-wnhelp.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='wnhelp.c' object='libWN_a-wnhelp.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libWN_a-wnhelp.o `test -f 'wnhelp.c' || echo '$(srcdir)/'`wnhelp.c + +libWN_a-wnhelp.obj: wnhelp.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libWN_a-wnhelp.obj -MD -MP -MF "$(DEPDIR)/libWN_a-wnhelp.Tpo" -c -o libWN_a-wnhelp.obj `if test -f 'wnhelp.c'; then $(CYGPATH_W) 'wnhelp.c'; else $(CYGPATH_W) '$(srcdir)/wnhelp.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libWN_a-wnhelp.Tpo" "$(DEPDIR)/libWN_a-wnhelp.Po"; else rm -f "$(DEPDIR)/libWN_a-wnhelp.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='wnhelp.c' object='libWN_a-wnhelp.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libWN_a-wnhelp.obj `if test -f 'wnhelp.c'; then $(CYGPATH_W) 'wnhelp.c'; else $(CYGPATH_W) '$(srcdir)/wnhelp.c'; fi` + +libWN_a-wnrtl.o: wnrtl.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libWN_a-wnrtl.o -MD -MP -MF "$(DEPDIR)/libWN_a-wnrtl.Tpo" -c -o libWN_a-wnrtl.o `test -f 'wnrtl.c' || echo '$(srcdir)/'`wnrtl.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libWN_a-wnrtl.Tpo" "$(DEPDIR)/libWN_a-wnrtl.Po"; else rm -f "$(DEPDIR)/libWN_a-wnrtl.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='wnrtl.c' object='libWN_a-wnrtl.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libWN_a-wnrtl.o `test -f 'wnrtl.c' || echo '$(srcdir)/'`wnrtl.c + +libWN_a-wnrtl.obj: wnrtl.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libWN_a-wnrtl.obj -MD -MP -MF "$(DEPDIR)/libWN_a-wnrtl.Tpo" -c -o libWN_a-wnrtl.obj `if test -f 'wnrtl.c'; then $(CYGPATH_W) 'wnrtl.c'; else $(CYGPATH_W) '$(srcdir)/wnrtl.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libWN_a-wnrtl.Tpo" "$(DEPDIR)/libWN_a-wnrtl.Po"; else rm -f "$(DEPDIR)/libWN_a-wnrtl.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='wnrtl.c' object='libWN_a-wnrtl.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libWN_a-wnrtl.obj `if test -f 'wnrtl.c'; then $(CYGPATH_W) 'wnrtl.c'; else $(CYGPATH_W) '$(srcdir)/wnrtl.c'; fi` + +libWN_a-wnutil.o: wnutil.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libWN_a-wnutil.o -MD -MP -MF "$(DEPDIR)/libWN_a-wnutil.Tpo" -c -o libWN_a-wnutil.o `test -f 'wnutil.c' || echo '$(srcdir)/'`wnutil.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libWN_a-wnutil.Tpo" "$(DEPDIR)/libWN_a-wnutil.Po"; else rm -f "$(DEPDIR)/libWN_a-wnutil.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='wnutil.c' object='libWN_a-wnutil.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libWN_a-wnutil.o `test -f 'wnutil.c' || echo '$(srcdir)/'`wnutil.c + +libWN_a-wnutil.obj: wnutil.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libWN_a-wnutil.obj -MD -MP -MF "$(DEPDIR)/libWN_a-wnutil.Tpo" -c -o libWN_a-wnutil.obj `if test -f 'wnutil.c'; then $(CYGPATH_W) 'wnutil.c'; else $(CYGPATH_W) '$(srcdir)/wnutil.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libWN_a-wnutil.Tpo" "$(DEPDIR)/libWN_a-wnutil.Po"; else rm -f "$(DEPDIR)/libWN_a-wnutil.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='wnutil.c' object='libWN_a-wnutil.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libWN_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libWN_a-wnutil.obj `if test -f 'wnutil.c'; then $(CYGPATH_W) 'wnutil.c'; else $(CYGPATH_W) '$(srcdir)/wnutil.c'; fi` +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LIBRARIES) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libLIBRARIES mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: install-libLIBRARIES + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLIBRARIES + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libLIBRARIES clean-recursive ctags \ + ctags-recursive distclean distclean-compile distclean-generic \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-libLIBRARIES install-man install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am uninstall-info-am \ + uninstall-libLIBRARIES + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/dtm_release/local/lib/binsrch.c b/dtm_release/local/lib/binsrch.c new file mode 100644 index 0000000000000000000000000000000000000000..85436f30edceba3da7661413db1b52ce12fdd9c3 --- /dev/null +++ b/dtm_release/local/lib/binsrch.c @@ -0,0 +1,225 @@ +/* + + binsearch.c - general binary search functions + +*/ + +#include <stdio.h> +#include <string.h> + +static char *Id = "$Id: binsrch.c,v 1.15 2005/02/01 16:46:43 wn Rel $"; + +/* Binary search - looks for the key passed at the start of a line + in the file associated with open file descriptor fp, and returns + a buffer containing the line in the file. */ + +#define KEY_LEN (1024) +#define LINE_LEN (1024*25) + +static char line[LINE_LEN]; +long last_bin_search_offset = 0; + +/* General purpose binary search function to search for key as first + item on line in open file. Item is delimited by space. */ + +#undef getc + +char *read_index(long offset, FILE *fp) { + char *linep; + + linep = line; + line[0] = '0'; + + fseek( fp, offset, SEEK_SET ); + fgets(linep, LINE_LEN, fp); + return(line); +} + +char *bin_search(char *searchkey, FILE *fp) +{ + int c; + long top, mid, bot, diff; + char *linep, key[KEY_LEN]; + int length; + + diff=666; + linep = line; + line[0] = '\0'; + + fseek(fp, 0L, 2); + top = 0; + bot = ftell(fp); + mid = (bot - top) / 2; + + do { + fseek(fp, mid - 1, 0); + if(mid != 1) + while((c = getc(fp)) != '\n' && c != EOF); + last_bin_search_offset = ftell( fp ); + fgets(linep, LINE_LEN, fp); + length = (int)(strchr(linep, ' ') - linep); + strncpy(key, linep, length); + key[length] = '\0'; + if(strcmp(key, searchkey) < 0) { + top = mid; + diff = (bot - top) / 2; + mid = top + diff; + } + if(strcmp(key, searchkey) > 0) { + bot = mid; + diff = (bot - top) / 2; + mid = top + diff; + } + } while((strcmp(key, searchkey)) && (diff != 0)); + + if(!strcmp(key, searchkey)) + return(line); + else + return(NULL); +} + +static long offset; + +static int bin_search_key(char *searchkey, FILE *fp) +{ + int c; + long top, mid, bot, diff; + char *linep, key[KEY_LEN]; + int length, offset1, offset2; + + /* do binary search to find correct place in file to insert line */ + + diff=666; + linep = line; + line[0] = '\0'; + + fseek(fp, 0L, 2); + top = 0; + bot = ftell(fp); + if (bot == 0) { + offset = 0; + return(0); /* empty file */ + } + mid = (bot - top) / 2; + + /* If only one line in file, don't work through loop */ + + length = 0; + rewind(fp); + while((c = getc(fp)) != '\n' && c != EOF) + line[length++] = c; + if (getc(fp) == EOF) { /* only 1 line in file */ + length = (int)(strchr(linep, ' ') - linep); + strncpy(key, linep, length); + key[length] = '\0'; + if(strcmp(key, searchkey) > 0) { + offset = 0; + return(0); /* line with key is not found */ + } else if (strcmp(key, searchkey) < 0) { + offset = ftell(fp); + return(0); /* line with key is not found */ + } else { + offset = 0; + return(1); /* line with key is found */ + } + } + + do { + fseek(fp, mid - 1, 0); + if(mid != 1) + while((c = getc(fp)) != '\n' && c != EOF); + offset1 = ftell(fp); /* offset at start of line */ + if (fgets(linep, LINE_LEN, fp) != NULL) { + offset2 = ftell(fp); /* offset at start of next line */ + length = (int)(strchr(linep, ' ') - linep); + strncpy(key, linep, length); + key[length] = '\0'; + if(strcmp(key, searchkey) < 0) { /* further in file */ + top = mid; + diff = (bot - top) / 2; + mid = top + diff; + offset = offset2; + } + if(strcmp(key, searchkey) > 0) { /* earlier in file */ + bot = mid; + diff = (bot - top) / 2; + mid = top + diff; + offset = offset1; + } + } else { + bot = mid; + diff = (bot - top) / 2; + mid = top + diff; + } + } while((strcmp(key, searchkey)) && (diff != 0)); + + if(!strcmp(key, searchkey)) { + offset = offset1; /* get to start of current line */ + return(1); /* line with key is found */ + } else + return(0); /* line with key is not found */ +} + +/* Copy contents from one file to another. */ + +void copyfile(FILE *fromfp, FILE *tofp) +{ + int c; + + while ((c = getc(fromfp)) != EOF) + putc(c, tofp); +} + +/* Function to replace a line in a file. Returns the original line, + or NULL in case of error. */ + +char *replace_line(char *new_line, char *searchkey, FILE *fp) +{ + FILE *tfp; /* temporary file pointer */ + + if (!bin_search_key(searchkey, fp)) + return(NULL); /* line with key not found */ + + if ((tfp = tmpfile()) == NULL) + return(NULL); /* could not create temp file */ + fseek(fp, offset, 0); + fgets(line, LINE_LEN, fp); /* read original */ + copyfile(fp, tfp); + if (fseek(fp, offset, 0) == -1) + return(NULL); /* could not seek to offset */ + fprintf(fp, new_line); /* write line */ + rewind(tfp); + copyfile(tfp, fp); + + fclose(tfp); + fflush(fp); + + return(line); +} + +/* Find location to insert line at in file. If line with this + key is already in file, return NULL. */ + +char *insert_line(char *new_line, char *searchkey, FILE *fp) +{ + FILE *tfp; + + if (bin_search_key(searchkey, fp)) + return(NULL); + + if ((tfp = tmpfile()) == NULL) + return(NULL); /* could not create temp file */ + if (fseek(fp, offset, 0) == -1) + return(NULL); /* could not seek to offset */ + copyfile(fp, tfp); + if (fseek(fp, offset, 0) == -1) + return(NULL); /* could not seek to offset */ + fprintf(fp, new_line); /* write line */ + rewind(tfp); + copyfile(tfp, fp); + + fclose(tfp); + fflush(fp); + + return(new_line); +} diff --git a/dtm_release/local/lib/morph.c b/dtm_release/local/lib/morph.c new file mode 100644 index 0000000000000000000000000000000000000000..ffc6bb67307d95a6eeef84fa38abab7ce3d3ebfd --- /dev/null +++ b/dtm_release/local/lib/morph.c @@ -0,0 +1,469 @@ +/* + + morph.c - WordNet search code morphology functions + +*/ + +#include <stdio.h> +#include <ctype.h> +#include <string.h> +#include <stdlib.h> +#include "wn.h" + +#ifdef _WINDOWS +#include <windows.h> +#include <windowsx.h> +#define EXCFILE "%s\\%s.exc" +#else +#define EXCFILE "%s/%s.exc" +#endif + +static char *Id = "$Id: morph.c,v 1.66 2005/03/18 18:14:24 wn Exp $"; + +static char *sufx[] ={ + /* Noun suffixes */ + "s", "ses", "xes", "zes", "ches", "shes", "men", "ies", + /* Verb suffixes */ + "s", "ies", "es", "es", "ed", "ed", "ing", "ing", + /* Adjective suffixes */ + "er", "est", "er", "est" +}; + +static char *addr[] ={ + /* Noun endings */ + "", "s", "x", "z", "ch", "sh", "man", "y", + /* Verb endings */ + "", "y", "e", "", "e", "", "e", "", + /* Adjective endings */ + "", "", "e", "e" +}; + +static int offsets[NUMPARTS] = { 0, 0, 8, 16 }; +static int cnts[NUMPARTS] = { 0, 8, 8, 4 }; +static char msgbuf[256]; + +#define NUMPREPS 15 + +static struct { + char *str; + int strlen; +} prepositions[NUMPREPS] = { + "to", 2, + "at", 2, + "of", 2, + "on", 2, + "off", 3, + "in", 2, + "out", 3, + "up", 2, + "down", 4, + "from", 4, + "with", 4, + "into", 4, + "for", 3, + "about", 5, + "between", 7, +}; + +static FILE *exc_fps[NUMPARTS + 1]; + +static int do_init(); +static int strend(char *, char *); +static char *wordbase(char *, int); +static int hasprep(char *, int); +static char *exc_lookup(char *, int); +static char *morphprep(char *); + +/* Open exception list files */ + +int morphinit(void) +{ + static int done = 0; + static int openerr = 0; + + if (!done) { + if (OpenDB) { /* make sure WN database files are open */ + if (!(openerr = do_init())) + done = 1; + } else + openerr = -1; + } + + return(openerr); +} + +/* Close exception list files and reopen */ +int re_morphinit(void) +{ + int i; + + for (i = 1; i <= NUMPARTS; i++) { + if (exc_fps[i] != NULL) { + fclose(exc_fps[i]); exc_fps[i] = NULL; + } + } + + return(OpenDB ? do_init() : -1); +} + +static int do_init(void) +{ + int i, openerr; +#ifdef _WINDOWS + HKEY hkey; + DWORD dwType, dwSize; +#else + char *env; +#endif + char searchdir[256], fname[256]; + + openerr = 0; + + /* Find base directory for database. If set, use WNSEARCHDIR. + If not set, check for WNHOME/dict, otherwise use DEFAULTPATH. */ + +#ifdef _WINDOWS + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Software\\WordNet\\2.1"), + 0, KEY_READ, &hkey) == ERROR_SUCCESS) { + dwSize = sizeof(searchdir); + RegQueryValueEx(hkey, TEXT("WNHome"), + NULL, &dwType, searchdir, &dwSize); + RegCloseKey(hkey); + strcat(searchdir, DICTDIR); + } + else if (RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Software\\WordNet\\2.1"), + 0, KEY_READ, &hkey) == ERROR_SUCCESS) { + dwSize = sizeof(searchdir); + RegQueryValueEx(hkey, TEXT("WNHome"), + NULL, &dwType, searchdir, &dwSize); + RegCloseKey(hkey); + strcat(searchdir, DICTDIR); + } else + sprintf(searchdir, DEFAULTPATH); +#else + if ((env = getenv("WNSEARCHDIR")) != NULL) + strcpy(searchdir, env); + else if ((env = getenv("WNHOME")) != NULL) + sprintf(searchdir, "%s%s", env, DICTDIR); + else + strcpy(searchdir, DEFAULTPATH); +#endif + + for (i = 1; i <= NUMPARTS; i++) { + sprintf(fname, EXCFILE, searchdir, partnames[i]); + if ((exc_fps[i] = fopen(fname, "r")) == NULL) { + sprintf(msgbuf, + "WordNet library error: Can't open exception file(%s)\n\n", + fname); + display_message(msgbuf); + openerr = -1; + } + } + return(openerr); +} + +/* Try to find baseform (lemma) of word or collocation in POS. + Works like strtok() - first call is with string, subsequent calls + with NULL argument return additional baseforms for original string. */ + +char *morphstr(char *origstr, int pos) +{ + static char searchstr[WORDBUF], str[WORDBUF]; + static int svcnt, svprep; + char word[WORDBUF], *tmp; + int cnt, st_idx = 0, end_idx; + int prep; + char *end_idx1, *end_idx2; + char *append; + + if (pos == SATELLITE) + pos = ADJ; + + /* First time through for this string */ + + if (origstr != NULL) { + /* Assume string hasn't had spaces substitued with '_' */ + strtolower(strsubst(strcpy(str, origstr), ' ', '_')); + searchstr[0] = '\0'; + cnt = cntwords(str, '_'); + svprep = 0; + + /* first try exception list */ + + if ((tmp = exc_lookup(str, pos)) && strcmp(tmp, str)) { + svcnt = 1; /* force next time to pass NULL */ + return(tmp); + } + + /* Then try simply morph on original string */ + + if (pos != VERB && (tmp = morphword(str, pos)) && strcmp(tmp, str)) + return(tmp); + + if (pos == VERB && cnt > 1 && (prep = hasprep(str, cnt))) { + /* assume we have a verb followed by a preposition */ + svprep = prep; + return(morphprep(str)); + } else { + svcnt = cnt = cntwords(str, '-'); + while (origstr && --cnt) { + end_idx1 = strchr(str + st_idx, '_'); + end_idx2 = strchr(str + st_idx, '-'); + if (end_idx1 && end_idx2) { + if (end_idx1 < end_idx2) { + end_idx = (int)(end_idx1 - str); + append = "_"; + } else { + end_idx = (int)(end_idx2 - str); + append = "-"; + } + } else { + if (end_idx1) { + end_idx = (int)(end_idx1 - str); + append = "_"; + } else { + end_idx = (int)(end_idx2 - str); + append = "-"; + } + } + if (end_idx < 0) return(NULL); /* shouldn't do this */ + strncpy(word, str + st_idx, end_idx - st_idx); + word[end_idx - st_idx] = '\0'; + if(tmp = morphword(word, pos)) + strcat(searchstr,tmp); + else + strcat(searchstr,word); + strcat(searchstr, append); + st_idx = end_idx + 1; + } + + if(tmp = morphword(strcpy(word, str + st_idx), pos)) + strcat(searchstr,tmp); + else + strcat(searchstr,word); + if(strcmp(searchstr, str) && is_defined(searchstr,pos)) + return(searchstr); + else + return(NULL); + } + } else { /* subsequent call on string */ + if (svprep) { /* if verb has preposition, no more morphs */ + svprep = 0; + return(NULL); + } else if (svcnt == 1) + return(exc_lookup(NULL, pos)); + else { + svcnt = 1; + if ((tmp = exc_lookup(str, pos)) && strcmp(tmp, str)) + return(tmp); + else + return(NULL); + } + } +} + +/* Try to find baseform (lemma) of individual word in POS */ +char *morphword(char *word, int pos) +{ + int offset, cnt; + int i; + static char retval[WORDBUF]; + char *tmp, tmpbuf[WORDBUF], *end; + + sprintf(retval,""); + sprintf(tmpbuf, ""); + end = ""; + + if(word == NULL) + return(NULL); + + /* first look for word on exception list */ + + if((tmp = exc_lookup(word, pos)) != NULL) + return(tmp); /* found it in exception list */ + + if (pos == ADV) { /* only use exception list for adverbs */ + return(NULL); + } + if (pos == NOUN) { + if (strend(word, "ful")) { + cnt = strrchr(word, 'f') - word; + strncat(tmpbuf, word, cnt); + end = "ful"; + } else + /* check for noun ending with 'ss' or short words */ + if (strend(word, "ss") || (strlen(word) <= 2)) + return(NULL); + } + +/* If not in exception list, try applying rules from tables */ + + if (tmpbuf[0] == '\0') + strcpy(tmpbuf, word); + + offset = offsets[pos]; + cnt = cnts[pos]; + + for(i = 0; i < cnt; i++){ + strcpy(retval, wordbase(tmpbuf, (i + offset))); + if(strcmp(retval, tmpbuf) && is_defined(retval, pos)) { + strcat(retval, end); + return(retval); + } + } + return(NULL); +} + +static int strend(char *str1, char *str2) +{ + char *pt1; + + if(strlen(str2) >= strlen(str1)) + return(0); + else { + pt1=str1; + pt1=strchr(str1,0); + pt1=pt1-strlen(str2); + return(!strcmp(pt1,str2)); + } +} + +static char *wordbase(char *word, int ender) +{ + char *pt1; + static char copy[WORDBUF]; + + strcpy(copy, word); + if(strend(copy,sufx[ender])) { + pt1=strchr(copy,'\0'); + pt1 -= strlen(sufx[ender]); + *pt1='\0'; + strcat(copy,addr[ender]); + } + return(copy); +} + +static int hasprep(char *s, int wdcnt) +{ + /* Find a preposition in the verb string and return its + corresponding word number. */ + + int i, wdnum; + + for (wdnum = 2; wdnum <= wdcnt; wdnum++) { + s = strchr(s, '_'); + for (s++, i = 0; i < NUMPREPS; i++) + if (!strncmp(s, prepositions[i].str, prepositions[i].strlen) && + (s[prepositions[i].strlen] == '_' || + s[prepositions[i].strlen] == '\0')) + return(wdnum); + } + return(0); +} + +static char *exc_lookup(char *word, int pos) +{ + static char line[WORDBUF], *beglp, *endlp; + char *excline; + int found = 0; + + if (exc_fps[pos] == NULL) + return(NULL); + + /* first time through load line from exception file */ + if(word != NULL){ + if ((excline = bin_search(word, exc_fps[pos])) != NULL) { + strcpy(line, excline); + endlp = strchr(line,' '); + } else + endlp = NULL; + } + if(endlp && *(endlp + 1) != ' '){ + beglp = endlp + 1; + while(*beglp && *beglp == ' ') beglp++; + endlp = beglp; + while(*endlp && *endlp != ' ' && *endlp != '\n') endlp++; + if(endlp != beglp){ + *endlp='\0'; + return(beglp); + } + } + beglp = NULL; + endlp = NULL; + return(NULL); +} + +static char *morphprep(char *s) +{ + char *rest, *exc_word, *lastwd = NULL, *last; + int i, offset, cnt; + char word[WORDBUF], end[WORDBUF]; + static char retval[WORDBUF]; + + /* Assume that the verb is the first word in the phrase. Strip it + off, check for validity, then try various morphs with the + rest of the phrase tacked on, trying to find a match. */ + + rest = strchr(s, '_'); + last = strrchr(s, '_'); + if (rest != last) { /* more than 2 words */ + if (lastwd = morphword(last + 1, NOUN)) { + strncpy(end, rest, last - rest + 1); + end[last-rest+1] = '\0'; + strcat(end, lastwd); + } + } + + strncpy(word, s, rest - s); + word[rest - s] = '\0'; + for (i = 0, cnt = strlen(word); i < cnt; i++) + if (!isalnum((unsigned char)(word[i]))) return(NULL); + + offset = offsets[VERB]; + cnt = cnts[VERB]; + + /* First try to find the verb in the exception list */ + + if ((exc_word = exc_lookup(word, VERB)) && + strcmp(exc_word, word)) { + + sprintf(retval, "%s%s", exc_word, rest); + if(is_defined(retval, VERB)) + return(retval); + else if (lastwd) { + sprintf(retval, "%s%s", exc_word, end); + if(is_defined(retval, VERB)) + return(retval); + } + } + + for (i = 0; i < cnt; i++) { + if ((exc_word = wordbase(word, (i + offset))) && + strcmp(word, exc_word)) { /* ending is different */ + + sprintf(retval, "%s%s", exc_word, rest); + if(is_defined(retval, VERB)) + return(retval); + else if (lastwd) { + sprintf(retval, "%s%s", exc_word, end); + if(is_defined(retval, VERB)) + return(retval); + } + } + } + sprintf(retval, "%s%s", word, rest); + if (strcmp(s, retval)) + return(retval); + if (lastwd) { + sprintf(retval, "%s%s", word, end); + if (strcmp(s, retval)) + return(retval); + } + return(NULL); +} + +/* + * Revision 1.1 91/09/25 15:39:47 wn + * Initial revision + * + */ diff --git a/dtm_release/local/lib/pkgconfig/gsl.pc b/dtm_release/local/lib/pkgconfig/gsl.pc new file mode 100644 index 0000000000000000000000000000000000000000..f14e34b2fd6f55786db3c1970837495a63481b58 --- /dev/null +++ b/dtm_release/local/lib/pkgconfig/gsl.pc @@ -0,0 +1,10 @@ +prefix=/n/fs/grad/jbg/.local +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: GSL +Description: GNU Scientific Library +Version: 1.10 +Libs: -L${exec_prefix}/lib -lgsl -lgslcblas -lm +Cflags: -I${prefix}/include diff --git a/dtm_release/local/lib/search.c b/dtm_release/local/lib/search.c new file mode 100644 index 0000000000000000000000000000000000000000..2d5f33126a30004459e57d05d81d6a0e3974bdb2 --- /dev/null +++ b/dtm_release/local/lib/search.c @@ -0,0 +1,2495 @@ +/* + + search.c - WordNet library of search code + +*/ + +#ifdef _WINDOWS +#include <windows.h> +#include <windowsx.h> +#endif +#include <stdio.h> +#include <ctype.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#include "wn.h" + +static char *Id = "$Id: search.c,v 1.165 2005/02/24 15:36:00 wn Exp $"; + +/* For adjectives, indicates synset type */ + +#define DONT_KNOW 0 +#define DIRECT_ANT 1 /* direct antonyms (cluster head) */ +#define INDIRECT_ANT 2 /* indrect antonyms (similar) */ +#define PERTAINYM 3 /* no antonyms or similars (pertainyms) */ + +/* Flags for printsynset() */ + +#define ALLWORDS 0 /* print all words */ +#define SKIP_ANTS 0 /* skip printing antonyms in printsynset() */ +#define PRINT_ANTS 1 /* print antonyms in printsynset() */ +#define SKIP_MARKER 0 /* skip printing adjective marker */ +#define PRINT_MARKER 1 /* print adjective marker */ + +/* Trace types used by printspaces() to determine print sytle */ + +#define TRACEP 1 /* traceptrs */ +#define TRACEC 2 /* tracecoords() */ +#define TRACEI 3 /* traceinherit() */ + +#define DEFON 1 +#define DEFOFF 0 + +/* Forward function declarations */ + +static void WNOverview(char *, int); +static void findverbgroups(IndexPtr); +static void add_relatives(int, IndexPtr, int, int); +static void free_rellist(void); +static void printsynset(char *, SynsetPtr, char *, int, int, int, int); +static void printantsynset(SynsetPtr, char *, int, int); +static char *printant(int, SynsetPtr, int, char *, char *); +static void printbuffer(char *); +static void printsns(SynsetPtr, int); +static void printsense(SynsetPtr, int); +static void catword(char *, SynsetPtr, int, int, int); +static void printspaces(int, int); +static void printrelatives(IndexPtr, int); +static int HasHoloMero(IndexPtr, int); +static int HasPtr(SynsetPtr, int); +static int getsearchsense(SynsetPtr, int); +static int depthcheck(int, SynsetPtr); +static void interface_doevents(); +static void getexample(char *, char *); +static int findexample(SynsetPtr); + +/* Static variables */ + +static int prflag, sense, prlexid; +static int overflag = 0; /* set when output buffer overflows */ +static char searchbuffer[SEARCHBUF]; +static int lastholomero; /* keep track of last holo/meronym printed */ +#define TMPBUFSIZE 1024*10 +static char tmpbuf[TMPBUFSIZE]; /* general purpose printing buffer */ +static char wdbuf[WORDBUF]; /* general purpose word buffer */ +static char msgbuf[256]; /* buffer for constructing error messages */ +static int adj_marker; + +extern long last_bin_search_offset; + + +/* Find word in index file and return parsed entry in data structure. + Input word must be exact match of string in database. */ + +IndexPtr index_lookup(char *word, int dbase) +{ + IndexPtr idx = NULL; + FILE *fp; + char *line; + + if ((fp = indexfps[dbase]) == NULL) { + sprintf(msgbuf, "WordNet library error: %s indexfile not open\n", + partnames[dbase]); + display_message(msgbuf); + return(NULL); + } + + if ((line = bin_search(word, fp)) != NULL) { + idx = parse_index( last_bin_search_offset, dbase, line); + } + return (idx); +} + +/* This function parses an entry from an index file into an Index data + * structure. It takes the byte offset and file number, and optionally the + * line. If the line is NULL, parse_index will get the line from the file. + * If the line is non-NULL, parse_index won't look at the file, but it still + * needs the dbase and offset parameters to be set, so it can store them in + * the Index struct. + */ + +IndexPtr parse_index(long offset, int dbase, char *line) { + + IndexPtr idx = NULL; + char *ptrtok; + int j; + + if ( !line ) + line = read_index( offset, indexfps[dbase] ); + + idx = (IndexPtr)malloc(sizeof(Index)); + assert(idx); + + /* set offset of entry in index file */ + idx->idxoffset = offset; + + idx->wd='\0'; + idx->pos='\0'; + idx->off_cnt=0; + idx->tagged_cnt = 0; + idx->sense_cnt=0; + idx->offset='\0'; + idx->ptruse_cnt=0; + idx->ptruse='\0'; + + /* get the word */ + ptrtok=strtok(line," \n"); + + idx->wd = malloc(strlen(ptrtok) + 1); + assert(idx->wd); + strcpy(idx->wd, ptrtok); + + /* get the part of speech */ + ptrtok=strtok(NULL," \n"); + idx->pos = malloc(strlen(ptrtok) + 1); + assert(idx->pos); + strcpy(idx->pos, ptrtok); + + /* get the collins count */ + ptrtok=strtok(NULL," \n"); + idx->sense_cnt = atoi(ptrtok); + + /* get the number of pointers types */ + ptrtok=strtok(NULL," \n"); + idx->ptruse_cnt = atoi(ptrtok); + + if (idx->ptruse_cnt) { + idx->ptruse = (int *) malloc(idx->ptruse_cnt * (sizeof(int))); + assert(idx->ptruse); + + /* get the pointers types */ + for(j=0;j < idx->ptruse_cnt; j++) { + ptrtok=strtok(NULL," \n"); + idx->ptruse[j] = getptrtype(ptrtok); + } + } + + /* get the number of offsets */ + ptrtok=strtok(NULL," \n"); + idx->off_cnt = atoi(ptrtok); + + /* get the number of senses that are tagged */ + ptrtok=strtok(NULL," \n"); + idx->tagged_cnt = atoi(ptrtok); + + /* make space for the offsets */ + idx->offset = (long *) malloc(idx->off_cnt * (sizeof(long))); + assert(idx->offset); + + /* get the offsets */ + for(j=0;j<idx->off_cnt;j++) { + ptrtok=strtok(NULL," \n"); + idx->offset[j] = atol(ptrtok); + } + return(idx); +} + +/* 'smart' search of index file. Find word in index file, trying different + techniques - replace hyphens with underscores, replace underscores with + hyphens, strip hyphens and underscores, strip periods. */ + +IndexPtr getindex(char *searchstr, int dbase) +{ + int i, j, k; + char c; + char strings[MAX_FORMS][WORDBUF]; /* vector of search strings */ + static IndexPtr offsets[MAX_FORMS]; + static int offset; + + /* This works like strrok(): if passed with a non-null string, + prepare vector of search strings and offsets. If string + is null, look at current list of offsets and return next + one, or NULL if no more alternatives for this word. */ + + if (searchstr != NULL) { + + offset = 0; + strtolower(searchstr); + for (i = 0; i < MAX_FORMS; i++) { + strcpy(strings[i], searchstr); + offsets[i] = 0; + } + + strsubst(strings[1], '_', '-'); + strsubst(strings[2], '-', '_'); + + /* remove all spaces and hyphens from last search string, then + all periods */ + for (i = j = k = 0; (c = searchstr[i]) != '\0'; i++) { + if (c != '_' && c != '-') + strings[3][j++] = c; + if (c != '.') + strings[4][k++] = c; + } + strings[3][j] = '\0'; + strings[4][k] = '\0'; + + /* Get offset of first entry. Then eliminate duplicates + and get offsets of unique strings. */ + + if (strings[0][0] != NULL) + offsets[0] = index_lookup(strings[0], dbase); + + for (i = 1; i < MAX_FORMS; i++) + if ((strings[i][0]) != NULL && (strcmp(strings[0], strings[i]))) + offsets[i] = index_lookup(strings[i], dbase); + } + + + for (i = offset; i < MAX_FORMS; i++) + if (offsets[i]) { + offset = i + 1; + return(offsets[i]); + } + + return(NULL); +} + +/* Read synset from data file at byte offset passed and return parsed + entry in data structure. */ + +SynsetPtr read_synset(int dbase, long boffset, char *word) +{ + FILE *fp; + + if((fp = datafps[dbase]) == NULL) { + sprintf(msgbuf, "WordNet library error: %s datafile not open\n", + partnames[dbase]); + display_message(msgbuf); + return(NULL); + } + + fseek(fp, boffset, 0); /* position file to byte offset requested */ + + return(parse_synset(fp, dbase, word)); /* parse synset and return */ +} + +/* Read synset at current byte offset in file and return parsed entry + in data structure. */ + +SynsetPtr parse_synset(FILE *fp, int dbase, char *word) +{ + static char line[LINEBUF]; + char tbuf[SMLINEBUF]; + char *ptrtok; + char *tmpptr; + int foundpert = 0; + char wdnum[3]; + int i; + SynsetPtr synptr; + long loc; /* sanity check on file location */ + + loc = ftell(fp); + + if ((tmpptr = fgets(line, LINEBUF, fp)) == NULL) + return(NULL); + + synptr = (SynsetPtr)malloc(sizeof(Synset)); + assert(synptr); + + synptr->hereiam = 0; + synptr->sstype = DONT_KNOW; + synptr->fnum = 0; + synptr->pos = '\0'; + synptr->wcount = 0; + synptr->words = '\0'; + synptr->whichword = 0; + synptr->ptrcount = 0; + synptr->ptrtyp = '\0'; + synptr->ptroff = '\0'; + synptr->ppos = '\0'; + synptr->pto = '\0'; + synptr->pfrm = '\0'; + synptr->fcount = 0; + synptr->frmid = '\0'; + synptr->frmto = '\0'; + synptr->defn = '\0'; + synptr->key = 0; + synptr->nextss = NULL; + synptr->nextform = NULL; + synptr->searchtype = -1; + synptr->ptrlist = NULL; + synptr->headword = NULL; + synptr->headsense = 0; + + ptrtok = line; + + /* looking at offset */ + ptrtok = strtok(line," \n"); + synptr->hereiam = atol(ptrtok); + + /* sanity check - make sure starting file offset matches first field */ + if (synptr->hereiam != loc) { + sprintf(msgbuf, "WordNet library error: no synset at location %d\n", + loc); + display_message(msgbuf); + free(synptr); + return(NULL); + } + + /* looking at FNUM */ + ptrtok = strtok(NULL," \n"); + synptr->fnum = atoi(ptrtok); + + /* looking at POS */ + ptrtok = strtok(NULL, " \n"); + synptr->pos = malloc(strlen(ptrtok) + 1); + assert(synptr->pos); + strcpy(synptr->pos, ptrtok); + if (getsstype(synptr->pos) == SATELLITE) + synptr->sstype = INDIRECT_ANT; + + /* looking at numwords */ + ptrtok = strtok(NULL, " \n"); + synptr->wcount = strtol(ptrtok, NULL, 16); + + synptr->words = (char **)malloc(synptr->wcount * sizeof(char *)); + assert(synptr->words); + synptr->wnsns = (int *)malloc(synptr->wcount * sizeof(int)); + assert(synptr->wnsns); + synptr->lexid = (int *)malloc(synptr->wcount * sizeof(int)); + assert(synptr->lexid); + + for (i = 0; i < synptr->wcount; i++) { + ptrtok = strtok(NULL, " \n"); + synptr->words[i] = malloc(strlen(ptrtok) + 1); + assert(synptr->words[i]); + strcpy(synptr->words[i], ptrtok); + + /* is this the word we're looking for? */ + + if (word && !strcmp(word,strtolower(ptrtok))) + synptr->whichword = i+1; + + ptrtok = strtok(NULL, " \n"); + sscanf(ptrtok, "%x", &synptr->lexid[i]); + } + + /* get the pointer count */ + ptrtok = strtok(NULL," \n"); + synptr->ptrcount = atoi(ptrtok); + + if (synptr->ptrcount) { + + /* alloc storage for the pointers */ + synptr->ptrtyp = (int *)malloc(synptr->ptrcount * sizeof(int)); + assert(synptr->ptrtyp); + synptr->ptroff = (long *)malloc(synptr->ptrcount * sizeof(long)); + assert(synptr->ptroff); + synptr->ppos = (int *)malloc(synptr->ptrcount * sizeof(int)); + assert(synptr->ppos); + synptr->pto = (int *)malloc(synptr->ptrcount * sizeof(int)); + assert(synptr->pto); + synptr->pfrm = (int *)malloc(synptr->ptrcount * sizeof(int)); + assert(synptr->pfrm); + + for(i = 0; i < synptr->ptrcount; i++) { + /* get the pointer type */ + ptrtok = strtok(NULL," \n"); + synptr->ptrtyp[i] = getptrtype(ptrtok); + /* For adjectives, set the synset type if it has a direct + antonym */ + if (dbase == ADJ && synptr->sstype == DONT_KNOW) { + if (synptr->ptrtyp[i] == ANTPTR) + synptr->sstype = DIRECT_ANT; + else if (synptr->ptrtyp[i] == PERTPTR) + foundpert = 1; + } + + /* get the pointer offset */ + ptrtok = strtok(NULL," \n"); + synptr->ptroff[i] = atol(ptrtok); + + /* get the pointer part of speech */ + ptrtok = strtok(NULL, " \n"); + synptr->ppos[i] = getpos(ptrtok); + + /* get the lexp to/from restrictions */ + ptrtok = strtok(NULL," \n"); + + tmpptr = ptrtok; + strncpy(wdnum, tmpptr, 2); + wdnum[2] = '\0'; + synptr->pfrm[i] = strtol(wdnum, (char **)NULL, 16); + + tmpptr += 2; + strncpy(wdnum, tmpptr, 2); + wdnum[2] = '\0'; + synptr->pto[i] = strtol(wdnum, (char **)NULL, 16); + } + } + + /* If synset type is still not set, see if it's a pertainym */ + + if (dbase == ADJ && synptr->sstype == DONT_KNOW && foundpert == 1) + synptr->sstype = PERTAINYM; + + /* retireve optional information from verb synset */ + if(dbase == VERB) { + ptrtok = strtok(NULL," \n"); + synptr->fcount = atoi(ptrtok); + + /* allocate frame storage */ + + synptr->frmid = (int *)malloc(synptr->fcount * sizeof(int)); + assert(synptr->frmid); + synptr->frmto = (int *)malloc(synptr->fcount * sizeof(int)); + assert(synptr->frmto); + + for(i=0;i<synptr->fcount;i++) { + /* skip the frame pointer (+) */ + ptrtok = strtok(NULL," \n"); + + ptrtok = strtok(NULL," \n"); + synptr->frmid[i] = atoi(ptrtok); + + ptrtok = strtok(NULL," \n"); + synptr->frmto[i] = strtol(ptrtok, NULL, 16); + } + } + + /* get the optional definition */ + + ptrtok = strtok(NULL," \n"); + if (ptrtok) { + ptrtok = strtok(NULL," \n"); + sprintf(tbuf, ""); + while (ptrtok != NULL) { + strcat(tbuf,ptrtok); + ptrtok = strtok(NULL, " \n"); + if(ptrtok) + strcat(tbuf," "); + } + assert((1 + strlen(tbuf)) < sizeof(tbuf)); + synptr->defn = malloc(strlen(tbuf) + 4); + assert(synptr->defn); + sprintf(synptr->defn,"(%s)",tbuf); + } + + if (keyindexfp) { /* we have unique keys */ + sprintf(tmpbuf, "%c:%8.8d", partchars[dbase], synptr->hereiam); + synptr->key = GetKeyForOffset(tmpbuf); + } + + /* Can't do earlier - calls indexlookup which messes up strtok calls */ + + for (i = 0; i < synptr->wcount; i++) + synptr->wnsns[i] = getsearchsense(synptr, i + 1); + + return(synptr); +} + +/* Free a synset linked list allocated by findtheinfo_ds() */ + +void free_syns(SynsetPtr synptr) +{ + SynsetPtr cursyn, nextsyn; + + if (synptr) { + cursyn = synptr; + while(cursyn) { + if (cursyn->nextform) + free_syns(cursyn->nextform); + nextsyn = cursyn->nextss; + free_synset(cursyn); + cursyn = nextsyn; + } + } +} + +/* Free a synset */ + +void free_synset(SynsetPtr synptr) +{ + int i; + + free(synptr->pos); + for (i = 0; i < synptr->wcount; i++){ + free(synptr->words[i]); + } + free(synptr->words); + free(synptr->wnsns); + free(synptr->lexid); + if (synptr->ptrcount) { + free(synptr->ptrtyp); + free(synptr->ptroff); + free(synptr->ppos); + free(synptr->pto); + free(synptr->pfrm); + } + if (synptr->fcount) { + free(synptr->frmid); + free(synptr->frmto); + } + if (synptr->defn) + free(synptr->defn); + if (synptr->headword) + free(synptr->headword); + if (synptr->ptrlist) + free_syns(synptr->ptrlist); /* changed from free_synset() */ + free(synptr); +} + +/* Free an index structure */ + +void free_index(IndexPtr idx) +{ + free(idx->wd); + free(idx->pos); + if (idx->ptruse) + free(idx->ptruse); + free(idx->offset); + free(idx); +} + +/* Recursive search algorithm to trace a pointer tree */ + +static void traceptrs(SynsetPtr synptr, int ptrtyp, int dbase, int depth) +{ + int i; + int extraindent = 0; + SynsetPtr cursyn; + char prefix[40], tbuf[20]; + int realptr; + + interface_doevents(); + if (abortsearch) + return; + + if (ptrtyp < 0) { + ptrtyp = -ptrtyp; + extraindent = 2; + } + + for (i = 0; i < synptr->ptrcount; i++) { + if ((ptrtyp == HYPERPTR && (synptr->ptrtyp[i] == HYPERPTR || + synptr->ptrtyp[i] == INSTANCE)) || + (ptrtyp == HYPOPTR && (synptr->ptrtyp[i] == HYPOPTR || + synptr->ptrtyp[i] == INSTANCES)) || + ((synptr->ptrtyp[i] == ptrtyp) && + ((synptr->pfrm[i] == 0) || + (synptr->pfrm[i] == synptr->whichword)))) { + + realptr = synptr->ptrtyp[i]; /* deal with INSTANCE */ + + if(!prflag) { /* print sense number and synset */ + printsns(synptr, sense + 1); + prflag = 1; + } + printspaces(TRACEP, depth + extraindent); + + switch(realptr) { + case PERTPTR: + if (dbase == ADV) + sprintf(prefix, "Derived from %s ", + partnames[synptr->ppos[i]]); + else + sprintf(prefix, "Pertains to %s ", + partnames[synptr->ppos[i]]); + break; + case ANTPTR: + if (dbase != ADJ) + sprintf(prefix, "Antonym of "); + break; + case PPLPTR: + sprintf(prefix, "Participle of verb "); + break; + case INSTANCE: + sprintf(prefix, "INSTANCE OF=> "); + break; + case INSTANCES: + sprintf(prefix, "HAS INSTANCE=> "); + break; + case HASMEMBERPTR: + sprintf(prefix, " HAS MEMBER: "); + break; + case HASSTUFFPTR: + sprintf(prefix, " HAS SUBSTANCE: "); + break; + case HASPARTPTR: + sprintf(prefix, " HAS PART: "); + break; + case ISMEMBERPTR: + sprintf(prefix, " MEMBER OF: "); + break; + case ISSTUFFPTR: + sprintf(prefix, " SUBSTANCE OF: "); + break; + case ISPARTPTR: + sprintf(prefix, " PART OF: "); + break; + default: + sprintf(prefix, "=> "); + break; + } + + /* Read synset pointed to */ + cursyn=read_synset(synptr->ppos[i], synptr->ptroff[i], ""); + + /* For Pertainyms and Participles pointing to a specific + sense, indicate the sense then retrieve the synset + pointed to and other info as determined by type. + Otherwise, just print the synset pointed to. */ + + if ((ptrtyp == PERTPTR || ptrtyp == PPLPTR) && + synptr->pto[i] != 0) { + sprintf(tbuf, " (Sense %d)\n", + cursyn->wnsns[synptr->pto[i] - 1]); + printsynset(prefix, cursyn, tbuf, DEFOFF, synptr->pto[i], + SKIP_ANTS, PRINT_MARKER); + if (ptrtyp == PPLPTR) { /* adjective pointing to verb */ + printsynset(" =>", cursyn, "\n", + DEFON, ALLWORDS, PRINT_ANTS, PRINT_MARKER); + traceptrs(cursyn, HYPERPTR, getpos(cursyn->pos), 0); + } else if (dbase == ADV) { /* adverb pointing to adjective */ + printsynset(" =>", cursyn, "\n",DEFON, ALLWORDS, + ((getsstype(cursyn->pos) == SATELLITE) + ? SKIP_ANTS : PRINT_ANTS), PRINT_MARKER); +#ifdef FOOP + traceptrs(cursyn, HYPERPTR, getpos(cursyn->pos), 0); +#endif + } else { /* adjective pointing to noun */ + printsynset(" =>", cursyn, "\n", + DEFON, ALLWORDS, PRINT_ANTS, PRINT_MARKER); + traceptrs(cursyn, HYPERPTR, getpos(cursyn->pos), 0); + } + } else if (ptrtyp == ANTPTR && dbase != ADJ && synptr->pto[i] != 0) { + sprintf(tbuf, " (Sense %d)\n", + cursyn->wnsns[synptr->pto[i] - 1]); + printsynset(prefix, cursyn, tbuf, DEFOFF, synptr->pto[i], + SKIP_ANTS, PRINT_MARKER); + printsynset(" =>", cursyn, "\n", DEFON, ALLWORDS, + PRINT_ANTS, PRINT_MARKER); + } else + printsynset(prefix, cursyn, "\n", DEFON, ALLWORDS, + PRINT_ANTS, PRINT_MARKER); + + /* For HOLONYMS and MERONYMS, keep track of last one + printed in buffer so results can be truncated later. */ + + if (ptrtyp >= ISMEMBERPTR && ptrtyp <= HASPARTPTR) + lastholomero = strlen(searchbuffer); + + if(depth) { + depth = depthcheck(depth, cursyn); + traceptrs(cursyn, ptrtyp, getpos(cursyn->pos), (depth+1)); + + free_synset(cursyn); + } else + free_synset(cursyn); + } + } +} + +static void tracecoords(SynsetPtr synptr, int ptrtyp, int dbase, int depth) +{ + int i; + SynsetPtr cursyn; + + interface_doevents(); + if (abortsearch) + return; + + for(i = 0; i < synptr->ptrcount; i++) { + if((synptr->ptrtyp[i] == HYPERPTR || synptr->ptrtyp[i] == INSTANCE) && + ((synptr->pfrm[i] == 0) || + (synptr->pfrm[i] == synptr->whichword))) { + + if(!prflag) { + printsns(synptr, sense + 1); + prflag = 1; + } + printspaces(TRACEC, depth); + + cursyn = read_synset(synptr->ppos[i], synptr->ptroff[i], ""); + + printsynset("-> ", cursyn, "\n", DEFON, ALLWORDS, + SKIP_ANTS, PRINT_MARKER); + + traceptrs(cursyn, ptrtyp, getpos(cursyn->pos), depth); + + if(depth) { + depth = depthcheck(depth, cursyn); + tracecoords(cursyn, ptrtyp, getpos(cursyn->pos), (depth+1)); + free_synset(cursyn); + } else + free_synset(cursyn); + } + } +} + +static void traceclassif(SynsetPtr synptr, int dbase, int search) +{ + int i, j, idx; + SynsetPtr cursyn; + long int prlist[1024]; + char head[60]; + int svwnsnsflag; + + interface_doevents(); + if (abortsearch) + return; + + idx = 0; + + for (i = 0; i < synptr->ptrcount; i++) { + if (((synptr->ptrtyp[i] >= CLASSIF_START) && + (synptr->ptrtyp[i] <= CLASSIF_END) && search == CLASSIFICATION) || + + ((synptr->ptrtyp[i] >= CLASS_START) && + (synptr->ptrtyp[i] <= CLASS_END) && search == CLASS) ) { + + if (!prflag) { + printsns(synptr, sense + 1); + prflag = 1; + } + + cursyn = read_synset(synptr->ppos[i], synptr->ptroff[i], ""); + + for (j = 0; j < idx; j++) { + if (synptr->ptroff[i] == prlist[j]) { + break; + } + } + + if (j == idx) { + prlist[idx++] = synptr->ptroff[i]; + printspaces(TRACEP, 0); + + if (synptr->ptrtyp[i] == CLASSIF_CATEGORY) + strcpy(head, "TOPIC->("); + else if (synptr->ptrtyp[i] == CLASSIF_USAGE) + strcpy(head, "USAGE->("); + else if (synptr->ptrtyp[i] == CLASSIF_REGIONAL) + strcpy(head, "REGION->("); + else if (synptr->ptrtyp[i] == CLASS_CATEGORY) + strcpy(head, "TOPIC_TERM->("); + else if (synptr->ptrtyp[i] == CLASS_USAGE) + strcpy(head, "USAGE_TERM->("); + else if (synptr->ptrtyp[i] == CLASS_REGIONAL) + strcpy(head, "REGION_TERM->("); + + strcat(head, partnames[synptr->ppos[i]]); + strcat(head, ") "); + + svwnsnsflag = wnsnsflag; + wnsnsflag = 1; + + printsynset(head, cursyn, "\n", DEFOFF, ALLWORDS, + SKIP_ANTS, SKIP_MARKER); + + wnsnsflag = svwnsnsflag; + } + + free_synset(cursyn); + } + } +} + +static void tracenomins(SynsetPtr synptr, int dbase) +{ + int i, j, idx; + SynsetPtr cursyn; + long int prlist[1024]; + char prefix[40], tbuf[20]; + + interface_doevents(); + if (abortsearch) + return; + + idx = 0; + + for (i = 0; i < synptr->ptrcount; i++) { + if ((synptr->ptrtyp[i] == DERIVATION) && + (synptr->pfrm[i] == synptr->whichword)) { + + if (!prflag) { + printsns(synptr, sense + 1); + prflag = 1; + } + + printspaces(TRACEP, 0); + + sprintf(prefix, "RELATED TO->(%s) ", + partnames[synptr->ppos[i]]); + + cursyn = read_synset(synptr->ppos[i], synptr->ptroff[i], ""); + + sprintf(tbuf, "#%d\n", + cursyn->wnsns[synptr->pto[i] - 1]); + printsynset(prefix, cursyn, tbuf, DEFOFF, synptr->pto[i], + SKIP_ANTS, SKIP_MARKER); + + /* only print synset once, even if more than one link */ + + for (j = 0; j < idx; j++) { +#ifdef FOOP + if (synptr->ptroff[i] == prlist[j]) { + break; + } +#endif + } + + if (j == idx) { + prlist[idx++] = synptr->ptroff[i]; + printspaces(TRACEP, 2); + printsynset("=> ", cursyn, "\n", DEFON, ALLWORDS, + SKIP_ANTS, PRINT_MARKER); + } + + free_synset(cursyn); + } + } +} + +/* Trace through the hypernym tree and print all MEMBER, STUFF + and PART info. */ + +static void traceinherit(SynsetPtr synptr, int ptrbase, int dbase, int depth) +{ + int i; + SynsetPtr cursyn; + + interface_doevents(); + if (abortsearch) + return; + + for(i=0;i<synptr->ptrcount;i++) { + if((synptr->ptrtyp[i] == HYPERPTR) && + ((synptr->pfrm[i] == 0) || + (synptr->pfrm[i] == synptr->whichword))) { + + if(!prflag) { + printsns(synptr, sense + 1); + prflag = 1; + } + printspaces(TRACEI, depth); + + cursyn = read_synset(synptr->ppos[i], synptr->ptroff[i], ""); + + printsynset("=> ", cursyn, "\n", DEFON, ALLWORDS, + SKIP_ANTS, PRINT_MARKER); + + traceptrs(cursyn, ptrbase, NOUN, depth); + traceptrs(cursyn, ptrbase + 1, NOUN, depth); + traceptrs(cursyn, ptrbase + 2, NOUN, depth); + + if(depth) { + depth = depthcheck(depth, cursyn); + traceinherit(cursyn, ptrbase, getpos(cursyn->pos), (depth+1)); + free_synset(cursyn); + } else + free_synset(cursyn); + } + } + + /* Truncate search buffer after last holo/meronym printed */ + searchbuffer[lastholomero] = '\0'; +} + +static void partsall(SynsetPtr synptr, int ptrtyp) +{ + int ptrbase; + int i, hasptr = 0; + + ptrbase = (ptrtyp == HMERONYM) ? HASMEMBERPTR : ISMEMBERPTR; + + /* First, print out the MEMBER, STUFF, PART info for this synset */ + + for (i = 0; i < 3; i++) { + if (HasPtr(synptr, ptrbase + i)) { + traceptrs(synptr, ptrbase + i, NOUN, 1); + hasptr++; + } + interface_doevents(); + if (abortsearch) + return; + } + + /* Print out MEMBER, STUFF, PART info for hypernyms on + HMERONYM search only */ + +/* if (hasptr && ptrtyp == HMERONYM) { */ + if (ptrtyp == HMERONYM) { + lastholomero = strlen(searchbuffer); + traceinherit(synptr, ptrbase, NOUN, 1); + } +} + +static void traceadjant(SynsetPtr synptr) +{ + SynsetPtr newsynptr; + int i, j; + int anttype = DIRECT_ANT; + SynsetPtr simptr, antptr; + static char similar[] = " => "; + + /* This search is only applicable for ADJ synsets which have + either direct or indirect antonyms (not valid for pertainyms). */ + + if (synptr->sstype == DIRECT_ANT || synptr->sstype == INDIRECT_ANT) { + printsns(synptr, sense + 1); + printbuffer("\n"); + + /* if indirect, get cluster head */ + + if(synptr->sstype == INDIRECT_ANT) { + anttype = INDIRECT_ANT; + i = 0; + while (synptr->ptrtyp[i] != SIMPTR) i++; + newsynptr = read_synset(ADJ, synptr->ptroff[i], ""); + } else + newsynptr = synptr; + + /* find antonyms - if direct, make sure that the antonym + ptr we're looking at is from this word */ + + for (i = 0; i < newsynptr->ptrcount; i++) { + + if (newsynptr->ptrtyp[i] == ANTPTR && + ((anttype == DIRECT_ANT && + newsynptr->pfrm[i] == newsynptr->whichword) || + (anttype == INDIRECT_ANT))) { + + /* read the antonym's synset and print it. if a + direct antonym, print it's satellites. */ + + antptr = read_synset(ADJ, newsynptr->ptroff[i], ""); + + if (anttype == DIRECT_ANT) { + printsynset("", antptr, "\n", DEFON, ALLWORDS, + PRINT_ANTS, PRINT_MARKER); + for(j = 0; j < antptr->ptrcount; j++) { + if(antptr->ptrtyp[j] == SIMPTR) { + simptr = read_synset(ADJ, antptr->ptroff[j], ""); + printsynset(similar, simptr, "\n", DEFON, + ALLWORDS, SKIP_ANTS, PRINT_MARKER); + free_synset(simptr); + } + } + } else + printantsynset(antptr, "\n", anttype, DEFON); + + free_synset(antptr); + } + } + if (newsynptr != synptr) + free_synset(newsynptr); + } +} + + +/* Fetch the given example sentence from the example file and print it out */ + +void getexample(char *offset, char *wd) +{ + char *line; + char sentbuf[512]; + + if (vsentfilefp != NULL) { + if (line = bin_search(offset, vsentfilefp)) { + while(*line != ' ') + line++; + + printbuffer(" EX: "); + sprintf(sentbuf, line, wd); + printbuffer(sentbuf); + } + } +} + +/* Find the example sentence references in the example sentence index file */ + +int findexample(SynsetPtr synptr) +{ + char tbuf[256], *temp, *offset; + int wdnum; + int found = 0; + + if (vidxfilefp != NULL) { + wdnum = synptr->whichword - 1; + + sprintf(tbuf,"%s%%%-1.1d:%-2.2d:%-2.2d::", + synptr->words[wdnum], + getpos(synptr->pos), + synptr->fnum, + synptr->lexid[wdnum]); + + if ((temp = bin_search(tbuf, vidxfilefp)) != NULL) { + + /* skip over sense key and get sentence numbers */ + + temp += strlen(synptr->words[wdnum]) + 11; + strcpy(tbuf, temp); + + offset = strtok(tbuf, " ,\n"); + + while (offset) { + getexample(offset, synptr->words[wdnum]); + offset = strtok(NULL, ",\n"); + } + found = 1; + } + } + return(found); +} + +static void printframe(SynsetPtr synptr, int prsynset) +{ + int i; + + if (prsynset) + printsns(synptr, sense + 1); + + if (!findexample(synptr)) { + for(i = 0; i < synptr->fcount; i++) { + if ((synptr->frmto[i] == synptr->whichword) || + (synptr->frmto[i] == 0)) { + if (synptr->frmto[i] == synptr->whichword) + printbuffer(" => "); + else + printbuffer(" *> "); + printbuffer(frametext[synptr->frmid[i]]); + printbuffer("\n"); + } + } + } +} + +static void printseealso(SynsetPtr synptr) +{ + SynsetPtr cursyn; + int i, first = 1; + int svwnsnsflag; + static char firstline[] = " Also See-> "; + static char otherlines[] = "; "; + char *prefix = firstline; + + /* Find all SEEALSO pointers from the searchword and print the + word or synset pointed to. */ + + for(i = 0; i < synptr->ptrcount; i++) { + if ((synptr->ptrtyp[i] == SEEALSOPTR) && + ((synptr->pfrm[i] == 0) || + (synptr->pfrm[i] == synptr->whichword))) { + + cursyn = read_synset(synptr->ppos[i], synptr->ptroff[i], ""); + + svwnsnsflag = wnsnsflag; + wnsnsflag = 1; + printsynset(prefix, cursyn, "", DEFOFF, + synptr->pto[i] == 0 ? ALLWORDS : synptr->pto[i], + SKIP_ANTS, SKIP_MARKER); + wnsnsflag = svwnsnsflag; + + free_synset(cursyn); + + if (first) { + prefix = otherlines; + first = 0; + } + } + } + if (!first) + printbuffer("\n"); +} + +static void freq_word(IndexPtr index) +{ + int familiar=0; + int cnt; + static char *a_an[] = { + "", "a noun", "a verb", "an adjective", "an adverb" }; + static char *freqcats[] = { + "extremely rare","very rare","rare","uncommon","common", + "familiar","very familiar","extremely familiar" + }; + + if(index) { + cnt = index->sense_cnt; + if (cnt == 0) familiar = 0; + if (cnt == 1) familiar = 1; + if (cnt == 2) familiar = 2; + if (cnt >= 3 && cnt <= 4) familiar = 3; + if (cnt >= 5 && cnt <= 8) familiar = 4; + if (cnt >= 9 && cnt <= 16) familiar = 5; + if (cnt >= 17 && cnt <= 32) familiar = 6; + if (cnt > 32 ) familiar = 7; + + sprintf(tmpbuf, + "\n%s used as %s is %s (polysemy count = %d)\n", + index->wd, a_an[getpos(index->pos)], freqcats[familiar], cnt); + printbuffer(tmpbuf); + } +} + +void wngrep (char *word_passed, int pos) { + FILE *inputfile; + char word[256]; + int wordlen, linelen, loc; + char line[1024]; + int count = 0; + + inputfile = indexfps[pos]; + if (inputfile == NULL) { + sprintf (msgbuf, "WordNet library error: Can't perform compounds " + "search because %s index file is not open\n", partnames[pos]); + display_message (msgbuf); + return; + } + rewind(inputfile); + + strcpy (word, word_passed); + ToLowerCase(word); /* map to lower case for index file search */ + strsubst (word, ' ', '_'); /* replace spaces with underscores */ + wordlen = strlen (word); + + while (fgets (line, 1024, inputfile) != NULL) { + for (linelen = 0; line[linelen] != ' '; linelen++) {} + if (linelen < wordlen) + continue; + line[linelen] = '\0'; + strstr_init (line, word); + while ((loc = strstr_getnext ()) != -1) { + if ( + /* at the start of the line */ + (loc == 0) || + /* at the end of the line */ + ((linelen - wordlen) == loc) || + /* as a word in the middle of the line */ + (((line[loc - 1] == '-') || (line[loc - 1] == '_')) && + ((line[loc + wordlen] == '-') || (line[loc + wordlen] == '_'))) + ) { + strsubst (line, '_', ' '); + sprintf (tmpbuf, "%s\n", line); + printbuffer (tmpbuf); + break; + } + } + if (count++ % 2000 == 0) { + interface_doevents (); + if (abortsearch) break; + } + } +} + +/* Stucture to keep track of 'relative groups'. All senses in a relative + group are displayed together at end of search. Transitivity is + supported, so if either of a new set of related senses is already + in a 'relative group', the other sense is added to that group as well. */ + +struct relgrp { + int senses[MAXSENSE]; + struct relgrp *next; +}; +static struct relgrp *rellist; + +static struct relgrp *mkrellist(void); + +/* Simple hash function */ +#define HASHTABSIZE 1223 /* Prime number. Must be > 2*MAXTOPS */ +#define hash(n) ((n) % HASHTABSIZE) + +/* Find relative groups for all senses of target word in given part + of speech. */ + +static void relatives(IndexPtr idx, int dbase) +{ + rellist = NULL; + + switch(dbase) { + + case VERB: + findverbgroups(idx); + interface_doevents(); + if (abortsearch) + break; + printrelatives(idx, VERB); + break; + default: + break; + } + + free_rellist(); +} + +static void findverbgroups(IndexPtr idx) +{ + int i, j, k; + SynsetPtr synset; + + assert(idx); + + /* Read all senses */ + + for (i = 0; i < idx->off_cnt; i++) { + + synset = read_synset(VERB, idx->offset[i], idx->wd); + + /* Look for VERBGROUP ptr(s) for this sense. If found, + create group for senses, or add to existing group. */ + + for (j = 0; j < synset->ptrcount; j++) { + if (synset->ptrtyp[j] == VERBGROUP) { + /* Need to find sense number for ptr offset */ + for (k = 0; k < idx->off_cnt; k++) { + if (synset->ptroff[j] == idx->offset[k]) { + add_relatives(VERB, idx, i, k); + break; + } + } + } + } + free_synset(synset); + } +} + +static void add_relatives(int pos, IndexPtr idx, int rel1, int rel2) +{ + int i; + struct relgrp *rel, *last, *r; + + /* If either of the new relatives are already in a relative group, + then add the other to the existing group (transitivity). + Otherwise create a new group and add these 2 senses to it. */ + + for (rel = rellist; rel; rel = rel->next) { + if (rel->senses[rel1] == 1 || rel->senses[rel2] == 1) { + rel->senses[rel1] = rel->senses[rel2] = 1; + + /* If part of another relative group, merge the groups */ + for (r = rellist; r; r = r->next) { + if (r != rel && + (r->senses[rel1] == 1 || r->senses[rel2] == 1)) { + for (i = 0; i < MAXSENSE; i++) + rel->senses[i] |= r->senses[i]; + } + } + return; + } + last = rel; + } + rel = mkrellist(); + rel->senses[rel1] = rel->senses[rel2] = 1; + if (rellist == NULL) + rellist = rel; + else + last->next = rel; +} + +static struct relgrp *mkrellist(void) +{ + struct relgrp *rel; + int i; + + rel = (struct relgrp *) malloc(sizeof(struct relgrp)); + assert(rel); + for (i = 0; i < MAXSENSE; i++) + rel->senses[i] = 0; + rel->next = NULL; + return(rel); +} + +static void free_rellist(void) +{ + struct relgrp *rel, *next; + + rel = rellist; + while(rel) { + next = rel->next; + free(rel); + rel = next; + } +} + +static void printrelatives(IndexPtr idx, int dbase) +{ + SynsetPtr synptr; + struct relgrp *rel; + int i, flag; + int outsenses[MAXSENSE]; + + for (i = 0; i < idx->off_cnt; i++) + outsenses[i] = 0; + prflag = 1; + + for (rel = rellist; rel; rel = rel->next) { + flag = 0; + for (i = 0; i < idx->off_cnt; i++) { + if (rel->senses[i] && !outsenses[i]) { + flag = 1; + synptr = read_synset(dbase, idx->offset[i], ""); + printsns(synptr, i + 1); + traceptrs(synptr, HYPERPTR, dbase, 0); + outsenses[i] = 1; + free_synset(synptr); + } + } + if (flag) + printbuffer("--------------\n"); + } + + for (i = 0; i < idx->off_cnt; i++) { + if (!outsenses[i]) { + synptr = read_synset(dbase, idx->offset[i], ""); + printsns(synptr, i + 1); + traceptrs(synptr, HYPERPTR, dbase, 0); + printbuffer("--------------\n"); + free_synset(synptr); + } + } +} + +/* + Search code interfaces to WordNet database + + findtheinfo() - print search results and return ptr to output buffer + findtheinfo_ds() - return search results in linked list data structrure +*/ + +char *findtheinfo(char *searchstr, int dbase, int ptrtyp, int whichsense) +{ + SynsetPtr cursyn; + IndexPtr idx = NULL; + int depth = 0; + int i, offsetcnt; + char *bufstart; + unsigned long offsets[MAXSENSE]; + int skipit; + + /* Initializations - + clear output buffer, search results structure, flags */ + + searchbuffer[0] = '\0'; + + wnresults.numforms = wnresults.printcnt = 0; + wnresults.searchbuf = searchbuffer; + wnresults.searchds = NULL; + + abortsearch = overflag = 0; + for (i = 0; i < MAXSENSE; i++) + offsets[i] = 0; + + switch (ptrtyp) { + case OVERVIEW: + WNOverview(searchstr, dbase); + break; + case FREQ: + while ((idx = getindex(searchstr, dbase)) != NULL) { + searchstr = NULL; + wnresults.SenseCount[wnresults.numforms] = idx->off_cnt; + freq_word(idx); + free_index(idx); + wnresults.numforms++; + } + break; + case WNGREP: + wngrep(searchstr, dbase); + break; + case RELATIVES: + case VERBGROUP: + while ((idx = getindex(searchstr, dbase)) != NULL) { + searchstr = NULL; + wnresults.SenseCount[wnresults.numforms] = idx->off_cnt; + relatives(idx, dbase); + free_index(idx); + wnresults.numforms++; + } + break; + default: + + /* If negative search type, set flag for recursive search */ + if (ptrtyp < 0) { + ptrtyp = -ptrtyp; + depth = 1; + } + bufstart = searchbuffer; + offsetcnt = 0; + + /* look at all spellings of word */ + + while ((idx = getindex(searchstr, dbase)) != NULL) { + + searchstr = NULL; /* clear out for next call to getindex() */ + wnresults.SenseCount[wnresults.numforms] = idx->off_cnt; + wnresults.OutSenseCount[wnresults.numforms] = 0; + + /* Print extra sense msgs if looking at all senses */ + if (whichsense == ALLSENSES) + printbuffer( +" \n"); + + /* Go through all of the searchword's senses in the + database and perform the search requested. */ + + for (sense = 0; sense < idx->off_cnt; sense++) { + + if (whichsense == ALLSENSES || whichsense == sense + 1) { + prflag = 0; + + /* Determine if this synset has already been done + with a different spelling. If so, skip it. */ + for (i = 0, skipit = 0; i < offsetcnt && !skipit; i++) { + if (offsets[i] == idx->offset[sense]) + skipit = 1; + } + if (skipit != 1) { + offsets[offsetcnt++] = idx->offset[sense]; + cursyn = read_synset(dbase, idx->offset[sense], idx->wd); + switch(ptrtyp) { + case ANTPTR: + if(dbase == ADJ) + traceadjant(cursyn); + else + traceptrs(cursyn, ANTPTR, dbase, depth); + break; + + case COORDS: + tracecoords(cursyn, HYPOPTR, dbase, depth); + break; + + case FRAMES: + printframe(cursyn, 1); + break; + + case MERONYM: + traceptrs(cursyn, HASMEMBERPTR, dbase, depth); + traceptrs(cursyn, HASSTUFFPTR, dbase, depth); + traceptrs(cursyn, HASPARTPTR, dbase, depth); + break; + + case HOLONYM: + traceptrs(cursyn, ISMEMBERPTR, dbase, depth); + traceptrs(cursyn, ISSTUFFPTR, dbase, depth); + traceptrs(cursyn, ISPARTPTR, dbase, depth); + break; + + case HMERONYM: + partsall(cursyn, HMERONYM); + break; + + case HHOLONYM: + partsall(cursyn, HHOLONYM); + break; + + case SEEALSOPTR: + printseealso(cursyn); + break; + +#ifdef FOOP + case PPLPTR: + traceptrs(cursyn, ptrtyp, dbase, depth); + traceptrs(cursyn, PPLPTR, dbase, depth); + break; +#endif + + case SIMPTR: + case SYNS: + case HYPERPTR: + printsns(cursyn, sense + 1); + prflag = 1; + + traceptrs(cursyn, ptrtyp, dbase, depth); + + if (dbase == ADJ) { + traceptrs(cursyn, PERTPTR, dbase, depth); + traceptrs(cursyn, PPLPTR, dbase, depth); + } else if (dbase == ADV) { + traceptrs(cursyn, PERTPTR, dbase, depth); + } + + if (saflag) /* print SEE ALSO pointers */ + printseealso(cursyn); + + if (dbase == VERB && frflag) + printframe(cursyn, 0); + break; + + case DERIVATION: + tracenomins(cursyn, dbase); + break; + + case CLASSIFICATION: + case CLASS: + traceclassif(cursyn, dbase, ptrtyp); + break; + + default: + traceptrs(cursyn, ptrtyp, dbase, depth); + break; + + } /* end switch */ + + free_synset(cursyn); + + } /* end if (skipit) */ + + } /* end if (whichsense) */ + + if (skipit != 1) { + interface_doevents(); + if ((whichsense == sense + 1) || abortsearch || overflag) + break; /* break out of loop - we're done */ + } + + } /* end for (sense) */ + + /* Done with an index entry - patch in number of senses output */ + + if (whichsense == ALLSENSES) { + i = wnresults.OutSenseCount[wnresults.numforms]; + if (i == idx->off_cnt && i == 1) + sprintf(tmpbuf, "\n1 sense of %s", idx->wd); + else if (i == idx->off_cnt) + sprintf(tmpbuf, "\n%d senses of %s", i, idx->wd); + else if (i > 0) /* printed some senses */ + sprintf(tmpbuf, "\n%d of %d senses of %s", + i, idx->off_cnt, idx->wd); + + /* Find starting offset in searchbuffer for this index + entry and patch string in. Then update bufstart + to end of searchbuffer for start of next index entry. */ + + if (i > 0) { + if (wnresults.numforms > 0) { + bufstart[0] = '\n'; + bufstart++; + } + strncpy(bufstart, tmpbuf, strlen(tmpbuf)); + bufstart = searchbuffer + strlen(searchbuffer); + } + } + + free_index(idx); + + interface_doevents(); + if (overflag || abortsearch) + break; /* break out of while (idx) loop */ + + wnresults.numforms++; + + } /* end while (idx) */ + + } /* end switch */ + + interface_doevents(); + if (abortsearch) + printbuffer("\nSearch Interrupted...\n"); + else if (overflag) + sprintf(searchbuffer, + "Search too large. Narrow search and try again...\n"); + + /* replace underscores with spaces before returning */ + + return(strsubst(searchbuffer, '_', ' ')); +} + +SynsetPtr findtheinfo_ds(char *searchstr, int dbase, int ptrtyp, int whichsense) +{ + IndexPtr idx; + SynsetPtr cursyn; + SynsetPtr synlist = NULL, lastsyn = NULL; + int depth = 0; + int newsense = 0; + + wnresults.numforms = 0; + wnresults.printcnt = 0; + + while ((idx = getindex(searchstr, dbase)) != NULL) { + + searchstr = NULL; /* clear out for next call */ + newsense = 1; + + if(ptrtyp < 0) { + ptrtyp = -ptrtyp; + depth = 1; + } + + wnresults.SenseCount[wnresults.numforms] = idx->off_cnt; + wnresults.OutSenseCount[wnresults.numforms] = 0; + wnresults.searchbuf = NULL; + wnresults.searchds = NULL; + + /* Go through all of the searchword's senses in the + database and perform the search requested. */ + + for(sense = 0; sense < idx->off_cnt; sense++) { + if (whichsense == ALLSENSES || whichsense == sense + 1) { + cursyn = read_synset(dbase, idx->offset[sense], idx->wd); + if (lastsyn) { + if (newsense) + lastsyn->nextform = cursyn; + else + lastsyn->nextss = cursyn; + } + if (!synlist) + synlist = cursyn; + newsense = 0; + + cursyn->searchtype = ptrtyp; + cursyn->ptrlist = traceptrs_ds(cursyn, ptrtyp, + getpos(cursyn->pos), + depth); + + lastsyn = cursyn; + + if (whichsense == sense + 1) + break; + } + } + free_index(idx); + wnresults.numforms++; + + if (ptrtyp == COORDS) { /* clean up by removing hypernym */ + lastsyn = synlist->ptrlist; + synlist->ptrlist = lastsyn->ptrlist; + free_synset(lastsyn); + } + } + wnresults.searchds = synlist; + return(synlist); +} + +/* Recursive search algorithm to trace a pointer tree and return results + in linked list of data structures. */ + +SynsetPtr traceptrs_ds(SynsetPtr synptr, int ptrtyp, int dbase, int depth) +{ + int i; + SynsetPtr cursyn, synlist = NULL, lastsyn = NULL; + int tstptrtyp, docoords; + + /* If synset is a satellite, find the head word of its + head synset and the head word's sense number. */ + + if (getsstype(synptr->pos) == SATELLITE) { + for (i = 0; i < synptr->ptrcount; i++) + if (synptr->ptrtyp[i] == SIMPTR) { + cursyn = read_synset(synptr->ppos[i], + synptr->ptroff[i], + ""); + synptr->headword = malloc(strlen(cursyn->words[0]) + 1); + assert(synptr->headword); + strcpy(synptr->headword, cursyn->words[0]); + synptr->headsense = cursyn->lexid[0]; + free_synset(cursyn); + break; + } + } + + if (ptrtyp == COORDS) { + tstptrtyp = HYPERPTR; + docoords = 1; + } else { + tstptrtyp = ptrtyp; + docoords = 0; + } + + for (i = 0; i < synptr->ptrcount; i++) { + if((synptr->ptrtyp[i] == tstptrtyp) && + ((synptr->pfrm[i] == 0) || + (synptr->pfrm[i] == synptr->whichword))) { + + cursyn=read_synset(synptr->ppos[i], synptr->ptroff[i], ""); + cursyn->searchtype = ptrtyp; + + if (lastsyn) + lastsyn->nextss = cursyn; + if (!synlist) + synlist = cursyn; + lastsyn = cursyn; + + if(depth) { + depth = depthcheck(depth, cursyn); + cursyn->ptrlist = traceptrs_ds(cursyn, ptrtyp, + getpos(cursyn->pos), + (depth+1)); + } else if (docoords) { + cursyn->ptrlist = traceptrs_ds(cursyn, HYPOPTR, NOUN, 0); + } + } + } + return(synlist); +} + +static void WNOverview(char *searchstr, int pos) +{ + SynsetPtr cursyn; + IndexPtr idx = NULL; + char *cpstring = searchstr, *bufstart; + int sense, i, offsetcnt; + int svdflag, skipit; + unsigned long offsets[MAXSENSE]; + + cpstring = searchstr; + bufstart = searchbuffer; + for (i = 0; i < MAXSENSE; i++) + offsets[i] = 0; + offsetcnt = 0; + + while ((idx = getindex(cpstring, pos)) != NULL) { + + cpstring = NULL; /* clear for next call to getindex() */ + wnresults.SenseCount[wnresults.numforms++] = idx->off_cnt; + wnresults.OutSenseCount[wnresults.numforms] = 0; + + printbuffer( +" \n"); + + /* Print synset for each sense. If requested, precede + synset with synset offset and/or lexical file information.*/ + + for (sense = 0; sense < idx->off_cnt; sense++) { + + for (i = 0, skipit = 0; i < offsetcnt && !skipit; i++) + if (offsets[i] == idx->offset[sense]) + skipit = 1; + + if (!skipit) { + offsets[offsetcnt++] = idx->offset[sense]; + cursyn = read_synset(pos, idx->offset[sense], idx->wd); + if (idx->tagged_cnt != -1 && + ((sense + 1) <= idx->tagged_cnt)) { + sprintf(tmpbuf, "%d. (%d) ", + sense + 1, GetTagcnt(idx, sense + 1)); + } else { + sprintf(tmpbuf, "%d. ", sense + 1); + } + + svdflag = dflag; + dflag = 1; + printsynset(tmpbuf, cursyn, "\n", DEFON, ALLWORDS, + SKIP_ANTS, SKIP_MARKER); + dflag = svdflag; + wnresults.OutSenseCount[wnresults.numforms]++; + wnresults.printcnt++; + + free_synset(cursyn); + } + } + + /* Print sense summary message */ + + i = wnresults.OutSenseCount[wnresults.numforms]; + + if (i > 0) { + if (i == 1) + sprintf(tmpbuf, "\nThe %s %s has 1 sense", + partnames[pos], idx->wd); + else + sprintf(tmpbuf, "\nThe %s %s has %d senses", + partnames[pos], idx->wd, i); + if (idx->tagged_cnt > 0) + sprintf(tmpbuf + strlen(tmpbuf), + " (first %d from tagged texts)\n", idx->tagged_cnt); + else if (idx->tagged_cnt == 0) + sprintf(tmpbuf + strlen(tmpbuf), + " (no senses from tagged texts)\n"); + + strncpy(bufstart, tmpbuf, strlen(tmpbuf)); + bufstart = searchbuffer + strlen(searchbuffer); + } else + bufstart[0] = '\0'; + + wnresults.numforms++; + free_index(idx); + } +} + +/* Do requested search on synset passed, returning output in buffer. */ + +char *do_trace(SynsetPtr synptr, int ptrtyp, int dbase, int depth) +{ + searchbuffer[0] = '\0'; /* clear output buffer */ + traceptrs(synptr, ptrtyp, dbase, depth); + return(searchbuffer); +} + +/* Set bit for each search type that is valid for the search word + passed and return bit mask. */ + +unsigned int is_defined(char *searchstr, int dbase) +{ + IndexPtr index; + int i; + unsigned long retval = 0; + + wnresults.numforms = wnresults.printcnt = 0; + wnresults.searchbuf = NULL; + wnresults.searchds = NULL; + + while ((index = getindex(searchstr, dbase)) != NULL) { + searchstr = NULL; /* clear out for next getindex() call */ + + wnresults.SenseCount[wnresults.numforms] = index->off_cnt; + + /* set bits that must be true for all words */ + + retval |= bit(SIMPTR) | bit(FREQ) | bit(SYNS)| + bit(WNGREP) | bit(OVERVIEW); + + /* go through list of pointer characters and set appropriate bits */ + + for(i = 0; i < index->ptruse_cnt; i++) { + + if (index->ptruse[i] <= LASTTYPE) { + retval |= bit(index->ptruse[i]); + } else if (index->ptruse[i] == INSTANCE) { + retval |= bit(HYPERPTR); + } else if (index->ptruse[i] == INSTANCES) { + retval |= bit(HYPOPTR); + } + + if (index->ptruse[i] == SIMPTR) { + retval |= bit(ANTPTR); + } +#ifdef FOOP + + if (index->ptruse[i] >= CLASSIF_START && + index->ptruse[i] <= CLASSIF_END) { + retval |= bit(CLASSIFICATION); + } + + + if (index->ptruse[i] >= CLASS_START && + index->ptruse[i] <= CLASS_END) { + retval |= bit(CLASS); + } +#endif + + if (index->ptruse[i] >= ISMEMBERPTR && + index->ptruse[i] <= ISPARTPTR) + retval |= bit(HOLONYM); + else if (index->ptruse[i] >= HASMEMBERPTR && + index->ptruse[i] <= HASPARTPTR) + retval |= bit(MERONYM); + + } + + if (dbase == NOUN) { + + /* check for inherited holonyms and meronyms */ + + if (HasHoloMero(index, HMERONYM)) + retval |= bit(HMERONYM); + if (HasHoloMero(index, HHOLONYM)) + retval |= bit(HHOLONYM); + + /* if synset has hypernyms, enable coordinate search */ + + if (retval & bit(HYPERPTR)) + retval |= bit(COORDS); + } else if (dbase == VERB) { + + /* if synset has hypernyms, enable coordinate search */ + if (retval & bit(HYPERPTR)) + retval |= bit(COORDS); + + /* enable grouping of related synsets and verb frames */ + + retval |= bit(RELATIVES) | bit(FRAMES); + } + + free_index(index); + wnresults.numforms++; + } + return(retval); +} + +/* Determine if any of the synsets that this word is in have inherited + meronyms or holonyms. */ + +static int HasHoloMero(IndexPtr index, int ptrtyp) +{ + int i, j; + SynsetPtr synset, psynset; + int found=0; + int ptrbase; + + ptrbase = (ptrtyp == HMERONYM) ? HASMEMBERPTR : ISMEMBERPTR; + + for(i = 0; i < index->off_cnt; i++) { + synset = read_synset(NOUN, index->offset[i], ""); + for (j = 0; j < synset->ptrcount; j++) { + if (synset->ptrtyp[j] == HYPERPTR) { + psynset = read_synset(NOUN, synset->ptroff[j], ""); + found += HasPtr(psynset, ptrbase); + found += HasPtr(psynset, ptrbase + 1); + found += HasPtr(psynset, ptrbase + 2); + + free_synset(psynset); + } + } + free_synset(synset); + } + return(found); +} + +static int HasPtr(SynsetPtr synptr, int ptrtyp) +{ + int i; + + for(i = 0; i < synptr->ptrcount; i++) { + if(synptr->ptrtyp[i] == ptrtyp) { + return(1); + } + } + return(0); +} + +/* Set bit for each POS that search word is in. 0 returned if + word is not in WordNet. */ + +unsigned int in_wn(char *word, int pos) +{ + int i; + unsigned int retval = 0; + + if (pos == ALL_POS) { + for (i = 1; i < NUMPARTS + 1; i++) + if (indexfps[i] != NULL && bin_search(word, indexfps[i]) != NULL) + retval |= bit(i); + } else if (indexfps[pos] != NULL && bin_search(word,indexfps[pos]) != NULL) + retval |= bit(pos); + return(retval); +} + +static int depthcheck(int depth, SynsetPtr synptr) +{ + if(depth >= MAXDEPTH) { + sprintf(msgbuf, + "WordNet library error: Error Cycle detected\n %s\n", + synptr->words[0]); + display_message(msgbuf); + depth = -1; /* reset to get one more trace then quit */ + } + return(depth); +} + +/* Strip off () enclosed comments from a word */ + +static char *deadjify(char *word) +{ + char *y; + + adj_marker = UNKNOWN_MARKER; /* default if not adj or unknown */ + + y=word; + while(*y) { + if(*y == '(') { + if (!strncmp(y, "(a)", 3)) + adj_marker = ATTRIBUTIVE; + else if (!strncmp(y, "(ip)", 4)) + adj_marker = IMMED_POSTNOMINAL; + else if (!strncmp(y, "(p)", 3)) + adj_marker = PREDICATIVE; + *y='\0'; + } else + y++; + } + return(word); +} + +static int getsearchsense(SynsetPtr synptr, int whichword) +{ + IndexPtr idx; + int i; + + strsubst(strcpy(wdbuf, synptr->words[whichword - 1]), ' ', '_'); + strtolower(wdbuf); + + if (idx = index_lookup(wdbuf, getpos(synptr->pos))) { + for (i = 0; i < idx->off_cnt; i++) + if (idx->offset[i] == synptr->hereiam) { + free_index(idx); + return(i + 1); + } + free_index(idx); + } + return(0); +} + +static void printsynset(char *head, SynsetPtr synptr, char *tail, int definition, int wdnum, int antflag, int markerflag) +{ + int i, wdcnt; + char tbuf[SMLINEBUF]; + + tbuf[0] = '\0'; /* clear working buffer */ + + strcat(tbuf, head); /* print head */ + + /* Precede synset with additional information as indiecated + by flags */ + + if (offsetflag) /* print synset offset */ + sprintf(tbuf + strlen(tbuf),"{%8.8d} ", synptr->hereiam); + if (fileinfoflag) { /* print lexicographer file information */ + sprintf(tbuf + strlen(tbuf), "<%s> ", lexfiles[synptr->fnum]); + prlexid = 1; /* print lexicographer id after word */ + } else + prlexid = 0; + + if (wdnum) /* print only specific word asked for */ + catword(tbuf, synptr, wdnum - 1, markerflag, antflag); + else /* print all words in synset */ + for(i = 0, wdcnt = synptr->wcount; i < wdcnt; i++) { + catword(tbuf, synptr, i, markerflag, antflag); + if (i < wdcnt - 1) + strcat(tbuf, ", "); + } + + if(definition && dflag && synptr->defn) { + strcat(tbuf," -- "); + strcat(tbuf,synptr->defn); + } + + strcat(tbuf,tail); + printbuffer(tbuf); +} + +static void printantsynset(SynsetPtr synptr, char *tail, int anttype, int definition) +{ + int i, wdcnt; + char tbuf[SMLINEBUF]; + char *str; + int first = 1; + + tbuf[0] = '\0'; + + if (offsetflag) + sprintf(tbuf,"{%8.8d} ", synptr->hereiam); + if (fileinfoflag) { + sprintf(tbuf + strlen(tbuf),"<%s> ", lexfiles[synptr->fnum]); + prlexid = 1; + } else + prlexid = 0; + + /* print anotnyms from cluster head (of indirect ant) */ + + strcat(tbuf, "INDIRECT (VIA "); + for(i = 0, wdcnt = synptr->wcount; i < wdcnt; i++) { + if (first) { + str = printant(ADJ, synptr, i + 1, "%s", ", "); + first = 0; + } else + str = printant(ADJ, synptr, i + 1, ", %s", ", "); + if (*str) + strcat(tbuf, str); + } + strcat(tbuf, ") -> "); + + /* now print synonyms from cluster head (of indirect ant) */ + + for (i = 0, wdcnt = synptr->wcount; i < wdcnt; i++) { + catword(tbuf, synptr, i, SKIP_MARKER, SKIP_ANTS); + if (i < wdcnt - 1) + strcat(tbuf, ", "); + } + + if(dflag && synptr->defn && definition) { + strcat(tbuf," -- "); + strcat(tbuf,synptr->defn); + } + + strcat(tbuf,tail); + printbuffer(tbuf); +} + +static void catword(char *buf, SynsetPtr synptr, int wdnum, int adjmarker, int antflag) +{ + static char vs[] = " (vs. %s)"; + static char *markers[] = { + "", /* UNKNOWN_MARKER */ + "(predicate)", /* PREDICATIVE */ + "(prenominal)", /* ATTRIBUTIVE */ + "(postnominal)", /* IMMED_POSTNOMINAL */ + }; + + /* Copy the word (since deadjify() changes original string), + deadjify() the copy and append to buffer */ + + strcpy(wdbuf, synptr->words[wdnum]); + strcat(buf, deadjify(wdbuf)); + + /* Print additional lexicographer information and WordNet sense + number as indicated by flags */ + + if (prlexid && (synptr->lexid[wdnum] != 0)) + sprintf(buf + strlen(buf), "%d", synptr->lexid[wdnum]); + if (wnsnsflag) + sprintf(buf + strlen(buf), "#%d", synptr->wnsns[wdnum]); + + /* For adjectives, append adjective marker if present, and + print antonym if flag is passed */ + + if (getpos(synptr->pos) == ADJ) { + if (adjmarker == PRINT_MARKER) + strcat(buf, markers[adj_marker]); + if (antflag == PRINT_ANTS) + strcat(buf, printant(ADJ, synptr, wdnum + 1, vs, "")); + } +} + +static char *printant(int dbase, SynsetPtr synptr, int wdnum, char *template, char *tail) +{ + int i, j, wdoff; + SynsetPtr psynptr; + char tbuf[WORDBUF]; + static char retbuf[SMLINEBUF]; + int first = 1; + + retbuf[0] = '\0'; + + /* Go through all the pointers looking for anotnyms from the word + indicated by wdnum. When found, print all the antonym's + antonym pointers which point back to wdnum. */ + + for (i = 0; i < synptr->ptrcount; i++) { + if (synptr->ptrtyp[i] == ANTPTR && synptr->pfrm[i] == wdnum) { + + psynptr = read_synset(dbase, synptr->ptroff[i], ""); + + for (j = 0; j < psynptr->ptrcount; j++) { + if (psynptr->ptrtyp[j] == ANTPTR && + psynptr->pto[j] == wdnum && + psynptr->ptroff[j] == synptr->hereiam) { + + wdoff = (psynptr->pfrm[j] ? (psynptr->pfrm[j] - 1) : 0); + + /* Construct buffer containing formatted antonym, + then add it onto end of return buffer */ + + strcpy(wdbuf, psynptr->words[wdoff]); + strcpy(tbuf, deadjify(wdbuf)); + + /* Print additional lexicographer information and + WordNet sense number as indicated by flags */ + + if (prlexid && (psynptr->lexid[wdoff] != 0)) + sprintf(tbuf + strlen(tbuf), "%d", + psynptr->lexid[wdoff]); + if (wnsnsflag) + sprintf(tbuf + strlen(tbuf), "#%d", + psynptr->wnsns[wdoff]); + if (!first) + strcat(retbuf, tail); + else + first = 0; + sprintf(retbuf + strlen(retbuf), template, tbuf); + } + } + free_synset(psynptr); + } + } + return(retbuf); +} + +static void printbuffer(char *string) +{ + if (overflag) + return; + if (strlen(searchbuffer) + strlen(string) >= SEARCHBUF) + overflag = 1; + else + strcat(searchbuffer, string); +} + +static void printsns(SynsetPtr synptr, int sense) +{ + printsense(synptr, sense); + printsynset("", synptr, "\n", DEFON, ALLWORDS, PRINT_ANTS, PRINT_MARKER); +} + +static void printsense(SynsetPtr synptr, int sense) +{ + char tbuf[256]; + + /* Append lexicographer filename after Sense # if flag is set. */ + + if (fnflag) + sprintf(tbuf,"\nSense %d in file \"%s\"\n", + sense, lexfiles[synptr->fnum]); + else + sprintf(tbuf,"\nSense %d\n", sense); + + printbuffer(tbuf); + + /* update counters */ + wnresults.OutSenseCount[wnresults.numforms]++; + wnresults.printcnt++; +} + +static void printspaces(int trace, int depth) +{ + int j; + + for (j = 0; j < depth; j++) + printbuffer(" "); + + switch(trace) { + case TRACEP: /* traceptrs(), tracenomins() */ + if (depth) + printbuffer(" "); + else + printbuffer(" "); + break; + + case TRACEC: /* tracecoords() */ + if (!depth) + printbuffer(" "); + break; + + case TRACEI: /* traceinherit() */ + if (!depth) + printbuffer("\n "); + break; + } +} + +/* Dummy function to force Tcl/Tk to look at event queue to see of + the user wants to stop the search. */ + +static void interface_doevents (void) { + if (interface_doevents_func != NULL) interface_doevents_func (); +} + +/* + Revision log: (since version 1.5) + + $Log: search.c,v $ + Revision 1.165 2005/02/24 15:36:00 wn + fixed bug - coordinate search was missing INSTANCE pointers + + Revision 1.164 2005/01/27 16:32:32 wn + removed 1.6 stuff and cleaned up #ifdefs + + Revision 1.163 2004/10/25 15:25:18 wn + added instances code + + Revision 1.162 2004/01/12 16:32:52 wn + changed "CATEGORY" to "TOPIC" + + Revision 1.161 2003/06/23 15:52:27 wn + cleaned up format of nomin output + + Revision 1.160 2003/06/05 15:29:45 wn + added pos and sense number for domains + + Revision 1.159 2003/04/15 13:54:16 wn + *** empty log message *** + + Revision 1.158 2003/03/20 19:31:36 wn + removed NOMIN_START/NOMIN_END range and replaced with DERIVATION + + Revision 1.157 2003/02/06 19:01:36 wn + added code to print out word pointed to in derivational links. + + Revision 1.156 2003/02/06 18:03:30 wn + work on classifications + + Revision 1.155 2002/10/29 15:46:27 wn + added CLASSIFICATION code + + Revision 1.154 2002/09/16 15:43:01 wn + allow "grep" string to be in upper case + + Revision 1.153 2002/09/16 15:39:16 wn + *** empty log message *** + + Revision 1.152 2002/03/22 19:39:15 wn + fill in key field in SynsetPtr if key file found + + Revision 1.151 2002/03/07 18:47:52 wn + updates for 1.7.1 + + Revision 1.150 2001/12/04 17:48:21 wn + added test to tracenomins to only print nominalizations of serach + word and not all words in synset + + Revision 1.149 2001/11/27 19:53:24 wn + removed check for version on verb example sentence stuff. only + needed for 1.5 + + Revision 1.148 2001/11/06 18:51:04 wn + fixed bug in getindex when passed "." + added code to skip classification + + Revision 1.147 2001/10/11 18:00:56 wn + fixed bug in free_syns - wasn't freeing synset pointed to by nextform + + Revision 1.146 2001/07/27 14:32:41 wn + fixed order of adjective markers + + Revision 1.145 2001/06/19 15:01:22 wn + commed out include for setutil.h + + Revision 1.144 2001/05/30 16:24:17 wn + changed is_defined to return unsigned int + + Revision 1.143 2001/03/30 17:13:00 wn + fixed is_defined - wasn't setting coords for verbs + + Revision 1.142 2001/03/29 16:18:03 wn + added newline before output from FREQ search + + Revision 1.141 2001/03/29 16:11:39 wn + added code to tractptrs to print direct antonyms nicer + + Revision 1.140 2001/03/27 18:47:41 wn + removed tcflag + + Revision 1.139 2001/03/27 16:47:44 wn + updated is_defined for holonyms and meronyms + + Revision 1.138 2000/08/14 16:04:24 wn + changed 'get_index' to call sub to do work + added code for nominalizations + + Revision 1.137 1998/08/11 18:07:11 wn + minor fixes: free synptr space before rreturning if error; remove + useless statement in free_syns + + * Revision 1.136 1998/08/07 17:51:32 wn + * added COORDS to traceptrs_ds and findtheinfo_ds + * fixed getsearchsense code to only happen in parse_synset + * + * Revision 1.135 1998/08/07 13:04:24 wn + * *** empty log message *** + * + * Revision 1.134 1997/11/07 16:27:36 wn + * cleanup calls to traceptrs + * + * Revision 1.133 1997/10/16 17:13:08 wn + * fixed bug in add_topnode when index == 0 + * + * Revision 1.132 1997/09/05 15:33:18 wn + * change printframes to only print generic frames if specific example not found + * + * Revision 1.131 1997/09/02 16:31:18 wn + * changed includes + * + * Revision 1.130 1997/09/02 14:43:23 wn + * added code to test wnrelease in parse_synset and WNOverview + * + * Revision 1.129 1997/08/29 20:45:25 wn + * added location sanity check on parse_synset + * + * Revision 1.128 1997/08/29 18:35:03 wn + * a bunch of additional cleanups; added code to traceptrs_ds to + * tore wordnet sense number for each word; added wnresults structure; + * terminate holo/mero search at highest level having holo/mero + * + * Revision 1.127 1997/08/28 17:26:46 wn + * Changed "n senses from tagged data" to "n senses from tagged texts" + * in the overview. + * + * Revision 1.126 1997/08/27 13:26:07 wn + * trivial change in wngrep (initialized count to zero) + * + * Revision 1.125 1997/08/26 21:13:14 wn + * Grep now runs quickly because it doesn't call the doevents callback + * after each line of the search. + * + * Revision 1.124 1997/08/26 20:11:23 wn + * massive cleanups to print functions + * + * Revision 1.123 1997/08/26 15:04:18 wn + * I think I got it this time; replaced goto skipit with int skipit flag + * to make compiling easier on the Mac. + * + * Revision 1.122 1997/08/26 14:43:40 wn + * In an effort to avoid compilation errors on the + * Mac caused by the use of a "goto", I had tried to replace it with + * an if block, but had done so improperly. This is the restored version + * from before. Next check-in will have it properly replaced with flags. + * + * Revision 1.121 1997/08/25 15:54:21 wn + * *** empty log message *** + * + * Revision 1.120 1997/08/22 21:06:02 wn + * added code to use wnsnsflag to print wn sense number after each word + * + * Revision 1.119 1997/08/22 20:52:09 wn + * cleaned up findtheinfo and other fns a bit + * + * Revision 1.118 1997/08/21 20:59:20 wn + * grep now uses strstr instead of regexp searches. the old version is + * still there but commented out. + * + * Revision 1.117 1997/08/21 18:41:30 wn + * now eliminates duplicates on search returns, but not yet in overview + * + Revision 1.116 1997/08/13 17:23:45 wn + fixed mac defines + + * Revision 1.115 1997/08/08 20:56:33 wn + * now uses built-in grep + * + * Revision 1.114 1997/08/08 19:15:41 wn + * added code to read attest_cnt field in index file. + * made searchbuffer fixed size + * added WNOverview (OVERVIEW) search + * added offsetflag to print synset offset before synset + * + * Revision 1.113 1997/08/05 14:20:29 wn + * changed printbuffer to not realloc space, removed calls to stopsearch() + * + * Revision 1.112 1997/07/25 17:30:03 wn + * various cleanups for release 1.6 + * + Revision 1.111 1997/07/11 20:20:04 wn + Added interface_doevents code for making searches interruptable in single-threaded environments. + + * Revision 1.110 1997/07/10 19:01:57 wn + * changed evca stuff + * + Revision 1.109 1997/04/22 19:59:08 wn + allow pertainyms to have antonyms + + * Revision 1.108 1996/09/17 20:05:01 wn + * cleaned up EVCA code + * + * Revision 1.107 1996/08/16 18:34:13 wn + * fixed minor bug in findcousins + * + * Revision 1.106 1996/07/17 14:02:17 wn + * Added Kohl's verb example sentences. See getexample() and findExample(). + * + * Revision 1.105 1996/06/14 18:49:49 wn + * upped size of tmpbuf + * + * Revision 1.104 1996/02/08 16:42:30 wn + * added some newlines to separate output and clear out tmpbuf + * so invalid searches return empty string + * + * Revision 1.103 1995/11/30 14:54:53 wn + * added grouped search for verbs + * + * Revision 1.102 1995/07/19 13:17:38 bagyenda + * *** empty log message *** + * + * Revision 1.101 1995/07/18 19:15:30 wn + * *** empty log message *** + * + * Revision 1.100 1995/07/18 18:56:24 bagyenda + * New implementation of grouped searches --Paul. + * + * Revision 1.99 1995/06/30 19:21:23 wn + * added code to findtheinfo_ds to link additional word forms + * onto synset chain + * + * Revision 1.98 1995/06/12 18:33:51 wn + * Minor change to getindex() -- Paul. + * + * Revision 1.97 1995/06/09 14:46:42 wn + * *** empty log message *** + * + * Revision 1.96 1995/06/09 14:32:49 wn + * changed code for PPLPTR and PERTPTR to print synsets pointed to + * + * Revision 1.95 1995/06/01 15:50:34 wn + * cleanup of code dealing with various hyphenations + * + */ diff --git a/dtm_release/local/lib/wnglobal.c b/dtm_release/local/lib/wnglobal.c new file mode 100644 index 0000000000000000000000000000000000000000..f5c745b0ea4db98b97d062500e92547c5acae6dd --- /dev/null +++ b/dtm_release/local/lib/wnglobal.c @@ -0,0 +1,156 @@ +/* + + wnglobal.c - global variables used by various WordNet applications + + $Id: wnglobal.c,v 1.55 2005/01/27 16:34:11 wn Rel $ + +*/ + +#ifndef NULL +#define NULL 0 +#endif + +char *wnrelease = "2.1"; + +/* Lexicographer file names and numbers */ + +char *lexfiles[] = { + "adj.all", /* 0 */ + "adj.pert", /* 1 */ + "adv.all", /* 2 */ + "noun.Tops", /* 3 */ + "noun.act", /* 4 */ + "noun.animal", /* 5 */ + "noun.artifact", /* 6 */ + "noun.attribute", /* 7 */ + "noun.body", /* 8 */ + "noun.cognition", /* 9 */ + "noun.communication", /* 10 */ + "noun.event", /* 11 */ + "noun.feeling", /* 12 */ + "noun.food", /* 13 */ + "noun.group", /* 14 */ + "noun.location", /* 15 */ + "noun.motive", /* 16 */ + "noun.object", /* 17 */ + "noun.person", /* 18 */ + "noun.phenomenon", /* 19 */ + "noun.plant", /* 20 */ + "noun.possession", /* 21 */ + "noun.process", /* 22 */ + "noun.quantity", /* 23 */ + "noun.relation", /* 24 */ + "noun.shape", /* 25 */ + "noun.state", /* 26 */ + "noun.substance", /* 27 */ + "noun.time", /* 28 */ + "verb.body", /* 29 */ + "verb.change", /* 30 */ + "verb.cognition", /* 31 */ + "verb.communication", /* 32 */ + "verb.competition", /* 33 */ + "verb.consumption", /* 34 */ + "verb.contact", /* 35 */ + "verb.creation", /* 36 */ + "verb.emotion", /* 37 */ + "verb.motion", /* 38 */ + "verb.perception", /* 39 */ + "verb.possession", /* 40 */ + "verb.social", /* 41 */ + "verb.stative", /* 42 */ + "verb.weather", /* 43 */ + "adj.ppl", /* 44 */ +}; + +/* Pointer characters and searches */ + +char *ptrtyp[]={ + "", /* 0 not used */ + "!", /* 1 ANTPTR */ + "@", /* 2 HYPERPTR */ + "~", /* 3 HYPOPTR */ + "*", /* 4 ENTAILPTR */ + "&", /* 5 SIMPTR */ + "#m", /* 6 ISMEMBERPTR */ + "#s", /* 7 ISSTUFFPTR */ + "#p", /* 8 ISPARTPTR */ + "%m", /* 9 HASMEMBERPTR */ + "%s", /* 10 HASSTUFFPTR */ + "%p", /* 11 HASPARTPTR */ + "%", /* 12 MERONYM */ + "#", /* 13 HOLONYM */ + ">", /* 14 CAUSETO */ + "<", /* 15 PPLPTR */ + "^", /* 16 SEEALSO */ + "\\", /* 17 PERTPTR */ + "=", /* 18 ATTRIBUTE */ + "$", /* 19 VERBGROUP */ + "+", /* 20 NOMINALIZATIONS */ + ";", /* 21 CLASSIFICATION */ + "-", /* 22 CLASS */ +/* additional searches, but not pointers. */ + "", /* SYNS */ + "", /* FREQ */ + "+", /* FRAMES */ + "", /* COORDS */ + "", /* RELATIVES */ + "", /* HMERONYM */ + "", /* HHOLONYM */ + "", /* WNGREP */ + "", /* OVERVIEW */ + ";c", /* CLASSIF_CATEGORY */ + ";u", /* CLASSIF_USAGE */ + ";r", /* CLASSIF_REGIONAL */ + "-c", /* CLASS_CATEGORY */ + "-u", /* CLASS_USAGE */ + "-r", /* CLASS_REGIONAL */ + "@i", /* INSTANCE */ + "~i", /* INSTANCES */ + NULL, +}; + +char *partnames[]={ "", "noun", "verb", "adj", "adv", NULL }; +char partchars[] = " nvara"; /* add char for satellites to end */ +char *adjclass[] = { "", "(p)", "(a)", "(ip)" }; + +/* Text of verb sentence frames */ + +char *frametext[] = { + "", + "Something ----s", + "Somebody ----s", + "It is ----ing", + "Something is ----ing PP", + "Something ----s something Adjective/Noun", + "Something ----s Adjective/Noun", + "Somebody ----s Adjective", + "Somebody ----s something", + "Somebody ----s somebody", + "Something ----s somebody", + "Something ----s something", + "Something ----s to somebody", + "Somebody ----s on something", + "Somebody ----s somebody something", + "Somebody ----s something to somebody", + "Somebody ----s something from somebody", + "Somebody ----s somebody with something", + "Somebody ----s somebody of something", + "Somebody ----s something on somebody", + "Somebody ----s somebody PP", + "Somebody ----s something PP", + "Somebody ----s PP", + "Somebody's (body part) ----s", + "Somebody ----s somebody to INFINITIVE", + "Somebody ----s somebody INFINITIVE", + "Somebody ----s that CLAUSE", + "Somebody ----s to somebody", + "Somebody ----s to INFINITIVE", + "Somebody ----s whether INFINITIVE", + "Somebody ----s somebody into V-ing something", + "Somebody ----s something with something", + "Somebody ----s INFINITIVE", + "Somebody ----s VERB-ing", + "It ----s that CLAUSE", + "Something ----s INFINITIVE", + "" +}; diff --git a/dtm_release/local/lib/wnhelp.c b/dtm_release/local/lib/wnhelp.c new file mode 100644 index 0000000000000000000000000000000000000000..80ca78e1125185cdcfeb2bda4ac8088c77b92621 --- /dev/null +++ b/dtm_release/local/lib/wnhelp.c @@ -0,0 +1,375 @@ +/* + + wnhelp.c + +*/ + +/* $Id: wnhelp.c,v 1.14 2005/02/01 17:03:46 wn Rel $ */ + +#include "wn.h" + +#ifndef NULL +#define NULL 0 +#endif + +/* Help Strings */ + +static char freq_help[] = /* FREQ */ +"Display familiarity and polysemy information for the search string. \n\ +The polysemy count is the number of senses in WordNet. \n\ +"; + +static char grep_help[] = /* WNGREP */ +"Print all strings in the database containing the search string \n\ +as an individual word, or as the first or last string in a word or \n\ +collocation. \n\ +"; + +static char coord_help[] = /* COORDS */ +"Display the coordinates (sisters) of the search string. This search \n\ +prints the immediate hypernym for each synset that contains the \n\ +search string and the hypernym's immediate `hyponyms'. \n\ +\n\ +Hypernym is the generic term used to designate a whole class of \n\ +specific instances. Y is a hypernym of X if X is a (kind of) Y. \n\ +\n\ +Hyponym is the generic term used to designate a member of a class. \n\ +X is a hyponym of Y if X is a (kind of) Y. \n\ +\n\ +Coordinate words are words that have the same hypernym.\n\ +\n\ +Hypernym synsets are preceded by \"->\", and hyponym synsets are \n\ +preceded by \"=>\". \n\ +"; + +static char hyper_help[] = /* HYPERPTR */ +"Display synonyms and immediate hypernyms of synsets containing \n\ +the search string. Synsets are ordered by frequency of occurrence. \n\ +\n\ +Hypernym is the generic term used to designate a whole class of \n\ +specific instances. Y is a hypernym of X if X is a (kind of) Y. \n\ +\n\ +Hypernym synsets are preceded by \"=>\". \n\ +"; + +static char relatives_help[] = /* RELATIVES */ +"Display synonyms and immediate hypernyms of synsets containing \n\ +the search string. Synsets are grouped by similarity of meaning. \n\ +\n\ +Hypernym is the generic term used to designate a whole class of \n\ +specific instances. Y is a hypernym of X if X is a (kind of) Y. \n\ +\n\ +Hypernym synsets are preceded by \"=>\". \n\ +"; + +static char ant_help[] = /* ANTPTR */ +"Display synsets containing direct anotnyms of the search string. \n\ +\n\ +Direct antonyms are a pair of words between which there is an \n\ +associative bond built up by co-occurrences. \n\ +\n\ +Antonym synsets are preceded by \"=>\". \n\ +"; + +static char hypertree_help[] = /* -HYPERPTR */ +"Recursively display hypernym (superordinate) tree for the search \n\ +string. \n\ +\n\ +Hypernym is the generic term used to designate a whole class of \n\ +specific instances. Y is a hypernym of X if X is a (kind of) Y. \n\ +\n\ +Hypernym synsets are preceded by \"=>\", and are indented from \n\ +the left according to their level in the hierarchy. \n\ +"; + +static char hypo_help[] = /* HYPONYM */ +"Display immediate hyponyms (subordinates) for the search string. \n\ +\n\ +Hyponym is the generic term used to designate a member of a class. \n\ +X is a hyponym of Y if X is a (kind of) Y. \n\ +\n\ +Hyponym synsets are preceded by \"=>\". \n\ +"; + +static char hypotree_help[] = /* -HYPONYM */ +"Display hyponym (subordinate) tree for the search string. This is \n\ +a recursive search that finds the hyponyms of each hyponym. \n\ +\n\ +Hyponym is the generic term used to designate a member of a class. \n\ +X is a hyponym of Y if X is a (kind of) Y. \n\ +\n\ +Hyponym synsets are preceded by \"=>\", and are indented from the left \n\ +according to their level in the hierarchy. \n\ +"; + +static char holo_help[] = /* HOLONYM */ +"Display all holonyms of the search string. \n\ +\n\ +A holonym is the name of the whole of which the 'meronym' names a part. \n\ +Y is a holonym of X if X is a part of Y. \n\ +\n\ +A meronym is the name of a constituent part, the substance of, or a \n\ +member of something. X is a meronym of Y if X is a part of Y. \n\ +\n\ +Holonym synsets are preceded with either the string \"MEMBER OF\", \n\ +\"PART OF\" or \"SUBSTANCE OF\" depending on the specific type of holonym. \n\ +"; + +static char holotree_help[] = /* -HOLONYM */ +"Display holonyms for search string tree. This is a recursive search \n\ +that prints all the holonyms of the search string and all of the \n\ +holonym's holonyms. \n\ +\n\ +A holonym is the name of the whole of which the meronym names a part. \n\ +Y is a holonym of X if X is a part of Y. \n\ +\n\ +A meronym is the name of a constituent part, the substance of, or a \n\ +member of something. X is a meronym of Y if X is a part of Y. \n\ +\n\ +Holonym synsets are preceded with either the string \"MEMBER OF\", \n\ +\"PART OF\" or \"SUBSTANCE OF\" depending on the specific \n\ +type of holonym. Synsets are indented from the left according to \n\ +their level in the hierarchy. \n\ +"; + +static char mero_help[] = /* MERONYM */ +"Display all meronyms of the search string. \n\ +\n\ +A meronym is the name of a constituent part, the substance of, or a \n\ +member of something. X is a meronym of Y if X is a part of Y. \n\ +\n\ +A holonym is the name of the whole of which the meronym names a part. \n\ +Y is a holonym of X if X is a part of Y. \n\ +\n\ +Meronym synsets are preceded with either the string \"HAS MEMBER\", \n\ +\"HAS PART\" or \"HAS SUBSTANCE\" depending on the specific type of holonym. \n\ +"; + +static char merotree_help[] = /* -HMERONYM */ +"Display meronyms for search string tree. This is a recursive search \n\ +the prints all the meronyms of the search string and all of its \n\ +hypernyms. \n\ +\n\ +A meronym is the name of a constituent part, the substance of, or a \n\ +member of something. X is a meronym of Y if X is a part of Y. \n\ +\n\ +A holonym is the name of the whole of which the meronym names a part. \n\ +Y is a holonym of X if X is a part of Y. \n\ +\n\ +Hypernym is the generic term used to designate a whole class of \n\ +specific instances. Y is a hypernym of X if X is a (kind of) Y. \n\ +\n\ +Meronym synsets are preceded with either the string \"HAS MEMBER\", \n\ +\"HAS PART\" or \"HAS SUBSTANCE\" depending on the specific type of \n\ +holonym. Synsets are indented from the left according to their level \n\ +in the hierarchy. \n\ +"; + +static char deriv_help[] = /* DERIVATION */ +"Display derived forms - nouns and verbs that are related morphologically. \n\ +Each related synset is preceeded by its part of speech. Each word in the \n\ +synset is followed by its sense number. \n\ +"; + +static char domain_help[] = /* CLASSIFICATION */ +"Display domain to which this synset belongs. \n\ +\n\ +Each domain synset is preceeded by \"TOPIC\", \"REGION\", or \"USAGE\" to \n\ +distinguish topical, geographic and functional classifications, and \n\ +it's part of speech. Each word is followed by its sense number. \n\ +"; + +static char domainterms_help[] = /* CLASS */ +"Display all synsets belonging to the domain. \n\ +\n\ +Each domain term synset is preceeded by \"TOPIC TERM\", \"REGION TERM\", or \n\ +\"USAGE TERM\" to distinguish topical, geographic and functional classes, \n\ +and its part of speech. Each word is followed by its sense number. \n\ +"; + +static char nattrib_help[] = /* ATTRIBUTE */ +"Display adjectives for which search string is an attribute. \n\ +"; + +static char aattrib_help[] = /* ATTRIBUTE */ +"Display nouns that are attributes of search string. \n\ +"; + +static char tropo_help[] = /* -HYPOPTR */ +"Display hyponym tree for the search string. This is \n\ +a recursive search that finds the hyponyms of each hyponym. \n\ +\n\ +For verbs, hyponyms are refered to as troponyms. Troponyms indicate particular ways \n\ +to perform a function. X is a hyponym of Y if to X is a particular way to Y. \n\ +\n\ +Troponym synsets are preceded by \"=>\", and are indented from the left \n\ +according to their level in the hierarchy. \n\ +"; + +static char entail_help[] = /* ENTAILPTR */ +"Recursively display entailment relations of the search string. \n\ +\n\ +The action represented by the verb X entails Y if X cannot be done \n\ +unless Y is, or has been, done. \n\ +\n\ +Entailment synsets are preceded by \"=>\", and are indented from the left \n\ +according to their level in the hierarchy. \n\ +"; + +static char causeto_help[] = /* CAUSETO */ +"Recursively display CAUSE TO relations of the search string. \n\ +\n\ +The action represented by the verb X causes the action represented by \n\ +the verb Y. \n\ +\n\ +CAUSE TO synsets are preceded by \"=>\", and are indented from the left \n\ +according to their level in the hierarch. \n\ +"; + +static char frames_help[] = /* FRAMES */ +"Display applicable verb sentence frames for the search string. \n\ +\n\ +A frame is a sentence template illustrating the usage of a verb. \n\ +\n\ +Verb sentence frames are preceded with the string \"*>\" if a sentence \n\ +frame is acceptable for all of the words in the synset, and with \"=>\" \n\ +if a sentence frame is acceptable for the search string only. \n\ +\n\ +Some verb senses have example sentences. These are preceeded with \"EX:\". \n\ +"; + +static char *nounhelps[] = { +hyper_help, +relatives_help, +ant_help, +coord_help, +hypertree_help, +hypo_help, +hypotree_help, +holo_help, +holotree_help, +mero_help, +merotree_help, +deriv_help, +nattrib_help, +domain_help, +domainterms_help, +freq_help, +grep_help +}; + +static char *verbhelps[] = { +hyper_help, +relatives_help, +ant_help, +coord_help, +hypertree_help, +tropo_help, +entail_help, +causeto_help, +deriv_help, +frames_help, +domain_help, +domainterms_help, +freq_help, +grep_help + }; + +static char *adjhelps[] = { +/* SIMPTR */ +"Display synonyms and synsets related to synsets containing \n\ +the search string. If the search string is in a head synset \n\ +the 'cluster's' satellite synsets are displayed. If the search \n\ +string is in a satellite synset, its head synset is displayed. \n\ +If the search string is a pertainym the word or synset that it \n\ +pertains to is displayed. \n\ +\n\ +A cluster is a group of adjective synsets that are organized around \n\ +antonymous pairs or triplets. An adjective cluster contains two or more \n\ +head synsets that contan antonyms. Each head synset has one or more \n\ +satellite synsets. \n\ +\n\ +A head synset contains at least one word that has a direct antonym \n\ +in another head synset of the same cluster. \n\ +\n\ +A satellite synset represents a concept that is similar in meaning to \n\ +the concept represented by its head synset. \n\ +\n\ +Direct antonyms are a pair of words between which there is an \n\ +associative bond built up by co-occurrences. \n\ +\n\ +Direct antonyms are printed in parentheses following the adjective. \n\ +The position of an adjective in relation to the noun may be restricted \n\ +to the prenominal, postnominal or predicative position. Where present \n\ +these restrictions are noted in parentheses. \n\ +\n\ +A pertainym is a relational adjective, usually defined by such phrases \n\ +as \"of or pertaining to\" and that does not have an antonym. It pertains \n\ +to a noun or another pertainym. \n\ +\n\ +Senses contained in head synsets are displayed above the satellites, \n\ +which are indented and preceded by \"=>\". Senses contained in \n\ +satellite synsets are displayed with the head synset below. The head \n\ +synset is preceded by \"=>\". \n\ +\n\ +Pertainym senses display the word or synsets that the search string \n\ +pertains to. \n\ +", +/* ANTPTR */ +"Display synsets containing antonyms of the search string. If the \n\ +search string is in a head synset the direct antonym is displayed \n\ +along with the head synset's satellite synsets. If the search \n\ +string is in a satellite synset, its indirect antonym is displayed \n\ +via the head synset \n\ +\n\ +A head synset contains at least one word that has a direct antonym \n\ +in another head synset of the same cluster. \n\ +\n\ +A satellite synset represents a concept that is similar in meaning to \n\ +the concept represented by its head synset. \n\ +\n\ +Direct antonyms are a pair of words between which there is an \n\ +associative bond built up by co-occurrences. \n\ +\n\ +Direct antonyms are printed in parentheses following the adjective. \n\ +The position of an adjective in relation to the noun may be restricted \n\ +to the prenominal, postnominal or predicative position. Where present \n\ +these restrictions are noted in parentheses. \n\ +\n\ +Senses contained in head synsets are displayed, followed by the \n\ +head synset containing the search string's direct antonym and its \n\ +similar synsets, which are indented and preceded by \"=>\". Senses \n\ +contained in satellite synsets are displayed followed by the indirect \n\ +antonym via the satellite's head synset. \n\ +", +aattrib_help, +domain_help, +domainterms_help, +freq_help, +grep_help + +}; + +static char *advhelps[] = { +/* SIMPTR */ +"Display synonyms and synsets related to synsets containing \n\ +the search string. If the search string is a pertainym the word \n\ +or synset that it pertains to is displayed. \n\ +\n\ +A pertainym is a relational adverb that is derived from an adjective. \n\ +\n\ +Pertainym senses display the word that the search string is derived from \n\ +and the adjective synset that contains the word. If the adjective synset \n\ +is a satellite synset, its head synset is also displayed. \n\ +", +ant_help, +domain_help, +domainterms_help, +freq_help, +grep_help +}; + +char **helptext[NUMPARTS + 1] = { + NULL, nounhelps, verbhelps, adjhelps, advhelps +}; + diff --git a/dtm_release/local/lib/wnrtl.c b/dtm_release/local/lib/wnrtl.c new file mode 100644 index 0000000000000000000000000000000000000000..5368d1fffbee33653178aacc69b32aac995fa5a2 --- /dev/null +++ b/dtm_release/local/lib/wnrtl.c @@ -0,0 +1,77 @@ +/* + + wnrtl.c - global variables used by WordNet Run Time Library + +*/ + +#include <stdio.h> +#include "wn.h" + +static char *Id = "$Id: wnrtl.c,v 1.8 2005/01/27 17:33:54 wn Rel $"; + +/* Search code variables and flags */ + +SearchResults wnresults; /* structure containing results of search */ + +int fnflag = 0; /* if set, print lex filename after sense */ +int dflag = 1; /* if set, print definitional glosses */ +int saflag = 1; /* if set, print SEE ALSO pointers */ +int fileinfoflag = 0; /* if set, print lex file info on synsets */ +int frflag = 0; /* if set, print verb frames */ +int abortsearch = 0; /* if set, stop search algorithm */ +int offsetflag = 0; /* if set, print byte offset of each synset */ +int wnsnsflag = 0; /* if set, print WN sense # for each word */ + +/* File pointers for database files */ + +int OpenDB = 0; /* if non-zero, database file are open */ +FILE *datafps[NUMPARTS + 1] = { NULL, NULL, NULL, NULL, NULL } , + *indexfps[NUMPARTS + 1] = { NULL, NULL, NULL, NULL, NULL } , + *sensefp = NULL, + *cntlistfp = NULL, + *keyindexfp = NULL, + *revkeyindexfp = NULL, + *vsentfilefp = NULL, *vidxfilefp = NULL; + +/* Method for interface to check for events while search is running */ + +void (*interface_doevents_func)(void) = NULL; + /* callback function for interruptable searches */ + /* in single-threaded interfaces */ + +/* General error message handler - can be defined by interface. + Default function provided in library returns -1 */ + +int default_display_message(char *); +int (*display_message)(char *) = default_display_message; + +/* + Revsion log: + + $Log: wnrtl.c,v $ + Revision 1.8 2005/01/27 17:33:54 wn + cleaned up includes + + Revision 1.7 2005/01/27 16:31:17 wn + removed cousinfp for 1.6 + + Revision 1.6 2002/03/22 20:29:58 wn + added revkeyindexfp + + Revision 1.5 2001/10/11 18:03:02 wn + initialize keyindexfp + + Revision 1.4 2001/03/27 18:48:15 wn + added cntlistfp + + Revision 1.3 2001/03/13 17:45:48 wn + *** empty log message *** + + Revision 1.2 2000/08/14 16:05:06 wn + added tcflag + + Revision 1.1 1997/09/02 16:31:18 wn + Initial revision + + +*/ diff --git a/dtm_release/local/lib/wnutil.c b/dtm_release/local/lib/wnutil.c new file mode 100644 index 0000000000000000000000000000000000000000..39b176e53c5b2099adac753ed29ca78b9e1b4d7a --- /dev/null +++ b/dtm_release/local/lib/wnutil.c @@ -0,0 +1,729 @@ +/* + + wnutil.c - utility functions used by WordNet code + +*/ + +#ifdef _WINDOWS +#include <windows.h> +#include <windowsx.h> +#endif + +#include <stdio.h> +#include <ctype.h> + +#ifdef __unix__ +#ifndef __MACH__ +#include <malloc.h> +#endif +#endif + +#include <assert.h> +#include <string.h> +#include <stdlib.h> + +#include "wn.h" + +static int do_init(); + +static char msgbuf[256]; /* buffer for constructing error messages */ + +/* used by the strstr wrapper functions */ +static char *strstr_word; +static char *strstr_stringstart; +static char *strstr_stringcurrent; + + +/* Initialization functions */ + +static void closefps(); + +int wninit(void) +{ + static int done = 0; + static int openerr = 0; + char *env; + + if (!done) { + if (env = getenv("WNDBVERSION")) { + wnrelease = strdup(env); /* set release */ + assert(wnrelease); + } + openerr = do_init(); + if (!openerr) { + done = 1; + OpenDB = 1; + openerr = morphinit(); + } + } + + return(openerr); +} + +int re_wninit(void) +{ + int openerr; + char *env; + + closefps(); + + if (env = getenv("WNDBVERSION")) { + wnrelease = strdup(env); /* set release */ + assert(wnrelease); + } + openerr = do_init(); + if (!openerr) { + OpenDB = 1; + openerr = re_morphinit(); + } + + return(openerr); +} + +static void closefps(void) +{ + int i; + + if (OpenDB) { + for (i = 1; i < NUMPARTS + 1; i++) { + if (datafps[i] != NULL) + fclose(datafps[i]); datafps[i] = NULL; + if (indexfps[i] != NULL) + fclose(indexfps[i]); indexfps[i] = NULL; + } + if (sensefp != NULL) { + fclose(sensefp); sensefp = NULL; + } + if (cntlistfp != NULL) { + fclose(cntlistfp); cntlistfp = NULL; + } + if (keyindexfp != NULL) { + fclose(keyindexfp); keyindexfp = NULL; + } + if (vsentfilefp != NULL) { + fclose(vsentfilefp); vsentfilefp = NULL; + } + if (vidxfilefp != NULL) { + fclose(vidxfilefp); vidxfilefp = NULL; + } + OpenDB = 0; + } +} + +static int do_init(void) +{ + int i, openerr; + char searchdir[256], tmpbuf[256]; + +#ifdef _WINDOWS + HKEY hkey; + DWORD dwType, dwSize; +#else + char *env; +#endif + + openerr = 0; + + /* Find base directory for database. If set, use WNSEARCHDIR. + If not set, check for WNHOME/dict, otherwise use DEFAULTPATH. */ + +#ifdef _WINDOWS + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Software\\WordNet\\2.1"), + 0, KEY_READ, &hkey) == ERROR_SUCCESS) { + dwSize = sizeof(searchdir); + RegQueryValueEx(hkey, TEXT("WNHome"), + NULL, &dwType, searchdir, &dwSize); + RegCloseKey(hkey); + strcat(searchdir, DICTDIR); + } else if (RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Software\\WordNet\\2.1"), + 0, KEY_READ, &hkey) == ERROR_SUCCESS) { + dwSize = sizeof(searchdir); + RegQueryValueEx(hkey, TEXT("WNHome"), + NULL, &dwType, searchdir, &dwSize); + RegCloseKey(hkey); + strcat(searchdir, DICTDIR); + } else + sprintf(searchdir, DEFAULTPATH); +#else + if ((env = getenv("WNSEARCHDIR")) != NULL) + strcpy(searchdir, env); + else if ((env = getenv("WNHOME")) != NULL) + sprintf(searchdir, "%s%s", env, DICTDIR); + else + strcpy(searchdir, DEFAULTPATH); +#endif + + for (i = 1; i < NUMPARTS + 1; i++) { + sprintf(tmpbuf, DATAFILE, searchdir, partnames[i]); + if((datafps[i] = fopen(tmpbuf, "r")) == NULL) { + sprintf(msgbuf, + "WordNet library error: Can't open datafile(%s)\n", + tmpbuf); + display_message(msgbuf); + openerr = -1; + } + sprintf(tmpbuf, INDEXFILE, searchdir, partnames[i]); + if((indexfps[i] = fopen(tmpbuf, "r")) == NULL) { + sprintf(msgbuf, + "WordNet library error: Can't open indexfile(%s)\n", + tmpbuf); + display_message(msgbuf); + openerr = -1; + } + } + + /* This file isn't used by the library and doesn't have to + be present. No error is reported if the open fails. */ + + sprintf(tmpbuf, SENSEIDXFILE, searchdir); + sensefp = fopen(tmpbuf, "r"); + + /* If this file isn't present, the runtime code will skip printint out + the number of times each sense was tagged. */ + + sprintf(tmpbuf, CNTLISTFILE, searchdir); + cntlistfp = fopen(tmpbuf, "r"); + + /* This file doesn't have to be present. No error is reported if the + open fails. */ + + sprintf(tmpbuf, KEYIDXFILE, searchdir); + keyindexfp = fopen(tmpbuf, "r"); + + sprintf(tmpbuf, REVKEYIDXFILE, searchdir); + revkeyindexfp = fopen(tmpbuf, "r"); + + sprintf(tmpbuf, VRBSENTFILE, searchdir); + if ((vsentfilefp = fopen(tmpbuf, "r")) == NULL) { + sprintf(msgbuf, +"WordNet library warning: Can't open verb example sentence file(%s)\n", + tmpbuf); + display_message(msgbuf); + } + + sprintf(tmpbuf, VRBIDXFILE, searchdir); + if ((vidxfilefp = fopen(tmpbuf, "r")) == NULL) { + sprintf(msgbuf, +"WordNet library warning: Can't open verb example sentence index file(%s)\n", + tmpbuf); + display_message(msgbuf); + } + + return(openerr); +} + +/* Count the number of underscore or space separated words in a string. */ + +int cntwords(char *s, char separator) +{ + register int wdcnt = 0; + + while (*s) { + if (*s == separator || *s == ' ' || *s == '_') { + wdcnt++; + while (*s && (*s == separator || *s == ' ' || *s == '_')) + s++; + } else + s++; + } + return(++wdcnt); +} + +/* Convert string to lower case remove trailing adjective marker if found */ + +char *strtolower(char *str) +{ + register char *s = str; + + while(*s != '\0') { + if(*s >= 'A' && *s <= 'Z') + *s += 32; + else if(*s == '(') { + *s='\0'; + break; + } + s++; + } + return(str); +} + +/* Convert string passed to lower case */ + +char *ToLowerCase(char *str) +{ + register char *s = str; + + while(*s != '\0') { + if(*s >= 'A' && *s <= 'Z') + *s += 32; + s++; + } + return(str); +} + +/* Replace all occurences of 'from' with 'to' in 'str' */ + +char *strsubst(char *str, char from, char to) +{ + register char *p; + + for (p = str; *p != 0; ++p) + if (*p == from) + *p = to; + return str; +} + +/* Return pointer code for pointer type characer passed. */ + +int getptrtype(char *ptrstr) +{ + register int i; + for(i = 1; i <= MAXPTR; i++) { + if(!strcmp(ptrstr, ptrtyp[i])) + return(i); + } + return(0); +} + +/* Return part of speech code for string passed */ + +int getpos(char *s) +{ + switch (*s) { + case 'n': + return(NOUN); + case 'a': + case 's': + return(ADJ); + case 'v': + return(VERB); + case 'r': + return(ADV); + default: + sprintf(msgbuf, + "WordNet library error: unknown part of speech %s\n", s); + display_message(msgbuf); + exit(-1); + } +} + +/* Return synset type code for string passed. */ + +int getsstype(char *s) +{ + switch (*s) { + case 'n': + return(NOUN); + case 'a': + return(ADJ); + case 'v': + return(VERB); + case 's': + return(SATELLITE); + case 'r': + return(ADV); + default: + sprintf(msgbuf, "WordNet library error: Unknown synset type %s\n", s); + display_message(msgbuf); + exit(-1); + } +} + +/* Pass in string for POS, return corresponding integer value */ + +int StrToPos(char *str) +{ + if (!strcmp(str, "noun")) + return(NOUN); + else if (!strcmp(str, "verb")) + return(VERB); + else if (!strcmp(str, "adj")) + return(ADJ); + else if (!strcmp(str, "adv")) + return(ADV); + else { + return(-1); + } +} + +#define MAX_TRIES 5 + +/* Find string for 'searchstr' as it is in index file */ + +char *GetWNStr(char *searchstr, int dbase) +{ + register int i, j, k, offset = 0; + register char c; + char *underscore = NULL, *hyphen = NULL, *period = NULL; + static char strings[MAX_TRIES][WORDBUF]; + + ToLowerCase(searchstr); + + if (!(underscore = strchr(searchstr, '_')) && + !(hyphen = strchr(searchstr, '-')) && + !(period = strchr(searchstr, '.'))) + return (strcpy(strings[0],searchstr)); + + for(i = 0; i < 3; i++) + strcpy(strings[i], searchstr); + if (underscore != NULL) strsubst(strings[1], '_', '-'); + if (hyphen != NULL) strsubst(strings[2], '-', '_'); + for(i = j = k = 0; (c = searchstr[i]) != '\0'; i++){ + if(c != '_' && c != '-') strings[3][j++] = c; + if(c != '.') strings[4][k++] = c; + } + strings[3][j] = '\0'; + strings[4][k] = '\0'; + + for(i = 1; i < MAX_TRIES; i++) + if(strcmp(strings[0], strings[i]) == 0) strings[i][0] = '\0'; + + for (i = (MAX_TRIES - 1); i >= 0; i--) + if (strings[i][0] != '\0') + if (bin_search(strings[i], indexfps[dbase]) != NULL) + offset = i; + + return(strings[offset]); +} + +/* Return synset for sense key passed. */ + +SynsetPtr GetSynsetForSense(char *sensekey) +{ + long offset; + + /* Pass in sense key and return parsed sysnet structure */ + + if ((offset = GetDataOffset(sensekey))) + return(read_synset(GetPOS(sensekey), + offset, + GetWORD(sensekey))); + else + return(NULL); +} + +/* Find offset of sense key in data file */ + +long GetDataOffset(char *sensekey) +{ + char *line; + + /* Pass in encoded sense string, return byte offset of corresponding + synset in data file. */ + + if (sensefp == NULL) { + display_message("WordNet library error: Sense index file not open\n"); + return(0L); + } + line = bin_search(sensekey, sensefp); + if (line) { + while (*line++ != ' '); + return(atol(line)); + } else + return(0L); +} + +/* Find polysemy count for sense key passed. */ + +int GetPolyCount(char *sensekey) +{ + IndexPtr idx; + int sense_cnt = 0; + + /* Pass in encoded sense string and return polysemy count + for word in corresponding POS */ + + idx = index_lookup(GetWORD(sensekey), GetPOS(sensekey)); + if (idx) { + sense_cnt = idx->sense_cnt; + free_index(idx); + } + return(sense_cnt); +} + +/* Return word part of sense key */ +char *GetWORD(char *sensekey) +{ + static char word[100]; + int i = 0; + + /* Pass in encoded sense string and return WORD */ + + while ((word[i++] = *sensekey++) != '%'); + word[i - 1] = '\0'; + return(word); +} + +/* Return POS code for sense key passed. */ + +int GetPOS(char *sensekey) +{ + int pos; + + /* Pass in encoded sense string and return POS */ + + while (*sensekey++ != '%'); /* skip over WORD */ + sscanf(sensekey, "%1d", &pos); + return(pos == SATELLITE ? ADJ : pos); +} + +/* Reconstruct synset from synset pointer and return ptr to buffer */ + +char *FmtSynset(SynsetPtr synptr, int defn) +{ + int i; + static char synset[SMLINEBUF]; + + synset[0] = '\0'; + + if (fileinfoflag) + sprintf(synset, "<%s> ", lexfiles[synptr->fnum]); + + strcat(synset, "{ "); + for (i = 0; i < (synptr->wcount - 1); i++) + sprintf(synset + strlen(synset), "%s, ", synptr->words[i]); + + strcat(synset, synptr->words[i]); + + if (defn && synptr->defn) + sprintf(synset + strlen(synset), " (%s) ", synptr->defn); + + strcat(synset, " }"); + return(synset); +} + +/* Convert WordNet sense number passed of IndexPtr entry to sense key. */ +char *WNSnsToStr(IndexPtr idx, int sense) +{ + SynsetPtr sptr, adjss; + char sensekey[512], lowerword[256]; + int j, sstype, pos; + + pos = getpos(idx->pos); + sptr = read_synset(pos, idx->offset[sense - 1], ""); + + if ((sstype = getsstype(sptr->pos)) == SATELLITE) { + for (j = 0; j < sptr->ptrcount; j++) { + if (sptr->ptrtyp[j] == SIMPTR) { + adjss = read_synset(sptr->ppos[j],sptr->ptroff[j],""); + sptr->headword = malloc (strlen(adjss->words[0]) + 1); + assert(sptr->headword); + strcpy(sptr->headword, adjss->words[0]); + strtolower(sptr->headword); + sptr->headsense = adjss->lexid[0]; + free_synset(adjss); + break; + } + } + } + + for (j = 0; j < sptr->wcount; j++) { + strcpy(lowerword, sptr->words[j]); + strtolower(lowerword); + if(!strcmp(lowerword, idx->wd)) + break; + } + + if (j == sptr->wcount) { + free_synset(sptr); + return(NULL); + } + + if (sstype == SATELLITE) + sprintf(sensekey,"%s%%%-1.1d:%-2.2d:%-2.2d:%s:%-2.2d", + idx->wd, SATELLITE, sptr->fnum, + sptr->lexid[j], sptr->headword,sptr->headsense); + else + sprintf(sensekey,"%s%%%-1.1d:%-2.2d:%-2.2d::", + idx->wd, pos, sptr->fnum, sptr->lexid[j]); + + free_synset(sptr); + return(strdup(sensekey)); +} + +/* Search for string and/or baseform of word in database and return + index structure for word if found in database. */ + +IndexPtr GetValidIndexPointer(char *word, int pos) +{ + IndexPtr idx; + char *morphword; + + idx = getindex(word, pos); + + if (idx == NULL) { + if ((morphword = morphstr(word, pos)) != NULL) + while (morphword) { + if ((idx = getindex(morphword, pos)) != NULL) break; + morphword = morphstr(NULL, pos); + } + } + return (idx); +} + +/* Return sense number in database for word and lexsn passed. */ + +int GetWNSense(char *word, char *lexsn) +{ + SnsIndexPtr snsidx; + char buf[256]; + + sprintf(buf, "%s%%%s", word, lexsn); /* create sensekey */ + if ((snsidx = GetSenseIndex(buf)) != NULL) + return(snsidx->wnsense); + else + return(0); +} + +/* Return parsed sense index entry for sense key passed. */ + +SnsIndexPtr GetSenseIndex(char *sensekey) +{ + char *line; + char buf[256], loc[9]; + SnsIndexPtr snsidx = NULL; + + if ((line = bin_search(sensekey, sensefp)) != NULL) { + snsidx = (SnsIndexPtr)malloc(sizeof(SnsIndex)); + assert(snsidx); + sscanf(line, "%s %s %d %d\n", + buf, + loc, + &snsidx->wnsense, + &snsidx->tag_cnt); + snsidx->sensekey = malloc(strlen(buf + 1)); + assert(snsidx->sensekey); + strcpy(snsidx->sensekey, buf); + snsidx->loc = atol(loc); + /* Parse out word from sensekey to make things easier for caller */ + snsidx->word = strdup(GetWORD(snsidx->sensekey)); + assert(snsidx->word); + snsidx->nextsi = NULL; + } + return(snsidx); +} + +/* Return number of times sense is tagged */ + +int GetTagcnt(IndexPtr idx, int sense) +{ + char *sensekey, *line; + char buf[256]; + int snum, cnt = 0; + + if (cntlistfp) { + + sensekey = WNSnsToStr(idx, sense); + if ((line = bin_search(sensekey, cntlistfp)) != NULL) { + sscanf(line, "%s %d %d", buf, &snum, &cnt); + } + free(sensekey); + } + + return(cnt); +} + +void FreeSenseIndex(SnsIndexPtr snsidx) +{ + if (snsidx) { + free(snsidx->word); + free(snsidx); + } +} + +char *GetOffsetForKey(unsigned int key) +{ + unsigned int rkey; + char ckey[7]; + static char loc[11] = ""; + char *line; + char searchdir[256], tmpbuf[256]; + + /* Try to open file in case wn_init wasn't called */ + + if (!keyindexfp) { + strcpy(searchdir, SetSearchdir()); + sprintf(tmpbuf, KEYIDXFILE, searchdir); + keyindexfp = fopen(tmpbuf, "r"); + } + if (keyindexfp) { + sprintf(ckey, "%6.6d", key); + if ((line = bin_search(ckey, keyindexfp)) != NULL) { + sscanf(line, "%d %s", &rkey, loc); + return(loc); + } + } + return(NULL); +} + + +unsigned int GetKeyForOffset(char *loc) +{ + unsigned int key; + char rloc[11] = ""; + char *line; + char searchdir[256], tmpbuf[256]; + + /* Try to open file in case wn_init wasn't called */ + + if (!revkeyindexfp) { + strcpy(searchdir, SetSearchdir()); + sprintf(tmpbuf, REVKEYIDXFILE, searchdir); + revkeyindexfp = fopen(tmpbuf, "r"); + } + if (revkeyindexfp) { + if ((line = bin_search(loc, revkeyindexfp)) != NULL) { + sscanf(line, "%s %d", rloc, &key ); + return(key); + } + } + return(0); +} + +char *SetSearchdir() +{ + static char searchdir[256]; + char *env; + + /* Find base directory for database. If set, use WNSEARCHDIR. + If not set, check for WNHOME/dict, otherwise use DEFAULTPATH. */ + + if ((env = getenv("WNSEARCHDIR")) != NULL) + strcpy(searchdir, env); + else if ((env = getenv("WNHOME")) != NULL) + sprintf(searchdir, "%s%s", env, DICTDIR); + else + strcpy(searchdir, DEFAULTPATH); + + return(searchdir); +} + +int default_display_message(char *msg) +{ + return(-1); +} + +/* +** Wrapper functions for strstr that allow you to retrieve each +** occurance of a word within a longer string, not just the first. +** +** strstr_init is called with the same arguments as normal strstr, +** but does not return any value. +** +** strstr_getnext returns the position offset (not a pointer, as does +** normal strstr) of the next occurance, or -1 if none remain. +*/ + +void strstr_init (char *string, char *word) { + strstr_word = word; + strstr_stringstart = string; + strstr_stringcurrent = string; +} + +int strstr_getnext (void) { + char *loc = strstr (strstr_stringcurrent, strstr_word); + if (loc == NULL) return -1; + strstr_stringcurrent = loc + 1; + return (loc - strstr_stringstart); +} + diff --git a/vipra-cmd/src/main/java/de/vipra/cmd/file/DTMFilebase.java b/vipra-cmd/src/main/java/de/vipra/cmd/file/DTMFilebase.java index 828c6fb2b701fe22808acab8a31697b040bde595..facea8ce635771f88a2e6a5c00291c5af8397c7e 100644 --- a/vipra-cmd/src/main/java/de/vipra/cmd/file/DTMFilebase.java +++ b/vipra-cmd/src/main/java/de/vipra/cmd/file/DTMFilebase.java @@ -48,11 +48,14 @@ public class DTMFilebase extends Filebase { for (ArticleFull article : articles) seqindex.add(article.getDate(), vocab.transform(article.getProcessedText())); - // write temp file + // use temp file File modelFileTmp = getModelFile(FILE_NAME + ".tmp"); Iterator<String> lines = null; if (modelFile.exists()) lines = FileUtils.iterateFileLines(modelFile); + + // concatenates the existing model file with new article entries in + // the temp file BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(modelFileTmp))); for (DTMDateIndexEntry e : seqindex) { if (e.exists) { diff --git a/vipra-cmd/src/main/java/de/vipra/cmd/file/DTMSequenceIndex.java b/vipra-cmd/src/main/java/de/vipra/cmd/file/DTMSequenceIndex.java index 2dfe89ec7e4e08daf483bc083eb02dd364829efd..8ce1e0899460d61eefba8838bb72eef7a785b363 100644 --- a/vipra-cmd/src/main/java/de/vipra/cmd/file/DTMSequenceIndex.java +++ b/vipra-cmd/src/main/java/de/vipra/cmd/file/DTMSequenceIndex.java @@ -9,6 +9,7 @@ import java.io.OutputStreamWriter; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.Date; import java.util.HashMap; @@ -88,7 +89,6 @@ public class DTMSequenceIndex implements Closeable, Iterable<DTMSequenceIndex.DT public void close() throws IOException { if (readonly) return; - List<String> windows = new ArrayList<>(); Map<String, Integer> windowSizes = new HashMap<>(); // write date index @@ -101,7 +101,6 @@ public class DTMSequenceIndex implements Closeable, Iterable<DTMSequenceIndex.DT Integer count = windowSizes.get(window); if (count == null) { windowSizes.put(window, 1); - windows.add(window); } else { windowSizes.put(window, count + 1); } @@ -111,13 +110,17 @@ public class DTMSequenceIndex implements Closeable, Iterable<DTMSequenceIndex.DT // write window index File seqFile = new File(file.getParentFile(), FILE_NAME); writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(seqFile, false))); - writer.write(Integer.toString(windows.size())); + writer.write(Integer.toString(windowSizes.size())); writer.write(Constants.LINE_SEP); - Collections.sort(windows); + + // write window sizes + String[] windows = windowSizes.keySet().toArray(new String[windowSizes.size()]); + Arrays.sort(windows); for (String window : windows) { writer.write(Integer.toString(windowSizes.get(window))); writer.write(Constants.LINE_SEP); } + writer.close(); } diff --git a/vipra-cmd/src/main/java/de/vipra/cmd/lda/DTMAnalyzer.java b/vipra-cmd/src/main/java/de/vipra/cmd/lda/DTMAnalyzer.java index 365141a0141c8183513973306331feba8bac9d4f..be8d1af83be6fc039cf609ec8415fc7cad9f1d25 100644 --- a/vipra-cmd/src/main/java/de/vipra/cmd/lda/DTMAnalyzer.java +++ b/vipra-cmd/src/main/java/de/vipra/cmd/lda/DTMAnalyzer.java @@ -7,7 +7,11 @@ import java.io.IOException; import java.io.InputStreamReader; import java.text.ParseException; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -24,7 +28,9 @@ import de.vipra.util.StringUtils; import de.vipra.util.ex.ConfigException; import de.vipra.util.ex.DatabaseException; import de.vipra.util.model.ArticleFull; +import de.vipra.util.model.Sequence; import de.vipra.util.model.TopicFull; +import de.vipra.util.model.TopicRef; import de.vipra.util.model.TopicWord; import de.vipra.util.model.Word; import de.vipra.util.service.MongoService; @@ -126,17 +132,42 @@ public class DTMAnalyzer extends Analyzer { in.close(); p.waitFor(); + // read gam.dat. It contains the topic proportions per article. + // TODO find out what proportions are good for and where to store + // them + + File gamFile = new File(outDir, "gam.dat"); + in = new BufferedReader(new InputStreamReader(new FileInputStream(gamFile))); + + for (int idxArticle = 0; idxArticle < index.size(); idxArticle++) { + double topicTotalProportions = 0; + double[] topicProportions = new double[Constants.K_TOPICS]; + + // gather individual topic proportions and sum of proportions + for (int idxTopic = 0; idxTopic < Constants.K_TOPICS; idxTopic++) { + double topicProportion = Double.parseDouble(in.readLine()); + topicTotalProportions += topicProportion; + topicProportions[idxTopic] = topicProportion; + } + + // normalize proportions + for (int idxTopic = 0; idxTopic < Constants.K_TOPICS; idxTopic++) + topicProportions[idxTopic] /= topicTotalProportions; + + // TODO save topic proportions + } + + in.close(); + + // read topic definition files and create topics + List<TopicFull> newTopics = new ArrayList<>(Constants.K_TOPICS); List<Word> newWords = new ArrayList<>(vocab.size()); int sequencesCount = sequences.size(); - // read topic definition files + // for each topic for (int i = 0; i < Constants.K_TOPICS; i++) { File seqFile = new File(outDirSeq, "topic-" + StringUtils.padNumber(i, 3) + "-var-e-log-prob.dat"); - if (!seqFile.exists()) { - log.error("seq file " + seqFile.getName() + " not found"); - continue; - } int lineCount = FileUtils.countLines(seqFile); int wordsPerSequence = lineCount / sequencesCount; @@ -163,6 +194,8 @@ public class DTMAnalyzer extends Analyzer { in.close(); + List<Sequence> newSequences = new ArrayList<>(sequencesCount); + // go through each sequence and gather all words that are above // the minimum relative word likeliness for (int idxSeq = 0; idxSeq < sequencesCount; idxSeq++) { @@ -175,15 +208,23 @@ public class DTMAnalyzer extends Analyzer { newWords.add(newWord); TopicWord newTopicWord = new TopicWord(newWord, likeliness); newSeqTopicWords.add(newTopicWord); - - // TODO gather words for static topic } } + Collections.sort(newSeqTopicWords, Comparator.reverseOrder()); - // TODO create dynamic topic of sequence + Sequence newSequence = new Sequence(); + newSequence.setNumber(idxSeq); + newSequence.setWords(newSeqTopicWords); + newSequences.add(newSequence); + + // TODO gather words for static topic } - // TODO create static topic + TopicFull newTopic = new TopicFull(); + newTopic.setSequences(newSequences); + newTopics.add(newTopic); + + // TODO add words to static topic } // recreate topics and words @@ -196,31 +237,45 @@ public class DTMAnalyzer extends Analyzer { throw new AnalyzerException(e); } - // read gam.dat. It contains the topic proportions per article. + // create topic references - File gamFile = new File(outDir, "gam.dat"); - if (!gamFile.exists()) { - throw new AnalyzerException("gam file " + gamFile.getName() + " not found"); - } - in = new BufferedReader(new InputStreamReader(new FileInputStream(gamFile))); + File multFile = new File(modelDir, "dtm-mult.dat"); + in = new BufferedReader(new InputStreamReader(new FileInputStream(multFile))); + Pattern wordCountPattern = Pattern.compile("(\\d+):(\\d+)"); + int articleIndex = 0; - for (int idxArticle = 0; idxArticle < index.size(); idxArticle++) { - double topicTotalProportions = 0; - double[] topicProportions = new double[Constants.K_TOPICS]; + // for each article in the model file + while ((line = in.readLine()) != null) { + List<TopicRef> newTopicRefs = new ArrayList<>(); - // gather individual topic proportions and sum of proportions - for (int idxTopic = 0; idxTopic < Constants.K_TOPICS; idxTopic++) { - double topicProportion = Double.parseDouble(in.readLine()); - topicTotalProportions += topicProportion; - topicProportions[idxTopic] = topicProportion; + // extract word:count pairs + Matcher matcher = wordCountPattern.matcher(line); + while (matcher.find()) { + int idxWord = Integer.parseInt(matcher.group(1)); + int wordCount = Integer.parseInt(matcher.group(2)); + + // TODO find topic/s of word, add as reference/s } - // normalize proportions - for (int idxTopic = 0; idxTopic < Constants.K_TOPICS; idxTopic++) - topicProportions[idxTopic] /= topicTotalProportions; + if (!newTopicRefs.isEmpty()) { + Collections.sort(newTopicRefs, Comparator.reverseOrder()); + + // update article with topic references (partial update) + ArticleFull article = new ArticleFull(); + article.setId(index.get(articleIndex++)); + article.setTopics(newTopicRefs); + + try { + // TODO: using field name here. Hard to refactor + dbArticles.updateSingle(article, "topics"); + } catch (DatabaseException e) { + log.error(e); + } + } } - // TODO create topicrefs + // TODO create topic references + } catch (IOException | InterruptedException e) { throw new AnalyzerException(e); } diff --git a/vipra-util/src/main/java/de/vipra/util/model/Sequence.java b/vipra-util/src/main/java/de/vipra/util/model/Sequence.java new file mode 100644 index 0000000000000000000000000000000000000000..23e8fbf06ee52e551602db4a89f0def29a87b6b1 --- /dev/null +++ b/vipra-util/src/main/java/de/vipra/util/model/Sequence.java @@ -0,0 +1,38 @@ +package de.vipra.util.model; + +import java.io.Serializable; +import java.util.List; + +import org.mongodb.morphia.annotations.Embedded; + +@SuppressWarnings("serial") +@Embedded +public class Sequence implements Comparable<Sequence>, Serializable { + + private Integer number; + + @Embedded + private List<TopicWord> words; + + public Integer getNumber() { + return number; + } + + public void setNumber(Integer number) { + this.number = number; + } + + public List<TopicWord> getWords() { + return words; + } + + public void setWords(List<TopicWord> words) { + this.words = words; + } + + @Override + public int compareTo(Sequence o) { + return this.number - o.getNumber(); + } + +} diff --git a/vipra-util/src/main/java/de/vipra/util/model/TopicFull.java b/vipra-util/src/main/java/de/vipra/util/model/TopicFull.java index 177a791d23498b8f363c68e40e7c4b91e4e70bcc..3d89fe1815ec6fff6063d22c894ce0c30c2f4a6f 100644 --- a/vipra-util/src/main/java/de/vipra/util/model/TopicFull.java +++ b/vipra-util/src/main/java/de/vipra/util/model/TopicFull.java @@ -31,6 +31,10 @@ public class TopicFull implements Model<ObjectId>, Serializable { @QueryIgnore(multi = true) private List<TopicWord> words; + @Embedded + @QueryIgnore(multi = true) + private List<Sequence> sequences; + private Date created; private Date modified; @@ -73,6 +77,14 @@ public class TopicFull implements Model<ObjectId>, Serializable { this.words = topicWords; } + public List<Sequence> getSequences() { + return sequences; + } + + public void setSequences(List<Sequence> sequences) { + this.sequences = sequences; + } + public Date getCreated() { return created; }