cdo-2.6.6.1/0000775000175000017500000000000015271332521012616 5ustar alastairalastaircdo-2.6.6.1/libkdtree/0000775000175000017500000000000015271332515014566 5ustar alastairalastaircdo-2.6.6.1/libkdtree/kdtree_spherical.cc0000664000175000017500000004452315271332515020415 0ustar alastairalastair/*!\file kdtree_spherical.c * \brief Routines specific to the 2-dimensional spherical kd-tree * */ #include "kdtree.h" #include "pqueue.h" /* ******************************************************************** general utility functions ********************************************************************* */ inline kdata_t kd_sph_dist(kdata_t *x, kdata_t *y) { if (!x || !y) return -1; return acos(sin(x[1]) * sin(y[1]) + cos(x[1]) * cos(y[1]) * cos(x[0] - y[0])); } inline kdata_t kd_sph_dist_sq(kdata_t *x, kdata_t *y) { if (!x || !y) return -1; /* arg = sqrt(kd_sqr(sin((x[1] - y[1])/2)) + cos(x[1]) * cos(y[1]) * kd_sqr(sin((x[0] - y[0])/2))); ds = 2 * asin(arg); */ return kd_sqr(kd_sph_dist(x, y)); } kdata_t kd_sph_bearing(kdata_t *p1, kdata_t *p2) { kdata_t x = cos(p1[1]) * sin(p2[1]) - sin(p1[1]) * cos(p2[1]) * cos(p2[0] - p1[0]); kdata_t y = sin(p2[0] - p1[0]) * cos(p2[1]); return atan2(y, x); } /*! \brief Compute cross-track distance * \param p1 a point * * \param p2 a second point defining a great circle from p1 * * \param p3 a third point whose distance from the great circle we compute * * \return distance of p3 from the great circle connecting p1 and p2. */ kdata_t kd_sph_xtd(kdata_t *p1, kdata_t *p2, kdata_t *p3) { kdata_t d13 = kd_sph_dist(p1, p3); kdata_t theta13 = kd_sph_bearing(p1, p3); kdata_t theta12 = kd_sph_bearing(p1, p2); return asin(sin(d13) * sin(theta13 - theta12)); } kdata_t kd_sph_orth_dist(kdata_t *p1, kdata_t *p2, int split) { kdata_t ra2, dec2; if (split == 1) { ra2 = p1[0]; dec2 = p2[1]; } else { ra2 = p2[0]; dec2 = p1[1]; } return acos(sin(p1[1]) * sin(dec2) + cos(p1[1]) * cos(dec2) * cos(p1[0] - ra2)); } /* end utility functions */ /* ****************************************************************** Functions for building and destroying trees ******************************************************************** */ /*! \brief build kd-tree structure * * \param points an array of kd_points (struct with position vector * and data container). * * \param nPoints the length of the points array. * * \param min a vector with the minimum positions of the corners of the * hyperrectangle containing the data. * * \param max a vector with the maximum positions of the corners of * the hyperrectangle containing the data. * * \param max_threads the maximal number of threads spawned for * construction of the tree. The threads will be unbalanced if this is * not a power of 2. * * \return root node of the tree */ kdTree_t * kd_sph_buildTree(struct kd_point *points, size_t nPoints, kdata_t *min, kdata_t *max, int max_threads) { kdTree_t *tree = (kdTree_t *) malloc(sizeof(kdTree_t)); #ifdef MEMPOOL tree->nodepool = kd_nodepool_new(nPoints*2); #endif struct kd_thread_data my_data; kd_initArg(&my_data, tree->nodepool, points, nPoints, min, max, 0,max_threads, 2); tree->node = (kdNode *)kd_doBuildTree(&my_data); return tree; } /* end of tree construction and destruction */ /* ******************************************************************* Functions for range searches ******************************************************************* */ /* Returns 1 if node is a point in the hyperrectangle defined by minimum and maximum vectors min and max. */ int kd_sph_isPointInRect(struct kdNode *node, kdata_t *min, kdata_t *max) { if (node == NULL) return 0; if (node->location[1] < min[1] || node->location[1] > max[1]) return 0; if (min[0] < 0 && node->location[0] > M_PI) { if (node->location[0] - 2 * M_PI < min[0] || node->location[0] - 2 * M_PI > max[0]) return 0; } else { if (node->location[0] < min[0] || node->location[0] > max[0]) return 0; } return 1; } /* Returns 1 if the hyperrectangle of node is fully contained within the HR described by the minimum and maximum vectors min and max. Returns 0 otherwise. */ int kd_sph_isRectInRect(struct kdNode *node, kdata_t *min, kdata_t *max) { if (node == NULL) return 0; /* if (min[0] < 0 && node->min[0] > M_PI) { if (node->min[0] - 2 * M_PI < min[0] || node->max[0] > max[0]) return 0; } else { if (node->min[0] < min[0] || node->max[0] > max[0] ) return 0; } if (node->min[1] < min[1] || node->max[1] > max[1]) return 0; */ /* If node is fully contained all corners must be points inside the rectangle */ struct kd_point *point; struct kdNode *tmpNode; point = (kd_point *)kd_malloc(sizeof(kd_point), "kd_point in RectInRect"); point->index = 0; point->point[0] = node->min[0]; point->point[1] = node->min[1]; tmpNode = kd_allocNode(point, 0, point->point, point->point, 0, 2); if (!kd_sph_isPointInRect(tmpNode, min, max)) { kd_doDestroyTree(tmpNode); free(point); return 0; } point->point[0] = node->min[0]; point->point[1] = node->max[1]; tmpNode = kd_allocNode(point, 0, point->point, point->point, 0, 2); if (!kd_sph_isPointInRect(tmpNode, min, max)) { kd_doDestroyTree(tmpNode); free(point); return 0; } point->point[0] = node->max[0]; point->point[1] = node->min[1]; tmpNode = kd_allocNode(point, 0, point->point, point->point, 0, 2); if (!kd_sph_isPointInRect(tmpNode, min, max)) { kd_doDestroyTree(tmpNode); free(point); return 0; } point->point[0] = node->max[0]; point->point[1] = node->max[1]; tmpNode = kd_allocNode(point, 0, point->point, point->point, 0, 2); if (!kd_sph_isPointInRect(tmpNode, min, max)) { kd_doDestroyTree(tmpNode); free(point); return 0; } kd_doDestroyTree(tmpNode); free(point); return 1; } /* Returns 1 if the hyperrectangle of node overlaps the HR described by the minimum and maximum vectors min and max. Returns 0 otherwise. */ int kd_sph_rectOverlapsRect(struct kdNode *node, kdata_t *min, kdata_t *max) { if (node == NULL) return 0; if (node->min[1] > max[1] || node->max[1] < min[1]) return 0; if ((node->min[0]> max[0]) || (node->max[0] < min[0])) return 0; return 1; } /*! * \brief Perform orthogonal range search (get all points in a * hyperrectangle). * * \param node the root node of tree to be searched. * * \param min a vector with the minimum positions of the corners of the * hyperrectangle containing the data. * * \param max a vector with the maximum positions of the corners of * the hyperrectangle containing the data. * * \return Pointer to a priority queue, NULL in case of problems. * * Rectangle must not cross the meridian! */ struct pqueue * kd_sph_ortRangeSearch(struct kdNode *node, kdata_t *min, kdata_t *max) { struct pqueue *res; if ((res = pqinit(NULL, 1)) == NULL) return NULL; if (!kd_sph_doOrtRangeSearch(node, min, max, res)) { for(size_t i = 0; i < res->size; i++) { free(res->d[i]); } free(res->d); free(res); return NULL; } return res; } /* This is the orthogonal range search. Returns 1 if okay, 0 in case of problems. */ int kd_sph_doOrtRangeSearch(struct kdNode *node, kdata_t *min, kdata_t *max, struct pqueue *res) { if (node == NULL) return 1; if (kd_isleaf(node) && kd_sph_isPointInRect(node, min, max)) { return kd_insertResTree(node, res); } else { if (kd_sph_isRectInRect(node->left, min, max)) { if (!kd_insertResTree(node->left, res)) return 0; } else { if (kd_sph_rectOverlapsRect(node->left, min, max)) if (!kd_sph_doOrtRangeSearch(node->left, min, max, res)) return 0; } if (kd_sph_isRectInRect(node->right, min, max)) { if (!kd_insertResTree(node->right, res)) return 0; } else { if (kd_sph_rectOverlapsRect(node->right, min, max)) if (!kd_sph_doOrtRangeSearch(node->right, min, max, res)) return 0; } } return 1; } /*! * \brief Find the nearest neighbor of a point. * * \param node the root node of the tree to be searched. * * \param p a vector to the point whose nearest neighbor is sought. * * \param max_dist_sq the square of the maximum distance to the * nearest neighbor. * * \return A pointer to node containing the nearest neighbor. * max_dist_sq is set to the square of the distance to the nearest * neigbor. */ struct kdNode * kd_sph_nearest(struct kdNode *node, kdata_t *p, kdata_t *max_dist_sq) { struct kdNode *nearer, *further, *nearest, *tmp, *tmp_nearest; kdata_t dist_sq, tmp_dist_sq, dx; kdata_t p1[2], p2[2]; if (!node) return NULL; /* This is a "<" sign, not the kd_sph_lt function because the tree is constructed assuming a Cartesian geometry. */ if (p[node->split] < node->location[node->split]) { nearer = node->left; further = node->right; } else { nearer = node->right; further = node->left; } tmp = kd_sph_nearest(nearer, p, max_dist_sq); if (tmp) nearest = tmp; else nearest = node; dist_sq = kd_sph_dist_sq(nearest->location, p); if (*max_dist_sq > dist_sq) *max_dist_sq = dist_sq; if (!further) return nearest; p1[0] = further->min[0]; p1[1] = further->max[1]; p2[0] = further->max[0]; p2[1] = further->min[1]; if (node->split == 0) /* We need to know the distance between the point p and the vertical lines delineating the rectangle. These lines are great circles so we need to know the cross-track distance. */ dx = kd_min(kd_sqr(kd_sph_xtd(further->min, p1, p)), kd_sqr(kd_sph_xtd(p2, further->max, p))); else /* We need to know the distance between the point p and the horizontal lines delineating the rectangle. Since the latitudes are not great circles, the shortest distance runs along the longitude of point p. */ dx = kd_min(kd_sqr(kd_sph_orth_dist(further->min, p, 1)), kd_sqr(kd_sph_orth_dist(further->max, p, 1))); if (*max_dist_sq > dx) { /* * some part of the further hyper-rectangle is in the search * radius, search the further node */ tmp = kd_sph_nearest(further, p, max_dist_sq); if (tmp) tmp_nearest = tmp; else tmp_nearest = further; tmp_dist_sq = kd_sph_dist_sq(tmp_nearest->location, p); if (tmp_dist_sq < dist_sq) { nearest = tmp_nearest; dist_sq = tmp_dist_sq; *max_dist_sq = kd_min(dist_sq, *max_dist_sq); } } return nearest; } /*! * \brief Return the q nearest-neighbors to a point. * * \param node the root node of the tree to be searched. * * \param p a vector to the point whose nearest neighbors are sought. * * \param max_dist_sq the square of the maximum distance to the * nearest neighbors. * * \param q the maximum number of points to be retured. * * \return A pointer to a priority queue of the points found, or NULL * in case of problems. */ struct pqueue * kd_sph_qnearest(struct kdNode *node, kdata_t *p, kdata_t *max_dist_sq, size_t q) { struct pqueue *res; if ((res = pqinit(NULL, q + 2)) == NULL) return NULL; if (!kd_sph_doQnearest(node, p, max_dist_sq, q + 1, res)) { for(size_t i = 0; i < res->size; i++) { free(res->d[i]); } free(res->d); free(res); return NULL; } return res; } /* * * This is the q nearest-neighbor search. * * This is a modification of the range search in which the maximum * search radius is decreased to the maximum of the queue as soon as * the queue is filled. * * return 1 if okay, zero in case of problems */ int kd_sph_doQnearest(struct kdNode *node, kdata_t *p, kdata_t *max_dist_sq, size_t q, struct pqueue *res) { struct kdNode *nearer, *further; struct resItem *point, *item; kdata_t dist_sq, dx; kdata_t p1[2], p2[2]; if (!node) return 1; dist_sq = kd_sph_dist_sq(node->location, p); if (dist_sq < *max_dist_sq && kd_isleaf(node)) { if ((point = (struct resItem *)kd_malloc(sizeof(struct resItem), "kd_sph_doQnearest: ")) == NULL) return 0; point->node = node; point->dist_sq = dist_sq; pqinsert(res, point); } if (res->size > q) { pqremove_max(res, &item); free(item); if (res->size > 1) { /* * Only inspect the queue if there are items left */ pqpeek_max(res, &item); *max_dist_sq = item->dist_sq; } else { /* * Nothing was found within the max search radius */ *max_dist_sq = 0; } } if (p[node->split] < node->location[node->split]) { nearer = node->left; further = node->right; } else { nearer = node->right; further = node->left; } if (!kd_sph_doQnearest(nearer, p, max_dist_sq, q, res)) return 0; if (!further) return 1; p1[0] = further->min[0]; p1[1] = further->max[1]; p2[0] = further->max[0]; p2[1] = further->min[1]; if (node->split == 0) /* We need to know the distance between the point p and the vertical lines delineating the rectangle. These lines are great circles so we need to know the cross-track distance. */ dx = kd_min(kd_sqr(kd_sph_xtd(further->min, p1, p)), kd_sqr(kd_sph_xtd(p2, further->max, p))); else /* We need to know the distance between the point p and the horizontal lines delineating the rectangle. Since the latitudes are not great circles, the shortest distance runs along the longitude of point p. */ dx = kd_min(kd_sqr(kd_sph_orth_dist(further->min, p, 1)), kd_sqr(kd_sph_orth_dist(further->max, p, 1))); if (*max_dist_sq > dx) { /* * some part of the further hyper-rectangle is in the search * radius, search the further node */ if (!kd_sph_doQnearest(further, p, max_dist_sq, q, res)) return 0; dist_sq = kd_sph_dist_sq(node->location, p); if (dist_sq < *max_dist_sq && kd_isleaf(node)) { if ((point = (struct resItem *)kd_malloc(sizeof(struct resItem), "kd_sph_doQnearest: ")) == NULL) return 0; point->node = node; point->dist_sq = dist_sq; pqinsert(res, point); } if (res->size > q) { pqremove_max(res, &item); free(item); if (res->size > 1) { /* * Only inspect the queue if there are items left */ pqpeek_max(res, &item); *max_dist_sq = item->dist_sq; } else { /* * Nothing was found within the max search radius */ *max_dist_sq = 0; } } } return 1; } /*! * \brief Perform a range search around a point. * * \param node the root node of the tree to be searched. * * \param p the location of the point around which the search is carried out . * * \param max_dist_sq the square of the radius of the hypersphere. * * \param ordered determines whether the result list should be ordered * in increasing distance (KD_ORDERED) or unordered (KD_UNORDERED). * * \return A pointer to a priority queue containing the points found, * NULL in case of problems. */ struct pqueue * kd_sph_range(struct kdNode *node, kdata_t *p, kdata_t *max_dist_sq, int ordered) { struct pqueue *res; if ((res = pqinit(NULL, 1)) == NULL) return NULL; if (!kd_sph_doRange(node, p, max_dist_sq, res, ordered)) { for(size_t i = 0; i < res->size; i++) { free(res->d[i]); } free(res->d); free(res); return NULL; } return res; } /* This is the range search. Returns 1 if okay, 0 in case of problems */ int kd_sph_doRange(struct kdNode *node, kdata_t *p, kdata_t *max_dist_sq, struct pqueue *res, int ordered) { struct kdNode *nearer, *further; struct resItem *point; kdata_t dist_sq, dx; kdata_t p1[2], p2[2]; if (!node) return 1; dist_sq = kd_sph_dist_sq(node->location, p); if (dist_sq < *max_dist_sq && kd_isleaf(node)) { if ((point = (struct resItem *)kd_malloc(sizeof(struct resItem), "kd_sph_doRange:")) == NULL) return 0; point->node = node; point->dist_sq = ordered ? dist_sq : -1; pqinsert(res, point); } if (p[node->split] < node->location[node->split]) { nearer = node->left; further = node->right; } else { nearer = node->right; further = node->left; } if (!kd_sph_doRange(nearer, p, max_dist_sq, res, ordered)) return 0; if (!further) return 1; p1[0] = further->min[0]; p1[1] = further->max[1]; p2[0] = further->max[0]; p2[1] = further->min[1]; if (node->split == 0) /* We need to know the distance between the point p and the vertical lines delineating the rectangle. These lines are great circles so we need to know the cross-track distance. */ dx = kd_min(kd_sqr(kd_sph_xtd(further->min, p1, p)), kd_sqr(kd_sph_xtd(p2, further->max, p))); else /* We need to know the distance between the point p and the horizontal lines delineating the rectangle. Since the latitudes are not great circles, the shortest distance runs along the longitude of point p. */ dx = kd_min(kd_sqr(kd_sph_orth_dist(further->min, p, 1)), kd_sqr(kd_sph_orth_dist(further->max, p, 1))); if (*max_dist_sq > dx) { /* * some part of the further hyper-rectangle is in the search * radius, search the further node */ if (!kd_sph_doRange(further, p, max_dist_sq, res, ordered)) return 0; dist_sq = kd_sph_dist_sq(node->location, p); if (dist_sq < *max_dist_sq && kd_isleaf(node)) { if ((point = (struct resItem *)kd_malloc(sizeof(struct resItem), "kd_sph_doRange: ")) == NULL) return 0; point->node = node; point->dist_sq = ordered ? dist_sq : -1; pqinsert(res, point); } } return 1; } /* End range searching functions */ cdo-2.6.6.1/libkdtree/kdtree.h0000664000175000017500000001716215271332515016224 0ustar alastairalastair/*! \file kdtree.h * \brief Include file for the kdtree library */ /* Code from: https://github.com/joergdietrich/libkdtree Uwe Schulzweida, 20150720: changed data pointer to unsigned int changed *point to point[KD_MAX_DIM] changed *location to location[KD_MAX_DIM] changed *min to min[KD_MAX_DIM] changed *max to max[KD_MAX_DIM] _compPoints: compare index if points[axis] are equal 20171102: renamed kd_buildArg() to kd_initArg(), changed interface and memory handling changed data pointer to size_t 20171112: added node pool */ #ifndef KDTREE_H_ #define KDTREE_H_ #include #include #include #include #include #include #include //#define MEMPOOL 1 #define KDDATATYPE double #define KDATA_ABS(x) fabs(x) //#define KDDATATYPE float //#define KDATA_ABS(x) fabsf(x) typedef KDDATATYPE kdata_t; #define KD_MAX_DIM 3 typedef struct kd_point { kdata_t point[KD_MAX_DIM]; size_t index; } kd_point; static inline int qcmp(struct kd_point *a, struct kd_point *b, int axis) { int ret = (a->point[axis] > b->point[axis]) ? 1 : (a->point[axis] < b->point[axis]) ? -1 : 0; if ( ret == 0 ) ret = (a->index > b->index) ? 1 : (a->index < b->index) ? -1 : 0; return ret; } /*! * \struct kdNode * \brief kd-tree node structure definition */ typedef struct kdNode { struct kdNode *left; /*! imp; kdNode *pool; } kdNodePool_t; typedef struct kdTree { kdNode *node; kdNodePool_t *nodepool; } kdTree_t; kdNodePool_t *kd_nodepool_new(size_t n); void kd_nodepool_delete(kdNodePool_t *pool); /*! * \struct resItem * \brief result items, member of a priority queue */ typedef struct resItem { struct kdNode *node; /*! #include #define PQPRIO(p) (p->dist_sq) int floorLog2(size_t n); int is_max_level(int i); size_t get_max_index(struct pqueue *q); size_t pq_get_min_child_index(struct pqueue *q, size_t i); size_t pq_get_max_child_index(struct pqueue *q, size_t i); void pq_swap_nodes(struct pqueue *q, size_t i, size_t j); void trickle_down(struct pqueue *q, size_t i); void trickle_down_min(struct pqueue *q, size_t i); void trickle_down_max(struct pqueue *q, size_t i); void bubble_up(struct pqueue *q, size_t i); void bubble_up_min(struct pqueue *q, size_t i); void bubble_up_max(struct pqueue *q, size_t i); #endif cdo-2.6.6.1/libkdtree/qsort.cc0000664000175000017500000002203715271332515016251 0ustar alastairalastair/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details (qsort.c is used to build libc.a and as such is covered by the LGPL -- Joerg Dietrich 2008)*/ #include #include "kdtree.h" /*- * Copyright (c) 1980, 1983 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms are permitted * provided that: (1) source distributions retain this entire copyright * notice and comment, and (2) distributions including binaries display * the following acknowledgement: ``This product includes software * developed by the University of California, Berkeley and its contributors'' * in the documentation or other materials provided with the distribution * and in all advertising materials mentioning features or use of this * software. Neither the name of the University 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ /* * qsort.c: * Our own version of the system qsort routine which is faster by an average * of 25%, with lows and highs of 10% and 50%. * The THRESHold below is the insertion sort threshold, and has been adjusted * for records of size 48 bytes. * The MTHREShold is where we stop finding a better median. */ #define THRESH 4 /* threshold for insertion */ #define MTHRESH 6 /* threshold for median */ static int thresh; /* THRESHold */ static int mthresh; /* MTHRESHold */ void qsortR(void *base0, size_t n, int axis); /* * qst: * Do a quicksort * First, find the median element, and put that one in the first place as the * discriminator. (This "median" is just the median of the first, last and * middle elements). (Using this median instead of the first element is a big * win). Then, the usual partitioning/swapping, followed by moving the * discriminator into the right place. Then, figure out the sizes of the two * partions, do the smaller one recursively and the larger one via a repeat of * this code. Stopping when there are less than THRESH elements in a partition * and cleaning up with an insertion sort (in our caller) is a huge win. * All data swaps are done in-line, which is space-losing but time-saving. * (And there are only three places where this is done). */ static void qst(struct kd_point *base, struct kd_point *max, int axis) { struct kd_point c, *i, *j, *jj; int ii; struct kd_point *mid, *tmp; int lo, hi; /* * At the top here, lo is the number of characters of elements in the * current partition. (Which should be max - base). * Find the median of the first, last, and middle element and make * that the middle element. Set j to largest of first and middle. * If max is larger than that guy, then it's that guy, else compare * max with loser of first and take larger. Things are set up to * prefer the middle, then the first in case of ties. */ lo = max - base; /* number of elements */ do { mid = i = base + (lo >> 1); if ( lo >= mthresh ) { j = (qcmp((jj = base), i, axis) > 0 ? jj : i); if ( qcmp(j, (tmp = max - 1), axis) > 0 ) { /* * switch to first loser */ j = (j == jj ? i : jj); if ( qcmp(j, tmp, axis) < 0 ) j = tmp; } if ( j != i ) { ii = 1; do { c = *i; *i++ = *j; *j++ = c; } while (--ii); } } /* * Semi-standard quicksort partitioning/swapping */ for ( i = base, j = max - 1;; ) { while ( i < mid && qcmp(i, mid, axis) <= 0 ) ++i; while ( j > mid ) { if ( qcmp(mid, j, axis) <= 0 ) { --j; continue; } tmp = i + 1; /* value of i after swap */ if ( i == mid ) { /* * j <-> mid, new mid is j */ mid = jj = j; } else { /* * i <-> j */ jj = j; --j; } goto swap; } if ( i == mid ) { break; } else { /* * i <-> mid, new mid is i */ jj = mid; tmp = mid = i; /* value of i after swap */ --j; } swap: ii = 1; do { c = *i; *i++ = *jj; *jj++ = c; } while ( --ii ); i = tmp; } /* * Look at sizes of the two partitions, do the smaller * one first by recursion, then do the larger one by * making sure lo is its size, base and max are update * correctly, and branching back. But only repeat * (recursively or by branching) if the partition is * of at least size THRESH. */ i = (j = mid) + 1; if ( (lo = j - base) <= (hi = max - i) ) { if ( lo >= thresh ) qst(base, j, axis); base = i; lo = hi; } else { if ( hi >= thresh ) qst(i, max, axis); max = j; } } while ( lo >= thresh ); } /* * qsort: * First, set up some global parameters for qst to share. Then, quicksort * with qst(), and then a cleanup insertion sort ourselves. Sound simple? * It's not... */ void NotUsed_qsortR(void *base0, size_t n, int axis) { struct kd_point *base = (struct kd_point *) base0; struct kd_point c, *i, *j, *lo, *hi; struct kd_point *min, *max; if ( n <= 1 ) return; thresh = THRESH; mthresh = MTHRESH; max = base + n; if ( n >= THRESH ) { qst(base, max, axis); hi = base + thresh; } else { hi = max; } /* * First put smallest element, which must be in the first THRESH, in * the first position as a sentinel. This is done just by searching * the first THRESH elements (or the first n if n < THRESH), finding * the min, and swapping it into the first position. */ for ( j = lo = base; (lo += 1) < hi; ) if ( qcmp(j, lo, axis) > 0 ) j = lo; if ( j != base ) { /* * swap j into place */ for ( i = base, hi = base + 1; i < hi; ) { c = *j; *j++ = *i; *i++ = c; } } /* * With our sentinel in place, we now run the following hyper-fast * insertion sort. For each remaining element, min, from [1] to [n-1], * set hi to the index of the element AFTER which this one goes. * Then, do the standard insertion sort shift on a character at a time * basis for each element in the frob. */ for ( min = base; (hi = min += 1) < max; ) { while ( qcmp(hi -= 1, min, axis) > 0 ) /* * void */ ; if ( (hi += 1) != min ) { for ( lo = min + 1; --lo >= min; ) { c = *lo; for ( i = j = lo; (j -= 1) >= hi; i = j ) *i = *j; *i = c; } } } } // quickSort // // This public-domain C implementation by Darel Rex Finley. // // * This function assumes it is called with valid parameters. // // Code from: http://alienryderflex.com/quicksort void qsortR(void *base0, size_t n, int axis) { struct kd_point *base = (struct kd_point *) base0; struct kd_point piv; #define MAX_LEVELS 300 int beg[MAX_LEVELS], end[MAX_LEVELS], L, R, swap, i = 0; beg[0] = 0; end[0] = (int)n; while ( i >= 0 ) { L = beg[i]; R = end[i]-1; if ( L < R ) { piv = base[L]; while ( L < R ) { while ( L < R && qcmp(&base[R], &piv, axis) >= 0 ) R--; if ( L < R ) base[L++] = base[R]; while ( L < R && qcmp(&base[L], &piv, axis) <= 0 ) L++; if ( L < R ) base[R--] = base[L]; } base[L] = piv; beg[i+1] = L+1; end[i+1] = end[i]; end[i++] = L; if ( end[i]-beg[i] > end[i-1]-beg[i-1] ) { swap = beg[i]; beg[i] = beg[i-1]; beg[i-1] = swap; swap = end[i]; end[i] = end[i-1]; end[i-1] = swap; } } else { i--; } } } void XqsortR(void *base0, size_t n, int idx) { if ( n < 2 ) return; struct kd_point *a = (struct kd_point *) base0; struct kd_point t; // kdata_t p = a[n/2].point[idx]; kd_point p = a[n/2]; int i, j; for ( i = 0, j = n - 1;; i++, j-- ) { // while ( a[i].point[idx] < p ) i++; // while ( p < a[j].point[idx] ) j--; while ( qcmp(a+i, &p, idx) < 0 ) i++; while ( qcmp(&p, a+j, idx) < 0 ) j--; if ( i >= j ) break; t = a[i]; a[i] = a[j]; a[j] = t; } qsortR(a, i, idx); qsortR(a + i, n - i, idx); } cdo-2.6.6.1/libkdtree/pmergesort.cc0000664000175000017500000000772015271332515017272 0ustar alastairalastair#include #include #include #include #include "kdtree.h" typedef struct param_t { struct kd_point *a; struct kd_point *b; size_t first; size_t nmemb; int axis; int max_threads; } param_t; extern void qsortR(void *base0, size_t n, int axis); void pm_buildparams(struct param_t *p, struct kd_point *a, struct kd_point *b, size_t first, size_t nmemb, int axis, int max_threads); int pmergesort(struct kd_point *base, size_t nmemb, int axis, int max_threads); void *mergesort_t(void *args); int pmergesort(struct kd_point *base, size_t nmemb, int axis, int max_threads) { struct kd_point *tmp = NULL; if ( max_threads > 1 ) if ((tmp = (struct kd_point*)calloc(nmemb, sizeof(struct kd_point))) == NULL) { perror("malloc"); return 0; } param_t args; args.a = base; args.b = tmp; args.first = 0; args.nmemb = nmemb; args.axis = axis; args.max_threads = max_threads; mergesort_t(&args); if (tmp) free(tmp); return 1; } void pm_buildparams(struct param_t *p, struct kd_point *a, struct kd_point *b, size_t first, size_t nmemb, int axis, int max_threads) { p->a = a; p->b = b; p->first = first; p->nmemb = nmemb; p->axis = axis; p->max_threads = max_threads; } void * mergesort_t(void *args) { size_t i, li, ri; struct param_t larg, rarg; pthread_t thr[2]; param_t *mya = (param_t *) args; if (mya->max_threads < 2) { /* * Reached maximum number of threads allocated to this * branch. Proceed with sequential sort of this chunk. */ qsortR(mya->a + mya->first, mya->nmemb, mya->axis); } else { /* * Start two new threads, each sorting half of array a */ pm_buildparams(&larg, mya->a, mya->b, mya->first, mya->nmemb / 2, mya->axis, mya->max_threads / 2); /* * Recursively sort the left half */ if (pthread_create(&thr[0], NULL, mergesort_t, (void *) &larg)) { perror("pthread_create"); return NULL; } pm_buildparams(&rarg, mya->a, mya->b, mya->first + mya->nmemb / 2, mya->nmemb - mya->nmemb / 2, mya->axis, mya->max_threads / 2); /* * Recursively sort the right half */ if (pthread_create(&thr[1], NULL, mergesort_t, (void *) &rarg)) { perror("pthread_create"); return NULL; } pthread_join(thr[0], NULL); pthread_join(thr[1], NULL); /* * Merge the two sorted chunks of array a into array b */ li = larg.first; ri = rarg.first; for(i = mya->first; i < mya->first + mya->nmemb; i++) { if (li >= larg.first + larg.nmemb) { /* * We already copied everything from the left chunk, * now copy from the right */ memcpy(mya->b + i, mya->a + ri, sizeof(struct kd_point)); ri++; } else if (ri >= rarg.first + rarg.nmemb) { /* * We already copied everything from the right chunk, * now copy from the left */ memcpy(mya->b + i, mya->a + li, sizeof(struct kd_point)); li++; } /* * We can still copy from both chunks, copy the smaller element */ else if ( qcmp(mya->a + li, mya->a + ri, mya->axis) < 1) { memcpy(mya->b + i, mya->a + li, sizeof(struct kd_point)); li++; } else { memcpy(mya->b + i, mya->a + ri, sizeof(struct kd_point)); ri++; } } /* * Now b is sorted, copy it back to a */ memcpy(mya->a + mya->first, mya->b + mya->first, mya->nmemb*sizeof(struct kd_point)); } return NULL; } cdo-2.6.6.1/libkdtree/pqueue.cc0000664000175000017500000002756615271332515016421 0ustar alastairalastair/*!\file pqueue.c * \brief Two-ended priority queues (min-max heap) * * Implementation of a min-max heap (two-ended priority queue) as * introduced by Atkinson et al. (1986), Communications of the ACM 10, * 996. */ #include "pqueue.h" /********************************************************************** * * We start with some general helper functions * */ /* Returns the floor form of a binary logarithm for a 32 bit integer. -1 is returned if n is 0. Ripped off wikipedia. */ inline int floorLog2(size_t n) { size_t pos = 0; if (n >= 1 << 16) { n >>= 16; pos += 16; } if (n >= 1 << 8) { n >>= 8; pos += 8; } if (n >= 1 << 4) { n >>= 4; pos += 4; } if (n >= 1 << 2) { n >>= 2; pos += 2; } if (n >= 1 << 1) pos += 1; if (n == 0) return -1; return pos; } /* Returns 1 if i is a max-sorted level, return 0 otherwise (min-sorted level). */ inline int is_max_level(size_t i) { return floorLog2(i) % 2; } /* Swap nodes i and j in the priority queue q */ void pq_swap_nodes(struct pqueue *q, size_t i, size_t j) { struct resItem *tmp; tmp = q->d[i]; q->d[i] = q->d[j]; q->d[j] = tmp; } /* Return the array index of the maximum node */ size_t get_max_index(struct pqueue *q) { size_t i; if (!q) return 0; switch (q->size) { case 1:{ /* * Empty queue */ i = 0; break; } case 2:{ /* * this is the only element (min and max) */ i = 1; break; } case 3:{ /* * This is the only element on the max level */ i = 2; break; } default:{ /* * Return the greater of the two elements on the max level */ if (PQPRIO(q->d[2]) > PQPRIO(q->d[3])) i = 2; else i = 3; } } return i; } /* End of general helper functions */ /* * * Functions to support insertion * */ /* Move a node up the tree */ void bubble_up_min(struct pqueue *q, size_t i) { /* * if node has a grandparent */ if (i > 3 && PQPRIO(q->d[i]) < PQPRIO(q->d[i / 4])) { pq_swap_nodes(q, i, i / 4); bubble_up_min(q, i / 4); } } void bubble_up_max(struct pqueue *q, size_t i) { /* * if node has a grandparent */ if (i > 3 && PQPRIO(q->d[i]) > PQPRIO(q->d[i / 4])) { pq_swap_nodes(q, i, i / 4); bubble_up_max(q, i / 4); } } void bubble_up(struct pqueue *q, size_t i) { if (!is_max_level(i)) { if (i > 1 && PQPRIO(q->d[i]) > PQPRIO(q->d[i / 2])) { pq_swap_nodes(q, i, i / 2); bubble_up_max(q, i / 2); } else { bubble_up_min(q, i); } } else { if (i > 1 && PQPRIO(q->d[i]) < PQPRIO(q->d[i / 2])) { pq_swap_nodes(q, i, i / 2); bubble_up_min(q, i / 2); } else { bubble_up_max(q, i); } } } /* * * Functions to support node removal * */ /* Get index of the smallest child or grandchild of q->d[i]. Caller must ensure that q->d[i] has at least one child. */ size_t pq_get_min_child_index(struct pqueue *q, size_t i) { size_t m; /* * First Child */ m = 2 * i; /* * Second Child */ if (q->size > 2 * i + 1) if (PQPRIO(q->d[m]) > PQPRIO(q->d[2 * i + 1])) m = 2 * i + 1; /* * First child of first child */ if (q->size > 4 * i) if (PQPRIO(q->d[m]) > PQPRIO(q->d[4 * i])) m = 4 * i; /* * Second child of first child */ if (q->size > 4 * i + 1) if (PQPRIO(q->d[m]) > PQPRIO(q->d[4 * i + 1])) m = 4 * i + 1; /* * First Child of second child */ if (q->size > 2 * (2 * i + 1)) if (PQPRIO(q->d[m]) > PQPRIO(q->d[2 * (2 * i + 1)])) m = 2 * (2 * i + 1); /* * Second child of second child */ if (q->size > 2 * (2 * i + 1) + 1) if (PQPRIO(q->d[m]) > PQPRIO(q->d[2 * (2 * i + 1) + 1])) m = 2 * (2 * i + 1) + 1; return m; } /* Get index of the largest children and grandchildren of q->d[i]. Caller must ensure that q->d[i] has at least one child. */ size_t pq_get_max_child_index(struct pqueue * q, size_t i) { size_t m; /* * First Child */ m = 2 * i; /* * Second Child */ if (q->size > 2 * i + 1) if (PQPRIO(q->d[m]) < PQPRIO(q->d[2 * i + 1])) m = 2 * i + 1; /* * First child of first child */ if (q->size > 4 * i) if (PQPRIO(q->d[m]) < PQPRIO(q->d[4 * i])) m = 4 * i; /* * Second child of first child */ if (q->size > 4 * i + 1) if (PQPRIO(q->d[m]) < PQPRIO(q->d[4 * i + 1])) m = 4 * i + 1; /* * First Child of second child */ if (q->size > 2 * (2 * i + 1)) if (PQPRIO(q->d[m]) < PQPRIO(q->d[2 * (2 * i + 1)])) m = 2 * (2 * i + 1); /* * Second child of second child */ if (q->size > 2 * (2 * i + 1) + 1) if (PQPRIO(q->d[m]) < PQPRIO(q->d[2 * (2 * i + 1) + 1])) m = 2 * (2 * i + 1) + 1; return m; } /* Move a node down the tree */ void trickle_down(struct pqueue *q, size_t i) { if (is_max_level(i)) trickle_down_max(q, i); else trickle_down_min(q, i); } void trickle_down_max(struct pqueue *q, size_t i) { size_t m; /* * if A[i] has children */ if (q->size > 2 * i) { /* * m := Index of the largest child or grandchild of A[i] */ m = pq_get_max_child_index(q, i); /* * if A[m] is a grandchild of A[i] */ if (m / 4 == i) { if (PQPRIO(q->d[m]) > PQPRIO(q->d[i])) pq_swap_nodes(q, i, m); if (PQPRIO(q->d[m]) < PQPRIO(q->d[m / 2])) pq_swap_nodes(q, m, m / 2); trickle_down_max(q, m); } else { /* * A[m] is a child of A[i] */ if (PQPRIO(q->d[m]) > PQPRIO(q->d[i])) pq_swap_nodes(q, i, m); } } } void trickle_down_min(struct pqueue *q, size_t i) { size_t m; /* * if A[i] has children */ if (q->size > 2 * i) { /* * m := Index of the smallest child or grandchild of A[i] */ m = pq_get_min_child_index(q, i); /* * if A[m] is a grandchild of A[i] */ if (m / 4 == i) { if (PQPRIO(q->d[m]) < PQPRIO(q->d[i])) pq_swap_nodes(q, i, m); if (PQPRIO(q->d[m]) > PQPRIO(q->d[m / 2])) pq_swap_nodes(q, m, m / 2); trickle_down_min(q, m); } else { /* * A[m] is a child of A[i] */ if (PQPRIO(q->d[m]) < PQPRIO(q->d[i])) pq_swap_nodes(q, i, m); } } } /* *********************************************************************** * * USER FUNCTIONS * *********************************************************************** */ /*! * \brief Initialize priority queue * * \param q a pointer to a priority queue, or NULL if the queue * should be initialized. * * \param n the number of queue items for which memory should be * preallocated. If you insert more than n items to the queue, * another n items will be allocated automatically. * * \return Pointer to priority queue, NULL in case of error. * */ struct pqueue * pqinit(struct pqueue *q, size_t n) { struct pqueue *tmp = q; if (!q && !(q = (pqueue *)malloc(sizeof(struct pqueue)))) { return NULL; } if (!(q->d = (struct resItem **)malloc(sizeof(struct resItem *) * n))) { if (!tmp) free(q); return NULL; } q->avail = q->step = n; q->size = 1; return q; } /*! * \brief Insert an item into the queue. * * \param q a pointer to a priority queue. * * \param d the datum to be inserted. * * \return 1 if the item has been inserted, 0 if the item could not be * appended. Either the queue pointer provided was NULL, or the * function was unable to allocate the amount of memory needed for the * new item. */ int pqinsert(struct pqueue *q, struct resItem *d) { struct resItem **tmp; size_t i, newsize; if (!q) return 0; /* * allocate more memory if necessary */ if (q->size >= q->avail) { newsize = q->size + q->step; if (!(tmp = (struct resItem **)realloc(q->d, sizeof(struct resItem *) * newsize))) { return 0; }; q->d = tmp; q->avail = newsize; } /* * insert item */ i = q->size++; q->d[i] = d; bubble_up(q, i); return 1; } /*! * \brief remove the highest-ranking (minimum) item from the queue. * * \param q a pointer to a priority queue. * * \param d a pointer to the struct resItem * variable that will hold the datum * corresponding to the queue item removed. * * \return non-NULL if an item has been removed. The variable that d * points to now contains the datum associated with the item in * question; or NULL if item could be removed. Either the queue * pointer provided was NULL, or the queue was empty. The chunk of * memory that d points to has not been modified. */ struct resItem ** pqremove_min(struct pqueue *q, struct resItem **d) { if (!q || q->size == 1) return NULL; *d = q->d[1]; q->d[1] = q->d[--q->size]; trickle_down(q, 1); return d; } /*! * \brief remove the lowest-ranking (maximum) item from the queue. * * \param q a pointer to a priority queue. * * \param d a pointer to the struct resItem * variable that will hold the datum * corresponding to the queue item removed. * * \return non-NULL if an item has been removed. The variable that d * points to now contains the datum associated with the item in * question; or NULL if item could be removed. Either the queue * pointer provided was NULL, or the queue was empty. The chunk of * memory that d points to has not been modified. */ struct resItem ** pqremove_max(struct pqueue *q, struct resItem **d) { size_t i; if (!q || q->size == 1) return NULL; i = get_max_index(q); *d = q->d[i]; q->d[i] = q->d[--q->size]; trickle_down(q, i); return d; } /*! * \brief access highest-ranking (minimum) item without removing it. * * \param q a pointer to a priority queue. * * \param d a pointer to the struct resItem * variable that will hold the datum * corresponding to the highest-ranking item. * * \return non-NULL in case of success. The variable that d points to * now contains the datum associated with the highest-ranking item; * NULL in case of failure. Either the queue pointer provided was * NULL, or the queue was empty. The chunk of memory that d points to * has not been modified. */ struct resItem ** pqpeek_min(struct pqueue *q, struct resItem **d) { if (!q || q->size == 1) return NULL; *d = q->d[1]; return d; } /*! * \brief access lowest-ranking (maximum) item without removing it. * * \param q a pointer to a priority queue. * * \param d a pointer to the struct resItem * variable that will hold the datum * corresponding to the highest-ranking item. * * \return non-NULL in case of success. The variable that d points to * now contains the datum associated with the highest-ranking item; * NULL in case of failure. Either the queue pointer provided was * NULL, or the queue was empty. The chunk of memory that d points to * has not been modified. */ struct resItem ** pqpeek_max(struct pqueue *q, struct resItem **d) { if (!q || q->size == 1) return NULL; *d = q->d[get_max_index(q)]; return d; } cdo-2.6.6.1/libkdtree/kdtree_common.cc0000664000175000017500000001672515271332515017736 0ustar alastairalastair/*!\file kdtree_common.c * \brief Routines common to the Cartesian and spherical kd-tree versions * */ #include "kdtree.h" #include "pqueue.h" extern int pmergesort(struct kd_point *base, size_t nmemb, int axis, int max_threads); /* ******************************************************************** general utility functions ********************************************************************* */ void * kd_malloc(size_t size, const char *msg) { void *ptr; if ((ptr = malloc(size)) == NULL) perror(msg); return ptr; } kdata_t kd_sqr(kdata_t x) { return (x < 0 || x > 0) ? x * x : 0; } int kd_isleaf(struct kdNode *n) { return (n->left || n->right) ? 0 : 1; } /* end utility functions */ /* ******************************************************************* Helper functions for debugging ******************************************************************* */ void kd_printNode(struct kdNode *node) { if (!node) { fprintf(stderr, "Node is empty.\n"); return; } printf("Node %p at (%f, %f)\n", (void *) node, node->location[0], node->location[1]); printf("Split axis: %d\n", node->split); printf("Corners: (%f, %f)\t(%f, %f)\n", node->min[0], node->min[1], node->max[0], node->max[1]); printf("Children: %p\t%p\n", (void *) node->left, (void *) node->right); printf("Index: %zu\n", node->index); printf("\n"); } void kd_printTree(struct kdNode *node) { if ( node == NULL ) return; kd_printTree(node->left); if ( kd_isleaf(node) ) printf("%f\t%f\n", node->location[0], node->location[1]); kd_printTree(node->right); } /* End helper functions */ void kd_initArg(struct kd_thread_data *d, kdNodePool *nodepool, struct kd_point *points, size_t nPoints, kdata_t *min, kdata_t *max, int depth, int max_threads, int dim) { d->nodepool = nodepool; d->points = points; d->nPoints = nPoints; memcpy(d->min, min, dim*sizeof(kdata_t)); memcpy(d->max, max, dim*sizeof(kdata_t)); d->depth = depth; d->max_threads = max_threads; d->dim = dim; } /* ****************************************************************** Functions for building and destroying trees ******************************************************************** */ /*! * \brief free the kd-tree data structure, * * \param node the root node of the tree to be destroyed * * \param *destr a pointer to the destructor function for the data container. * * \return This function does not return a value */ static void kd_freeNode(kdNode *node) { if ( node ) free(node); } kdNodePool_t *kd_nodepool_new(size_t n) { kdNodePool_t *nodepool = (kdNodePool_t *) malloc(sizeof(kdNodePool_t)); nodepool->size = n; nodepool->imp = 0; nodepool->pool = (kdNode *) malloc(n*sizeof(kdNode)); printf("kd_nodepool_new: size=%zu\n", n); return nodepool; } void kd_nodepool_delete(kdNodePool_t *nodepool) { if ( nodepool == NULL ) return; if ( nodepool->pool ) free(nodepool->pool); free(nodepool); } struct kdNode * kd_allocNode(struct kd_point *points, size_t pivot, kdata_t *min, kdata_t *max, int axis, int dim) { struct kdNode *node; if ((node = (kdNode *)kd_malloc(sizeof(kdNode), "kd_allocNode (node): ")) == NULL) return NULL; node->split = axis; memcpy(node->location, points[pivot].point, dim * sizeof(kdata_t)); memcpy(node->min, min, dim * sizeof(kdata_t)); memcpy(node->max, max, dim * sizeof(kdata_t)); node->left = node->right = NULL; node->index = 0; return node; } struct kdNode * kd_allocNodeP(kdNodePool *nodepool, struct kd_point *points, size_t pivot, kdata_t *min, kdata_t *max, int axis, int dim) { struct kdNode *node; if ( nodepool ) { if ( nodepool->imp >= nodepool->size ) return NULL; node = &nodepool->pool[nodepool->imp++]; } else { if ((node = (kdNode *)kd_malloc(sizeof(kdNode), "kd_allocNode (node): ")) == NULL) return NULL; } node->split = axis; memcpy(node->location, points[pivot].point, dim * sizeof(kdata_t)); memcpy(node->min, min, dim * sizeof(kdata_t)); memcpy(node->max, max, dim * sizeof(kdata_t)); node->left = node->right = NULL; node->index = 0; return node; } void kd_doDestroyTree(struct kdNode *node) { if ( node == NULL ) return; kd_doDestroyTree(node->left); kd_doDestroyTree(node->right); kd_freeNode(node); } void kd_destroyTree(kdTree_t *tree) { if ( tree == NULL ) return; if ( tree->nodepool ) kd_nodepool_delete(tree->nodepool); else kd_doDestroyTree(tree->node); free(tree); } void *kd_doBuildTree(void *threadarg) { kdata_t tmpMaxLeft[KD_MAX_DIM], tmpMinRight[KD_MAX_DIM]; struct kdNode *node; pthread_t threads[2]; pthread_attr_t attr; struct kd_thread_data argleft, argright; struct kd_thread_data *my_data = (struct kd_thread_data *) threadarg; kdNodePool_t *nodepool = my_data->nodepool; struct kd_point *points = my_data->points; size_t nPoints = my_data->nPoints; kdata_t *min = my_data->min; kdata_t *max = my_data->max; int depth = my_data->depth; int max_threads = my_data->max_threads; int dim = my_data->dim; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); int sortaxis = depth % dim; if (nPoints == 1) { if ((node = kd_allocNodeP(nodepool, points, 0, min, max, sortaxis, dim)) == NULL) return NULL; node->index = points[0].index; return node; } // If this iteration is allowed to start more threads, we first use them to parallelize the sorting pmergesort(points, nPoints, sortaxis, max_threads); size_t pivot = nPoints / 2; if ((node = kd_allocNodeP(nodepool, points, pivot, min, max, sortaxis, dim)) == NULL) return NULL; memcpy(tmpMaxLeft, max, dim * sizeof(kdata_t)); tmpMaxLeft[sortaxis] = node->location[sortaxis]; kd_initArg(&argleft, nodepool, points, pivot, min, tmpMaxLeft, depth + 1, max_threads / 2, dim); if (max_threads > 1) { pthread_create(&threads[0], &attr, kd_doBuildTree, (void *) &argleft); } else { node->left = (kdNode *)kd_doBuildTree((void *) &argleft); if (!node->left) { kd_doDestroyTree(node); return NULL; } } memcpy(tmpMinRight, min, dim * sizeof(kdata_t)); tmpMinRight[sortaxis] = node->location[sortaxis]; kd_initArg(&argright, nodepool, &points[pivot], nPoints - pivot, tmpMinRight, max, depth + 1, max_threads / 2, dim); if (max_threads > 1) { pthread_create(&threads[1], &attr, kd_doBuildTree, (void *) &argright); } else { node->right = (kdNode *)kd_doBuildTree((void *) &argright); if (!node->right) { kd_doDestroyTree(node); return NULL; } } if (max_threads > 1) { pthread_join(threads[0], (void **) (&node->left)); pthread_join(threads[1], (void **) (&node->right)); if (!node->left || !node->right) { kd_doDestroyTree(node); return NULL; } } return (void *) node; } /* end of tree construction and destruction */ /* Functions dealing with result heaps */ /* Insert the sub-tree starting at node into the result heap res */ int kd_insertResTree(struct kdNode *node, struct pqueue *res) { if ( node == NULL ) return 1; if ( !kd_insertResTree(node->left, res) ) return 0; if ( kd_isleaf(node) ) { struct resItem *point; if ((point = (struct resItem *)kd_malloc(sizeof(struct resItem), "kd_insertResTree: ")) == NULL) return 0; point->node = node; point->dist_sq = -1; pqinsert(res, point); } if ( !kd_insertResTree(node->right, res) ) return 0; return 1; } cdo-2.6.6.1/libkdtree/kdtree_cartesian.cc0000664000175000017500000003275415271332515020417 0ustar alastairalastair/*!\file kdtree_cartesian.c * \brief Routines specific to the n-dimensional cartesian kd-tree * */ #if defined(HAVE_CONFIG_H) #include "config.h" #endif #include "kdtree.h" #include "pqueue.h" /* ******************************************************************** general utility functions ********************************************************************* */ static constexpr kdata_t square(const kdata_t x) noexcept { return x*x; } static constexpr kdata_t kd_dist_sq(const kdata_t * a, const kdata_t * b) noexcept { return (float)(square((a[0]-b[0]))+square((a[1]-b[1]))+square((a[2]-b[2]))); } kdata_t kd_min(kdata_t x, kdata_t y) { return x < y ? x : y; } /* ****************************************************************** Functions for building and destroying trees ******************************************************************** */ /*! \brief build kd-tree structure * * \param points an array of kd_points (struct with position vector * and data container). * * \param nPoints the length of the points array. * * \param constr a pointer to a void *constructor() function to include * the data container in the tree; optional, can be NULL * * \param destr a pointer to a void destructor() function to free() * the data containers in the tree; optional, can be NULL, but should * be given if the constr argument is non-NULL. * * \param min a vector with the minimum positions of the corners of the * hyperrectangle containing the data. * * \param max a vector with the maximum positions of the corners of * the hyperrectangle containing the data. * * \param dim the dimensionality of the data. * * \param max_threads the maximal number of threads spawned for * construction of the tree. The threads will be unbalanced if this is * not a power of 2. * * \return root node of the tree */ kdTree_t * kd_buildTree(struct kd_point *points, size_t nPoints, kdata_t *min, kdata_t *max, int dim, int max_threads) { kdTree_t *tree = (kdTree_t *) calloc(1, sizeof(kdTree_t)); #ifdef MEMPOOL tree->nodepool = kd_nodepool_new(nPoints*2); #endif struct kd_thread_data my_data; kd_initArg(&my_data, tree->nodepool, points, nPoints, min, max, 0, max_threads, dim); tree->node = (kdNode *)kd_doBuildTree(&my_data); if ( tree->node == NULL ) { free(tree); tree = NULL; } return tree; } /* ******************************************************************* Functions for range searches ******************************************************************* */ /* Returns 1 if node is a point in the hyperrectangle defined by minimum and maximum vectors min and max. */ int kd_isPointInRect(struct kdNode *node, kdata_t *min, kdata_t *max, int dim) { int i; if (node == NULL) return 0; for(i = 0; i < dim; i++) { if (node->location[i] < min[i] || node->location[i] > max[i]) return 0; } return 1; } /* Returns 1 if the hyperrectangle of node is fully contained within the HR described by the minimum and maximum vectors min and max. Returns 0 otherwise. */ int kd_isRectInRect(struct kdNode *node, kdata_t *min, kdata_t *max, int dim) { int i; if (node == NULL) return 0; for(i = 0; i < dim; i++) { if (node->min[i] < min[i] || node->max[i] > max[i]) return 0; } return 1; } /* Returns 1 if the hyperrectangle of node overlaps the HR described the minimum and maximum vectors min and max. Returns 0 otherwise. */ int kd_rectOverlapsRect(struct kdNode *node, kdata_t *min, kdata_t *max, int dim) { int i; if (node == NULL) return 0; for(i = 0; i < dim; i++) { if ((node->min[i] > max[i] || node->max[i] < min[i])) return 0; } return 1; } /*! * \brief Perform orthogonal range search (get all points in a * hyperrectangle). * * \param node the root node of tree to be searched. * * \param min a vector with the minimum positions of the corners of the * hyperrectangle containing the data. * * \param max a vector with the maximum positions of the corners of * the hyperrectangle containing the data. * * \param dim the dimension of the data. * * \return Pointer to a priority queue, NULL in case of problems. */ struct pqueue * kd_ortRangeSearch(struct kdNode *node, kdata_t *min, kdata_t *max, int dim) { struct pqueue *res; if ((res = pqinit(NULL, 1)) == NULL) return NULL; if (!kd_doOrtRangeSearch(node, min, max, dim, res)) { for(size_t i = 0; i < res->size; i++) { free(res->d[i]); } free(res->d); free(res); return NULL; } return res; } /* This is the orthogonal range search. Returns 1 if okay, 0 in case of problems. */ int kd_doOrtRangeSearch(struct kdNode *node, kdata_t *min, kdata_t *max, int dim, struct pqueue *res) { if (node == NULL) return 1; if (kd_isleaf(node) && kd_isPointInRect(node, min, max, dim)) { return kd_insertResTree(node, res); } else { if (kd_isRectInRect(node->left, min, max, dim)) { if (!kd_insertResTree(node->left, res)) return 0; } else { if (kd_rectOverlapsRect(node->left, min, max, dim)) if (!kd_doOrtRangeSearch(node->left, min, max, dim, res)) return 0; } if (kd_isRectInRect(node->right, min, max, dim)) { if (!kd_insertResTree(node->right, res)) return 0; } else { if (kd_rectOverlapsRect(node->right, min, max, dim)) if (!kd_doOrtRangeSearch(node->right, min, max, dim, res)) return 0; } } return 1; } /*! * \brief Find the nearest neighbor of a point. * * \param node the root node of the tree to be searched. * * \param p a vector to the point whose nearest neighbor is sought. * * \param max_dist_sq the square of the maximum distance to the * nearest neighbor. * * \param dim the dimension of the data. * * \return A pointer to node containing the nearest neighbor. * max_dist_sq is set to the square of the distance to the nearest * neigbor. */ struct kdNode * kd_nearest(struct kdNode *node, kdata_t *p, kdata_t *max_dist_sq, int dim) { if ( !node ) return NULL; struct kdNode *nearer, *further; if ( p[node->split] < node->location[node->split] ) { nearer = node->left; further = node->right; } else { nearer = node->right; further = node->left; } struct kdNode *tmp = kd_nearest(nearer, p, max_dist_sq, dim); struct kdNode *nearest = NULL; if ( tmp ) nearest = tmp; else nearest = node; kdata_t dist_sq = kd_dist_sq(nearest->location, p); if (*max_dist_sq > dist_sq) *max_dist_sq = dist_sq; if (!further) return nearest; kdata_t dx = kd_min(KDATA_ABS(p[node->split] - further->min[node->split]), KDATA_ABS(p[node->split] - further->max[node->split])); if ( *max_dist_sq > kd_sqr(dx) ) { /* * some part of the further hyper-rectangle is in the search * radius, search the further node */ struct kdNode *tmp_nearest; tmp = kd_nearest(further, p, max_dist_sq, dim); if ( tmp ) tmp_nearest = tmp; else tmp_nearest = further; kdata_t tmp_dist_sq = kd_dist_sq(tmp_nearest->location, p); if ( tmp_dist_sq < dist_sq || (tmp_dist_sq <= dist_sq && tmp_nearest->index < nearest->index) ) { nearest = tmp_nearest; dist_sq = tmp_dist_sq; *max_dist_sq = kd_min(dist_sq, *max_dist_sq); } } return nearest; } /*! * \brief Return the q nearest-neighbors to a point. * * \param node the root node of the tree to be searched. * * \param p a vector to the point whose nearest neighbors are sought. * * \param max_dist_sq the square of the maximum distance to the * nearest neighbors. * * \param q the maximum number of points to be retured. * * \param dim the dimension of the data. * * \return A pointer to a priority queue of the points found, or NULL * in case of problems. */ struct pqueue * kd_qnearest(struct kdNode *node, kdata_t *p, kdata_t *max_dist_sq, size_t q, int dim) { struct pqueue *res = pqinit(NULL, q + 2); if ( res == NULL) return NULL; if ( !kd_doQnearest(node, p, max_dist_sq, q + 1, dim, res) ) { for ( size_t i = 0; i < res->size; ++i ) free(res->d[i]); free(res->d); free(res); return NULL; } return res; } /* * * This is the q nearest-neighbor search. * * This is a modification of the range search in which the maximum * search radius is decreased to the maximum of the queue as soon as * the queue is filled. * * return 1 if okay, zero in case of problems */ // Uwe Schulzweida: extract kd_check_dist() from kd_doQnearest() static bool kd_check_dist(struct kdNode *node, kdata_t *p, kdata_t *max_dist_sq, size_t q, struct pqueue *res) { kdata_t dist_sq = kd_dist_sq(node->location, p); if ( dist_sq < *max_dist_sq && kd_isleaf(node) ) { struct resItem *point = (struct resItem *) kd_malloc(sizeof(struct resItem), "kd_doQnearest: "); if ( point == NULL) return false; point->node = node; point->dist_sq = dist_sq; pqinsert(res, point); } if ( res->size > q ) { struct resItem *item; pqremove_max(res, &item); free(item); if ( res->size > 1 ) { // Only inspect the queue if there are items left pqpeek_max(res, &item); *max_dist_sq = item->dist_sq; } else { // Nothing was found within the max search radius *max_dist_sq = 0; } } return true; } int kd_doQnearest(struct kdNode *node, kdata_t *p, kdata_t *max_dist_sq, size_t q, int dim, struct pqueue *res) { if ( !node ) return 1; if ( !kd_check_dist(node, p, max_dist_sq, q, res) ) return 0; struct kdNode *nearer, *further; if ( p[node->split] < node->location[node->split] ) { nearer = node->left; further = node->right; } else { nearer = node->right; further = node->left; } if ( !kd_doQnearest(nearer, p, max_dist_sq, q, dim, res) ) return 0; if ( !further ) return 1; kdata_t dx = kd_min(KDATA_ABS(p[node->split] - further->min[node->split]), KDATA_ABS(p[node->split] - further->max[node->split])); if ( *max_dist_sq > kd_sqr(dx) ) { /* * some part of the further hyper-rectangle is in the search * radius, search the further node */ if (!kd_doQnearest(further, p, max_dist_sq, q, dim, res)) return 0; if (!kd_check_dist(node, p, max_dist_sq, q, res)) return 0; } return 1; } /*! * \brief Perform a range search around a point. * * \param node the root node of the tree to be searched. * * \param p the location of the point around which the search is carried out . * * \param max_dist_sq the square of the radius of the hypersphere. * * \param dim the dimension of the data. \param ordered determines * whether the result list should be ordered in increasing distance * (KD_ORDERED) or unordered (KD_UNORDERED). * * \return A pointer to a priority queue containing the points found, * NULL in case of problems. */ struct pqueue * kd_range(struct kdNode *node, kdata_t *p, kdata_t *max_dist_sq, int dim, int ordered) { struct pqueue *res = pqinit(NULL, 1); if ( res == NULL ) return NULL; if ( !kd_doRange(node, p, max_dist_sq, dim, res, ordered) ) { for( size_t i = 0; i < res->size; ++i ) { free(res->d[i]); } free(res->d); free(res); return NULL; } return res; } /* This is the range search. Returns 1 if okay, 0 in case of problems */ int kd_doRange(struct kdNode *node, kdata_t *p, kdata_t *max_dist_sq, int dim, struct pqueue *res, int ordered) { struct kdNode *nearer, *further; struct resItem *point; kdata_t dist_sq, dx; if (!node) return 1; dist_sq = kd_dist_sq(node->location, p); if (dist_sq < *max_dist_sq && kd_isleaf(node)) { if ((point = (struct resItem *)kd_malloc(sizeof(struct resItem), "kd_doRange:")) == NULL) return 0; point->node = node; point->dist_sq = ordered ? dist_sq : -1; pqinsert(res, point); } if (p[node->split] < node->location[node->split]) { nearer = node->left; further = node->right; } else { nearer = node->right; further = node->left; } if (!kd_doRange(nearer, p, max_dist_sq, dim, res, ordered)) return 0; if (!further) return 1; dx = kd_min(KDATA_ABS(p[node->split] - further->min[node->split]), KDATA_ABS(p[node->split] - further->max[node->split])); if (*max_dist_sq > kd_sqr(dx)) { /* * some part of the further hyper-rectangle is in the search * radius, search the further node */ if (!kd_doRange(further, p, max_dist_sq, dim, res, ordered)) return 0; dist_sq = kd_dist_sq(node->location, p); if (dist_sq < *max_dist_sq && kd_isleaf(node)) { if ((point = (struct resItem *)kd_malloc(sizeof(struct resItem), "kd_doRange: ")) == NULL) return 0; point->node = node; point->dist_sq = ordered ? dist_sq : -1; pqinsert(res, point); } } return 1; } /* End range searching functions */ cdo-2.6.6.1/libkdtree/Makefile.in0000664000175000017500000005517415271332515016647 0ustar alastairalastair# Makefile.in generated by automake 1.18.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2025 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@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) am__rm_f = rm -f $(am__rm_f_notfound) am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 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@ subdir = libkdtree ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/libcdi/m4/acx_c_package.m4 \ $(top_srcdir)/libcdi/m4/acx_lang_check_include.m4 \ $(top_srcdir)/libcdi/m4/acx_lang_package.m4 \ $(top_srcdir)/libcdi/m4/acx_m4_list_to_quoted_strings.m4 \ $(top_srcdir)/libcdi/m4/acx_option_search_libs.m4 \ $(top_srcdir)/libcdi/m4/acx_options.m4 \ $(top_srcdir)/libcdi/m4/acx_uuid.m4 \ $(top_srcdir)/libcdi/m4/asx_tr_arg.m4 \ $(top_srcdir)/m4/acx_cfortran_flags.m4 \ $(top_srcdir)/m4/acx_check_cfortran.m4 \ $(top_srcdir)/m4/acx_options.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_subdirs_configure.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/libcdi/m4/acx_lang_c_check_include.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libkdtree_la_LIBADD = am_libkdtree_la_OBJECTS = kdtree_cartesian.lo kdtree_common.lo \ kdtree_spherical.lo pmergesort.lo pqueue.lo qsort.lo libkdtree_la_OBJECTS = $(am_libkdtree_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/kdtree_cartesian.Plo \ ./$(DEPDIR)/kdtree_common.Plo ./$(DEPDIR)/kdtree_spherical.Plo \ ./$(DEPDIR)/pmergesort.Plo ./$(DEPDIR)/pqueue.Plo \ ./$(DEPDIR)/qsort.Plo am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libkdtree_la_SOURCES) DIST_SOURCES = $(libkdtree_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CPPFLAGS = @AM_CPPFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH = @BASH@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CLDFLAGS = @CLDFLAGS@ CLIBS = @CLIBS@ CMOR_LIBS = @CMOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CURL_INCLUDE = @CURL_INCLUDE@ CURL_LDFLAGS = @CURL_LDFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DCE_UUIDROOT = @DCE_UUIDROOT@ DCE_UUID_C_INCLUDE = @DCE_UUID_C_INCLUDE@ DCE_UUID_C_LIB = @DCE_UUID_C_LIB@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECCODES_INCLUDE = @ECCODES_INCLUDE@ ECCODES_LIBS = @ECCODES_LIBS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_ACROSS = @ENABLE_ACROSS@ ENABLE_CDI_LIB = @ENABLE_CDI_LIB@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ ENABLE_EXTRA = @ENABLE_EXTRA@ ENABLE_FORTRAN = @ENABLE_FORTRAN@ ENABLE_GRIB = @ENABLE_GRIB@ ENABLE_GRIBAPI = @ENABLE_GRIBAPI@ ENABLE_IEG = @ENABLE_IEG@ ENABLE_NETCDF = @ENABLE_NETCDF@ ENABLE_SERVICE = @ENABLE_SERVICE@ ENABLE_THREADS = @ENABLE_THREADS@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ FILECMD = @FILECMD@ FORTRAN_WORKS = @FORTRAN_WORKS@ GREP = @GREP@ HAVE_CXX20 = @HAVE_CXX20@ HDF5_INCLUDE = @HDF5_INCLUDE@ HDF5_LIBS = @HDF5_LIBS@ HDF5_ROOT = @HDF5_ROOT@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAGICS_INCLUDE = @MAGICS_INCLUDE@ MAGICS_LIBS = @MAGICS_LIBS@ MAGICS_ROOT = @MAGICS_ROOT@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETCDF_INCLUDE = @NETCDF_INCLUDE@ NETCDF_LIBS = @NETCDF_LIBS@ NETCDF_ROOT = @NETCDF_ROOT@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OSSP_UUIDROOT = @OSSP_UUIDROOT@ OSSP_UUID_C_INCLUDE = @OSSP_UUID_C_INCLUDE@ OSSP_UUID_C_LIB = @OSSP_UUID_C_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PROJ_INCLUDE = @PROJ_INCLUDE@ PROJ_LDFLAGS = @PROJ_LDFLAGS@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SYSTEM_TYPE = @SYSTEM_TYPE@ SZLIB_INCLUDE = @SZLIB_INCLUDE@ SZLIB_LIBS = @SZLIB_LIBS@ THREADS_INCLUDE = @THREADS_INCLUDE@ THREADS_LIBS = @THREADS_LIBS@ UDUNITS_INCLUDE = @UDUNITS_INCLUDE@ UDUNITS_LDFLAGS = @UDUNITS_LDFLAGS@ UTIL_LINUX_UUIDROOT = @UTIL_LINUX_UUIDROOT@ UTIL_LINUX_UUID_C_INCLUDE = @UTIL_LINUX_UUID_C_INCLUDE@ UTIL_LINUX_UUID_C_LIB = @UTIL_LINUX_UUID_C_LIB@ UUID_C_INCLUDE = @UUID_C_INCLUDE@ UUID_C_LIB = @UUID_C_LIB@ VERSION = @VERSION@ XML2_LIBS = @XML2_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ am__xargs_n = @am__xargs_n@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ 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@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ subdirs_extra = @subdirs_extra@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # noinst_LTLIBRARIES = libkdtree.la libkdtree_la_SOURCES = kdtree.h kdtree_cartesian.cc kdtree_common.cc kdtree_spherical.cc pmergesort.cc pqueue.cc pqueue.h qsort.cc all: all-am .SUFFIXES: .SUFFIXES: .cc .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libkdtree/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign libkdtree/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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -$(am__rm_f) $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ echo rm -f $${locs}; \ $(am__rm_f) $${locs} libkdtree.la: $(libkdtree_la_OBJECTS) $(libkdtree_la_DEPENDENCIES) $(EXTRA_libkdtree_la_DEPENDENCIES) $(AM_V_CXXLD)$(CXXLINK) $(libkdtree_la_OBJECTS) $(libkdtree_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kdtree_cartesian.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kdtree_common.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kdtree_spherical.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pmergesort.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pqueue.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qsort.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @: >>$@ am--depfiles: $(am__depfiles_remade) .cc.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cc.lo: @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -$(am__rm_f) $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_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-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/kdtree_cartesian.Plo -rm -f ./$(DEPDIR)/kdtree_common.Plo -rm -f ./$(DEPDIR)/kdtree_spherical.Plo -rm -f ./$(DEPDIR)/pmergesort.Plo -rm -f ./$(DEPDIR)/pqueue.Plo -rm -f ./$(DEPDIR)/qsort.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/kdtree_cartesian.Plo -rm -f ./$(DEPDIR)/kdtree_common.Plo -rm -f ./$(DEPDIR)/kdtree_spherical.Plo -rm -f ./$(DEPDIR)/pmergesort.Plo -rm -f ./$(DEPDIR)/pqueue.Plo -rm -f ./$(DEPDIR)/qsort.Plo -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: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile # 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: # Tell GNU make to disable its built-in pattern rules. %:: %,v %:: RCS/%,v %:: RCS/% %:: s.% %:: SCCS/s.% cdo-2.6.6.1/libkdtree/Makefile.am0000664000175000017500000000034115271332515016620 0ustar alastairalastair## Process this file with automake to produce Makefile.in # noinst_LTLIBRARIES = libkdtree.la libkdtree_la_SOURCES = kdtree.h kdtree_cartesian.cc kdtree_common.cc kdtree_spherical.cc pmergesort.cc pqueue.cc pqueue.h qsort.cc cdo-2.6.6.1/README0000664000175000017500000000632415271332515013506 0ustar alastairalastair CDO - Climate Data Operators ---------------------------- This package contains the source code for CDO. This program was developed at the Max-Planck-Institute for Meteorology. CDO is a collection of Operators to manipulate and analyse Climate model Data. Supported data formats are GRIB, netCDF, SERVICE, EXTRA and IEG. See the AUTHORS file for the list of authors. CDO is licensed under the 3-clause BSD License. This License covers all files in the CDO repository unless stated otherwise. Read the file LICENSE in the source distribution for details. MPI-M makes no representations or warranties of any kind concerning the Software and any results (including but not limited to any data) generated by use of the Software (hereinafter "Results"), express or implied, and the absence of any legal or actual defects, whether discoverable or not. The use of the Software and the Results is at your own risk. Specifically, and not to limit the foregoing, MPI-M makes no representations or warranties (i) regarding the fitness for a particular purpose of the Software and the Results, (ii) that the use of the Software and the Results will not infringe any patents or other intellectual property rights of any third party, and (iii) that the use of the Software and the Results will not cause any damages of any kind to you or to any third party. Operators: There are more than 600 operators available. Read OPERATORS for a short overview of all operators. Documentation: A detailed description of all operators can be found in: ./doc/cdo.pdf Online reference manuals: cdo -h Building and installing it: 1. Run ./configure, with some options if you wish. The standard options are documented in the INSTALL file. The configuration script has some more options; type 'configure -h' to see them. The most interesting ones are the usual --prefix= and --with-netcdf= to enable netCDF support. The netCDF-4 configuration depends on the netCDF-4 and HDF5 installation! You have to define the location of the HDF5 installation if netCDF-4 was build with HDF5 support: --with-netcdf= --with-hdf5= You have to specify also the location of the SZLIB if HDF5 was build with SZLIB support. If only the linking is required, you can directly set the linking path with --with-szlib-lib=, --with-zlib-lib= and --with-hdf5-lib= To process szip compressed GRIB files you have to enable SZLIB support with: --with-szlib= 2. Do "make" to compile the program. 3. (Optional) Do "make install", possibly as root if the destination permissions require that. This installs CDO in the directory specified during configuration. The default prefix is /usr/local. Porting: This package was designed for maximum portability. It is written entirely in ISO C++20 and C11, and will compile on most UNIX platforms. Contact: Send questions, comments and bug reports to cdo-2.6.6.1/libnanoflann/0000775000175000017500000000000015271332515015262 5ustar alastairalastaircdo-2.6.6.1/libnanoflann/nanoflann.hpp0000664000175000017500000022221515271332515017751 0ustar alastairalastair/*********************************************************************** * Software License Agreement (BSD License) * * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. * Copyright 2011-2021 Jose Luis Blanco (joseluisblancoc@gmail.com). * All rights reserved. * * THE BSD LICENSE * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. *************************************************************************/ /** \mainpage nanoflann C++ API documentation * nanoflann is a C++ header-only library for building KD-Trees, mostly * optimized for 2D or 3D point clouds. * * nanoflann does not require compiling or installing, just an * #include in your code. * * See: * - C++ API organized by modules * - Online README * - Doxygen * documentation */ #ifndef NANOFLANN_HPP_ #define NANOFLANN_HPP_ // Uwe Schulzweida #define NANOFLANN_FIRST_MATCH 1 #include #include #include #include // for abs() #include // for fwrite() #include // for abs() #include #include // std::reference_wrapper #include #include /** Library version: 0xMmP (M=Major,m=minor,P=patch) */ #define NANOFLANN_VERSION 0x132 // Avoid conflicting declaration of min/max macros in windows headers /* #if !defined(NOMINMAX) && \ (defined(_WIN32) || defined(_WIN32_) || defined(WIN32) || defined(_WIN64)) #define NOMINMAX #ifdef max #undef max #undef min #endif #endif */ namespace nanoflann { /** @addtogroup nanoflann_grp nanoflann C++ library for ANN * @{ */ /** the PI constant (required to avoid MSVC missing symbols) */ template T pi_const() { return static_cast(3.14159265358979323846); } /** * Traits if object is resizable and assignable (typically has a resize | assign * method) */ template struct has_resize : std::false_type {}; template struct has_resize().resize(1), 0)> : std::true_type {}; template struct has_assign : std::false_type {}; template struct has_assign().assign(1, 0), 0)> : std::true_type {}; /** * Free function to resize a resizable object */ template inline typename std::enable_if::value, void>::type resize(Container &c, const size_t nElements) { c.resize(nElements); } /** * Free function that has no effects on non resizable containers (e.g. * std::array) It raises an exception if the expected size does not match */ template inline typename std::enable_if::value, void>::type resize(Container &c, const size_t nElements) { if (nElements != c.size()) throw std::logic_error("Try to change the size of a std::array."); } /** * Free function to assign to a container */ template inline typename std::enable_if::value, void>::type assign(Container &c, const size_t nElements, const T &value) { c.assign(nElements, value); } /** * Free function to assign to a std::array */ template inline typename std::enable_if::value, void>::type assign(Container &c, const size_t nElements, const T &value) { for (size_t i = 0; i < nElements; i++) c[i] = value; } /** @addtogroup result_sets_grp Result set classes * @{ */ template class KNNResultSet { public: typedef _DistanceType DistanceType; typedef _IndexType IndexType; typedef _CountType CountType; private: IndexType *indices; DistanceType *dists; // Uwe Schulzweida DistanceType radius; CountType capacity; CountType count; public: inline KNNResultSet(CountType capacity_) : indices(0), dists(0), capacity(capacity_), count(0) {} // Uwe Schulzweida inline KNNResultSet(DistanceType radius_, CountType capacity_) : indices(0), dists(0), radius(radius_), capacity(capacity_), count(0) {} inline void init(IndexType *indices_, DistanceType *dists_) { indices = indices_; dists = dists_; count = 0; // Uwe Schulzweida if (capacity) dists[capacity - 1] = radius; if (capacity) indices[capacity - 1] = (std::numeric_limits::max)(); } inline CountType size() const { return count; } inline bool full() const { return count == capacity; } /** * Called during search to add an element matching the criteria. * @return true if the search should be continued, false if the results are * sufficient */ inline bool addPoint(DistanceType dist, IndexType index) { CountType i; for (i = count; i > 0; --i) { #ifdef NANOFLANN_FIRST_MATCH // If defined and two points have the same // distance, the one with the lowest-index will be // returned first. // if ((dists[i - 1] > dist) || ((dist == dists[i - 1]) && (indices[i - 1] > index))) { // Uwe Schulzweida if ((dists[i - 1] > dist) || ((dist <= dists[i - 1]) && (indices[i - 1] > index))) { #else if (dists[i - 1] > dist) { #endif if (i < capacity) { dists[i] = dists[i - 1]; indices[i] = indices[i - 1]; } } else break; } if (i < capacity) { dists[i] = dist; indices[i] = index; } if (count < capacity) count++; // tell caller that the search shall continue return true; } inline DistanceType worstDist() const { return dists[capacity - 1]; } // Uwe Schulzweida inline IndexType worstIndex() const { return indices[capacity - 1]; } }; /** operator "<" for std::sort() */ struct IndexDist_Sorter { /** PairType will be typically: std::pair */ template inline bool operator()(const PairType &p1, const PairType &p2) const { return p1.second < p2.second; } }; /** * A result-set class used when performing a radius based search. */ template class RadiusResultSet { public: typedef _DistanceType DistanceType; typedef _IndexType IndexType; public: const DistanceType radius; std::vector> &m_indices_dists; inline RadiusResultSet( DistanceType radius_, std::vector> &indices_dists) : radius(radius_), m_indices_dists(indices_dists) { init(); } inline void init() { clear(); } inline void clear() { m_indices_dists.clear(); } inline size_t size() const { return m_indices_dists.size(); } inline bool full() const { return true; } /** * Called during search to add an element matching the criteria. * @return true if the search should be continued, false if the results are * sufficient */ inline bool addPoint(DistanceType dist, IndexType index) { if (dist < radius) m_indices_dists.push_back(std::make_pair(index, dist)); return true; } inline DistanceType worstDist() const { return radius; } /** * Find the worst result (furtherest neighbor) without copying or sorting * Pre-conditions: size() > 0 */ std::pair worst_item() const { if (m_indices_dists.empty()) throw std::runtime_error("Cannot invoke RadiusResultSet::worst_item() on " "an empty list of results."); typedef typename std::vector>::const_iterator DistIt; DistIt it = std::max_element(m_indices_dists.begin(), m_indices_dists.end(), IndexDist_Sorter()); return *it; } }; /** @} */ /** @addtogroup loadsave_grp Load/save auxiliary functions * @{ */ template void save_value(FILE *stream, const T &value, size_t count = 1) { fwrite(&value, sizeof(value), count, stream); } template void save_value(FILE *stream, const std::vector &value) { size_t size = value.size(); fwrite(&size, sizeof(size_t), 1, stream); fwrite(value.data(), sizeof(T), size, stream); } template void load_value(FILE *stream, T &value, size_t count = 1) { size_t read_cnt = fread(&value, sizeof(value), count, stream); if (read_cnt != count) { throw std::runtime_error("Cannot read from file"); } } template void load_value(FILE *stream, std::vector &value) { size_t size; size_t read_cnt = fread(&size, sizeof(size_t), 1, stream); if (read_cnt != 1) { throw std::runtime_error("Cannot read from file"); } value.resize(size); read_cnt = fread(value.data(), sizeof(T), size, stream); if (read_cnt != size) { throw std::runtime_error("Cannot read from file"); } } /** @} */ /** @addtogroup metric_grp Metric (distance) classes * @{ */ struct Metric {}; /** Manhattan distance functor (generic version, optimized for * high-dimensionality data sets). Corresponding distance traits: * nanoflann::metric_L1 \tparam T Type of the elements (e.g. double, float, * uint8_t) \tparam _DistanceType Type of distance variables (must be signed) * (e.g. float, double, int64_t) */ template struct L1_Adaptor { typedef T ElementType; typedef _DistanceType DistanceType; const DataSource &data_source; L1_Adaptor(const DataSource &_data_source) : data_source(_data_source) {} inline DistanceType evalMetric(const T *a, const size_t b_idx, size_t size, DistanceType worst_dist = -1) const { DistanceType result = DistanceType(); const T *last = a + size; const T *lastgroup = last - 3; size_t d = 0; /* Process 4 items with each loop for efficiency. */ while (a < lastgroup) { const DistanceType diff0 = std::abs(a[0] - data_source.kdtree_get_pt(b_idx, d++)); const DistanceType diff1 = std::abs(a[1] - data_source.kdtree_get_pt(b_idx, d++)); const DistanceType diff2 = std::abs(a[2] - data_source.kdtree_get_pt(b_idx, d++)); const DistanceType diff3 = std::abs(a[3] - data_source.kdtree_get_pt(b_idx, d++)); result += diff0 + diff1 + diff2 + diff3; a += 4; if ((worst_dist > 0) && (result > worst_dist)) { return result; } } /* Process last 0-3 components. Not needed for standard vector lengths. */ while (a < last) { result += std::abs(*a++ - data_source.kdtree_get_pt(b_idx, d++)); } return result; } template inline DistanceType accum_dist(const U a, const V b, const size_t) const { return std::abs(a - b); } }; /** Squared Euclidean distance functor (generic version, optimized for * high-dimensionality data sets). Corresponding distance traits: * nanoflann::metric_L2 \tparam T Type of the elements (e.g. double, float, * uint8_t) \tparam _DistanceType Type of distance variables (must be signed) * (e.g. float, double, int64_t) */ template struct L2_Adaptor { typedef T ElementType; typedef _DistanceType DistanceType; const DataSource &data_source; L2_Adaptor(const DataSource &_data_source) : data_source(_data_source) {} inline DistanceType evalMetric(const T *a, const size_t b_idx, size_t size, DistanceType worst_dist = -1) const { DistanceType result = DistanceType(); const T *last = a + size; const T *lastgroup = last - 3; size_t d = 0; /* Process 4 items with each loop for efficiency. */ while (a < lastgroup) { const DistanceType diff0 = a[0] - data_source.kdtree_get_pt(b_idx, d++); const DistanceType diff1 = a[1] - data_source.kdtree_get_pt(b_idx, d++); const DistanceType diff2 = a[2] - data_source.kdtree_get_pt(b_idx, d++); const DistanceType diff3 = a[3] - data_source.kdtree_get_pt(b_idx, d++); result += diff0 * diff0 + diff1 * diff1 + diff2 * diff2 + diff3 * diff3; a += 4; if ((worst_dist > 0) && (result > worst_dist)) { return result; } } /* Process last 0-3 components. Not needed for standard vector lengths. */ while (a < last) { const DistanceType diff0 = *a++ - data_source.kdtree_get_pt(b_idx, d++); result += diff0 * diff0; } return result; } template inline DistanceType accum_dist(const U a, const V b, const size_t) const { return (a - b) * (a - b); } }; /** Squared Euclidean (L2) distance functor (suitable for low-dimensionality * datasets, like 2D or 3D point clouds) Corresponding distance traits: * nanoflann::metric_L2_Simple \tparam T Type of the elements (e.g. double, * float, uint8_t) \tparam _DistanceType Type of distance variables (must be * signed) (e.g. float, double, int64_t) */ template struct L2_Simple_Adaptor { typedef T ElementType; typedef _DistanceType DistanceType; const DataSource &data_source; L2_Simple_Adaptor(const DataSource &_data_source) : data_source(_data_source) {} inline DistanceType evalMetric(const T *a, const size_t b_idx, size_t size) const { DistanceType result = DistanceType(); for (size_t i = 0; i < size; ++i) { const DistanceType diff = a[i] - data_source.kdtree_get_pt(b_idx, i); result += diff * diff; } return result; } template inline DistanceType accum_dist(const U a, const V b, const size_t) const { return (a - b) * (a - b); } }; /** SO2 distance functor * Corresponding distance traits: nanoflann::metric_SO2 * \tparam T Type of the elements (e.g. double, float) * \tparam _DistanceType Type of distance variables (must be signed) (e.g. * float, double) orientation is constrained to be in [-pi, pi] */ template struct SO2_Adaptor { typedef T ElementType; typedef _DistanceType DistanceType; const DataSource &data_source; SO2_Adaptor(const DataSource &_data_source) : data_source(_data_source) {} inline DistanceType evalMetric(const T *a, const size_t b_idx, size_t size) const { return accum_dist(a[size - 1], data_source.kdtree_get_pt(b_idx, size - 1), size - 1); } /** Note: this assumes that input angles are already in the range [-pi,pi] */ template inline DistanceType accum_dist(const U a, const V b, const size_t) const { DistanceType result = DistanceType(); DistanceType PI = pi_const(); result = b - a; if (result > PI) result -= 2 * PI; else if (result < -PI) result += 2 * PI; return result; } }; /** SO3 distance functor (Uses L2_Simple) * Corresponding distance traits: nanoflann::metric_SO3 * \tparam T Type of the elements (e.g. double, float) * \tparam _DistanceType Type of distance variables (must be signed) (e.g. * float, double) */ template struct SO3_Adaptor { typedef T ElementType; typedef _DistanceType DistanceType; L2_Simple_Adaptor distance_L2_Simple; SO3_Adaptor(const DataSource &_data_source) : distance_L2_Simple(_data_source) {} inline DistanceType evalMetric(const T *a, const size_t b_idx, size_t size) const { return distance_L2_Simple.evalMetric(a, b_idx, size); } template inline DistanceType accum_dist(const U a, const V b, const size_t idx) const { return distance_L2_Simple.accum_dist(a, b, idx); } }; /** Metaprogramming helper traits class for the L1 (Manhattan) metric */ struct metric_L1 : public Metric { template struct traits { typedef L1_Adaptor distance_t; }; }; /** Metaprogramming helper traits class for the L2 (Euclidean) metric */ struct metric_L2 : public Metric { template struct traits { typedef L2_Adaptor distance_t; }; }; /** Metaprogramming helper traits class for the L2_simple (Euclidean) metric */ struct metric_L2_Simple : public Metric { template struct traits { typedef L2_Simple_Adaptor distance_t; }; }; /** Metaprogramming helper traits class for the SO3_InnerProdQuat metric */ struct metric_SO2 : public Metric { template struct traits { typedef SO2_Adaptor distance_t; }; }; /** Metaprogramming helper traits class for the SO3_InnerProdQuat metric */ struct metric_SO3 : public Metric { template struct traits { typedef SO3_Adaptor distance_t; }; }; /** @} */ /** @addtogroup param_grp Parameter structs * @{ */ /** Parameters (see README.md) */ struct KDTreeSingleIndexAdaptorParams { KDTreeSingleIndexAdaptorParams(size_t _leaf_max_size = 10) : leaf_max_size(_leaf_max_size) {} size_t leaf_max_size; }; /** Search options for KDTreeSingleIndexAdaptor::findNeighbors() */ struct SearchParams { /** Note: The first argument (checks_IGNORED_) is ignored, but kept for * compatibility with the FLANN interface */ SearchParams(int checks_IGNORED_ = 32, float eps_ = 0, bool sorted_ = true) : checks(checks_IGNORED_), eps(eps_), sorted(sorted_) {} int checks; //!< Ignored parameter (Kept for compatibility with the FLANN //!< interface). float eps; //!< search for eps-approximate neighbours (default: 0) bool sorted; //!< only for radius search, require neighbours sorted by //!< distance (default: true) }; /** @} */ /** @addtogroup memalloc_grp Memory allocation * @{ */ /** * Allocates (using C's malloc) a generic type T. * * Params: * count = number of instances to allocate. * Returns: pointer (of type T*) to memory buffer */ template inline T *allocate(size_t count = 1) { T *mem = static_cast(::malloc(sizeof(T) * count)); return mem; } /** * Pooled storage allocator * * The following routines allow for the efficient allocation of storage in * small chunks from a specified pool. Rather than allowing each structure * to be freed individually, an entire pool of storage is freed at once. * This method has two advantages over just using malloc() and free(). First, * it is far more efficient for allocating small objects, as there is * no overhead for remembering all the information needed to free each * object or consolidating fragmented memory. Second, the decision about * how long to keep an object is made at the time of allocation, and there * is no need to track down all the objects to free them. * */ const size_t WORDSIZE = 16; const size_t BLOCKSIZE = 8192; class PooledAllocator { /* We maintain memory alignment to word boundaries by requiring that all allocations be in multiples of the machine wordsize. */ /* Size of machine word in bytes. Must be power of 2. */ /* Minimum number of bytes requested at a time from the system. Must be * multiple of WORDSIZE. */ size_t remaining; /* Number of bytes left in current block of storage. */ void *base; /* Pointer to base of current block of storage. */ void *loc; /* Current location in block to next allocate memory. */ void internal_init() { remaining = 0; base = NULL; usedMemory = 0; wastedMemory = 0; } public: size_t usedMemory; size_t wastedMemory; /** Default constructor. Initializes a new pool. */ PooledAllocator() { internal_init(); } /** * Destructor. Frees all the memory allocated in this pool. */ ~PooledAllocator() { free_all(); } /** Frees all allocated memory chunks */ void free_all() { while (base != NULL) { void *prev = *(static_cast(base)); /* Get pointer to prev block. */ ::free(base); base = prev; } internal_init(); } /** * Returns a pointer to a piece of new memory of the given size in bytes * allocated from the pool. */ void *malloc(const size_t req_size) { /* Round size up to a multiple of wordsize. The following expression only works for WORDSIZE that is a power of 2, by masking last bits of incremented size to zero. */ const size_t size = (req_size + (WORDSIZE - 1)) & ~(WORDSIZE - 1); /* Check whether a new block must be allocated. Note that the first word of a block is reserved for a pointer to the previous block. */ if (size > remaining) { wastedMemory += remaining; /* Allocate new storage. */ const size_t blocksize = (size + sizeof(void *) + (WORDSIZE - 1) > BLOCKSIZE) ? size + sizeof(void *) + (WORDSIZE - 1) : BLOCKSIZE; // use the standard C malloc to allocate memory void *m = ::malloc(blocksize); if (!m) { fprintf(stderr, "Failed to allocate memory.\n"); throw std::bad_alloc(); } /* Fill first word of new block with pointer to previous block. */ static_cast(m)[0] = base; base = m; size_t shift = 0; // int size_t = (WORDSIZE - ( (((size_t)m) + sizeof(void*)) & // (WORDSIZE-1))) & (WORDSIZE-1); remaining = blocksize - sizeof(void *) - shift; loc = (static_cast(m) + sizeof(void *) + shift); } void *rloc = loc; loc = static_cast(loc) + size; remaining -= size; usedMemory += size; return rloc; } /** * Allocates (using this pool) a generic type T. * * Params: * count = number of instances to allocate. * Returns: pointer (of type T*) to memory buffer */ template T *allocate(const size_t count = 1) { T *mem = static_cast(this->malloc(sizeof(T) * count)); return mem; } }; /** @} */ /** @addtogroup nanoflann_metaprog_grp Auxiliary metaprogramming stuff * @{ */ /** Used to declare fixed-size arrays when DIM>0, dynamically-allocated vectors * when DIM=-1. Fixed size version for a generic DIM: */ template struct array_or_vector_selector { typedef std::array container_t; }; /** Dynamic size version */ template struct array_or_vector_selector<-1, T> { typedef std::vector container_t; }; /** @} */ /** kd-tree base-class * * Contains the member functions common to the classes KDTreeSingleIndexAdaptor * and KDTreeSingleIndexDynamicAdaptor_. * * \tparam Derived The name of the class which inherits this class. * \tparam DatasetAdaptor The user-provided adaptor (see comments above). * \tparam Distance The distance metric to use, these are all classes derived * from nanoflann::Metric \tparam DIM Dimensionality of data points (e.g. 3 for * 3D points) \tparam IndexType Will be typically size_t or int */ template class KDTreeBaseClass { public: /** Frees the previously-built index. Automatically called within * buildIndex(). */ void freeIndex(Derived &obj) { obj.pool.free_all(); obj.root_node = NULL; obj.m_size_at_index_build = 0; } typedef typename Distance::ElementType ElementType; typedef typename Distance::DistanceType DistanceType; /*--------------------- Internal Data Structures --------------------------*/ struct Node { /** Union used because a node can be either a LEAF node or a non-leaf node, * so both data fields are never used simultaneously */ union { struct leaf { IndexType left, right; //!< Indices of points in leaf node } lr; struct nonleaf { int divfeat; //!< Dimension used for subdivision. DistanceType divlow, divhigh; //!< The values used for subdivision. } sub; } node_type; Node *child1, *child2; //!< Child nodes (both=NULL mean its a leaf node) }; typedef Node *NodePtr; struct Interval { ElementType low, high; }; /** * Array of indices to vectors in the dataset. */ std::vector vind; NodePtr root_node; size_t m_leaf_max_size; size_t m_size; //!< Number of current points in the dataset size_t m_size_at_index_build; //!< Number of points in the dataset when the //!< index was built int dim; //!< Dimensionality of each data point /** Define "BoundingBox" as a fixed-size or variable-size container depending * on "DIM" */ typedef typename array_or_vector_selector::container_t BoundingBox; /** Define "distance_vector_t" as a fixed-size or variable-size container * depending on "DIM" */ typedef typename array_or_vector_selector::container_t distance_vector_t; /** The KD-tree used to find neighbours */ BoundingBox root_bbox; /** * Pooled memory allocator. * * Using a pooled memory allocator is more efficient * than allocating memory directly when there is a large * number small of memory allocations. */ PooledAllocator pool; /** Returns number of points in dataset */ size_t size(const Derived &obj) const { return obj.m_size; } /** Returns the length of each point in the dataset */ size_t veclen(const Derived &obj) { return static_cast(DIM > 0 ? DIM : obj.dim); } /// Helper accessor to the dataset points: inline ElementType dataset_get(const Derived &obj, size_t idx, int component) const { return obj.dataset.kdtree_get_pt(idx, component); } /** * Computes the inde memory usage * Returns: memory used by the index */ size_t usedMemory(Derived &obj) { return obj.pool.usedMemory + obj.pool.wastedMemory + obj.dataset.kdtree_get_point_count() * sizeof(IndexType); // pool memory and vind array memory } void computeMinMax(const Derived &obj, IndexType *ind, IndexType count, int element, ElementType &min_elem, ElementType &max_elem) { min_elem = dataset_get(obj, ind[0], element); max_elem = dataset_get(obj, ind[0], element); for (IndexType i = 1; i < count; ++i) { ElementType val = dataset_get(obj, ind[i], element); if (val < min_elem) min_elem = val; if (val > max_elem) max_elem = val; } } /** * Create a tree node that subdivides the list of vecs from vind[first] * to vind[last]. The routine is called recursively on each sublist. * * @param left index of the first vector * @param right index of the last vector */ NodePtr divideTree(Derived &obj, const IndexType left, const IndexType right, BoundingBox &bbox) { NodePtr node = obj.pool.template allocate(); // allocate memory /* If too few exemplars remain, then make this a leaf node. */ if ((right - left) <= static_cast(obj.m_leaf_max_size)) { node->child1 = node->child2 = NULL; /* Mark as leaf node. */ node->node_type.lr.left = left; node->node_type.lr.right = right; // compute bounding-box of leaf points for (int i = 0; i < (DIM > 0 ? DIM : obj.dim); ++i) { bbox[i].low = dataset_get(obj, obj.vind[left], i); bbox[i].high = dataset_get(obj, obj.vind[left], i); } for (IndexType k = left + 1; k < right; ++k) { for (int i = 0; i < (DIM > 0 ? DIM : obj.dim); ++i) { if (bbox[i].low > dataset_get(obj, obj.vind[k], i)) bbox[i].low = dataset_get(obj, obj.vind[k], i); if (bbox[i].high < dataset_get(obj, obj.vind[k], i)) bbox[i].high = dataset_get(obj, obj.vind[k], i); } } } else { IndexType idx; int cutfeat; DistanceType cutval; middleSplit_(obj, &obj.vind[0] + left, right - left, idx, cutfeat, cutval, bbox); node->node_type.sub.divfeat = cutfeat; BoundingBox left_bbox(bbox); left_bbox[cutfeat].high = cutval; node->child1 = divideTree(obj, left, left + idx, left_bbox); BoundingBox right_bbox(bbox); right_bbox[cutfeat].low = cutval; node->child2 = divideTree(obj, left + idx, right, right_bbox); node->node_type.sub.divlow = left_bbox[cutfeat].high; node->node_type.sub.divhigh = right_bbox[cutfeat].low; for (int i = 0; i < (DIM > 0 ? DIM : obj.dim); ++i) { bbox[i].low = std::min(left_bbox[i].low, right_bbox[i].low); bbox[i].high = std::max(left_bbox[i].high, right_bbox[i].high); } } return node; } void middleSplit_(Derived &obj, IndexType *ind, IndexType count, IndexType &index, int &cutfeat, DistanceType &cutval, const BoundingBox &bbox) { const DistanceType EPS = static_cast(0.00001); ElementType max_span = bbox[0].high - bbox[0].low; for (int i = 1; i < (DIM > 0 ? DIM : obj.dim); ++i) { ElementType span = bbox[i].high - bbox[i].low; if (span > max_span) { max_span = span; } } ElementType max_spread = -1; cutfeat = 0; for (int i = 0; i < (DIM > 0 ? DIM : obj.dim); ++i) { ElementType span = bbox[i].high - bbox[i].low; if (span > (1 - EPS) * max_span) { ElementType min_elem, max_elem; computeMinMax(obj, ind, count, i, min_elem, max_elem); ElementType spread = max_elem - min_elem; ; if (spread > max_spread) { cutfeat = i; max_spread = spread; } } } // split in the middle DistanceType split_val = (bbox[cutfeat].low + bbox[cutfeat].high) / 2; ElementType min_elem, max_elem; computeMinMax(obj, ind, count, cutfeat, min_elem, max_elem); if (split_val < min_elem) cutval = min_elem; else if (split_val > max_elem) cutval = max_elem; else cutval = split_val; IndexType lim1, lim2; planeSplit(obj, ind, count, cutfeat, cutval, lim1, lim2); if (lim1 > count / 2) index = lim1; else if (lim2 < count / 2) index = lim2; else index = count / 2; } /** * Subdivide the list of points by a plane perpendicular on axe corresponding * to the 'cutfeat' dimension at 'cutval' position. * * On return: * dataset[ind[0..lim1-1]][cutfeat]cutval */ void planeSplit(Derived &obj, IndexType *ind, const IndexType count, int cutfeat, DistanceType &cutval, IndexType &lim1, IndexType &lim2) { /* Move vector indices for left subtree to front of list. */ IndexType left = 0; IndexType right = count - 1; for (;;) { while (left <= right && dataset_get(obj, ind[left], cutfeat) < cutval) ++left; while (right && left <= right && dataset_get(obj, ind[right], cutfeat) >= cutval) --right; if (left > right || !right) break; // "!right" was added to support unsigned Index types std::swap(ind[left], ind[right]); ++left; --right; } /* If either list is empty, it means that all remaining features * are identical. Split in the middle to maintain a balanced tree. */ lim1 = left; right = count - 1; for (;;) { while (left <= right && dataset_get(obj, ind[left], cutfeat) <= cutval) ++left; while (right && left <= right && dataset_get(obj, ind[right], cutfeat) > cutval) --right; if (left > right || !right) break; // "!right" was added to support unsigned Index types std::swap(ind[left], ind[right]); ++left; --right; } lim2 = left; } DistanceType computeInitialDistances(const Derived &obj, const ElementType *vec, distance_vector_t &dists) const { assert(vec); DistanceType distsq = DistanceType(); for (int i = 0; i < (DIM > 0 ? DIM : obj.dim); ++i) { if (vec[i] < obj.root_bbox[i].low) { dists[i] = obj.distance.accum_dist(vec[i], obj.root_bbox[i].low, i); distsq += dists[i]; } if (vec[i] > obj.root_bbox[i].high) { dists[i] = obj.distance.accum_dist(vec[i], obj.root_bbox[i].high, i); distsq += dists[i]; } } return distsq; } void save_tree(Derived &obj, FILE *stream, NodePtr tree) { save_value(stream, *tree); if (tree->child1 != NULL) { save_tree(obj, stream, tree->child1); } if (tree->child2 != NULL) { save_tree(obj, stream, tree->child2); } } void load_tree(Derived &obj, FILE *stream, NodePtr &tree) { tree = obj.pool.template allocate(); load_value(stream, *tree); if (tree->child1 != NULL) { load_tree(obj, stream, tree->child1); } if (tree->child2 != NULL) { load_tree(obj, stream, tree->child2); } } /** Stores the index in a binary file. * IMPORTANT NOTE: The set of data points is NOT stored in the file, so when * loading the index object it must be constructed associated to the same * source of data points used while building it. See the example: * examples/saveload_example.cpp \sa loadIndex */ void saveIndex_(Derived &obj, FILE *stream) { save_value(stream, obj.m_size); save_value(stream, obj.dim); save_value(stream, obj.root_bbox); save_value(stream, obj.m_leaf_max_size); save_value(stream, obj.vind); save_tree(obj, stream, obj.root_node); } /** Loads a previous index from a binary file. * IMPORTANT NOTE: The set of data points is NOT stored in the file, so the * index object must be constructed associated to the same source of data * points used while building the index. See the example: * examples/saveload_example.cpp \sa loadIndex */ void loadIndex_(Derived &obj, FILE *stream) { load_value(stream, obj.m_size); load_value(stream, obj.dim); load_value(stream, obj.root_bbox); load_value(stream, obj.m_leaf_max_size); load_value(stream, obj.vind); load_tree(obj, stream, obj.root_node); } }; /** @addtogroup kdtrees_grp KD-tree classes and adaptors * @{ */ /** kd-tree static index * * Contains the k-d trees and other information for indexing a set of points * for nearest-neighbor matching. * * The class "DatasetAdaptor" must provide the following interface (can be * non-virtual, inlined methods): * * \code * // Must return the number of data poins * inline size_t kdtree_get_point_count() const { ... } * * * // Must return the dim'th component of the idx'th point in the class: * inline T kdtree_get_pt(const size_t idx, const size_t dim) const { ... } * * // Optional bounding-box computation: return false to default to a standard * bbox computation loop. * // Return true if the BBOX was already computed by the class and returned * in "bb" so it can be avoided to redo it again. * // Look at bb.size() to find out the expected dimensionality (e.g. 2 or 3 * for point clouds) template bool kdtree_get_bbox(BBOX &bb) const * { * bb[0].low = ...; bb[0].high = ...; // 0th dimension limits * bb[1].low = ...; bb[1].high = ...; // 1st dimension limits * ... * return true; * } * * \endcode * * \tparam DatasetAdaptor The user-provided adaptor (see comments above). * \tparam Distance The distance metric to use: nanoflann::metric_L1, * nanoflann::metric_L2, nanoflann::metric_L2_Simple, etc. \tparam DIM * Dimensionality of data points (e.g. 3 for 3D points) \tparam IndexType Will * be typically size_t or int */ template class KDTreeSingleIndexAdaptor : public KDTreeBaseClass< KDTreeSingleIndexAdaptor, Distance, DatasetAdaptor, DIM, IndexType> { public: /** Deleted copy constructor*/ KDTreeSingleIndexAdaptor( const KDTreeSingleIndexAdaptor &) = delete; /** * The dataset used by this index */ const DatasetAdaptor &dataset; //!< The source of our data const KDTreeSingleIndexAdaptorParams index_params; Distance distance; typedef typename nanoflann::KDTreeBaseClass< nanoflann::KDTreeSingleIndexAdaptor, Distance, DatasetAdaptor, DIM, IndexType> BaseClassRef; typedef typename BaseClassRef::ElementType ElementType; typedef typename BaseClassRef::DistanceType DistanceType; typedef typename BaseClassRef::Node Node; typedef Node *NodePtr; typedef typename BaseClassRef::Interval Interval; /** Define "BoundingBox" as a fixed-size or variable-size container depending * on "DIM" */ typedef typename BaseClassRef::BoundingBox BoundingBox; /** Define "distance_vector_t" as a fixed-size or variable-size container * depending on "DIM" */ typedef typename BaseClassRef::distance_vector_t distance_vector_t; /** * KDTree constructor * * Refer to docs in README.md or online in * https://github.com/jlblancoc/nanoflann * * The KD-Tree point dimension (the length of each point in the datase, e.g. 3 * for 3D points) is determined by means of: * - The \a DIM template parameter if >0 (highest priority) * - Otherwise, the \a dimensionality parameter of this constructor. * * @param inputData Dataset with the input features * @param params Basically, the maximum leaf node size */ KDTreeSingleIndexAdaptor(const int dimensionality, const DatasetAdaptor &inputData, const KDTreeSingleIndexAdaptorParams ¶ms = KDTreeSingleIndexAdaptorParams()) : dataset(inputData), index_params(params), distance(inputData) { BaseClassRef::root_node = NULL; BaseClassRef::m_size = dataset.kdtree_get_point_count(); BaseClassRef::m_size_at_index_build = BaseClassRef::m_size; BaseClassRef::dim = dimensionality; if (DIM > 0) BaseClassRef::dim = DIM; BaseClassRef::m_leaf_max_size = params.leaf_max_size; // Create a permutable array of indices to the input vectors. init_vind(); } /** * Builds the index */ void buildIndex() { BaseClassRef::m_size = dataset.kdtree_get_point_count(); BaseClassRef::m_size_at_index_build = BaseClassRef::m_size; init_vind(); this->freeIndex(*this); BaseClassRef::m_size_at_index_build = BaseClassRef::m_size; if (BaseClassRef::m_size == 0) return; computeBoundingBox(BaseClassRef::root_bbox); BaseClassRef::root_node = this->divideTree(*this, 0, BaseClassRef::m_size, BaseClassRef::root_bbox); // construct the tree } /** \name Query methods * @{ */ /** * Find set of nearest neighbors to vec[0:dim-1]. Their indices are stored * inside the result object. * * Params: * result = the result object in which the indices of the * nearest-neighbors are stored vec = the vector for which to search the * nearest neighbors * * \tparam RESULTSET Should be any ResultSet * \return True if the requested neighbors could be found. * \sa knnSearch, radiusSearch */ template bool findNeighbors(RESULTSET &result, const ElementType *vec, const SearchParams &searchParams) const { assert(vec); if (this->size(*this) == 0) return false; if (!BaseClassRef::root_node) throw std::runtime_error( "[nanoflann] findNeighbors() called before building the index."); float epsError = 1 + searchParams.eps; distance_vector_t dists; // fixed or variable-sized container (depending on DIM) auto zero = static_cast(0); assign(dists, (DIM > 0 ? DIM : BaseClassRef::dim), zero); // Fill it with zeros. DistanceType distsq = this->computeInitialDistances(*this, vec, dists); searchLevel(result, vec, BaseClassRef::root_node, distsq, dists, epsError); // "count_leaf" parameter removed since was neither // used nor returned to the user. return result.full(); } /** * Find the "num_closest" nearest neighbors to the \a query_point[0:dim-1]. * Their indices are stored inside the result object. \sa radiusSearch, * findNeighbors \note nChecks_IGNORED is ignored but kept for compatibility * with the original FLANN interface. \return Number `N` of valid points in * the result set. Only the first `N` entries in `out_indices` and * `out_distances_sq` will be valid. Return may be less than `num_closest` * only if the number of elements in the tree is less than `num_closest`. */ size_t knnSearch(const ElementType *query_point, const size_t num_closest, IndexType *out_indices, DistanceType *out_distances_sq, const int /* nChecks_IGNORED */ = 10) const { nanoflann::KNNResultSet resultSet(num_closest); resultSet.init(out_indices, out_distances_sq); this->findNeighbors(resultSet, query_point, nanoflann::SearchParams()); return resultSet.size(); } // Uwe Schulzweida size_t knnRangeSearch(const ElementType *query_point, const DistanceType radius, const size_t num_closest, IndexType *out_indices, DistanceType *out_distances_sq, const int /* nChecks_IGNORED */ = 10) const { nanoflann::KNNResultSet resultSet(radius, num_closest); resultSet.init(out_indices, out_distances_sq); this->findNeighbors(resultSet, query_point, nanoflann::SearchParams()); return resultSet.size(); } /** * Find all the neighbors to \a query_point[0:dim-1] within a maximum radius. * The output is given as a vector of pairs, of which the first element is a * point index and the second the corresponding distance. Previous contents of * \a IndicesDists are cleared. * * If searchParams.sorted==true, the output list is sorted by ascending * distances. * * For a better performance, it is advisable to do a .reserve() on the vector * if you have any wild guess about the number of expected matches. * * \sa knnSearch, findNeighbors, radiusSearchCustomCallback * \return The number of points within the given radius (i.e. indices.size() * or dists.size() ) */ size_t radiusSearch(const ElementType *query_point, const DistanceType &radius, std::vector> &IndicesDists, const SearchParams &searchParams) const { RadiusResultSet resultSet(radius, IndicesDists); const size_t nFound = radiusSearchCustomCallback(query_point, resultSet, searchParams); if (searchParams.sorted) std::sort(IndicesDists.begin(), IndicesDists.end(), IndexDist_Sorter()); return nFound; } /** * Just like radiusSearch() but with a custom callback class for each point * found in the radius of the query. See the source of RadiusResultSet<> as a * start point for your own classes. \sa radiusSearch */ template size_t radiusSearchCustomCallback( const ElementType *query_point, SEARCH_CALLBACK &resultSet, const SearchParams &searchParams = SearchParams()) const { this->findNeighbors(resultSet, query_point, searchParams); return resultSet.size(); } /** @} */ public: /** Make sure the auxiliary list \a vind has the same size than the current * dataset, and re-generate if size has changed. */ void init_vind() { // Create a permutable array of indices to the input vectors. BaseClassRef::m_size = dataset.kdtree_get_point_count(); if (BaseClassRef::vind.size() != BaseClassRef::m_size) BaseClassRef::vind.resize(BaseClassRef::m_size); for (size_t i = 0; i < BaseClassRef::m_size; i++) BaseClassRef::vind[i] = i; } void computeBoundingBox(BoundingBox &bbox) { resize(bbox, (DIM > 0 ? DIM : BaseClassRef::dim)); if (dataset.kdtree_get_bbox(bbox)) { // Done! It was implemented in derived class } else { const size_t N = dataset.kdtree_get_point_count(); if (!N) throw std::runtime_error("[nanoflann] computeBoundingBox() called but " "no data points found."); for (int i = 0; i < (DIM > 0 ? DIM : BaseClassRef::dim); ++i) { bbox[i].low = bbox[i].high = this->dataset_get(*this, 0, i); } for (size_t k = 1; k < N; ++k) { for (int i = 0; i < (DIM > 0 ? DIM : BaseClassRef::dim); ++i) { if (this->dataset_get(*this, k, i) < bbox[i].low) bbox[i].low = this->dataset_get(*this, k, i); if (this->dataset_get(*this, k, i) > bbox[i].high) bbox[i].high = this->dataset_get(*this, k, i); } } } } /** * Performs an exact search in the tree starting from a node. * \tparam RESULTSET Should be any ResultSet * \return true if the search should be continued, false if the results are * sufficient */ template bool searchLevel(RESULTSET &result_set, const ElementType *vec, const NodePtr node, DistanceType mindistsq, distance_vector_t &dists, const float epsError) const { /* If this is a leaf node, then do check and return. */ if ((node->child1 == NULL) && (node->child2 == NULL)) { // count_leaf += (node->lr.right-node->lr.left); // Removed since was // neither used nor returned to the user. DistanceType worst_dist = result_set.worstDist(); // Uwe Schulzweida const IndexType worst_index = result_set.worstIndex(); for (IndexType i = node->node_type.lr.left; i < node->node_type.lr.right; ++i) { const IndexType index = BaseClassRef::vind[i]; // reorder... : i; DistanceType dist = distance.evalMetric( vec, index, (DIM > 0 ? DIM : BaseClassRef::dim)); #ifdef NANOFLANN_FIRST_MATCH // Uwe Schulzweida dist = (float) dist; if (dist < worst_dist || (dist <= worst_dist && index < worst_index) ) { #else if (dist < worst_dist) { #endif if (!result_set.addPoint(dist, BaseClassRef::vind[i])) { // the resultset doesn't want to receive any more points, we're done // searching! return false; } } } return true; } /* Which child branch should be taken first? */ int idx = node->node_type.sub.divfeat; ElementType val = vec[idx]; DistanceType diff1 = val - node->node_type.sub.divlow; DistanceType diff2 = val - node->node_type.sub.divhigh; NodePtr bestChild; NodePtr otherChild; DistanceType cut_dist; if ((diff1 + diff2) < 0) { bestChild = node->child1; otherChild = node->child2; cut_dist = distance.accum_dist(val, node->node_type.sub.divhigh, idx); } else { bestChild = node->child2; otherChild = node->child1; cut_dist = distance.accum_dist(val, node->node_type.sub.divlow, idx); } /* Call recursively to search next level down. */ if (!searchLevel(result_set, vec, bestChild, mindistsq, dists, epsError)) { // the resultset doesn't want to receive any more points, we're done // searching! return false; } DistanceType dst = dists[idx]; mindistsq = mindistsq + cut_dist - dst; dists[idx] = cut_dist; if (mindistsq * epsError <= result_set.worstDist()) { if (!searchLevel(result_set, vec, otherChild, mindistsq, dists, epsError)) { // the resultset doesn't want to receive any more points, we're done // searching! return false; } } dists[idx] = dst; return true; } public: /** Stores the index in a binary file. * IMPORTANT NOTE: The set of data points is NOT stored in the file, so when * loading the index object it must be constructed associated to the same * source of data points used while building it. See the example: * examples/saveload_example.cpp \sa loadIndex */ void saveIndex(FILE *stream) { this->saveIndex_(*this, stream); } /** Loads a previous index from a binary file. * IMPORTANT NOTE: The set of data points is NOT stored in the file, so the * index object must be constructed associated to the same source of data * points used while building the index. See the example: * examples/saveload_example.cpp \sa loadIndex */ void loadIndex(FILE *stream) { this->loadIndex_(*this, stream); } }; // class KDTree /** kd-tree dynamic index * * Contains the k-d trees and other information for indexing a set of points * for nearest-neighbor matching. * * The class "DatasetAdaptor" must provide the following interface (can be * non-virtual, inlined methods): * * \code * // Must return the number of data poins * inline size_t kdtree_get_point_count() const { ... } * * // Must return the dim'th component of the idx'th point in the class: * inline T kdtree_get_pt(const size_t idx, const size_t dim) const { ... } * * // Optional bounding-box computation: return false to default to a standard * bbox computation loop. * // Return true if the BBOX was already computed by the class and returned * in "bb" so it can be avoided to redo it again. * // Look at bb.size() to find out the expected dimensionality (e.g. 2 or 3 * for point clouds) template bool kdtree_get_bbox(BBOX &bb) const * { * bb[0].low = ...; bb[0].high = ...; // 0th dimension limits * bb[1].low = ...; bb[1].high = ...; // 1st dimension limits * ... * return true; * } * * \endcode * * \tparam DatasetAdaptor The user-provided adaptor (see comments above). * \tparam Distance The distance metric to use: nanoflann::metric_L1, * nanoflann::metric_L2, nanoflann::metric_L2_Simple, etc. \tparam DIM * Dimensionality of data points (e.g. 3 for 3D points) \tparam IndexType Will * be typically size_t or int */ template class KDTreeSingleIndexDynamicAdaptor_ : public KDTreeBaseClass, Distance, DatasetAdaptor, DIM, IndexType> { public: /** * The dataset used by this index */ const DatasetAdaptor &dataset; //!< The source of our data KDTreeSingleIndexAdaptorParams index_params; std::vector &treeIndex; Distance distance; typedef typename nanoflann::KDTreeBaseClass< nanoflann::KDTreeSingleIndexDynamicAdaptor_, Distance, DatasetAdaptor, DIM, IndexType> BaseClassRef; typedef typename BaseClassRef::ElementType ElementType; typedef typename BaseClassRef::DistanceType DistanceType; typedef typename BaseClassRef::Node Node; typedef Node *NodePtr; typedef typename BaseClassRef::Interval Interval; /** Define "BoundingBox" as a fixed-size or variable-size container depending * on "DIM" */ typedef typename BaseClassRef::BoundingBox BoundingBox; /** Define "distance_vector_t" as a fixed-size or variable-size container * depending on "DIM" */ typedef typename BaseClassRef::distance_vector_t distance_vector_t; /** * KDTree constructor * * Refer to docs in README.md or online in * https://github.com/jlblancoc/nanoflann * * The KD-Tree point dimension (the length of each point in the datase, e.g. 3 * for 3D points) is determined by means of: * - The \a DIM template parameter if >0 (highest priority) * - Otherwise, the \a dimensionality parameter of this constructor. * * @param inputData Dataset with the input features * @param params Basically, the maximum leaf node size */ KDTreeSingleIndexDynamicAdaptor_( const int dimensionality, const DatasetAdaptor &inputData, std::vector &treeIndex_, const KDTreeSingleIndexAdaptorParams ¶ms = KDTreeSingleIndexAdaptorParams()) : dataset(inputData), index_params(params), treeIndex(treeIndex_), distance(inputData) { BaseClassRef::root_node = NULL; BaseClassRef::m_size = 0; BaseClassRef::m_size_at_index_build = 0; BaseClassRef::dim = dimensionality; if (DIM > 0) BaseClassRef::dim = DIM; BaseClassRef::m_leaf_max_size = params.leaf_max_size; } /** Assignment operator definiton */ KDTreeSingleIndexDynamicAdaptor_ operator=(const KDTreeSingleIndexDynamicAdaptor_ &rhs) { KDTreeSingleIndexDynamicAdaptor_ tmp(rhs); std::swap(BaseClassRef::vind, tmp.BaseClassRef::vind); std::swap(BaseClassRef::m_leaf_max_size, tmp.BaseClassRef::m_leaf_max_size); std::swap(index_params, tmp.index_params); std::swap(treeIndex, tmp.treeIndex); std::swap(BaseClassRef::m_size, tmp.BaseClassRef::m_size); std::swap(BaseClassRef::m_size_at_index_build, tmp.BaseClassRef::m_size_at_index_build); std::swap(BaseClassRef::root_node, tmp.BaseClassRef::root_node); std::swap(BaseClassRef::root_bbox, tmp.BaseClassRef::root_bbox); std::swap(BaseClassRef::pool, tmp.BaseClassRef::pool); return *this; } /** * Builds the index */ void buildIndex() { BaseClassRef::m_size = BaseClassRef::vind.size(); this->freeIndex(*this); BaseClassRef::m_size_at_index_build = BaseClassRef::m_size; if (BaseClassRef::m_size == 0) return; computeBoundingBox(BaseClassRef::root_bbox); BaseClassRef::root_node = this->divideTree(*this, 0, BaseClassRef::m_size, BaseClassRef::root_bbox); // construct the tree } /** \name Query methods * @{ */ /** * Find set of nearest neighbors to vec[0:dim-1]. Their indices are stored * inside the result object. * * Params: * result = the result object in which the indices of the * nearest-neighbors are stored vec = the vector for which to search the * nearest neighbors * * \tparam RESULTSET Should be any ResultSet * \return True if the requested neighbors could be found. * \sa knnSearch, radiusSearch */ template bool findNeighbors(RESULTSET &result, const ElementType *vec, const SearchParams &searchParams) const { assert(vec); if (this->size(*this) == 0) return false; if (!BaseClassRef::root_node) return false; float epsError = 1 + searchParams.eps; // fixed or variable-sized container (depending on DIM) distance_vector_t dists; // Fill it with zeros. assign(dists, (DIM > 0 ? DIM : BaseClassRef::dim), static_cast(0)); DistanceType distsq = this->computeInitialDistances(*this, vec, dists); searchLevel(result, vec, BaseClassRef::root_node, distsq, dists, epsError); // "count_leaf" parameter removed since was neither // used nor returned to the user. return result.full(); } /** * Find the "num_closest" nearest neighbors to the \a query_point[0:dim-1]. * Their indices are stored inside the result object. \sa radiusSearch, * findNeighbors \note nChecks_IGNORED is ignored but kept for compatibility * with the original FLANN interface. \return Number `N` of valid points in * the result set. Only the first `N` entries in `out_indices` and * `out_distances_sq` will be valid. Return may be less than `num_closest` * only if the number of elements in the tree is less than `num_closest`. */ size_t knnSearch(const ElementType *query_point, const size_t num_closest, IndexType *out_indices, DistanceType *out_distances_sq, const int /* nChecks_IGNORED */ = 10) const { nanoflann::KNNResultSet resultSet(num_closest); resultSet.init(out_indices, out_distances_sq); this->findNeighbors(resultSet, query_point, nanoflann::SearchParams()); return resultSet.size(); } /** * Find all the neighbors to \a query_point[0:dim-1] within a maximum radius. * The output is given as a vector of pairs, of which the first element is a * point index and the second the corresponding distance. Previous contents of * \a IndicesDists are cleared. * * If searchParams.sorted==true, the output list is sorted by ascending * distances. * * For a better performance, it is advisable to do a .reserve() on the vector * if you have any wild guess about the number of expected matches. * * \sa knnSearch, findNeighbors, radiusSearchCustomCallback * \return The number of points within the given radius (i.e. indices.size() * or dists.size() ) */ size_t radiusSearch(const ElementType *query_point, const DistanceType &radius, std::vector> &IndicesDists, const SearchParams &searchParams) const { RadiusResultSet resultSet(radius, IndicesDists); const size_t nFound = radiusSearchCustomCallback(query_point, resultSet, searchParams); if (searchParams.sorted) std::sort(IndicesDists.begin(), IndicesDists.end(), IndexDist_Sorter()); return nFound; } /** * Just like radiusSearch() but with a custom callback class for each point * found in the radius of the query. See the source of RadiusResultSet<> as a * start point for your own classes. \sa radiusSearch */ template size_t radiusSearchCustomCallback( const ElementType *query_point, SEARCH_CALLBACK &resultSet, const SearchParams &searchParams = SearchParams()) const { this->findNeighbors(resultSet, query_point, searchParams); return resultSet.size(); } /** @} */ public: void computeBoundingBox(BoundingBox &bbox) { resize(bbox, (DIM > 0 ? DIM : BaseClassRef::dim)); if (dataset.kdtree_get_bbox(bbox)) { // Done! It was implemented in derived class } else { const size_t N = BaseClassRef::m_size; if (!N) throw std::runtime_error("[nanoflann] computeBoundingBox() called but " "no data points found."); for (int i = 0; i < (DIM > 0 ? DIM : BaseClassRef::dim); ++i) { bbox[i].low = bbox[i].high = this->dataset_get(*this, BaseClassRef::vind[0], i); } for (size_t k = 1; k < N; ++k) { for (int i = 0; i < (DIM > 0 ? DIM : BaseClassRef::dim); ++i) { if (this->dataset_get(*this, BaseClassRef::vind[k], i) < bbox[i].low) bbox[i].low = this->dataset_get(*this, BaseClassRef::vind[k], i); if (this->dataset_get(*this, BaseClassRef::vind[k], i) > bbox[i].high) bbox[i].high = this->dataset_get(*this, BaseClassRef::vind[k], i); } } } } /** * Performs an exact search in the tree starting from a node. * \tparam RESULTSET Should be any ResultSet */ template void searchLevel(RESULTSET &result_set, const ElementType *vec, const NodePtr node, DistanceType mindistsq, distance_vector_t &dists, const float epsError) const { /* If this is a leaf node, then do check and return. */ if ((node->child1 == NULL) && (node->child2 == NULL)) { // count_leaf += (node->lr.right-node->lr.left); // Removed since was // neither used nor returned to the user. DistanceType worst_dist = result_set.worstDist(); for (IndexType i = node->node_type.lr.left; i < node->node_type.lr.right; ++i) { const IndexType index = BaseClassRef::vind[i]; // reorder... : i; if (treeIndex[index] == -1) continue; DistanceType dist = distance.evalMetric( vec, index, (DIM > 0 ? DIM : BaseClassRef::dim)); if (dist < worst_dist) { if (!result_set.addPoint( static_cast(dist), static_cast( BaseClassRef::vind[i]))) { // the resultset doesn't want to receive any more points, we're done // searching! return; // false; } } } return; } /* Which child branch should be taken first? */ int idx = node->node_type.sub.divfeat; ElementType val = vec[idx]; DistanceType diff1 = val - node->node_type.sub.divlow; DistanceType diff2 = val - node->node_type.sub.divhigh; NodePtr bestChild; NodePtr otherChild; DistanceType cut_dist; if ((diff1 + diff2) < 0) { bestChild = node->child1; otherChild = node->child2; cut_dist = distance.accum_dist(val, node->node_type.sub.divhigh, idx); } else { bestChild = node->child2; otherChild = node->child1; cut_dist = distance.accum_dist(val, node->node_type.sub.divlow, idx); } /* Call recursively to search next level down. */ searchLevel(result_set, vec, bestChild, mindistsq, dists, epsError); DistanceType dst = dists[idx]; mindistsq = mindistsq + cut_dist - dst; dists[idx] = cut_dist; if (mindistsq * epsError <= result_set.worstDist()) { searchLevel(result_set, vec, otherChild, mindistsq, dists, epsError); } dists[idx] = dst; } public: /** Stores the index in a binary file. * IMPORTANT NOTE: The set of data points is NOT stored in the file, so when * loading the index object it must be constructed associated to the same * source of data points used while building it. See the example: * examples/saveload_example.cpp \sa loadIndex */ void saveIndex(FILE *stream) { this->saveIndex_(*this, stream); } /** Loads a previous index from a binary file. * IMPORTANT NOTE: The set of data points is NOT stored in the file, so the * index object must be constructed associated to the same source of data * points used while building the index. See the example: * examples/saveload_example.cpp \sa loadIndex */ void loadIndex(FILE *stream) { this->loadIndex_(*this, stream); } }; /** kd-tree dynaimic index * * class to create multiple static index and merge their results to behave as * single dynamic index as proposed in Logarithmic Approach. * * Example of usage: * examples/dynamic_pointcloud_example.cpp * * \tparam DatasetAdaptor The user-provided adaptor (see comments above). * \tparam Distance The distance metric to use: nanoflann::metric_L1, * nanoflann::metric_L2, nanoflann::metric_L2_Simple, etc. \tparam DIM * Dimensionality of data points (e.g. 3 for 3D points) \tparam IndexType Will * be typically size_t or int */ template class KDTreeSingleIndexDynamicAdaptor { public: typedef typename Distance::ElementType ElementType; typedef typename Distance::DistanceType DistanceType; protected: size_t m_leaf_max_size; size_t treeCount; size_t pointCount; /** * The dataset used by this index */ const DatasetAdaptor &dataset; //!< The source of our data std::vector treeIndex; //!< treeIndex[idx] is the index of tree in which //!< point at idx is stored. treeIndex[idx]=-1 //!< means that point has been removed. KDTreeSingleIndexAdaptorParams index_params; int dim; //!< Dimensionality of each data point typedef KDTreeSingleIndexDynamicAdaptor_ index_container_t; std::vector index; public: /** Get a const ref to the internal list of indices; the number of indices is * adapted dynamically as the dataset grows in size. */ const std::vector &getAllIndices() const { return index; } private: /** finds position of least significant unset bit */ int First0Bit(IndexType num) { int pos = 0; while (num & 1) { num = num >> 1; pos++; } return pos; } /** Creates multiple empty trees to handle dynamic support */ void init() { typedef KDTreeSingleIndexDynamicAdaptor_ my_kd_tree_t; std::vector index_( treeCount, my_kd_tree_t(dim /*dim*/, dataset, treeIndex, index_params)); index = index_; } public: Distance distance; /** * KDTree constructor * * Refer to docs in README.md or online in * https://github.com/jlblancoc/nanoflann * * The KD-Tree point dimension (the length of each point in the datase, e.g. 3 * for 3D points) is determined by means of: * - The \a DIM template parameter if >0 (highest priority) * - Otherwise, the \a dimensionality parameter of this constructor. * * @param inputData Dataset with the input features * @param params Basically, the maximum leaf node size */ KDTreeSingleIndexDynamicAdaptor(const int dimensionality, const DatasetAdaptor &inputData, const KDTreeSingleIndexAdaptorParams ¶ms = KDTreeSingleIndexAdaptorParams(), const size_t maximumPointCount = 1000000000U) : dataset(inputData), index_params(params), distance(inputData) { treeCount = static_cast(std::log2(maximumPointCount)); pointCount = 0U; dim = dimensionality; treeIndex.clear(); if (DIM > 0) dim = DIM; m_leaf_max_size = params.leaf_max_size; init(); const size_t num_initial_points = dataset.kdtree_get_point_count(); if (num_initial_points > 0) { addPoints(0, num_initial_points - 1); } } /** Deleted copy constructor*/ KDTreeSingleIndexDynamicAdaptor( const KDTreeSingleIndexDynamicAdaptor &) = delete; /** Add points to the set, Inserts all points from [start, end] */ void addPoints(IndexType start, IndexType end) { size_t count = end - start + 1; treeIndex.resize(treeIndex.size() + count); for (IndexType idx = start; idx <= end; idx++) { int pos = First0Bit(pointCount); index[pos].vind.clear(); treeIndex[pointCount] = pos; for (int i = 0; i < pos; i++) { for (int j = 0; j < static_cast(index[i].vind.size()); j++) { index[pos].vind.push_back(index[i].vind[j]); if (treeIndex[index[i].vind[j]] != -1) treeIndex[index[i].vind[j]] = pos; } index[i].vind.clear(); index[i].freeIndex(index[i]); } index[pos].vind.push_back(idx); index[pos].buildIndex(); pointCount++; } } /** Remove a point from the set (Lazy Deletion) */ void removePoint(size_t idx) { if (idx >= pointCount) return; treeIndex[idx] = -1; } /** * Find set of nearest neighbors to vec[0:dim-1]. Their indices are stored * inside the result object. * * Params: * result = the result object in which the indices of the * nearest-neighbors are stored vec = the vector for which to search the * nearest neighbors * * \tparam RESULTSET Should be any ResultSet * \return True if the requested neighbors could be found. * \sa knnSearch, radiusSearch */ template bool findNeighbors(RESULTSET &result, const ElementType *vec, const SearchParams &searchParams) const { for (size_t i = 0; i < treeCount; i++) { index[i].findNeighbors(result, &vec[0], searchParams); } return result.full(); } }; /** An L2-metric KD-tree adaptor for working with data directly stored in an * Eigen Matrix, without duplicating the data storage. You can select whether a * row or column in the matrix represents a point in the state space. * * Example of usage: * \code * Eigen::Matrix mat; * // Fill out "mat"... * * typedef KDTreeEigenMatrixAdaptor< Eigen::Matrix > * my_kd_tree_t; const int max_leaf = 10; my_kd_tree_t mat_index(mat, max_leaf * ); mat_index.index->buildIndex(); mat_index.index->... \endcode * * \tparam DIM If set to >0, it specifies a compile-time fixed dimensionality * for the points in the data set, allowing more compiler optimizations. \tparam * Distance The distance metric to use: nanoflann::metric_L1, * nanoflann::metric_L2, nanoflann::metric_L2_Simple, etc. \tparam row_major * If set to true the rows of the matrix are used as the points, if set to false * the columns of the matrix are used as the points. */ template struct KDTreeEigenMatrixAdaptor { typedef KDTreeEigenMatrixAdaptor self_t; typedef typename MatrixType::Scalar num_t; typedef typename MatrixType::Index IndexType; typedef typename Distance::template traits::distance_t metric_t; typedef KDTreeSingleIndexAdaptor index_t; index_t *index; //! The kd-tree index for the user to call its methods as //! usual with any other FLANN index. /// Constructor: takes a const ref to the matrix object with the data points KDTreeEigenMatrixAdaptor(const size_t dimensionality, const std::reference_wrapper &mat, const int leaf_max_size = 10) : m_data_matrix(mat) { const auto dims = row_major ? mat.get().cols() : mat.get().rows(); if (size_t(dims) != dimensionality) throw std::runtime_error( "Error: 'dimensionality' must match column count in data matrix"); if (DIM > 0 && int(dims) != DIM) throw std::runtime_error( "Data set dimensionality does not match the 'DIM' template argument"); index = new index_t(static_cast(dims), *this /* adaptor */, nanoflann::KDTreeSingleIndexAdaptorParams(leaf_max_size)); index->buildIndex(); } public: /** Deleted copy constructor */ KDTreeEigenMatrixAdaptor(const self_t &) = delete; ~KDTreeEigenMatrixAdaptor() { delete index; } const std::reference_wrapper m_data_matrix; /** Query for the \a num_closest closest points to a given point (entered as * query_point[0:dim-1]). Note that this is a short-cut method for * index->findNeighbors(). The user can also call index->... methods as * desired. \note nChecks_IGNORED is ignored but kept for compatibility with * the original FLANN interface. */ inline void query(const num_t *query_point, const size_t num_closest, IndexType *out_indices, num_t *out_distances_sq, const int /* nChecks_IGNORED */ = 10) const { nanoflann::KNNResultSet resultSet(num_closest); resultSet.init(out_indices, out_distances_sq); index->findNeighbors(resultSet, query_point, nanoflann::SearchParams()); } /** @name Interface expected by KDTreeSingleIndexAdaptor * @{ */ const self_t &derived() const { return *this; } self_t &derived() { return *this; } // Must return the number of data points inline size_t kdtree_get_point_count() const { if(row_major) return m_data_matrix.get().rows(); else return m_data_matrix.get().cols(); } // Returns the dim'th component of the idx'th point in the class: inline num_t kdtree_get_pt(const IndexType idx, size_t dim) const { if(row_major) return m_data_matrix.get().coeff(idx, IndexType(dim)); else return m_data_matrix.get().coeff(IndexType(dim), idx); } // Optional bounding-box computation: return false to default to a standard // bbox computation loop. // Return true if the BBOX was already computed by the class and returned in // "bb" so it can be avoided to redo it again. Look at bb.size() to find out // the expected dimensionality (e.g. 2 or 3 for point clouds) template bool kdtree_get_bbox(BBOX & /*bb*/) const { return false; } /** @} */ }; // end of KDTreeEigenMatrixAdaptor /** @} */ /** @} */ // end of grouping } // namespace nanoflann #endif /* NANOFLANN_HPP_ */ cdo-2.6.6.1/libnanoflann/COPYING0000664000175000017500000000271215271332515016317 0ustar alastairalastairSoftware License Agreement (BSD License) Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. Copyright 2011 Jose L. Blanco (joseluisblancoc@gmail.com). All rights reserved. THE BSD LICENSE Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. 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. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. cdo-2.6.6.1/libnanoflann/README.md0000664000175000017500000004627115271332515016553 0ustar alastairalastair![nanoflann](https://raw.githubusercontent.com/jlblancoc/nanoflann/master/doc/logo.png) # nanoflann [![CI Linux](https://github.com/jlblancoc/nanoflann/actions/workflows/ci-linux.yml/badge.svg)](https://github.com/jlblancoc/nanoflann/actions/workflows/ci-linux.yml) [![CI Check clang-format](https://github.com/jlblancoc/nanoflann/actions/workflows/check-clang-format.yml/badge.svg)](https://github.com/jlblancoc/nanoflann/actions/workflows/check-clang-format.yml) [![CircleCI](https://circleci.com/gh/jlblancoc/nanoflann/tree/master.svg?style=svg)](https://circleci.com/gh/jlblancoc/nanoflann/tree/master) [![Windows build status](https://ci.appveyor.com/api/projects/status/h8k1apfogxyqhskd/branch/master?svg=true)](https://ci.appveyor.com/project/jlblancoc/nanoflann/branch/master) [![codecov](https://codecov.io/gh/jlblancoc/nanoflann/graph/badge.svg?token=yOKq5lpizE)](https://codecov.io/gh/jlblancoc/nanoflann) ## 1. About *nanoflann* is a **C++11 [header-only](http://en.wikipedia.org/wiki/Header-only) library** for building KD-Trees of datasets with different topologies: R2, R3 (point clouds), SO(2) and SO(3) (2D and 3D rotation groups). No support for approximate NN is provided. *nanoflann* does not require compiling or installing. You just need to `#include ` in your code. This library is a *fork* of the [flann library](https://github.com/flann-lib/flann) by Marius Muja and David G. Lowe, and born as a child project of [MRPT](https://www.mrpt.org/). Following the original license terms, *nanoflann* is distributed under the BSD license. Please, for bugs use the issues button or fork and open a pull request. Cite as: ``` @misc{blanco2014nanoflann, title = {nanoflann: a {C}++ header-only fork of {FLANN}, a library for Nearest Neighbor ({NN}) with KD-trees}, author = {Blanco, Jose Luis and Rai, Pranjal Kumar}, howpublished = {\url{https://github.com/jlblancoc/nanoflann}}, year = {2014} } ``` See the release [CHANGELOG](CHANGELOG.md) for a list of project changes. ### 1.1. Obtaining the code * Easiest way: clone this GIT repository and take the `include/nanoflann.hpp` file for use where you need it. * Debian or Ubuntu ([21.04 or newer](https://launchpad.net/ubuntu/+source/nanoflann)) users can install it simply with: ```bash $ sudo apt install libnanoflann-dev ``` * macOS users can install `nanoflann` with [Homebrew](https://brew.sh) with: ```shell $ brew install brewsci/science/nanoflann ``` or ```shell $ brew tap brewsci/science $ brew install nanoflann ``` MacPorts users can use: ```shell $ sudo port install nanoflann ``` * Linux users can also install it with [Linuxbrew](https://docs.brew.sh/Homebrew-on-Linux) with: `brew install homebrew/science/nanoflann` * List of [**stable releases**](https://github.com/jlblancoc/nanoflann/releases). Check out the [CHANGELOG](https://github.com/jlblancoc/nanoflann/blob/master/CHANGELOG.md) Although nanoflann itself doesn't have to be compiled, you can build some examples and tests with: ```shell $ sudo apt-get install build-essential cmake libgtest-dev libeigen3-dev $ mkdir build && cd build && cmake .. $ make && make test ``` ### 1.2. C++ API reference * Browse the [Doxygen documentation](https://jlblancoc.github.io/nanoflann/). * **Important note:** If L2 norms are used, notice that search radius and all passed and returned distances are actually *squared distances*. ### 1.3. Code examples * KD-tree look-up with `knnSearch()` and `radiusSearch()`: [pointcloud_kdd_radius.cpp](https://github.com/jlblancoc/nanoflann/blob/master/examples/pointcloud_kdd_radius.cpp) * KD-tree look-up on a point cloud dataset: [pointcloud_example.cpp](https://github.com/jlblancoc/nanoflann/blob/master/examples/pointcloud_example.cpp) * KD-tree look-up on a dynamic point cloud dataset: [dynamic_pointcloud_example.cpp](https://github.com/jlblancoc/nanoflann/blob/master/examples/dynamic_pointcloud_example.cpp) * KD-tree look-up on a rotation group (SO2): [SO2_example.cpp](https://github.com/jlblancoc/nanoflann/blob/master/examples/SO2_adaptor_example.cpp) * KD-tree look-up on a rotation group (SO3): [SO3_example.cpp](https://github.com/jlblancoc/nanoflann/blob/master/examples/SO3_adaptor_example.cpp) * KD-tree look-up on a point cloud dataset with an external adaptor class: [pointcloud_adaptor_example.cpp](https://github.com/jlblancoc/nanoflann/blob/master/examples/pointcloud_adaptor_example.cpp) * KD-tree look-up directly on an `Eigen::Matrix<>`: [matrix_example.cpp](https://github.com/jlblancoc/nanoflann/blob/master/examples/matrix_example.cpp) * KD-tree look-up directly on `std::vector >` or `std::vector`: [vector_of_vectors_example.cpp](https://github.com/jlblancoc/nanoflann/blob/master/examples/vector_of_vectors_example.cpp) * Example with a `Makefile` for usage through `pkg-config` (for example, after doing a "make install" or after installing from Ubuntu repositories): [example_with_pkgconfig/](https://github.com/jlblancoc/nanoflann/blob/master/examples/example_with_pkgconfig/) * Example of how to build an index and save it to disk for later usage: [saveload_example.cpp](https://github.com/jlblancoc/nanoflann/blob/master/examples/saveload_example.cpp) * GUI examples (requires `mrpt-gui`, e.g. `sudo apt install libmrpt-gui-dev`): - [nanoflann_gui_example_R3](https://github.com/jlblancoc/nanoflann/blob/master/examples/examples_gui/nanoflann_gui_example_R3/nanoflann_gui_example_R3.cpp) ![nanoflann-demo-1](https://user-images.githubusercontent.com/5497818/201550433-d561c5a9-4e87-453d-9cf8-8202d7876235.gif) ### 1.4. Why a fork? * **Execution time efficiency**: * The power of the original `flann` library comes from the possibility of choosing between different ANN algorithms. The cost of this flexibility is the declaration of pure virtual methods which (in some circumstances) impose [run-time penalties](http://www.cs.cmu.edu/~gilpin/c%2B%2B/performance.html#virtualfunctions). In `nanoflann` all those virtual methods have been replaced by a combination of the [Curiously Recurring Template Pattern](http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern) (CRTP) and inlined methods, which are much faster. * For `radiusSearch()`, there is no need to make a call to determine the number of points within the radius and then call it again to get the data. By using STL containers for the output data, containers are automatically resized. * Users can (optionally) set the problem dimensionality at compile-time via a template argument, thus allowing the compiler to fully unroll loops. * `nanoflann` allows users to provide a precomputed bounding box of the data, if available, to avoid recomputation. * Indices of data points have been converted from `int` to `size_t`, which removes a limit when handling very large data sets. * **Memory efficiency**: Instead of making a copy of the entire dataset into a custom `flann`-like matrix before building a KD-tree index, `nanoflann` allows direct access to your data via an **adaptor interface** which must be implemented in your class. Refer to the examples below or to the C++ API of [nanoflann::KDTreeSingleIndexAdaptor<>](https://jlblancoc.github.io/nanoflann/classnanoflann_1_1KDTreeSingleIndexAdaptor.html) for more info. ### 1.5. What can *nanoflann* do? * Building KD-trees with a single index (no randomized KD-trees, no approximate searches). * Fast, thread-safe querying for closest neighbors on KD-trees. The entry points are: * [nanoflann::KDTreeSingleIndexAdaptor<>](https://jlblancoc.github.io/nanoflann/classnanoflann_1_1KDTreeSingleIndexAdaptor.html)`::knnSearch()` * Finds the `num_closest` nearest neighbors to `query_point[0:dim-1]`. Their indices are stored inside the result object. See an [example usage code](https://github.com/jlblancoc/nanoflann/blob/master/examples/pointcloud_kdd_radius.cpp#L119). * [nanoflann::KDTreeSingleIndexAdaptor<>](https://jlblancoc.github.io/nanoflann/classnanoflann_1_1KDTreeSingleIndexAdaptor.html)`::radiusSearch()` * Finds all the neighbors to `query_point[0:dim-1]` within a maximum radius. The output is given as a vector of pairs, of which the first element is a point index and the second the corresponding distance. See an [example usage code](https://github.com/jlblancoc/nanoflann/blob/master/examples/pointcloud_kdd_radius.cpp#L141). * [nanoflann::KDTreeSingleIndexAdaptor<>](https://jlblancoc.github.io/nanoflann/classnanoflann_1_1KDTreeSingleIndexAdaptor.html)`::radiusSearchCustomCallback()` * Can be used to receive a callback for each point found in range. This may be more efficient in some situations instead of building a huge vector of pairs with the results. * [nanoflann::KDTreeSingleIndexAdaptor<>](https://jlblancoc.github.io/nanoflann/classnanoflann_1_1KDTreeSingleIndexAdaptor.html)`::findWithinBox()` [New in 1.8.0]: Optimized search within a given axis-aligned bound box. * Working with 2D and 3D point clouds or N-dimensional data sets. * Working directly with `Eigen::Matrix<>` classes (matrices and vectors-of-vectors). * Working with dynamic point clouds without a need to rebuild entire kd-tree index. Two options: * `nanoflann::KDTreeSingleIndexDynamicAdaptor<>`: the Bentley–Saxe "logarithmic forest" of static sub-trees. * `nanoflann::KDTreeSingleIndexIncrementalAdaptor<>` [New]: a single self-balancing tree, recommended for sliding-window LiDAR-style maps. Supports incremental `addPoints`, lazy `removePoint`, and axis-aligned box trimming (`removeBox` / `removeOutsideBox`) with bounded memory under churn. See the design & benchmark report in [nanoflann-benchmark/incrementalTests](https://github.com/MRPT/nanoflann-benchmark/tree/master/incrementalTests/REPORT.md). * `nanoflann::KDTreeSingleIndexIncrementalAdaptorMT<>` [New]: the same index with the large rebalancing rebuilds offloaded to a background thread, to bound the foreground update-latency tail (see the [threading analysis](https://github.com/MRPT/nanoflann-benchmark/tree/master/incrementalTests/async_rebalance.md)). Disabled under `NANOFLANN_NO_THREADS`. * Working with the distance metrics: * `R^N`: Euclidean spaces: * `L1` (Manhattan) * `L2` (**squared** Euclidean norm, favoring SSE2 optimization). * `L2_Simple` (**squared** Euclidean norm, for low-dimensionality data sets like point clouds). * `SO(2)`: 2D rotational group * `metric_SO2`: Absolute angular diference. * `SO(3)`: 3D rotational group (better suppport to be provided in future releases) * `metric_SO3`: Inner product between quaternions. * Saves and load the built indices to disk. * GUI based support for benchmarking multiple kd-tree libraries namely nanoflann, flann, fastann and libkdtree. ### 1.6. What can't *nanoflann* do? * Use other distance metrics apart from L1, L2, SO2 and SO3. * Support for SE(3) groups. * Only the C++ interface exists: there is no support for C, MATLAB or Python. * There is no automatic algorithm configuration (as described in the original Muja & Lowe's paper). ### 1.7. Use in your project via CMake You can directly drop the `nanoflann.hpp` file in your project. Alternatively, the CMake standard method is also available: * Build and "install" nanoflann. Set `CMAKE_INSTALL_PREFIX` to a proper path and then execute `make install` (Linux, OSX) or build the `INSTALL` target (Visual Studio). * Then, add something like this to the CMake script of your project: ```cmake # Find nanoflannConfig.cmake: find_package(nanoflann) add_executable(my_project test.cpp) # Make sure the include path is used: target_link_libraries(my_project nanoflann::nanoflann) ``` ### 1.8. Package Managers #### Using `conan` You can install pre-built binaries for `nanoflann` or build it from source using [Conan](https://conan.io/). Use the following command to install latest version: ```sh $ conan install --requires="nanoflann/[*]" --build=missing ``` For detailed instructions on how to use Conan, please refer to the [Conan documentation](https://docs.conan.io/2/). The `nanoflann` Conan recipe is kept up to date by Conan maintainers and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/conan-io/conan-center-index) on the ConanCenterIndex repository. #### Using `vcpkg` You can download and install nanoflann using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager: ```sh $ git clone https://github.com/Microsoft/vcpkg.git $ cd vcpkg $ ./bootstrap-vcpkg.sh $ ./vcpkg integrate install $ ./vcpkg install nanoflann ``` The nanoflann port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. ### 1.9. Compile time definitions * `NANOFLANN_FIRST_MATCH`: If defined and two points have the same distance, the one with the lowest-index will be returned first. Otherwise there is no particular order. * `NANOFLANN_NO_THREADS`: If defined, multithreading capabilities will be disabled, so that the library can be used without linking with pthreads. If one tries to use multiple threads, an exception will be thrown. * `NANOFLANN_NODE_ALIGNMENT`: The memory alignment, in bytes, used for KD-tree nodes. Defaults to `16`. ### 1.10. Thread safety * **Index build**: pass `n_thread_build > 1` in `KDTreeSingleIndexAdaptorParams` to parallelize the build via `std::async` (unless `NANOFLANN_NO_THREADS` is defined). * **Queries**: `findNeighbors()`, `knnSearch()`, `radiusSearch()` and `rknnSearch()` are `const` and safe to call concurrently from multiple threads on the same index, as long as no thread is concurrently building or modifying it. * The internal `PooledAllocator` is **not** thread-safe, so building an index from multiple threads (or mixing queries with an in-progress build) is not supported. ------ ## 2. Any help choosing the KD-tree parameters? ### 2.1. `KDTreeSingleIndexAdaptorParams::leaf_max_size` A KD-tree is... well, a tree :-). And as such it has a root node, a set of intermediary nodes and finally, "leaf" nodes which are those without children. Points (or, properly, point indices) are only stored in leaf nodes. Each leaf contains a list of which points fall within its range. While building the tree, nodes are recursively divided until the number of points inside is equal or below some threshold. **That is `leaf_max_size`**. While doing queries, the "tree algorithm" ends by selecting leaf nodes, then performing linear search (one-by-one) for the closest point to the query within all those in the leaf. So, `leaf_max_size` must be set as a **tradeoff**: * Large values mean that the tree will be built faster (since the tree will be smaller), but each query will be slower (since the linear search in the leaf is to be done over more points). * Small values will build the tree much slower (there will be many tree nodes), but queries will be faster... up to some point, since the "tree-part" of the search (logarithmic complexity) still has a significant cost. What number to select really depends on the application and even on the size of the processor cache memory, so ideally you should do some benchmarking for maximizing efficiency. But to help choosing a good value as a rule of thumb, I provide the following two benchmarks. Each graph represents the tree build (horizontal) and query (vertical) times for different `leaf_max_size` values between 1 and 10K (as 95% uncertainty ellipses, deformed due to the logarithmic scale). * A 100K point cloud, uniformly distributed (each point has (x,y,z) `float` coordinates): ![perf5_1e5pts_time_vs_maxleaf](https://raw.githubusercontent.com/jlblancoc/nanoflann/master/doc/perf5_1e5pts_time_vs_maxleaf.png) * A ~150K point cloud from a real dataset (`scan_071_points.dat` from the [Freiburg Campus 360 dataset](http://ais.informatik.uni-freiburg.de/projects/datasets/fr360/), each point has (x,y,z) `float` coordinates): ![perf5_1e5pts_time_vs_maxleaf_real_dataset](https://raw.githubusercontent.com/jlblancoc/nanoflann/master/doc/perf5_1e5pts_time_vs_maxleaf_real_dataset.png) So, it seems that a `leaf_max_size` **between 10 and 50** would be optimum in applications where the cost of queries dominates (e.g. [ICP](http://en.wikipedia.org/wiki/Iterative_closest_point])). At present, its default value is 10. ### 2.2. `KDTreeSingleIndexAdaptorParams::checks` This parameter is really ignored in `nanoflann`, but was kept for backward compatibility with the original FLANN interface. Just ignore it. ### 2.3. `KDTreeSingleIndexAdaptorParams::n_thread_build` This parameter determines the maximum number of threads that can be called concurrently during the construction of the KD tree. The default value is 1. When the parameter is set to 0, `nanoflann` automatically determines the number of threads to use. See [this pull request](https://github.com/jlblancoc/nanoflann/pull/236) for some benchmarking showing that using the maximum number of threads is not always the most efficient approach. Do benchmarking on your data! ----- ## 3. Performance ### 3.1. `nanoflann`: faster and less memory usage Refer to the "Why a fork?" section above for the main optimization ideas behind `nanoflann`. Notice that there are no explicit SSE2/SSE3 optimizations in `nanoflann`, but the intensive usage of `inline` and templates in practice turns into automatically SSE-optimized code generated by the compiler. ### 3.2. Benchmark: original `flann` vs `nanoflann` The most time-consuming part of many point cloud algorithms (like ICP) is querying a KD-Tree for nearest neighbors. This operation is therefore the most time critical. `nanoflann` provides a ~50% time saving with respect to the original `flann` implementation (times in this chart are in microseconds for each query): ![perf3_query](https://raw.githubusercontent.com/jlblancoc/nanoflann/master/doc/perf3_query.small.png) Although most of the gain comes from the queries (due to the large number of them in any typical operation with point clouds), there is also some time saved while building the KD-tree index, due to the templatized-code but also for the avoidance of duplicating the data in an auxiliary matrix (times in the next chart are in milliseconds): ![perf4_time_saved](https://raw.githubusercontent.com/jlblancoc/nanoflann/master/doc/perf4_time_saved.small.png) These performance tests are only representative of our testing. If you want to repeat them, read the instructions in [perf-tests](https://github.com/jlblancoc/nanoflann/tree/master/perf-tests) ---- ## 4. Other KD-tree projects * [FLANN](http://www.cs.ubc.ca/research/flann/) - Marius Muja and David G. Lowe (University of British Columbia). * [FASTANN](http://www.robots.ox.ac.uk/~vgg/software/fastann/) - James Philbin (VGG, University of Oxford). * [ANN](http://www.cs.umd.edu/~mount/ANN/) - David M. Mount and Sunil Arya (University of Maryland). * [libkdtree++](https://packages.debian.org/source/sid/libkdtree++) - Martin F. Krafft & others.
*Note: The project logo is due to [CedarSeed](http://www.iconarchive.com/show/patisserie-icons-by-cedarseed/Flan-icon.html)* **Contributors** cdo-2.6.6.1/libnanoflann/Makefile.in0000664000175000017500000003604315271332515017335 0ustar alastairalastair# Makefile.in generated by automake 1.18.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2025 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@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) am__rm_f = rm -f $(am__rm_f_notfound) am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 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@ subdir = libnanoflann ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/libcdi/m4/acx_c_package.m4 \ $(top_srcdir)/libcdi/m4/acx_lang_check_include.m4 \ $(top_srcdir)/libcdi/m4/acx_lang_package.m4 \ $(top_srcdir)/libcdi/m4/acx_m4_list_to_quoted_strings.m4 \ $(top_srcdir)/libcdi/m4/acx_option_search_libs.m4 \ $(top_srcdir)/libcdi/m4/acx_options.m4 \ $(top_srcdir)/libcdi/m4/acx_uuid.m4 \ $(top_srcdir)/libcdi/m4/asx_tr_arg.m4 \ $(top_srcdir)/m4/acx_cfortran_flags.m4 \ $(top_srcdir)/m4/acx_check_cfortran.m4 \ $(top_srcdir)/m4/acx_options.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_subdirs_configure.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/libcdi/m4/acx_lang_c_check_include.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in COPYING README.md DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CPPFLAGS = @AM_CPPFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH = @BASH@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CLDFLAGS = @CLDFLAGS@ CLIBS = @CLIBS@ CMOR_LIBS = @CMOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CURL_INCLUDE = @CURL_INCLUDE@ CURL_LDFLAGS = @CURL_LDFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DCE_UUIDROOT = @DCE_UUIDROOT@ DCE_UUID_C_INCLUDE = @DCE_UUID_C_INCLUDE@ DCE_UUID_C_LIB = @DCE_UUID_C_LIB@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECCODES_INCLUDE = @ECCODES_INCLUDE@ ECCODES_LIBS = @ECCODES_LIBS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_ACROSS = @ENABLE_ACROSS@ ENABLE_CDI_LIB = @ENABLE_CDI_LIB@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ ENABLE_EXTRA = @ENABLE_EXTRA@ ENABLE_FORTRAN = @ENABLE_FORTRAN@ ENABLE_GRIB = @ENABLE_GRIB@ ENABLE_GRIBAPI = @ENABLE_GRIBAPI@ ENABLE_IEG = @ENABLE_IEG@ ENABLE_NETCDF = @ENABLE_NETCDF@ ENABLE_SERVICE = @ENABLE_SERVICE@ ENABLE_THREADS = @ENABLE_THREADS@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ FILECMD = @FILECMD@ FORTRAN_WORKS = @FORTRAN_WORKS@ GREP = @GREP@ HAVE_CXX20 = @HAVE_CXX20@ HDF5_INCLUDE = @HDF5_INCLUDE@ HDF5_LIBS = @HDF5_LIBS@ HDF5_ROOT = @HDF5_ROOT@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAGICS_INCLUDE = @MAGICS_INCLUDE@ MAGICS_LIBS = @MAGICS_LIBS@ MAGICS_ROOT = @MAGICS_ROOT@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETCDF_INCLUDE = @NETCDF_INCLUDE@ NETCDF_LIBS = @NETCDF_LIBS@ NETCDF_ROOT = @NETCDF_ROOT@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OSSP_UUIDROOT = @OSSP_UUIDROOT@ OSSP_UUID_C_INCLUDE = @OSSP_UUID_C_INCLUDE@ OSSP_UUID_C_LIB = @OSSP_UUID_C_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PROJ_INCLUDE = @PROJ_INCLUDE@ PROJ_LDFLAGS = @PROJ_LDFLAGS@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SYSTEM_TYPE = @SYSTEM_TYPE@ SZLIB_INCLUDE = @SZLIB_INCLUDE@ SZLIB_LIBS = @SZLIB_LIBS@ THREADS_INCLUDE = @THREADS_INCLUDE@ THREADS_LIBS = @THREADS_LIBS@ UDUNITS_INCLUDE = @UDUNITS_INCLUDE@ UDUNITS_LDFLAGS = @UDUNITS_LDFLAGS@ UTIL_LINUX_UUIDROOT = @UTIL_LINUX_UUIDROOT@ UTIL_LINUX_UUID_C_INCLUDE = @UTIL_LINUX_UUID_C_INCLUDE@ UTIL_LINUX_UUID_C_LIB = @UTIL_LINUX_UUID_C_LIB@ UUID_C_INCLUDE = @UUID_C_INCLUDE@ UUID_C_LIB = @UUID_C_LIB@ VERSION = @VERSION@ XML2_LIBS = @XML2_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ am__xargs_n = @am__xargs_n@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ 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@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ subdirs_extra = @subdirs_extra@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # EXTRA_DIST = COPYING README.md nanoflann.hpp all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libnanoflann/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign libnanoflann/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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -$(am__rm_f) $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_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-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am .PRECIOUS: Makefile # 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: # Tell GNU make to disable its built-in pattern rules. %:: %,v %:: RCS/%,v %:: RCS/% %:: s.% %:: SCCS/s.% cdo-2.6.6.1/libnanoflann/Makefile.am0000664000175000017500000000015115271332515017313 0ustar alastairalastair## Process this file with automake to produce Makefile.in # EXTRA_DIST = COPYING README.md nanoflann.hpp cdo-2.6.6.1/INSTALL0000664000175000017500000002202415271332515013652 0ustar alastairalastairCopyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 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' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' 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 `--target=TYPE' option 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 will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `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. cdo-2.6.6.1/contrib/0000775000175000017500000000000015271332515014261 5ustar alastairalastaircdo-2.6.6.1/contrib/cdoCompletion.zsh0000664000175000017500000005007215271332515017612 0ustar alastairalastaircompctl -k "( --apply \ --argument_groups \ --attribs \ --chunksize \ --chunkspec \ --cmor \ --config \ --copy_chunkspec \ --disable_file_suffix \ --disable_history \ --double \ --download_path \ --eccodes \ --enableexcept \ --envvars \ --fast \ --file_suffix \ --force \ --gridsearchradius \ --history \ --history_info \ --icon_grids \ --ignore_time_bounds \ --module_info \ --netcdf_hdr_pad \ --no_history \ --no_remap_weights \ --nofile \ --nsb \ --operators \ --operators_no_output \ --pedantic \ --percentile \ --precision \ --print_filename \ --query \ --reduce_dim \ --reduce_dims \ --remap_weights \ --remove_chunkspec \ --reset_history \ --rusage \ --seed \ --settings \ --shuffle \ --single \ --sortparam \ --test \ --timestat_date \ --use_fftw \ --use_time_bounds \ --version_info \ --worker \ -A, \ -C, \ -D, \ -F, \ -M, \ -O, \ -P, \ -Q, \ -R, \ -S, \ -T, \ -V, \ -a, \ -b, \ -c, \ -d, \ -f, \ -g, \ -h, \ -i, \ -k, \ -l, \ -m, \ -p, \ -r, \ -s, \ -t, \ -u, \ -v, \ -w, \ -z, \ abs -abs \ acos -acos \ add -add \ addc -addc \ addtrend -addtrend \ adipot -adipot \ adisit -adisit \ aexpr -aexpr \ aexprf -aexprf \ after -after \ afterburner -afterburner \ air_density -air_density \ anomaly -anomaly \ ap2hl -ap2hl \ ap2hlx -ap2hlx \ ap2pl -ap2pl \ ap2plx -ap2plx \ arg -arg \ asin -asin \ atan -atan \ atan2 -atan2 \ bandpass -bandpass \ bitrounding -bitrounding \ bottomvalue -bottomvalue \ boxavg -boxavg \ cat -cat \ cdiread -cdiread \ cdiwrite -cdiwrite \ changemulti -changemulti \ chcode -chcode \ chlevel -chlevel \ chlevelc -chlevelc \ chlevelv -chlevelv \ chltype -chltype \ chname -chname \ chparam -chparam \ chtabnum -chtabnum \ chunit -chunit \ chvar -chvar \ cinfo -cinfo \ clone -clone \ cloudlayer -cloudlayer \ cmor -cmor \ cmorlite -cmorlite \ codetab -codetab \ collgrid -collgrid \ complextopol -complextopol \ complextorect -complextorect \ conj -conj \ consecsum -consecsum \ consects -consects \ const -const \ contour -contour \ conv_cmor_table -conv_cmor_table \ copy -copy \ cos -cos \ coshill -coshill \ dayadd -dayadd \ dayavg -dayavg \ daycount -daycount \ daydiv -daydiv \ daymax -daymax \ daymean -daymean \ daymin -daymin \ daymul -daymul \ daypctl -daypctl \ dayrange -dayrange \ daystd -daystd \ daystd1 -daystd1 \ daysub -daysub \ daysum -daysum \ dayvar -dayvar \ dayvar1 -dayvar1 \ dcw -dcw \ del29feb -del29feb \ delattribute -delattribute \ delcode -delcode \ delday -delday \ delete -delete \ delgridcell -delgridcell \ delmulti -delmulti \ delname -delname \ delparam -delparam \ delta_pressure -delta_pressure \ deltat -deltat \ delvar -delvar \ detrend -detrend \ dhouravg -dhouravg \ dhourmax -dhourmax \ dhourmean -dhourmean \ dhourmin -dhourmin \ dhourrange -dhourrange \ dhourstd -dhourstd \ dhourstd1 -dhourstd1 \ dhoursum -dhoursum \ dhourvar -dhourvar \ dhourvar1 -dhourvar1 \ diff -diff \ diffc -diffc \ diffn -diffn \ diffp -diffp \ difftest -difftest \ diffv -diffv \ distgrid -distgrid \ div -div \ divc -divc \ divcoslat -divcoslat \ divdpm -divdpm \ divdpy -divdpy \ dminuteavg -dminuteavg \ dminutemax -dminutemax \ dminutemean -dminutemean \ dminutemin -dminutemin \ dminuterange -dminuterange \ dminutestd -dminutestd \ dminutestd1 -dminutestd1 \ dminutesum -dminutesum \ dminutevar -dminutevar \ dminutevar1 -dminutevar1 \ dump_cmor_table -dump_cmor_table \ dumpmap -dumpmap \ duplicate -duplicate \ dv2ps -dv2ps \ dv2uv -dv2uv \ dv2uvl -dv2uvl \ eca_cdd -eca_cdd \ eca_cfd -eca_cfd \ eca_csu -eca_csu \ eca_cwd -eca_cwd \ eca_cwdi -eca_cwdi \ eca_cwfi -eca_cwfi \ eca_etr -eca_etr \ eca_fd -eca_fd \ eca_gsl -eca_gsl \ eca_hd -eca_hd \ eca_hwdi -eca_hwdi \ eca_hwfi -eca_hwfi \ eca_id -eca_id \ eca_pd -eca_pd \ eca_r10mm -eca_r10mm \ eca_r1mm -eca_r1mm \ eca_r20mm -eca_r20mm \ eca_r75p -eca_r75p \ eca_r75ptot -eca_r75ptot \ eca_r90p -eca_r90p \ eca_r90ptot -eca_r90ptot \ eca_r95p -eca_r95p \ eca_r95ptot -eca_r95ptot \ eca_r99p -eca_r99p \ eca_r99ptot -eca_r99ptot \ eca_rr1 -eca_rr1 \ eca_rx1day -eca_rx1day \ eca_rx5day -eca_rx5day \ eca_sdii -eca_sdii \ eca_su -eca_su \ eca_tg10p -eca_tg10p \ eca_tg90p -eca_tg90p \ eca_tn10p -eca_tn10p \ eca_tn90p -eca_tn90p \ eca_tr -eca_tr \ eca_tx10p -eca_tx10p \ eca_tx90p -eca_tx90p \ enlarge -enlarge \ ensavg -ensavg \ ensbrs -ensbrs \ enscrps -enscrps \ enskurt -enskurt \ ensmax -ensmax \ ensmean -ensmean \ ensmedian -ensmedian \ ensmin -ensmin \ enspctl -enspctl \ ensrange -ensrange \ ensrkhistspace -ensrkhistspace \ ensrkhisttime -ensrkhisttime \ ensroc -ensroc \ ensskew -ensskew \ ensstd -ensstd \ ensstd1 -ensstd1 \ enssum -enssum \ ensvar -ensvar \ ensvar1 -ensvar1 \ eof -eof \ eof3d -eof3d \ eof3dspatial -eof3dspatial \ eof3dtime -eof3dtime \ eofcoeff -eofcoeff \ eofcoeff3d -eofcoeff3d \ eofspatial -eofspatial \ eoftime -eoftime \ eq -eq \ eqc -eqc \ etccdi -etccdi \ etccdi_cdd -etccdi_cdd \ etccdi_csdi -etccdi_csdi \ etccdi_cwd -etccdi_cwd \ etccdi_fd -etccdi_fd \ etccdi_gsl -etccdi_gsl \ etccdi_hd -etccdi_hd \ etccdi_id -etccdi_id \ etccdi_r10mm -etccdi_r10mm \ etccdi_r1mm -etccdi_r1mm \ etccdi_r20mm -etccdi_r20mm \ etccdi_r95p -etccdi_r95p \ etccdi_r99p -etccdi_r99p \ etccdi_rx1day -etccdi_rx1day \ etccdi_rx1daymon -etccdi_rx1daymon \ etccdi_rx5day -etccdi_rx5day \ etccdi_rx5daymon -etccdi_rx5daymon \ etccdi_sdii -etccdi_sdii \ etccdi_su -etccdi_su \ etccdi_tn10p -etccdi_tn10p \ etccdi_tn90p -etccdi_tn90p \ etccdi_tr -etccdi_tr \ etccdi_tx10p -etccdi_tx10p \ etccdi_tx90p -etccdi_tx90p \ etccdi_wsdi -etccdi_wsdi \ exp -exp \ export_e5ml -export_e5ml \ expr -expr \ exprf -exprf \ fc2gp -fc2gp \ fc2sp -fc2sp \ fdns -fdns \ filedes -filedes \ fillmiss -fillmiss \ fillmiss2 -fillmiss2 \ fldavg -fldavg \ fldcor -fldcor \ fldcount -fldcount \ fldcovar -fldcovar \ fldint -fldint \ fldkurt -fldkurt \ fldmax -fldmax \ fldmean -fldmean \ fldmedian -fldmedian \ fldmin -fldmin \ fldpctl -fldpctl \ fldrange -fldrange \ fldrms -fldrms \ fldskew -fldskew \ fldstd -fldstd \ fldstd1 -fldstd1 \ fldsum -fldsum \ fldvar -fldvar \ fldvar1 -fldvar1 \ for -for \ fourier -fourier \ fourier2grid -fourier2grid \ ge -ge \ gec -gec \ genbic -genbic \ genbil -genbil \ gencon -gencon \ gendis -gendis \ gengrid -gengrid \ genknn -genknn \ genlaf -genlaf \ genlevelbounds -genlevelbounds \ gennn -gennn \ genycon -genycon \ genycon2test -genycon2test \ gh2hl -gh2hl \ gh2hlx -gh2hlx \ gheight -gheight \ gheight_full -gheight_full \ gheight_half -gheight_half \ gheighthalf -gheighthalf \ globavg -globavg \ gmtcells -gmtcells \ gmtxyz -gmtxyz \ gp2fc -gp2fc \ gp2sp -gp2sp \ gp2spl -gp2spl \ gradsdes -gradsdes \ graph -graph \ grfill -grfill \ grid2fourier -grid2fourier \ gridarea -gridarea \ gridboxavg -gridboxavg \ gridboxkurt -gridboxkurt \ gridboxmax -gridboxmax \ gridboxmean -gridboxmean \ gridboxmedian -gridboxmedian \ gridboxmin -gridboxmin \ gridboxrange -gridboxrange \ gridboxskew -gridboxskew \ gridboxstd -gridboxstd \ gridboxstd1 -gridboxstd1 \ gridboxsum -gridboxsum \ gridboxvar -gridboxvar \ gridboxvar1 -gridboxvar1 \ gridcellidx -gridcellidx \ gridcellindex -gridcellindex \ griddes -griddes \ griddes2 -griddes2 \ griddx -griddx \ griddy -griddy \ gridmask -gridmask \ gridweights -gridweights \ gt -gt \ gtc -gtc \ harmonic -harmonic \ highpass -highpass \ histcount -histcount \ histfreq -histfreq \ histmean -histmean \ histsum -histsum \ houravg -houravg \ hourcount -hourcount \ hourmax -hourmax \ hourmean -hourmean \ hourmin -hourmin \ hourpctl -hourpctl \ hourrange -hourrange \ hourstd -hourstd \ hourstd1 -hourstd1 \ hoursum -hoursum \ hourvar -hourvar \ hourvar1 -hourvar1 \ hpdegrade -hpdegrade \ hpupgrade -hpupgrade \ hurr -hurr \ ifnotthen -ifnotthen \ ifnotthenc -ifnotthenc \ ifthen -ifthen \ ifthenc -ifthenc \ ifthenelse -ifthenelse \ im -im \ import_binary -import_binary \ import_cmsaf -import_cmsaf \ import_e5ml -import_e5ml \ import_fv3grid -import_fv3grid \ import_grads -import_grads \ import_obs -import_obs \ imtocomplex -imtocomplex \ info -info \ infoc -infoc \ infon -infon \ infop -infop \ infov -infov \ input -input \ inputext -inputext \ inputsrv -inputsrv \ int -int \ intgridbil -intgridbil \ intgriddis -intgriddis \ intgridknn -intgridknn \ intgridnn -intgridnn \ intgridtraj -intgridtraj \ intlevel -intlevel \ intlevel3d -intlevel3d \ intlevelx -intlevelx \ intlevelx3d -intlevelx3d \ intntime -intntime \ inttime -inttime \ intyear -intyear \ invertlat -invertlat \ invertlatdata -invertlatdata \ invertlatdes -invertlatdes \ invertlev -invertlev \ invertlon -invertlon \ invertlondata -invertlondata \ invertlondes -invertlondes \ isosurface -isosurface \ le -le \ lec -lec \ lic -lic \ linfo -linfo \ ln -ln \ log -log \ log10 -log10 \ lowpass -lowpass \ lt -lt \ ltc -ltc \ map -map \ mask -mask \ maskcircle -maskcircle \ maskindexbox -maskindexbox \ masklonlatbox -masklonlatbox \ maskregion -maskregion \ mastrfu -mastrfu \ max -max \ maxc -maxc \ meandiff2test -meandiff2test \ meravg -meravg \ merge -merge \ mergegrid -mergegrid \ mergetime -mergetime \ merkurt -merkurt \ mermax -mermax \ mermean -mermean \ mermedian -mermedian \ mermin -mermin \ merpctl -merpctl \ merrange -merrange \ merskew -merskew \ merstd -merstd \ merstd1 -merstd1 \ mersum -mersum \ mervar -mervar \ mervar1 -mervar1 \ min -min \ minc -minc \ ml2hl -ml2hl \ ml2hlx -ml2hlx \ ml2pl -ml2pl \ ml2plx -ml2plx \ mod -mod \ monadd -monadd \ monavg -monavg \ moncount -moncount \ mondiv -mondiv \ monmax -monmax \ monmean -monmean \ monmin -monmin \ monmul -monmul \ monpctl -monpctl \ monrange -monrange \ monstd -monstd \ monstd1 -monstd1 \ monsub -monsub \ monsum -monsum \ monvar -monvar \ monvar1 -monvar1 \ mrotuv -mrotuv \ mrotuvb -mrotuvb \ mul -mul \ mulc -mulc \ mulcoslat -mulcoslat \ muldoy -muldoy \ muldpm -muldpm \ muldpy -muldpy \ ncode -ncode \ ncopy -ncopy \ ndate -ndate \ ne -ne \ nec -nec \ ngridpoints -ngridpoints \ ngrids -ngrids \ nint -nint \ nlevel -nlevel \ nmon -nmon \ nop -nop \ not -not \ npar -npar \ ntime -ntime \ nvar -nvar \ nyear -nyear \ output -output \ outputarr -outputarr \ outputbounds -outputbounds \ outputboundscpt -outputboundscpt \ outputcenter -outputcenter \ outputcenter2 -outputcenter2 \ outputcentercpt -outputcentercpt \ outputext -outputext \ outputf -outputf \ outputfld -outputfld \ outputint -outputint \ outputkey -outputkey \ outputkml -outputkml \ outputsrv -outputsrv \ outputtab -outputtab \ outputtri -outputtri \ outputts -outputts \ outputvector -outputvector \ outputvrml -outputvrml \ outputxyz -outputxyz \ pack -pack \ pardup -pardup \ parmul -parmul \ partab -partab \ partab2 -partab2 \ pinfo -pinfo \ pinfov -pinfov \ pow -pow \ pressure -pressure \ pressure_full -pressure_full \ pressure_half -pressure_half \ projuvLatLon -projuvLatLon \ query -query \ rand -rand \ random -random \ re -re \ reci -reci \ recttocomplex -recttocomplex \ reducegrid -reducegrid \ regres -regres \ remap -remap \ remapavg -remapavg \ remapavgtest -remapavgtest \ remapbic -remapbic \ remapbil -remapbil \ remapcon -remapcon \ remapdis -remapdis \ remapeta -remapeta \ remapeta_s -remapeta_s \ remapeta_z -remapeta_z \ remapknn -remapknn \ remapkurt -remapkurt \ remaplaf -remaplaf \ remapmax -remapmax \ remapmean -remapmean \ remapmedian -remapmedian \ remapmin -remapmin \ remapnn -remapnn \ remaprange -remaprange \ remapskew -remapskew \ remapstd -remapstd \ remapstd1 -remapstd1 \ remapsum -remapsum \ remapvar -remapvar \ remapvar1 -remapvar1 \ remapycon -remapycon \ remapycon2test -remapycon2test \ replace -replace \ retocomplex -retocomplex \ rhopot -rhopot \ rotuvN -rotuvN \ rotuvNorth -rotuvNorth \ rotuvb -rotuvb \ runavg -runavg \ runmax -runmax \ runmean -runmean \ runmin -runmin \ runpctl -runpctl \ runrange -runrange \ runstd -runstd \ runstd1 -runstd1 \ runsum -runsum \ runvar -runvar \ runvar1 -runvar1 \ samplegrid -samplegrid \ samplegridicon -samplegridicon \ sealevelpressure -sealevelpressure \ seasavg -seasavg \ seascount -seascount \ seasmax -seasmax \ seasmean -seasmean \ seasmin -seasmin \ seasmonavg -seasmonavg \ seasmonmean -seasmonmean \ seaspctl -seaspctl \ seasrange -seasrange \ seasstd -seasstd \ seasstd1 -seasstd1 \ seassum -seassum \ seasvar -seasvar \ seasvar1 -seasvar1 \ seinfo -seinfo \ seinfoc -seinfoc \ seinfon -seinfon \ seinfop -seinfop \ selcircle -selcircle \ selcode -selcode \ seldate -seldate \ selday -selday \ select -select \ selgrid -selgrid \ selgridcell -selgridcell \ selgridname -selgridname \ selhour -selhour \ selindexbox -selindexbox \ sellevel -sellevel \ sellevidx -sellevidx \ sellonlatbox -sellonlatbox \ selltype -selltype \ selmon -selmon \ selmonth -selmonth \ selmulti -selmulti \ selname -selname \ seloperator -seloperator \ selparam -selparam \ selrec -selrec \ selregion -selregion \ selseas -selseas \ selseason -selseason \ selsmon -selsmon \ selstdname -selstdname \ selstep -selstep \ seltabnum -seltabnum \ seltime -seltime \ seltimeidx -seltimeidx \ seltimestep -seltimestep \ selvar -selvar \ selyear -selyear \ selyearidx -selyearidx \ selzaxis -selzaxis \ selzaxisname -selzaxisname \ seq -seq \ setattribute -setattribute \ setcalendar -setcalendar \ setchunkspec -setchunkspec \ setcindexbox -setcindexbox \ setclonlatbox -setclonlatbox \ setcode -setcode \ setcodetab -setcodetab \ setctomiss -setctomiss \ setdate -setdate \ setday -setday \ setfilter -setfilter \ setgrid -setgrid \ setgridarea -setgridarea \ setgridcell -setgridcell \ setgridmask -setgridmask \ setgridnumber -setgridnumber \ setgridtype -setgridtype \ setgriduri -setgriduri \ sethalo -sethalo \ setlevel -setlevel \ setltype -setltype \ setmaxsteps -setmaxsteps \ setmiss -setmiss \ setmisstoc -setmisstoc \ setmisstodis -setmisstodis \ setmisstonn -setmisstonn \ setmissval -setmissval \ setmon -setmon \ setname -setname \ setparam -setparam \ setpartab -setpartab \ setpartabc -setpartabc \ setpartabn -setpartabn \ setpartabp -setpartabp \ setpartabv -setpartabv \ setprojparams -setprojparams \ setrcaname -setrcaname \ setreftime -setreftime \ setrtoc -setrtoc \ setrtoc2 -setrtoc2 \ setrtomiss -setrtomiss \ setstdname -setstdname \ settabnum -settabnum \ settaxis -settaxis \ settbounds -settbounds \ settime -settime \ settunits -settunits \ setunit -setunit \ setvals -setvals \ setvar -setvar \ setvrange -setvrange \ setyear -setyear \ setzaxis -setzaxis \ shaded -shaded \ shifttime -shifttime \ shiftx -shiftx \ shifty -shifty \ showattribute -showattribute \ showattsvar -showattsvar \ showchunkspec -showchunkspec \ showcode -showcode \ showdate -showdate \ showfilter -showfilter \ showformat -showformat \ showgrid -showgrid \ showhistory -showhistory \ showlevel -showlevel \ showltype -showltype \ showmon -showmon \ showname -showname \ showparam -showparam \ showstdname -showstdname \ showtime -showtime \ showtimestamp -showtimestamp \ showunit -showunit \ showvar -showvar \ showyear -showyear \ sin -sin \ sincos -sincos \ sinfo -sinfo \ sinfoc -sinfoc \ sinfon -sinfon \ sinfop -sinfop \ sinfov -sinfov \ smooth -smooth \ smooth9 -smooth9 \ sortcode -sortcode \ sortlevel -sortlevel \ sortname -sortname \ sortparam -sortparam \ sorttaxis -sorttaxis \ sorttimestamp -sorttimestamp \ sortvar -sortvar \ sp2fc -sp2fc \ sp2gp -sp2gp \ sp2gpl -sp2gpl \ sp2sp -sp2sp \ spartab -spartab \ spcut -spcut \ specinfo -specinfo \ spectrum -spectrum \ splitcode -splitcode \ splitdate -splitdate \ splitdatetime -splitdatetime \ splitday -splitday \ splitensemble -splitensemble \ splitgrid -splitgrid \ splithour -splithour \ splitlevel -splitlevel \ splitmon -splitmon \ splitname -splitname \ splitparam -splitparam \ splitrec -splitrec \ splitseas -splitseas \ splitsel -splitsel \ splittabnum -splittabnum \ splitvar -splitvar \ splityear -splityear \ splityearmon -splityearmon \ splitzaxis -splitzaxis \ sqr -sqr \ sqrt -sqrt \ stdatm -stdatm \ strbre -strbre \ stream -stream \ strgal -strgal \ strwin -strwin \ sub -sub \ subc -subc \ subgrid -subgrid \ subtrend -subtrend \ symmetrize -symmetrize \ szip -szip \ tan -tan \ tee -tee \ temp -temp \ testcellsearch -testcellsearch \ testfield -testfield \ testpointsearch -testpointsearch \ thinout -thinout \ timavg -timavg \ timcor -timcor \ timcount -timcount \ timcovar -timcovar \ timcumsum -timcumsum \ timederivative -timederivative \ timfillmiss -timfillmiss \ timmax -timmax \ timmaxidx -timmaxidx \ timmean -timmean \ timmin -timmin \ timminidx -timminidx \ timpctl -timpctl \ timrange -timrange \ timrmsd -timrmsd \ timselavg -timselavg \ timselmax -timselmax \ timselmean -timselmean \ timselmin -timselmin \ timselpctl -timselpctl \ timselrange -timselrange \ timselstd -timselstd \ timselstd1 -timselstd1 \ timselsum -timselsum \ timselvar -timselvar \ timselvar1 -timselvar1 \ timsort -timsort \ timstd -timstd \ timstd1 -timstd1 \ timsum -timsum \ timvar -timvar \ timvar1 -timvar1 \ timyearavg -timyearavg \ timyearmean -timyearmean \ tinfo -tinfo \ topo -topo \ topvalue -topvalue \ tpnhalo -tpnhalo \ transxy -transxy \ trend -trend \ tstepcount -tstepcount \ unpack -unpack \ unsetgridmask -unsetgridmask \ usegridnumber -usegridnumber \ uv2dv -uv2dv \ uv2dv_cfd -uv2dv_cfd \ uv2dvl -uv2dvl \ uv2vr_cfd -uv2vr_cfd \ uvDestag -uvDestag \ vardes -vardes \ varquot2test -varquot2test \ varrms -varrms \ varsavg -varsavg \ varskurt -varskurt \ varsmax -varsmax \ varsmean -varsmean \ varsmedian -varsmedian \ varsmin -varsmin \ varspctl -varspctl \ varsrange -varsrange \ varsskew -varsskew \ varsstd -varsstd \ varsstd1 -varsstd1 \ varssum -varssum \ varsvar -varsvar \ varsvar1 -varsvar1 \ vct -vct \ vct2 -vct2 \ vector -vector \ verifygrid -verifygrid \ verifyweights -verifyweights \ vertavg -vertavg \ vertcum -vertcum \ vertcumhl -vertcumhl \ vertfillmiss -vertfillmiss \ vertint -vertint \ vertmax -vertmax \ vertmean -vertmean \ vertmin -vertmin \ vertrange -vertrange \ vertstd -vertstd \ vertstd1 -vertstd1 \ vertsum -vertsum \ vertvar -vertvar \ vertvar1 -vertvar1 \ vertwind -vertwind \ vinfo -vinfo \ vlist -vlist \ wct -wct \ writegrid -writegrid \ writerandom -writerandom \ writeremapscrip -writeremapscrip \ xsinfo -xsinfo \ xsinfoc -xsinfoc \ xsinfon -xsinfon \ xsinfop -xsinfop \ ydayadd -ydayadd \ ydayavg -ydayavg \ ydaydiv -ydaydiv \ ydaymax -ydaymax \ ydaymean -ydaymean \ ydaymin -ydaymin \ ydaymul -ydaymul \ ydaypctl -ydaypctl \ ydayrange -ydayrange \ ydaystd -ydaystd \ ydaystd1 -ydaystd1 \ ydaysub -ydaysub \ ydaysum -ydaysum \ ydayvar -ydayvar \ ydayvar1 -ydayvar1 \ ydrunavg -ydrunavg \ ydrunmax -ydrunmax \ ydrunmean -ydrunmean \ ydrunmin -ydrunmin \ ydrunpctl -ydrunpctl \ ydrunstd -ydrunstd \ ydrunstd1 -ydrunstd1 \ ydrunsum -ydrunsum \ ydrunvar -ydrunvar \ ydrunvar1 -ydrunvar1 \ yearadd -yearadd \ yearavg -yearavg \ yearcount -yearcount \ yeardiv -yeardiv \ yearmax -yearmax \ yearmaxidx -yearmaxidx \ yearmean -yearmean \ yearmin -yearmin \ yearminidx -yearminidx \ yearmonavg -yearmonavg \ yearmonmean -yearmonmean \ yearmul -yearmul \ yearpctl -yearpctl \ yearrange -yearrange \ yearstd -yearstd \ yearstd1 -yearstd1 \ yearsub -yearsub \ yearsum -yearsum \ yearvar -yearvar \ yearvar1 -yearvar1 \ yhouradd -yhouradd \ yhouravg -yhouravg \ yhourdiv -yhourdiv \ yhourmax -yhourmax \ yhourmean -yhourmean \ yhourmin -yhourmin \ yhourmul -yhourmul \ yhourrange -yhourrange \ yhourstd -yhourstd \ yhourstd1 -yhourstd1 \ yhoursub -yhoursub \ yhoursum -yhoursum \ yhourvar -yhourvar \ yhourvar1 -yhourvar1 \ ymonadd -ymonadd \ ymonavg -ymonavg \ ymondiv -ymondiv \ ymoneq -ymoneq \ ymonge -ymonge \ ymongt -ymongt \ ymonle -ymonle \ ymonlt -ymonlt \ ymonmax -ymonmax \ ymonmean -ymonmean \ ymonmin -ymonmin \ ymonmul -ymonmul \ ymonne -ymonne \ ymonpctl -ymonpctl \ ymonrange -ymonrange \ ymonstd -ymonstd \ ymonstd1 -ymonstd1 \ ymonsub -ymonsub \ ymonsum -ymonsum \ ymonvar -ymonvar \ ymonvar1 -ymonvar1 \ yseasadd -yseasadd \ yseasavg -yseasavg \ yseasdiv -yseasdiv \ yseaseq -yseaseq \ yseasge -yseasge \ yseasgt -yseasgt \ yseasle -yseasle \ yseaslt -yseaslt \ yseasmax -yseasmax \ yseasmean -yseasmean \ yseasmin -yseasmin \ yseasmul -yseasmul \ yseasne -yseasne \ yseaspctl -yseaspctl \ yseasrange -yseasrange \ yseasstd -yseasstd \ yseasstd1 -yseasstd1 \ yseassub -yseassub \ yseassum -yseassum \ yseasvar -yseasvar \ yseasvar1 -yseasvar1 \ zaxisdes -zaxisdes \ zonavg -zonavg \ zonint -zonint \ zonkurt -zonkurt \ zonmax -zonmax \ zonmean -zonmean \ zonmedian -zonmedian \ zonmin -zonmin \ zonpctl -zonpctl \ zonrange -zonrange \ zonskew -zonskew \ zonstd -zonstd \ zonstd1 -zonstd1 \ zonsum -zonsum \ zonvar -zonvar \ zonvar1 -zonvar1 \ zs2zl -zs2zl \ zs2zlx -zs2zlx \ zsdepth -zsdepth \ )" -f cdo cdo-2.6.6.1/contrib/makecompl.rb0000775000175000017500000000557215271332515016572 0ustar alastairalastair#!/usr/bin/env ruby require 'optparse' require 'pp' $opts = {:bin => '../src/cdo',:outfile => 'cdoCompletion'} OptionParser.new do |o| o.banner = "Create auto completion files for different shells\n " + "Usage: makecompl.rb [-h] [-b CMD] [-o FILENAME]" o.separator("") o.separator("Options are ...") o.on("-b", "--binary CMD", "Choose a CDO binary different from #{$opts[:bin]}") {|cmd| $opts[:bin] = cmd} o.on("-o", "--outfile FILENAME", "Set the filename for all completions files (default: #{$opts[:outfile]})") {|fname| $opts[:outfile] = fname} o.on("-h","--help","Show this help") {puts o puts puts <<-'END' RESTRICTIONS: Supported shells are TCSH, BASH and ZSH. For tcsh completion is only performed for regular options and operators with prepended '-'. Bash and zsh also complete opertors without leading '-'. AUTHOR: Ralf Mueller, ralf.mueller@mpimet.mpg.de LICENSE: CDO's License END exit } end.parse! #=============================================================================== def getOperators # try to run the CDO binary first cmd = $opts[:bin] + ' --operators' help = IO.popen(cmd).readlines.map {|l| l.chomp.lstrip} if 5 >= help.size puts "Operators could not get listed by running the CDO binary (#{$opts[:bin]})" puts "Create operator list by scanning the documentation..." Dir.glob('../doc/tex/mod/*').map {|mod| File.open(mod).readlines.grep(/Operators/).map {|line| line.chomp.split('=')[-1].split(' ') } }.flatten else help.map {|line| line.split[0]} end end def getOptions cmd = $opts[:bin] + ' -h 2>&1' options = IO.popen(cmd).readlines.map {|l| l.chomp.lstrip}.grep(/^--*\w+(,| )/).map {|line| line.split[0]}#{|item| /^-(-)\w+ /.match(item)}.map {|o| o[0,2]} if options.empty? puts "Commandline options could not get listed by running the CDO binary (#{$opts[:bin]})" puts "Go on processing operators only ..." exit 1 end options end #=============================================================================== operators = getOperators.sort options = getOptions.sort #pp operators; pp options # Create the configuration files complCmds = { :tcsh => ['set cdoCmpl = (\\','); complete cdo \'c/-/$cdoCmpl/\' \'n/*/f/\''], :zsh => ['compctl -k "(' ,')" -f cdo'], :bash => ['complete -W "' ,'" -f cdo'] } [:bash, :zsh, :tcsh].each {|shell| # tcsh: Remove the prepended '-' from the cdo cmdline options. This will be # added through tcsh's completion command # otherwise: Add operators WITH leading '-' completions = (:tcsh == shell ) ? options.map {|o| o[1..-1]} + operators : options + operators.map {|o| "#{o} -#{o}"} File.open($opts[:outfile] + '.' + shell.to_s,'w') {|f| f << complCmds[shell][0] << "\n" completions.each {|item| f << item << " \\" << "\n" } f << complCmds[shell][1] << "\n" } } cdo-2.6.6.1/contrib/cdoCompletion.bash0000664000175000017500000005007115271332515017722 0ustar alastairalastaircomplete -W " --apply \ --argument_groups \ --attribs \ --chunksize \ --chunkspec \ --cmor \ --config \ --copy_chunkspec \ --disable_file_suffix \ --disable_history \ --double \ --download_path \ --eccodes \ --enableexcept \ --envvars \ --fast \ --file_suffix \ --force \ --gridsearchradius \ --history \ --history_info \ --icon_grids \ --ignore_time_bounds \ --module_info \ --netcdf_hdr_pad \ --no_history \ --no_remap_weights \ --nofile \ --nsb \ --operators \ --operators_no_output \ --pedantic \ --percentile \ --precision \ --print_filename \ --query \ --reduce_dim \ --reduce_dims \ --remap_weights \ --remove_chunkspec \ --reset_history \ --rusage \ --seed \ --settings \ --shuffle \ --single \ --sortparam \ --test \ --timestat_date \ --use_fftw \ --use_time_bounds \ --version_info \ --worker \ -A, \ -C, \ -D, \ -F, \ -M, \ -O, \ -P, \ -Q, \ -R, \ -S, \ -T, \ -V, \ -a, \ -b, \ -c, \ -d, \ -f, \ -g, \ -h, \ -i, \ -k, \ -l, \ -m, \ -p, \ -r, \ -s, \ -t, \ -u, \ -v, \ -w, \ -z, \ abs -abs \ acos -acos \ add -add \ addc -addc \ addtrend -addtrend \ adipot -adipot \ adisit -adisit \ aexpr -aexpr \ aexprf -aexprf \ after -after \ afterburner -afterburner \ air_density -air_density \ anomaly -anomaly \ ap2hl -ap2hl \ ap2hlx -ap2hlx \ ap2pl -ap2pl \ ap2plx -ap2plx \ arg -arg \ asin -asin \ atan -atan \ atan2 -atan2 \ bandpass -bandpass \ bitrounding -bitrounding \ bottomvalue -bottomvalue \ boxavg -boxavg \ cat -cat \ cdiread -cdiread \ cdiwrite -cdiwrite \ changemulti -changemulti \ chcode -chcode \ chlevel -chlevel \ chlevelc -chlevelc \ chlevelv -chlevelv \ chltype -chltype \ chname -chname \ chparam -chparam \ chtabnum -chtabnum \ chunit -chunit \ chvar -chvar \ cinfo -cinfo \ clone -clone \ cloudlayer -cloudlayer \ cmor -cmor \ cmorlite -cmorlite \ codetab -codetab \ collgrid -collgrid \ complextopol -complextopol \ complextorect -complextorect \ conj -conj \ consecsum -consecsum \ consects -consects \ const -const \ contour -contour \ conv_cmor_table -conv_cmor_table \ copy -copy \ cos -cos \ coshill -coshill \ dayadd -dayadd \ dayavg -dayavg \ daycount -daycount \ daydiv -daydiv \ daymax -daymax \ daymean -daymean \ daymin -daymin \ daymul -daymul \ daypctl -daypctl \ dayrange -dayrange \ daystd -daystd \ daystd1 -daystd1 \ daysub -daysub \ daysum -daysum \ dayvar -dayvar \ dayvar1 -dayvar1 \ dcw -dcw \ del29feb -del29feb \ delattribute -delattribute \ delcode -delcode \ delday -delday \ delete -delete \ delgridcell -delgridcell \ delmulti -delmulti \ delname -delname \ delparam -delparam \ delta_pressure -delta_pressure \ deltat -deltat \ delvar -delvar \ detrend -detrend \ dhouravg -dhouravg \ dhourmax -dhourmax \ dhourmean -dhourmean \ dhourmin -dhourmin \ dhourrange -dhourrange \ dhourstd -dhourstd \ dhourstd1 -dhourstd1 \ dhoursum -dhoursum \ dhourvar -dhourvar \ dhourvar1 -dhourvar1 \ diff -diff \ diffc -diffc \ diffn -diffn \ diffp -diffp \ difftest -difftest \ diffv -diffv \ distgrid -distgrid \ div -div \ divc -divc \ divcoslat -divcoslat \ divdpm -divdpm \ divdpy -divdpy \ dminuteavg -dminuteavg \ dminutemax -dminutemax \ dminutemean -dminutemean \ dminutemin -dminutemin \ dminuterange -dminuterange \ dminutestd -dminutestd \ dminutestd1 -dminutestd1 \ dminutesum -dminutesum \ dminutevar -dminutevar \ dminutevar1 -dminutevar1 \ dump_cmor_table -dump_cmor_table \ dumpmap -dumpmap \ duplicate -duplicate \ dv2ps -dv2ps \ dv2uv -dv2uv \ dv2uvl -dv2uvl \ eca_cdd -eca_cdd \ eca_cfd -eca_cfd \ eca_csu -eca_csu \ eca_cwd -eca_cwd \ eca_cwdi -eca_cwdi \ eca_cwfi -eca_cwfi \ eca_etr -eca_etr \ eca_fd -eca_fd \ eca_gsl -eca_gsl \ eca_hd -eca_hd \ eca_hwdi -eca_hwdi \ eca_hwfi -eca_hwfi \ eca_id -eca_id \ eca_pd -eca_pd \ eca_r10mm -eca_r10mm \ eca_r1mm -eca_r1mm \ eca_r20mm -eca_r20mm \ eca_r75p -eca_r75p \ eca_r75ptot -eca_r75ptot \ eca_r90p -eca_r90p \ eca_r90ptot -eca_r90ptot \ eca_r95p -eca_r95p \ eca_r95ptot -eca_r95ptot \ eca_r99p -eca_r99p \ eca_r99ptot -eca_r99ptot \ eca_rr1 -eca_rr1 \ eca_rx1day -eca_rx1day \ eca_rx5day -eca_rx5day \ eca_sdii -eca_sdii \ eca_su -eca_su \ eca_tg10p -eca_tg10p \ eca_tg90p -eca_tg90p \ eca_tn10p -eca_tn10p \ eca_tn90p -eca_tn90p \ eca_tr -eca_tr \ eca_tx10p -eca_tx10p \ eca_tx90p -eca_tx90p \ enlarge -enlarge \ ensavg -ensavg \ ensbrs -ensbrs \ enscrps -enscrps \ enskurt -enskurt \ ensmax -ensmax \ ensmean -ensmean \ ensmedian -ensmedian \ ensmin -ensmin \ enspctl -enspctl \ ensrange -ensrange \ ensrkhistspace -ensrkhistspace \ ensrkhisttime -ensrkhisttime \ ensroc -ensroc \ ensskew -ensskew \ ensstd -ensstd \ ensstd1 -ensstd1 \ enssum -enssum \ ensvar -ensvar \ ensvar1 -ensvar1 \ eof -eof \ eof3d -eof3d \ eof3dspatial -eof3dspatial \ eof3dtime -eof3dtime \ eofcoeff -eofcoeff \ eofcoeff3d -eofcoeff3d \ eofspatial -eofspatial \ eoftime -eoftime \ eq -eq \ eqc -eqc \ etccdi -etccdi \ etccdi_cdd -etccdi_cdd \ etccdi_csdi -etccdi_csdi \ etccdi_cwd -etccdi_cwd \ etccdi_fd -etccdi_fd \ etccdi_gsl -etccdi_gsl \ etccdi_hd -etccdi_hd \ etccdi_id -etccdi_id \ etccdi_r10mm -etccdi_r10mm \ etccdi_r1mm -etccdi_r1mm \ etccdi_r20mm -etccdi_r20mm \ etccdi_r95p -etccdi_r95p \ etccdi_r99p -etccdi_r99p \ etccdi_rx1day -etccdi_rx1day \ etccdi_rx1daymon -etccdi_rx1daymon \ etccdi_rx5day -etccdi_rx5day \ etccdi_rx5daymon -etccdi_rx5daymon \ etccdi_sdii -etccdi_sdii \ etccdi_su -etccdi_su \ etccdi_tn10p -etccdi_tn10p \ etccdi_tn90p -etccdi_tn90p \ etccdi_tr -etccdi_tr \ etccdi_tx10p -etccdi_tx10p \ etccdi_tx90p -etccdi_tx90p \ etccdi_wsdi -etccdi_wsdi \ exp -exp \ export_e5ml -export_e5ml \ expr -expr \ exprf -exprf \ fc2gp -fc2gp \ fc2sp -fc2sp \ fdns -fdns \ filedes -filedes \ fillmiss -fillmiss \ fillmiss2 -fillmiss2 \ fldavg -fldavg \ fldcor -fldcor \ fldcount -fldcount \ fldcovar -fldcovar \ fldint -fldint \ fldkurt -fldkurt \ fldmax -fldmax \ fldmean -fldmean \ fldmedian -fldmedian \ fldmin -fldmin \ fldpctl -fldpctl \ fldrange -fldrange \ fldrms -fldrms \ fldskew -fldskew \ fldstd -fldstd \ fldstd1 -fldstd1 \ fldsum -fldsum \ fldvar -fldvar \ fldvar1 -fldvar1 \ for -for \ fourier -fourier \ fourier2grid -fourier2grid \ ge -ge \ gec -gec \ genbic -genbic \ genbil -genbil \ gencon -gencon \ gendis -gendis \ gengrid -gengrid \ genknn -genknn \ genlaf -genlaf \ genlevelbounds -genlevelbounds \ gennn -gennn \ genycon -genycon \ genycon2test -genycon2test \ gh2hl -gh2hl \ gh2hlx -gh2hlx \ gheight -gheight \ gheight_full -gheight_full \ gheight_half -gheight_half \ gheighthalf -gheighthalf \ globavg -globavg \ gmtcells -gmtcells \ gmtxyz -gmtxyz \ gp2fc -gp2fc \ gp2sp -gp2sp \ gp2spl -gp2spl \ gradsdes -gradsdes \ graph -graph \ grfill -grfill \ grid2fourier -grid2fourier \ gridarea -gridarea \ gridboxavg -gridboxavg \ gridboxkurt -gridboxkurt \ gridboxmax -gridboxmax \ gridboxmean -gridboxmean \ gridboxmedian -gridboxmedian \ gridboxmin -gridboxmin \ gridboxrange -gridboxrange \ gridboxskew -gridboxskew \ gridboxstd -gridboxstd \ gridboxstd1 -gridboxstd1 \ gridboxsum -gridboxsum \ gridboxvar -gridboxvar \ gridboxvar1 -gridboxvar1 \ gridcellidx -gridcellidx \ gridcellindex -gridcellindex \ griddes -griddes \ griddes2 -griddes2 \ griddx -griddx \ griddy -griddy \ gridmask -gridmask \ gridweights -gridweights \ gt -gt \ gtc -gtc \ harmonic -harmonic \ highpass -highpass \ histcount -histcount \ histfreq -histfreq \ histmean -histmean \ histsum -histsum \ houravg -houravg \ hourcount -hourcount \ hourmax -hourmax \ hourmean -hourmean \ hourmin -hourmin \ hourpctl -hourpctl \ hourrange -hourrange \ hourstd -hourstd \ hourstd1 -hourstd1 \ hoursum -hoursum \ hourvar -hourvar \ hourvar1 -hourvar1 \ hpdegrade -hpdegrade \ hpupgrade -hpupgrade \ hurr -hurr \ ifnotthen -ifnotthen \ ifnotthenc -ifnotthenc \ ifthen -ifthen \ ifthenc -ifthenc \ ifthenelse -ifthenelse \ im -im \ import_binary -import_binary \ import_cmsaf -import_cmsaf \ import_e5ml -import_e5ml \ import_fv3grid -import_fv3grid \ import_grads -import_grads \ import_obs -import_obs \ imtocomplex -imtocomplex \ info -info \ infoc -infoc \ infon -infon \ infop -infop \ infov -infov \ input -input \ inputext -inputext \ inputsrv -inputsrv \ int -int \ intgridbil -intgridbil \ intgriddis -intgriddis \ intgridknn -intgridknn \ intgridnn -intgridnn \ intgridtraj -intgridtraj \ intlevel -intlevel \ intlevel3d -intlevel3d \ intlevelx -intlevelx \ intlevelx3d -intlevelx3d \ intntime -intntime \ inttime -inttime \ intyear -intyear \ invertlat -invertlat \ invertlatdata -invertlatdata \ invertlatdes -invertlatdes \ invertlev -invertlev \ invertlon -invertlon \ invertlondata -invertlondata \ invertlondes -invertlondes \ isosurface -isosurface \ le -le \ lec -lec \ lic -lic \ linfo -linfo \ ln -ln \ log -log \ log10 -log10 \ lowpass -lowpass \ lt -lt \ ltc -ltc \ map -map \ mask -mask \ maskcircle -maskcircle \ maskindexbox -maskindexbox \ masklonlatbox -masklonlatbox \ maskregion -maskregion \ mastrfu -mastrfu \ max -max \ maxc -maxc \ meandiff2test -meandiff2test \ meravg -meravg \ merge -merge \ mergegrid -mergegrid \ mergetime -mergetime \ merkurt -merkurt \ mermax -mermax \ mermean -mermean \ mermedian -mermedian \ mermin -mermin \ merpctl -merpctl \ merrange -merrange \ merskew -merskew \ merstd -merstd \ merstd1 -merstd1 \ mersum -mersum \ mervar -mervar \ mervar1 -mervar1 \ min -min \ minc -minc \ ml2hl -ml2hl \ ml2hlx -ml2hlx \ ml2pl -ml2pl \ ml2plx -ml2plx \ mod -mod \ monadd -monadd \ monavg -monavg \ moncount -moncount \ mondiv -mondiv \ monmax -monmax \ monmean -monmean \ monmin -monmin \ monmul -monmul \ monpctl -monpctl \ monrange -monrange \ monstd -monstd \ monstd1 -monstd1 \ monsub -monsub \ monsum -monsum \ monvar -monvar \ monvar1 -monvar1 \ mrotuv -mrotuv \ mrotuvb -mrotuvb \ mul -mul \ mulc -mulc \ mulcoslat -mulcoslat \ muldoy -muldoy \ muldpm -muldpm \ muldpy -muldpy \ ncode -ncode \ ncopy -ncopy \ ndate -ndate \ ne -ne \ nec -nec \ ngridpoints -ngridpoints \ ngrids -ngrids \ nint -nint \ nlevel -nlevel \ nmon -nmon \ nop -nop \ not -not \ npar -npar \ ntime -ntime \ nvar -nvar \ nyear -nyear \ output -output \ outputarr -outputarr \ outputbounds -outputbounds \ outputboundscpt -outputboundscpt \ outputcenter -outputcenter \ outputcenter2 -outputcenter2 \ outputcentercpt -outputcentercpt \ outputext -outputext \ outputf -outputf \ outputfld -outputfld \ outputint -outputint \ outputkey -outputkey \ outputkml -outputkml \ outputsrv -outputsrv \ outputtab -outputtab \ outputtri -outputtri \ outputts -outputts \ outputvector -outputvector \ outputvrml -outputvrml \ outputxyz -outputxyz \ pack -pack \ pardup -pardup \ parmul -parmul \ partab -partab \ partab2 -partab2 \ pinfo -pinfo \ pinfov -pinfov \ pow -pow \ pressure -pressure \ pressure_full -pressure_full \ pressure_half -pressure_half \ projuvLatLon -projuvLatLon \ query -query \ rand -rand \ random -random \ re -re \ reci -reci \ recttocomplex -recttocomplex \ reducegrid -reducegrid \ regres -regres \ remap -remap \ remapavg -remapavg \ remapavgtest -remapavgtest \ remapbic -remapbic \ remapbil -remapbil \ remapcon -remapcon \ remapdis -remapdis \ remapeta -remapeta \ remapeta_s -remapeta_s \ remapeta_z -remapeta_z \ remapknn -remapknn \ remapkurt -remapkurt \ remaplaf -remaplaf \ remapmax -remapmax \ remapmean -remapmean \ remapmedian -remapmedian \ remapmin -remapmin \ remapnn -remapnn \ remaprange -remaprange \ remapskew -remapskew \ remapstd -remapstd \ remapstd1 -remapstd1 \ remapsum -remapsum \ remapvar -remapvar \ remapvar1 -remapvar1 \ remapycon -remapycon \ remapycon2test -remapycon2test \ replace -replace \ retocomplex -retocomplex \ rhopot -rhopot \ rotuvN -rotuvN \ rotuvNorth -rotuvNorth \ rotuvb -rotuvb \ runavg -runavg \ runmax -runmax \ runmean -runmean \ runmin -runmin \ runpctl -runpctl \ runrange -runrange \ runstd -runstd \ runstd1 -runstd1 \ runsum -runsum \ runvar -runvar \ runvar1 -runvar1 \ samplegrid -samplegrid \ samplegridicon -samplegridicon \ sealevelpressure -sealevelpressure \ seasavg -seasavg \ seascount -seascount \ seasmax -seasmax \ seasmean -seasmean \ seasmin -seasmin \ seasmonavg -seasmonavg \ seasmonmean -seasmonmean \ seaspctl -seaspctl \ seasrange -seasrange \ seasstd -seasstd \ seasstd1 -seasstd1 \ seassum -seassum \ seasvar -seasvar \ seasvar1 -seasvar1 \ seinfo -seinfo \ seinfoc -seinfoc \ seinfon -seinfon \ seinfop -seinfop \ selcircle -selcircle \ selcode -selcode \ seldate -seldate \ selday -selday \ select -select \ selgrid -selgrid \ selgridcell -selgridcell \ selgridname -selgridname \ selhour -selhour \ selindexbox -selindexbox \ sellevel -sellevel \ sellevidx -sellevidx \ sellonlatbox -sellonlatbox \ selltype -selltype \ selmon -selmon \ selmonth -selmonth \ selmulti -selmulti \ selname -selname \ seloperator -seloperator \ selparam -selparam \ selrec -selrec \ selregion -selregion \ selseas -selseas \ selseason -selseason \ selsmon -selsmon \ selstdname -selstdname \ selstep -selstep \ seltabnum -seltabnum \ seltime -seltime \ seltimeidx -seltimeidx \ seltimestep -seltimestep \ selvar -selvar \ selyear -selyear \ selyearidx -selyearidx \ selzaxis -selzaxis \ selzaxisname -selzaxisname \ seq -seq \ setattribute -setattribute \ setcalendar -setcalendar \ setchunkspec -setchunkspec \ setcindexbox -setcindexbox \ setclonlatbox -setclonlatbox \ setcode -setcode \ setcodetab -setcodetab \ setctomiss -setctomiss \ setdate -setdate \ setday -setday \ setfilter -setfilter \ setgrid -setgrid \ setgridarea -setgridarea \ setgridcell -setgridcell \ setgridmask -setgridmask \ setgridnumber -setgridnumber \ setgridtype -setgridtype \ setgriduri -setgriduri \ sethalo -sethalo \ setlevel -setlevel \ setltype -setltype \ setmaxsteps -setmaxsteps \ setmiss -setmiss \ setmisstoc -setmisstoc \ setmisstodis -setmisstodis \ setmisstonn -setmisstonn \ setmissval -setmissval \ setmon -setmon \ setname -setname \ setparam -setparam \ setpartab -setpartab \ setpartabc -setpartabc \ setpartabn -setpartabn \ setpartabp -setpartabp \ setpartabv -setpartabv \ setprojparams -setprojparams \ setrcaname -setrcaname \ setreftime -setreftime \ setrtoc -setrtoc \ setrtoc2 -setrtoc2 \ setrtomiss -setrtomiss \ setstdname -setstdname \ settabnum -settabnum \ settaxis -settaxis \ settbounds -settbounds \ settime -settime \ settunits -settunits \ setunit -setunit \ setvals -setvals \ setvar -setvar \ setvrange -setvrange \ setyear -setyear \ setzaxis -setzaxis \ shaded -shaded \ shifttime -shifttime \ shiftx -shiftx \ shifty -shifty \ showattribute -showattribute \ showattsvar -showattsvar \ showchunkspec -showchunkspec \ showcode -showcode \ showdate -showdate \ showfilter -showfilter \ showformat -showformat \ showgrid -showgrid \ showhistory -showhistory \ showlevel -showlevel \ showltype -showltype \ showmon -showmon \ showname -showname \ showparam -showparam \ showstdname -showstdname \ showtime -showtime \ showtimestamp -showtimestamp \ showunit -showunit \ showvar -showvar \ showyear -showyear \ sin -sin \ sincos -sincos \ sinfo -sinfo \ sinfoc -sinfoc \ sinfon -sinfon \ sinfop -sinfop \ sinfov -sinfov \ smooth -smooth \ smooth9 -smooth9 \ sortcode -sortcode \ sortlevel -sortlevel \ sortname -sortname \ sortparam -sortparam \ sorttaxis -sorttaxis \ sorttimestamp -sorttimestamp \ sortvar -sortvar \ sp2fc -sp2fc \ sp2gp -sp2gp \ sp2gpl -sp2gpl \ sp2sp -sp2sp \ spartab -spartab \ spcut -spcut \ specinfo -specinfo \ spectrum -spectrum \ splitcode -splitcode \ splitdate -splitdate \ splitdatetime -splitdatetime \ splitday -splitday \ splitensemble -splitensemble \ splitgrid -splitgrid \ splithour -splithour \ splitlevel -splitlevel \ splitmon -splitmon \ splitname -splitname \ splitparam -splitparam \ splitrec -splitrec \ splitseas -splitseas \ splitsel -splitsel \ splittabnum -splittabnum \ splitvar -splitvar \ splityear -splityear \ splityearmon -splityearmon \ splitzaxis -splitzaxis \ sqr -sqr \ sqrt -sqrt \ stdatm -stdatm \ strbre -strbre \ stream -stream \ strgal -strgal \ strwin -strwin \ sub -sub \ subc -subc \ subgrid -subgrid \ subtrend -subtrend \ symmetrize -symmetrize \ szip -szip \ tan -tan \ tee -tee \ temp -temp \ testcellsearch -testcellsearch \ testfield -testfield \ testpointsearch -testpointsearch \ thinout -thinout \ timavg -timavg \ timcor -timcor \ timcount -timcount \ timcovar -timcovar \ timcumsum -timcumsum \ timederivative -timederivative \ timfillmiss -timfillmiss \ timmax -timmax \ timmaxidx -timmaxidx \ timmean -timmean \ timmin -timmin \ timminidx -timminidx \ timpctl -timpctl \ timrange -timrange \ timrmsd -timrmsd \ timselavg -timselavg \ timselmax -timselmax \ timselmean -timselmean \ timselmin -timselmin \ timselpctl -timselpctl \ timselrange -timselrange \ timselstd -timselstd \ timselstd1 -timselstd1 \ timselsum -timselsum \ timselvar -timselvar \ timselvar1 -timselvar1 \ timsort -timsort \ timstd -timstd \ timstd1 -timstd1 \ timsum -timsum \ timvar -timvar \ timvar1 -timvar1 \ timyearavg -timyearavg \ timyearmean -timyearmean \ tinfo -tinfo \ topo -topo \ topvalue -topvalue \ tpnhalo -tpnhalo \ transxy -transxy \ trend -trend \ tstepcount -tstepcount \ unpack -unpack \ unsetgridmask -unsetgridmask \ usegridnumber -usegridnumber \ uv2dv -uv2dv \ uv2dv_cfd -uv2dv_cfd \ uv2dvl -uv2dvl \ uv2vr_cfd -uv2vr_cfd \ uvDestag -uvDestag \ vardes -vardes \ varquot2test -varquot2test \ varrms -varrms \ varsavg -varsavg \ varskurt -varskurt \ varsmax -varsmax \ varsmean -varsmean \ varsmedian -varsmedian \ varsmin -varsmin \ varspctl -varspctl \ varsrange -varsrange \ varsskew -varsskew \ varsstd -varsstd \ varsstd1 -varsstd1 \ varssum -varssum \ varsvar -varsvar \ varsvar1 -varsvar1 \ vct -vct \ vct2 -vct2 \ vector -vector \ verifygrid -verifygrid \ verifyweights -verifyweights \ vertavg -vertavg \ vertcum -vertcum \ vertcumhl -vertcumhl \ vertfillmiss -vertfillmiss \ vertint -vertint \ vertmax -vertmax \ vertmean -vertmean \ vertmin -vertmin \ vertrange -vertrange \ vertstd -vertstd \ vertstd1 -vertstd1 \ vertsum -vertsum \ vertvar -vertvar \ vertvar1 -vertvar1 \ vertwind -vertwind \ vinfo -vinfo \ vlist -vlist \ wct -wct \ writegrid -writegrid \ writerandom -writerandom \ writeremapscrip -writeremapscrip \ xsinfo -xsinfo \ xsinfoc -xsinfoc \ xsinfon -xsinfon \ xsinfop -xsinfop \ ydayadd -ydayadd \ ydayavg -ydayavg \ ydaydiv -ydaydiv \ ydaymax -ydaymax \ ydaymean -ydaymean \ ydaymin -ydaymin \ ydaymul -ydaymul \ ydaypctl -ydaypctl \ ydayrange -ydayrange \ ydaystd -ydaystd \ ydaystd1 -ydaystd1 \ ydaysub -ydaysub \ ydaysum -ydaysum \ ydayvar -ydayvar \ ydayvar1 -ydayvar1 \ ydrunavg -ydrunavg \ ydrunmax -ydrunmax \ ydrunmean -ydrunmean \ ydrunmin -ydrunmin \ ydrunpctl -ydrunpctl \ ydrunstd -ydrunstd \ ydrunstd1 -ydrunstd1 \ ydrunsum -ydrunsum \ ydrunvar -ydrunvar \ ydrunvar1 -ydrunvar1 \ yearadd -yearadd \ yearavg -yearavg \ yearcount -yearcount \ yeardiv -yeardiv \ yearmax -yearmax \ yearmaxidx -yearmaxidx \ yearmean -yearmean \ yearmin -yearmin \ yearminidx -yearminidx \ yearmonavg -yearmonavg \ yearmonmean -yearmonmean \ yearmul -yearmul \ yearpctl -yearpctl \ yearrange -yearrange \ yearstd -yearstd \ yearstd1 -yearstd1 \ yearsub -yearsub \ yearsum -yearsum \ yearvar -yearvar \ yearvar1 -yearvar1 \ yhouradd -yhouradd \ yhouravg -yhouravg \ yhourdiv -yhourdiv \ yhourmax -yhourmax \ yhourmean -yhourmean \ yhourmin -yhourmin \ yhourmul -yhourmul \ yhourrange -yhourrange \ yhourstd -yhourstd \ yhourstd1 -yhourstd1 \ yhoursub -yhoursub \ yhoursum -yhoursum \ yhourvar -yhourvar \ yhourvar1 -yhourvar1 \ ymonadd -ymonadd \ ymonavg -ymonavg \ ymondiv -ymondiv \ ymoneq -ymoneq \ ymonge -ymonge \ ymongt -ymongt \ ymonle -ymonle \ ymonlt -ymonlt \ ymonmax -ymonmax \ ymonmean -ymonmean \ ymonmin -ymonmin \ ymonmul -ymonmul \ ymonne -ymonne \ ymonpctl -ymonpctl \ ymonrange -ymonrange \ ymonstd -ymonstd \ ymonstd1 -ymonstd1 \ ymonsub -ymonsub \ ymonsum -ymonsum \ ymonvar -ymonvar \ ymonvar1 -ymonvar1 \ yseasadd -yseasadd \ yseasavg -yseasavg \ yseasdiv -yseasdiv \ yseaseq -yseaseq \ yseasge -yseasge \ yseasgt -yseasgt \ yseasle -yseasle \ yseaslt -yseaslt \ yseasmax -yseasmax \ yseasmean -yseasmean \ yseasmin -yseasmin \ yseasmul -yseasmul \ yseasne -yseasne \ yseaspctl -yseaspctl \ yseasrange -yseasrange \ yseasstd -yseasstd \ yseasstd1 -yseasstd1 \ yseassub -yseassub \ yseassum -yseassum \ yseasvar -yseasvar \ yseasvar1 -yseasvar1 \ zaxisdes -zaxisdes \ zonavg -zonavg \ zonint -zonint \ zonkurt -zonkurt \ zonmax -zonmax \ zonmean -zonmean \ zonmedian -zonmedian \ zonmin -zonmin \ zonpctl -zonpctl \ zonrange -zonrange \ zonskew -zonskew \ zonstd -zonstd \ zonstd1 -zonstd1 \ zonsum -zonsum \ zonvar -zonvar \ zonvar1 -zonvar1 \ zs2zl -zs2zl \ zs2zlx -zs2zlx \ zsdepth -zsdepth \ " -f cdo cdo-2.6.6.1/contrib/cdoCompletion.tcsh0000664000175000017500000002567115271332515017756 0ustar alastairalastairset cdoCmpl = (\ -apply \ -argument_groups \ -attribs \ -chunksize \ -chunkspec \ -cmor \ -config \ -copy_chunkspec \ -disable_file_suffix \ -disable_history \ -double \ -download_path \ -eccodes \ -enableexcept \ -envvars \ -fast \ -file_suffix \ -force \ -gridsearchradius \ -history \ -history_info \ -icon_grids \ -ignore_time_bounds \ -module_info \ -netcdf_hdr_pad \ -no_history \ -no_remap_weights \ -nofile \ -nsb \ -operators \ -operators_no_output \ -pedantic \ -percentile \ -precision \ -print_filename \ -query \ -reduce_dim \ -reduce_dims \ -remap_weights \ -remove_chunkspec \ -reset_history \ -rusage \ -seed \ -settings \ -shuffle \ -single \ -sortparam \ -test \ -timestat_date \ -use_fftw \ -use_time_bounds \ -version_info \ -worker \ A, \ C, \ D, \ F, \ M, \ O, \ P, \ Q, \ R, \ S, \ T, \ V, \ a, \ b, \ c, \ d, \ f, \ g, \ h, \ i, \ k, \ l, \ m, \ p, \ r, \ s, \ t, \ u, \ v, \ w, \ z, \ abs \ acos \ add \ addc \ addtrend \ adipot \ adisit \ aexpr \ aexprf \ after \ afterburner \ air_density \ anomaly \ ap2hl \ ap2hlx \ ap2pl \ ap2plx \ arg \ asin \ atan \ atan2 \ bandpass \ bitrounding \ bottomvalue \ boxavg \ cat \ cdiread \ cdiwrite \ changemulti \ chcode \ chlevel \ chlevelc \ chlevelv \ chltype \ chname \ chparam \ chtabnum \ chunit \ chvar \ cinfo \ clone \ cloudlayer \ cmor \ cmorlite \ codetab \ collgrid \ complextopol \ complextorect \ conj \ consecsum \ consects \ const \ contour \ conv_cmor_table \ copy \ cos \ coshill \ dayadd \ dayavg \ daycount \ daydiv \ daymax \ daymean \ daymin \ daymul \ daypctl \ dayrange \ daystd \ daystd1 \ daysub \ daysum \ dayvar \ dayvar1 \ dcw \ del29feb \ delattribute \ delcode \ delday \ delete \ delgridcell \ delmulti \ delname \ delparam \ delta_pressure \ deltat \ delvar \ detrend \ dhouravg \ dhourmax \ dhourmean \ dhourmin \ dhourrange \ dhourstd \ dhourstd1 \ dhoursum \ dhourvar \ dhourvar1 \ diff \ diffc \ diffn \ diffp \ difftest \ diffv \ distgrid \ div \ divc \ divcoslat \ divdpm \ divdpy \ dminuteavg \ dminutemax \ dminutemean \ dminutemin \ dminuterange \ dminutestd \ dminutestd1 \ dminutesum \ dminutevar \ dminutevar1 \ dump_cmor_table \ dumpmap \ duplicate \ dv2ps \ dv2uv \ dv2uvl \ eca_cdd \ eca_cfd \ eca_csu \ eca_cwd \ eca_cwdi \ eca_cwfi \ eca_etr \ eca_fd \ eca_gsl \ eca_hd \ eca_hwdi \ eca_hwfi \ eca_id \ eca_pd \ eca_r10mm \ eca_r1mm \ eca_r20mm \ eca_r75p \ eca_r75ptot \ eca_r90p \ eca_r90ptot \ eca_r95p \ eca_r95ptot \ eca_r99p \ eca_r99ptot \ eca_rr1 \ eca_rx1day \ eca_rx5day \ eca_sdii \ eca_su \ eca_tg10p \ eca_tg90p \ eca_tn10p \ eca_tn90p \ eca_tr \ eca_tx10p \ eca_tx90p \ enlarge \ ensavg \ ensbrs \ enscrps \ enskurt \ ensmax \ ensmean \ ensmedian \ ensmin \ enspctl \ ensrange \ ensrkhistspace \ ensrkhisttime \ ensroc \ ensskew \ ensstd \ ensstd1 \ enssum \ ensvar \ ensvar1 \ eof \ eof3d \ eof3dspatial \ eof3dtime \ eofcoeff \ eofcoeff3d \ eofspatial \ eoftime \ eq \ eqc \ etccdi \ etccdi_cdd \ etccdi_csdi \ etccdi_cwd \ etccdi_fd \ etccdi_gsl \ etccdi_hd \ etccdi_id \ etccdi_r10mm \ etccdi_r1mm \ etccdi_r20mm \ etccdi_r95p \ etccdi_r99p \ etccdi_rx1day \ etccdi_rx1daymon \ etccdi_rx5day \ etccdi_rx5daymon \ etccdi_sdii \ etccdi_su \ etccdi_tn10p \ etccdi_tn90p \ etccdi_tr \ etccdi_tx10p \ etccdi_tx90p \ etccdi_wsdi \ exp \ export_e5ml \ expr \ exprf \ fc2gp \ fc2sp \ fdns \ filedes \ fillmiss \ fillmiss2 \ fldavg \ fldcor \ fldcount \ fldcovar \ fldint \ fldkurt \ fldmax \ fldmean \ fldmedian \ fldmin \ fldpctl \ fldrange \ fldrms \ fldskew \ fldstd \ fldstd1 \ fldsum \ fldvar \ fldvar1 \ for \ fourier \ fourier2grid \ ge \ gec \ genbic \ genbil \ gencon \ gendis \ gengrid \ genknn \ genlaf \ genlevelbounds \ gennn \ genycon \ genycon2test \ gh2hl \ gh2hlx \ gheight \ gheight_full \ gheight_half \ gheighthalf \ globavg \ gmtcells \ gmtxyz \ gp2fc \ gp2sp \ gp2spl \ gradsdes \ graph \ grfill \ grid2fourier \ gridarea \ gridboxavg \ gridboxkurt \ gridboxmax \ gridboxmean \ gridboxmedian \ gridboxmin \ gridboxrange \ gridboxskew \ gridboxstd \ gridboxstd1 \ gridboxsum \ gridboxvar \ gridboxvar1 \ gridcellidx \ gridcellindex \ griddes \ griddes2 \ griddx \ griddy \ gridmask \ gridweights \ gt \ gtc \ harmonic \ highpass \ histcount \ histfreq \ histmean \ histsum \ houravg \ hourcount \ hourmax \ hourmean \ hourmin \ hourpctl \ hourrange \ hourstd \ hourstd1 \ hoursum \ hourvar \ hourvar1 \ hpdegrade \ hpupgrade \ hurr \ ifnotthen \ ifnotthenc \ ifthen \ ifthenc \ ifthenelse \ im \ import_binary \ import_cmsaf \ import_e5ml \ import_fv3grid \ import_grads \ import_obs \ imtocomplex \ info \ infoc \ infon \ infop \ infov \ input \ inputext \ inputsrv \ int \ intgridbil \ intgriddis \ intgridknn \ intgridnn \ intgridtraj \ intlevel \ intlevel3d \ intlevelx \ intlevelx3d \ intntime \ inttime \ intyear \ invertlat \ invertlatdata \ invertlatdes \ invertlev \ invertlon \ invertlondata \ invertlondes \ isosurface \ le \ lec \ lic \ linfo \ ln \ log \ log10 \ lowpass \ lt \ ltc \ map \ mask \ maskcircle \ maskindexbox \ masklonlatbox \ maskregion \ mastrfu \ max \ maxc \ meandiff2test \ meravg \ merge \ mergegrid \ mergetime \ merkurt \ mermax \ mermean \ mermedian \ mermin \ merpctl \ merrange \ merskew \ merstd \ merstd1 \ mersum \ mervar \ mervar1 \ min \ minc \ ml2hl \ ml2hlx \ ml2pl \ ml2plx \ mod \ monadd \ monavg \ moncount \ mondiv \ monmax \ monmean \ monmin \ monmul \ monpctl \ monrange \ monstd \ monstd1 \ monsub \ monsum \ monvar \ monvar1 \ mrotuv \ mrotuvb \ mul \ mulc \ mulcoslat \ muldoy \ muldpm \ muldpy \ ncode \ ncopy \ ndate \ ne \ nec \ ngridpoints \ ngrids \ nint \ nlevel \ nmon \ nop \ not \ npar \ ntime \ nvar \ nyear \ output \ outputarr \ outputbounds \ outputboundscpt \ outputcenter \ outputcenter2 \ outputcentercpt \ outputext \ outputf \ outputfld \ outputint \ outputkey \ outputkml \ outputsrv \ outputtab \ outputtri \ outputts \ outputvector \ outputvrml \ outputxyz \ pack \ pardup \ parmul \ partab \ partab2 \ pinfo \ pinfov \ pow \ pressure \ pressure_full \ pressure_half \ projuvLatLon \ query \ rand \ random \ re \ reci \ recttocomplex \ reducegrid \ regres \ remap \ remapavg \ remapavgtest \ remapbic \ remapbil \ remapcon \ remapdis \ remapeta \ remapeta_s \ remapeta_z \ remapknn \ remapkurt \ remaplaf \ remapmax \ remapmean \ remapmedian \ remapmin \ remapnn \ remaprange \ remapskew \ remapstd \ remapstd1 \ remapsum \ remapvar \ remapvar1 \ remapycon \ remapycon2test \ replace \ retocomplex \ rhopot \ rotuvN \ rotuvNorth \ rotuvb \ runavg \ runmax \ runmean \ runmin \ runpctl \ runrange \ runstd \ runstd1 \ runsum \ runvar \ runvar1 \ samplegrid \ samplegridicon \ sealevelpressure \ seasavg \ seascount \ seasmax \ seasmean \ seasmin \ seasmonavg \ seasmonmean \ seaspctl \ seasrange \ seasstd \ seasstd1 \ seassum \ seasvar \ seasvar1 \ seinfo \ seinfoc \ seinfon \ seinfop \ selcircle \ selcode \ seldate \ selday \ select \ selgrid \ selgridcell \ selgridname \ selhour \ selindexbox \ sellevel \ sellevidx \ sellonlatbox \ selltype \ selmon \ selmonth \ selmulti \ selname \ seloperator \ selparam \ selrec \ selregion \ selseas \ selseason \ selsmon \ selstdname \ selstep \ seltabnum \ seltime \ seltimeidx \ seltimestep \ selvar \ selyear \ selyearidx \ selzaxis \ selzaxisname \ seq \ setattribute \ setcalendar \ setchunkspec \ setcindexbox \ setclonlatbox \ setcode \ setcodetab \ setctomiss \ setdate \ setday \ setfilter \ setgrid \ setgridarea \ setgridcell \ setgridmask \ setgridnumber \ setgridtype \ setgriduri \ sethalo \ setlevel \ setltype \ setmaxsteps \ setmiss \ setmisstoc \ setmisstodis \ setmisstonn \ setmissval \ setmon \ setname \ setparam \ setpartab \ setpartabc \ setpartabn \ setpartabp \ setpartabv \ setprojparams \ setrcaname \ setreftime \ setrtoc \ setrtoc2 \ setrtomiss \ setstdname \ settabnum \ settaxis \ settbounds \ settime \ settunits \ setunit \ setvals \ setvar \ setvrange \ setyear \ setzaxis \ shaded \ shifttime \ shiftx \ shifty \ showattribute \ showattsvar \ showchunkspec \ showcode \ showdate \ showfilter \ showformat \ showgrid \ showhistory \ showlevel \ showltype \ showmon \ showname \ showparam \ showstdname \ showtime \ showtimestamp \ showunit \ showvar \ showyear \ sin \ sincos \ sinfo \ sinfoc \ sinfon \ sinfop \ sinfov \ smooth \ smooth9 \ sortcode \ sortlevel \ sortname \ sortparam \ sorttaxis \ sorttimestamp \ sortvar \ sp2fc \ sp2gp \ sp2gpl \ sp2sp \ spartab \ spcut \ specinfo \ spectrum \ splitcode \ splitdate \ splitdatetime \ splitday \ splitensemble \ splitgrid \ splithour \ splitlevel \ splitmon \ splitname \ splitparam \ splitrec \ splitseas \ splitsel \ splittabnum \ splitvar \ splityear \ splityearmon \ splitzaxis \ sqr \ sqrt \ stdatm \ strbre \ stream \ strgal \ strwin \ sub \ subc \ subgrid \ subtrend \ symmetrize \ szip \ tan \ tee \ temp \ testcellsearch \ testfield \ testpointsearch \ thinout \ timavg \ timcor \ timcount \ timcovar \ timcumsum \ timederivative \ timfillmiss \ timmax \ timmaxidx \ timmean \ timmin \ timminidx \ timpctl \ timrange \ timrmsd \ timselavg \ timselmax \ timselmean \ timselmin \ timselpctl \ timselrange \ timselstd \ timselstd1 \ timselsum \ timselvar \ timselvar1 \ timsort \ timstd \ timstd1 \ timsum \ timvar \ timvar1 \ timyearavg \ timyearmean \ tinfo \ topo \ topvalue \ tpnhalo \ transxy \ trend \ tstepcount \ unpack \ unsetgridmask \ usegridnumber \ uv2dv \ uv2dv_cfd \ uv2dvl \ uv2vr_cfd \ uvDestag \ vardes \ varquot2test \ varrms \ varsavg \ varskurt \ varsmax \ varsmean \ varsmedian \ varsmin \ varspctl \ varsrange \ varsskew \ varsstd \ varsstd1 \ varssum \ varsvar \ varsvar1 \ vct \ vct2 \ vector \ verifygrid \ verifyweights \ vertavg \ vertcum \ vertcumhl \ vertfillmiss \ vertint \ vertmax \ vertmean \ vertmin \ vertrange \ vertstd \ vertstd1 \ vertsum \ vertvar \ vertvar1 \ vertwind \ vinfo \ vlist \ wct \ writegrid \ writerandom \ writeremapscrip \ xsinfo \ xsinfoc \ xsinfon \ xsinfop \ ydayadd \ ydayavg \ ydaydiv \ ydaymax \ ydaymean \ ydaymin \ ydaymul \ ydaypctl \ ydayrange \ ydaystd \ ydaystd1 \ ydaysub \ ydaysum \ ydayvar \ ydayvar1 \ ydrunavg \ ydrunmax \ ydrunmean \ ydrunmin \ ydrunpctl \ ydrunstd \ ydrunstd1 \ ydrunsum \ ydrunvar \ ydrunvar1 \ yearadd \ yearavg \ yearcount \ yeardiv \ yearmax \ yearmaxidx \ yearmean \ yearmin \ yearminidx \ yearmonavg \ yearmonmean \ yearmul \ yearpctl \ yearrange \ yearstd \ yearstd1 \ yearsub \ yearsum \ yearvar \ yearvar1 \ yhouradd \ yhouravg \ yhourdiv \ yhourmax \ yhourmean \ yhourmin \ yhourmul \ yhourrange \ yhourstd \ yhourstd1 \ yhoursub \ yhoursum \ yhourvar \ yhourvar1 \ ymonadd \ ymonavg \ ymondiv \ ymoneq \ ymonge \ ymongt \ ymonle \ ymonlt \ ymonmax \ ymonmean \ ymonmin \ ymonmul \ ymonne \ ymonpctl \ ymonrange \ ymonstd \ ymonstd1 \ ymonsub \ ymonsum \ ymonvar \ ymonvar1 \ yseasadd \ yseasavg \ yseasdiv \ yseaseq \ yseasge \ yseasgt \ yseasle \ yseaslt \ yseasmax \ yseasmean \ yseasmin \ yseasmul \ yseasne \ yseaspctl \ yseasrange \ yseasstd \ yseasstd1 \ yseassub \ yseassum \ yseasvar \ yseasvar1 \ zaxisdes \ zonavg \ zonint \ zonkurt \ zonmax \ zonmean \ zonmedian \ zonmin \ zonpctl \ zonrange \ zonskew \ zonstd \ zonstd1 \ zonsum \ zonvar \ zonvar1 \ zs2zl \ zs2zlx \ zsdepth \ ); complete cdo 'c/-/$cdoCmpl/' 'n/*/f/' cdo-2.6.6.1/contrib/Makefile.in0000664000175000017500000003724515271332515016341 0ustar alastairalastair# Makefile.in generated by automake 1.18.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2025 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@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) am__rm_f = rm -f $(am__rm_f_notfound) am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 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@ @MAINTAINER_MODE_TRUE@am__append_1 = $(DISTCLEANFILES) subdir = contrib ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/libcdi/m4/acx_c_package.m4 \ $(top_srcdir)/libcdi/m4/acx_lang_check_include.m4 \ $(top_srcdir)/libcdi/m4/acx_lang_package.m4 \ $(top_srcdir)/libcdi/m4/acx_m4_list_to_quoted_strings.m4 \ $(top_srcdir)/libcdi/m4/acx_option_search_libs.m4 \ $(top_srcdir)/libcdi/m4/acx_options.m4 \ $(top_srcdir)/libcdi/m4/acx_uuid.m4 \ $(top_srcdir)/libcdi/m4/asx_tr_arg.m4 \ $(top_srcdir)/m4/acx_cfortran_flags.m4 \ $(top_srcdir)/m4/acx_check_cfortran.m4 \ $(top_srcdir)/m4/acx_options.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_subdirs_configure.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/libcdi/m4/acx_lang_c_check_include.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CPPFLAGS = @AM_CPPFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH = @BASH@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CLDFLAGS = @CLDFLAGS@ CLIBS = @CLIBS@ CMOR_LIBS = @CMOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CURL_INCLUDE = @CURL_INCLUDE@ CURL_LDFLAGS = @CURL_LDFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DCE_UUIDROOT = @DCE_UUIDROOT@ DCE_UUID_C_INCLUDE = @DCE_UUID_C_INCLUDE@ DCE_UUID_C_LIB = @DCE_UUID_C_LIB@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECCODES_INCLUDE = @ECCODES_INCLUDE@ ECCODES_LIBS = @ECCODES_LIBS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_ACROSS = @ENABLE_ACROSS@ ENABLE_CDI_LIB = @ENABLE_CDI_LIB@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ ENABLE_EXTRA = @ENABLE_EXTRA@ ENABLE_FORTRAN = @ENABLE_FORTRAN@ ENABLE_GRIB = @ENABLE_GRIB@ ENABLE_GRIBAPI = @ENABLE_GRIBAPI@ ENABLE_IEG = @ENABLE_IEG@ ENABLE_NETCDF = @ENABLE_NETCDF@ ENABLE_SERVICE = @ENABLE_SERVICE@ ENABLE_THREADS = @ENABLE_THREADS@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ FILECMD = @FILECMD@ FORTRAN_WORKS = @FORTRAN_WORKS@ GREP = @GREP@ HAVE_CXX20 = @HAVE_CXX20@ HDF5_INCLUDE = @HDF5_INCLUDE@ HDF5_LIBS = @HDF5_LIBS@ HDF5_ROOT = @HDF5_ROOT@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAGICS_INCLUDE = @MAGICS_INCLUDE@ MAGICS_LIBS = @MAGICS_LIBS@ MAGICS_ROOT = @MAGICS_ROOT@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETCDF_INCLUDE = @NETCDF_INCLUDE@ NETCDF_LIBS = @NETCDF_LIBS@ NETCDF_ROOT = @NETCDF_ROOT@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OSSP_UUIDROOT = @OSSP_UUIDROOT@ OSSP_UUID_C_INCLUDE = @OSSP_UUID_C_INCLUDE@ OSSP_UUID_C_LIB = @OSSP_UUID_C_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PROJ_INCLUDE = @PROJ_INCLUDE@ PROJ_LDFLAGS = @PROJ_LDFLAGS@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SYSTEM_TYPE = @SYSTEM_TYPE@ SZLIB_INCLUDE = @SZLIB_INCLUDE@ SZLIB_LIBS = @SZLIB_LIBS@ THREADS_INCLUDE = @THREADS_INCLUDE@ THREADS_LIBS = @THREADS_LIBS@ UDUNITS_INCLUDE = @UDUNITS_INCLUDE@ UDUNITS_LDFLAGS = @UDUNITS_LDFLAGS@ UTIL_LINUX_UUIDROOT = @UTIL_LINUX_UUIDROOT@ UTIL_LINUX_UUID_C_INCLUDE = @UTIL_LINUX_UUID_C_INCLUDE@ UTIL_LINUX_UUID_C_LIB = @UTIL_LINUX_UUID_C_LIB@ UUID_C_INCLUDE = @UUID_C_INCLUDE@ UUID_C_LIB = @UUID_C_LIB@ VERSION = @VERSION@ XML2_LIBS = @XML2_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ am__xargs_n = @am__xargs_n@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ 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@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ subdirs_extra = @subdirs_extra@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = makecompl.rb cdoCompletion.bash cdoCompletion.tcsh cdoCompletion.zsh CLEANFILES = $(am__append_1) DISTCLEANFILES = `ls cdoCompletion.*` all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign contrib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign contrib/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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am @MAINTAINER_MODE_FALSE@all-local: all-am: Makefile all-local installdirs: 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -$(am__rm_f) $(CLEANFILES) distclean-generic: -$(am__rm_f) $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES) -$(am__rm_f) $(DISTCLEANFILES) 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-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am all-local check check-am clean clean-generic \ clean-libtool cscopelist-am ctags-am distclean \ distclean-generic distclean-libtool distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ uninstall-am .PRECIOUS: Makefile completions: if hash ruby >/dev/null 2>&1 ; then \ ruby -KN $(srcdir)/makecompl.rb -o cdoCompletion; \ fi cdoCompletion.bash cdoCompletion.zsh cdoCompletion.tcsh: completions test: if hash ruby >/dev/null 2>&1 ; then \ cd ruby;ruby test/test_cdo.rb \ fi if hash python >/dev/null 2>&1 ; then \ cd python; python test/test_cdo.py \ fi @MAINTAINER_MODE_TRUE@all-local: completions # 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: # Tell GNU make to disable its built-in pattern rules. %:: %,v %:: RCS/%,v %:: RCS/% %:: s.% %:: SCCS/s.% cdo-2.6.6.1/contrib/Makefile.am0000664000175000017500000000107415271332515016317 0ustar alastairalastairEXTRA_DIST = makecompl.rb cdoCompletion.bash cdoCompletion.tcsh cdoCompletion.zsh CLEANFILES = DISTCLEANFILES = `ls cdoCompletion.*` completions: if hash ruby >/dev/null 2>&1 ; then \ ruby -KN $(srcdir)/makecompl.rb -o cdoCompletion; \ fi cdoCompletion.bash cdoCompletion.zsh cdoCompletion.tcsh: completions test: if hash ruby >/dev/null 2>&1 ; then \ cd ruby;ruby test/test_cdo.rb \ fi if hash python >/dev/null 2>&1 ; then \ cd python; python test/test_cdo.py \ fi if MAINTAINER_MODE all-local: completions CLEANFILES += $(DISTCLEANFILES) endif cdo-2.6.6.1/libcdi/0000775000175000017500000000000015271332515014047 5ustar alastairalastaircdo-2.6.6.1/libcdi/README0000664000175000017500000000475215271332515014737 0ustar alastairalastair CDI - Climate Data Interface ---------------------------- This package contains the source code for the CDI library from the Max-Planck-Institute for Meteorology. CDI is a C and Fortran Interface to access Climate model Data. Supported data formats are GRIB, netCDF, SERVICE, EXTRA and IEG. See the AUTHORS file for the list of authors. CDI is licensed under the 3-clause BSD License. This License covers all files in the CDI repository unless stated otherwise. Read the file LICENSE in the source distribution for details. MPI-M makes no representations or warranties of any kind concerning the Software and any results (including but not limited to any data) generated by use of the Software (hereinafter "Results"), express or implied, and the absence of any legal or actual defects, whether discoverable or not. The use of the Software and the Results is at your own risk. Specifically, and not to limit the foregoing, MPI-M makes no representations or warranties (i) regarding the fitness for a particular purpose of the Software and the Results, (ii) that the use of the Software and the Results will not infringe any patents or other intellectual property rights of any third party, and (iii) that the use of the Software and the Results will not cause any damages of any kind to you or to any third party. Documentation: CDI C Manual: ./doc/cdi_cman.pdf CDI Fortran Manual: ./doc/cdi_fman.pdf Installation: 1. Run ./configure, with some options if you wish. The standard options are documented in the INSTALL file. The configuration script has some more options; type 'configure -h' to see them. The most interesting ones are the usual --prefix= and --with-netcdf= to enable netCDF support. 2. Do "make" to compile the library. 3. (Optional) Do "make install", possibly as root if the destination permissions require that. This installs CDI in the directory specified during configuration. The default prefix is /usr/local. Porting: This library was designed for maximum portability. It is written entirely in ANSI C99, and will compile on most UNIX platforms. The FORTRAN 77 interface is using the cfortran.h macros from http://www-zeus.desy.de/~burow/cfortran/ Contact: Send questions, comments and bug reports to cdo-2.6.6.1/libcdi/INSTALL0000664000175000017500000002202415271332515015100 0ustar alastairalastairCopyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 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' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' 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 `--target=TYPE' option 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 will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `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. cdo-2.6.6.1/libcdi/tests/0000775000175000017500000000000015271332515015211 5ustar alastairalastaircdo-2.6.6.1/libcdi/tests/pio_write_setup_grid.c0000664000175000017500000001443615271332515021613 0ustar alastairalastair#if defined(HAVE_CONFIG_H) #include "config.h" #endif #include #include #ifdef USE_MPI #include #include #include "error.h" #include "pio_util.h" #endif #include "dmemory.h" #if defined USE_MPI && defined HAVE_PPM_CORE #include #include #endif #include "cdi.h" #ifdef USE_MPI #include "cdipio.h" #endif #include "pio_write_setup_grid.h" #include "cdi_uuid.h" #include "simple_model_helper.h" #if USE_MPI void findPartition2D(int npart[2], int num_parts) { const uint64_t rscale = 256; uint32_t *factors = NULL; xassert(num_parts > 0); int numFactors = PPM_prime_factorization_32((uint32_t) num_parts, &factors); /* try to distribute prime factors on dimensions to get * approx. 2 times as many parts in x dim than y dim */ const uint64_t optimumRatio = rscale * 2; npart[0] = num_parts, npart[1] = 1; uint_fast32_t npart_attempt[2]; uint64_t bestRatio = (uint64_t) num_parts * rscale, bestDiff = (uint64_t) llabs((long long) (bestRatio - optimumRatio)); /* test all assignments of factors to dimensions, starting with * only one assigned to x dim (omitting 0 because that would * always give npart[1] > npart[0] */ for (int assign2X = 1; assign2X <= numFactors; ++assign2X) { uint_fast32_t pattern = (UINT32_C(1) << assign2X) - 1, lastPattern = pattern << (numFactors - assign2X); do { npart_attempt[0] = 1; npart_attempt[1] = 1; /* loop over all factors */ for (uint_fast32_t i = 0; i < (uint_fast32_t) numFactors; ++i) { uint_fast32_t dim_idx = (pattern >> i) & 1; npart_attempt[dim_idx] *= factors[i]; } uint64_t ratio = ((uint64_t) npart_attempt[0] * rscale) / (uint64_t) npart_attempt[1]; uint64_t diff = (uint64_t) llabs((long long) (ratio - optimumRatio)); if (diff < bestDiff) { npart[0] = (int) npart_attempt[0]; npart[1] = (int) npart_attempt[1]; bestDiff = diff; bestRatio = ratio; } { uint_fast32_t t; #if HAVE_DECL___BUILTIN_CTZ t = pattern | (pattern - 1); pattern = (t + 1) | (((~t & -~t) - 1) >> (__builtin_ctz((unsigned) pattern) + 1)); #else t = (pattern | (pattern - 1)) + 1; pattern = t | ((((t & -t) / (pattern & -pattern)) >> 1) - 1); #endif } } while (pattern <= lastPattern); } Free(factors); } #endif int setupGrid(const struct model_config *setup, MPI_Comm comm) { int nlon = setup->nlon, nlat = setup->nlat; int gridID; int rank = 0; #if USE_MPI xmpi(MPI_Comm_rank(comm, &rank)); #else (void) comm; #endif if (setup->flags & PIO_WRITE_CONFIG_USE_DIST_GRID_FLAG) { #if USE_MPI if (setup->flags & PIO_WRITE_CONFIG_CREATE_CURVILINEAR_GRID_FLAG) { size_t gridsize = (size_t) nlon * (size_t) nlat; Xt_int grid_global_shape[2] = { (Xt_int) nlat, (Xt_int) nlon }, grid_local_chunk_start[2]; int nprocs; xmpi(MPI_Comm_size(comm, &nprocs)); int nprocs2D[2], grid_local_chunk_shape[2]; findPartition2D(nprocs2D, nprocs); { struct PPM_extent set_interval_y = { 0, nlat }, part_interval_y = PPM_uniform_partition(set_interval_y, nprocs2D[1], rank / nprocs2D[0]); grid_local_chunk_shape[0] = part_interval_y.size; grid_local_chunk_start[0] = part_interval_y.first; } { struct PPM_extent set_interval_x = { 0, nlon }, part_interval_x = PPM_uniform_partition(set_interval_x, nprocs2D[0], rank % nprocs2D[0]); grid_local_chunk_shape[1] = part_interval_x.size; grid_local_chunk_start[1] = part_interval_x.first; } { Xt_idxlist partDesc2D = xt_idxsection_new((Xt_int) 0, 2, grid_global_shape, grid_local_chunk_shape, grid_local_chunk_start); const int gridDecoChunks[2][2] = { [0] = { [0] = (int)grid_local_chunk_start[0], [1] = (int)grid_local_chunk_shape[0], }, [1] = { [0] = (int)grid_local_chunk_start[1], [1] = (int)grid_local_chunk_shape[1], } }; gridID = cdiPioDistGridCreate(GRID_CURVILINEAR, (int) gridsize, nlon, nlat, 0, gridDecoChunks, partDesc2D, NULL, NULL); xt_idxlist_delete(partDesc2D); } size_t grid_chunk_size = (size_t) grid_local_chunk_shape[0] * (size_t) grid_local_chunk_shape[1]; { double *grid_chunk = (double *) Malloc(2 * grid_chunk_size * sizeof(*grid_chunk)); /* anti-clockwise coordinates around Amazonia */ static const struct cart_coord region[4] = { { .lon = DEG2RAD(-85.0), .lat = DEG2RAD(-25.0) }, { .lon = DEG2RAD(-44.0), .lat = DEG2RAD(-18.0) }, { .lon = DEG2RAD(-50.0), .lat = DEG2RAD(7.0) }, { .lon = DEG2RAD(-80.0), .lat = DEG2RAD(10.0) } }; const size_t xyRange[2][2] = { { (size_t) grid_local_chunk_start[1], (size_t) grid_local_chunk_start[0] }, { (size_t) grid_local_chunk_shape[1], (size_t) grid_local_chunk_shape[0] } }; computeCurvilinearChunk(grid_chunk, region, (size_t) nlon, (size_t) nlat, xyRange); gridDefXvals(gridID, grid_chunk + grid_chunk_size); gridDefYvals(gridID, grid_chunk); Free(grid_chunk); } } else { fputs("Error: distributed lat-lon grids are unsupported" " at this moment.\n", stderr); abort(); } #else fputs("Error: distributed grids are unsupported for" " non-MPI configurations.\n", stderr); abort(); #endif } else { if (setup->flags & PIO_WRITE_CONFIG_CREATE_CURVILINEAR_GRID_FLAG) gridID = createLocalCurvilinearGrid(nlon, nlat); else gridID = createGlobalLatLonGrid(nlon, nlat); } if (setup->flags & PIO_WRITE_CONFIG_CREATE_UUID_FLAG) { unsigned char uuid[CDI_UUID_SIZE]; if (rank == 0) cdiCreateUUID(uuid); #if USE_MPI MPI_Bcast(uuid, CDI_UUID_SIZE, MPI_UNSIGNED_CHAR, 0, comm); #endif gridDefUUID(gridID, uuid); } return gridID; } /* * Local Variables: * c-file-style: "Java" * c-basic-offset: 2 * indent-tabs-mode: nil * show-trailing-whitespace: t * require-trailing-newline: t * End: */ cdo-2.6.6.1/libcdi/tests/pio_write_deco2d.parallel.run.in0000664000175000017500000000017615271332515023364 0ustar alastairalastair#!@SHELL@ mpi_task_num=6 pio_write='./pio_write_deco2d.parallel' . ./pio_write.run # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/pio_cksum_asynch.run.in0000664000175000017500000000027515271332515021706 0ustar alastairalastair#!@SHELL@ pio_write_args="-p PIO_ASYNCH -w 3" #mpi_task_num=7 mpi_task_num=6 . ./pio_write.run ( . ./pio_write_dist_array.run ) || test $? -eq 77 # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/pio_cksum_mpi_fw_ordered.run.in0000664000175000017500000000021415271332515023377 0ustar alastairalastair#!@SHELL@ pio_write_args="-p PIO_MPI_FW_ORDERED -w 2" mpi_task_num=5 . ./pio_write.run ( . ./pio_write_dist_array.run ) || test $? -eq 77 cdo-2.6.6.1/libcdi/tests/pio_write.h0000664000175000017500000000204015271332515017357 0ustar alastairalastair#ifndef PIO_WRITE_H #define PIO_WRITE_H #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef USE_MPI #include #else typedef int MPI_Comm; #endif #include enum { PIO_WRITE_CONFIG_CHECKSUM_BIT = 0, PIO_WRITE_CONFIG_CREATE_UUID_BIT, PIO_WRITE_CONFIG_CREATE_CURVILINEAR_GRID_BIT, PIO_WRITE_CONFIG_USE_DIST_GRID_BIT, PIO_WRITE_CONFIG_PRESET_DECOMPOSITION_BIT, PIO_WRITE_CONFIG_CHECKSUM_FLAG = 1 << PIO_WRITE_CONFIG_CHECKSUM_BIT, PIO_WRITE_CONFIG_CREATE_UUID_FLAG = 1 << PIO_WRITE_CONFIG_CREATE_UUID_BIT, PIO_WRITE_CONFIG_CREATE_CURVILINEAR_GRID_FLAG = 1 << PIO_WRITE_CONFIG_CREATE_CURVILINEAR_GRID_BIT, PIO_WRITE_CONFIG_USE_DIST_GRID_FLAG = 1 << PIO_WRITE_CONFIG_USE_DIST_GRID_BIT, PIO_WRITE_CONFIG_PRESET_DECOMPOSITION_FLAG = 1 << PIO_WRITE_CONFIG_PRESET_DECOMPOSITION_BIT, }; struct model_config { int nlon, nlat, nts, max_nlev, nvars; int filetype, datatype; int flags; int taxistype, taxisunit; const char *suffix, *prefix; }; void modelRun(const struct model_config *setup, MPI_Comm comm); #endif cdo-2.6.6.1/libcdi/tests/test_byteswap.run.in0000664000175000017500000000020115271332515021232 0ustar alastairalastair#!@SHELL@ @top_builddir@/libtool --mode=execute ${tool_wrap} ./test_byteswap || exit 1 # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/simple_model_helper.c0000664000175000017500000002074615271332515021376 0ustar alastairalastair#if defined(HAVE_CONFIG_H) #include "config.h" #endif #include #include #include #include #include #include #if defined USE_MPI && defined HAVE_PPM_CORE #include #include #endif #include "cdi.h" #include "dmemory.h" #include "error.h" #include "simple_model_helper.h" void var_scale(int datatype, double *mscale, double *mrscale) { int mant_bits; switch (datatype) { case CDI_DATATYPE_PACK8: mant_bits = 7; break; case CDI_DATATYPE_PACK16: mant_bits = 15; break; case CDI_DATATYPE_PACK24: mant_bits = 23; break; case CDI_DATATYPE_FLT32: mant_bits = 24; break; case CDI_DATATYPE_FLT64: mant_bits = 53; break; case CDI_DATATYPE_INT8: case CDI_DATATYPE_INT16: case CDI_DATATYPE_INT32: default: fprintf(stderr, "Unexpected or unusable content format: %d\n", datatype); exit(EXIT_FAILURE); } *mscale = (double) (INT64_C(1) << mant_bits); *mrscale = 1.0 / *mscale; } /** * Compute UNIX epoch-based time_t from CDI's decimal encoding of date. */ time_t cditime2time_t(int date, int timeofday) { struct tm t_s; time_t t; t_s.tm_year = date / 10000; t_s.tm_mon = (date - t_s.tm_year * 10000) / 100; t_s.tm_mday = date % 100; t_s.tm_year -= 1900; t_s.tm_hour = timeofday / 10000; t_s.tm_min = (timeofday % 10000) / 100; t_s.tm_sec = timeofday % 100; t_s.tm_isdst = 0; t = mktime(&t_s); return t; } /** * Build decimal encoding of date from UNIX epoch-based time_t. */ void time_t2cditime(time_t t, int *date, int *timeofday) { struct tm *t_s; t_s = localtime(&t); *date = (t_s->tm_year + 1900) * 10000 + t_s->tm_mon * 100 + t_s->tm_mday; *timeofday = t_s->tm_hour * 10000 + t_s->tm_min * 100 + t_s->tm_sec; } void composeFilename(char **buf, const char *fname_prefix, int tfID, const char *suffix) { size_t fnSize = strlen(fname_prefix) + (tfID >= 0 ? 1 + sizeof(int) * 3 : 0) + 1 + strlen(suffix) + 1; char *filename = (char *) Realloc(*buf, fnSize); int plen = tfID >= 0 ? snprintf(filename, fnSize, "%s_%d.%s", fname_prefix, tfID, suffix) : snprintf(filename, fnSize, "%s.%s", fname_prefix, suffix); if ((size_t) plen >= fnSize) { fprintf(stderr, "unexpected error: printing to string of size %zu" " results in %d chars to write\n", fnSize, plen); abort(); } filename[fnSize - 1] = 0; *buf = filename; } int composeStream(char **buf, const char *fname_prefix, int tfID, const char *suffix, int filetype) { char *temp = buf ? *buf : NULL; composeFilename(&temp, fname_prefix, tfID, suffix); int streamID = streamOpenWrite(temp, filetype); if (streamID < 0) { fprintf(stderr, "Failed to open stream: %s\n", cdiStringError(streamID)); abort(); } if (!buf) free(temp); else *buf = temp; return streamID; } int createGlobalLatLonGrid(int nlon, int nlat) { int gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); size_t maxAxisSize = (size_t) (nlon > nlat ? nlon : nlat); double *restrict coords = (double *) Malloc(maxAxisSize * sizeof(coords[0])); { double step = 360.0 / (double) nlon, ofs = step * 0.5; for (size_t i = 0; i < (size_t) nlon; ++i) coords[i] = (double) i * step + ofs; gridDefXvals(gridID, coords); } { double step = 180.0 / (double) nlat, ofs = step * 0.5; for (size_t i = 0; i < (size_t) nlat; ++i) coords[i] = (double) i * step - 90.0 + ofs; gridDefYvals(gridID, coords); } Free(coords); return gridID; } int createLocalCurvilinearGrid(int sizex, int sizey) { size_t gridsize = (size_t) sizex * (size_t) sizey; int gridID = gridCreate(GRID_CURVILINEAR, (int) gridsize); gridDefXsize(gridID, sizex); gridDefYsize(gridID, sizey); { /* anti-clockwise coordinates around Amazonia */ static const struct cart_coord region[4] = { { .lon = DEG2RAD(-85.0), .lat = DEG2RAD(-25.0) }, { .lon = DEG2RAD(-44.0), .lat = DEG2RAD(-18.0) }, { .lon = DEG2RAD(-50.0), .lat = DEG2RAD(7.0) }, { .lon = DEG2RAD(-80.0), .lat = DEG2RAD(10.0) } }; double(*gridCoords)[sizey][sizex] = (double(*)[sizey][sizex]) Malloc(sizeof(*gridCoords) * gridsize * 2); { const size_t xyRange[2][2] = { { 0, 0 }, { (size_t) sizex, (size_t) sizey } }; computeCurvilinearChunk((double *) gridCoords, region, (size_t) sizex, (size_t) sizey, xyRange); } gridDefXvals(gridID, (double *) (gridCoords[1])); gridDefYvals(gridID, (double *) (gridCoords[0])); Free(gridCoords); } return gridID; } static inline double cartDistance(struct cart_coord p1, struct cart_coord p2) { double d_lat = sin((p1.lat - p2.lat) / 2.0), d_lon = sin((p1.lon - p2.lon) / 2.0), d = 2.0 * asin(sqrt(d_lat * d_lat + cos(p1.lat) * cos(p2.lat) * (d_lon * d_lon))); return d; } static inline struct cart_coord intermediateCoord(struct cart_coord p1, struct cart_coord p2, double f) { double d = cartDistance(p1, p2), sine_of_d = sin(d), A = sin((1 - f) * d) / sine_of_d, B = sin(f * d) / sine_of_d, x = A * cos(p1.lat) * cos(p1.lon) + B * cos(p2.lat) * cos(p2.lon), y = A * cos(p1.lat) * sin(p1.lon) + B * cos(p2.lat) * sin(p2.lon), z = A * sin(p1.lat) + B * sin(p2.lat); struct cart_coord ic = { .lon = atan2(y, x), .lat = atan2(z, sqrt(x * x + y * y)) }; return ic; } void computeCurvilinearChunk(double *coords_, const struct cart_coord a[4], size_t sizex, size_t sizey, const size_t xyRange[2][2]) { size_t startx = xyRange[0][0], starty = xyRange[0][1], chunkSizeX = xyRange[1][0], chunkSizeY = xyRange[1][1], endx = startx + chunkSizeX, endy = starty + chunkSizeY; assert(startx <= endx && endx <= sizex && starty <= endy && endy <= sizey); #ifdef __cplusplus auto coords = (double(*)[chunkSizeY][chunkSizeX]) coords_; #else double(*coords)[chunkSizeY][chunkSizeX] = (double(*)[sizey][sizex]) coords_; #endif for (size_t j = starty; j < endy; ++j) { double g = (double) j / (double) (sizey - 1); /* compute start/end coordinates of great circle in x direction */ struct cart_coord gc_left = intermediateCoord(a[0], a[3], g), gc_right = intermediateCoord(a[1], a[2], g); for (size_t i = startx; i < endx; ++i) { double f = (double) i / (double) (sizex - 1); struct cart_coord pij = intermediateCoord(gc_left, gc_right, f); coords[0][j - starty][i - startx] = RAD2DEG(pij.lat); coords[1][j - starty][i - startx] = RAD2DEG(pij.lon); } } } #if defined USE_MPI && !defined HAVE_PPM_CORE static int32_t uniform_partition_start(struct PPM_extent set_interval, int nparts, int part_idx); struct PPM_extent PPM_uniform_partition(struct PPM_extent set_interval, int nparts, int part_idx) { struct PPM_extent range; range.first = uniform_partition_start(set_interval, nparts, part_idx); range.size = uniform_partition_start(set_interval, nparts, part_idx + 1) - range.first; return range; } static int32_t uniform_partition_start(struct PPM_extent set_interval, int nparts, int part_idx) { int32_t part_offset = ((int64_t) set_interval.size * (int64_t) part_idx) / (int64_t) nparts; int32_t start = set_interval.first + part_offset; return start; } int PPM_prime_factorization_32(uint32_t n, uint32_t **factors) { if (n <= 1) return 0; uint32_t *restrict pfactors = (uint32_t *) Realloc(*factors, 32 * sizeof(pfactors[0])); size_t numFactors = 0; uint32_t unfactored = n; while (!(unfactored & 1)) { pfactors[numFactors] = 2; ++numFactors; unfactored >>= 1; } uint32_t divisor = 3; while (unfactored > 1) { while (unfactored % divisor == 0) { unfactored /= divisor; pfactors[numFactors] = divisor; ++numFactors; } divisor += 1; } *factors = pfactors; return numFactors; } #endif #if !defined USE_MPI || !defined HAVE_PPM_CORE static char repeatable_rand_state[31 * sizeof(long)]; long cdi_repeatable_random(void) { char *caller_rand_state = setstate(repeatable_rand_state); long retval = random(); setstate(caller_rand_state); return retval; } void cdi_seed_repeatable_random(unsigned seed) { char *caller_rand_state = initstate(seed, repeatable_rand_state, sizeof(repeatable_rand_state)); setstate(caller_rand_state); } #endif /* * Local Variables: * c-file-style: "Java" * c-basic-offset: 2 * indent-tabs-mode: nil * show-trailing-whitespace: t * require-trailing-newline: t * End: */ cdo-2.6.6.1/libcdi/tests/test_resource_copy.run.in0000664000175000017500000000025615271332515022267 0ustar alastairalastair#!@SHELL@ test 'x@ENABLE_GRIB@' = xyes || exit 77 @top_builddir@/libtool --mode=execute ${tool_wrap} ./test_resource_copy || exit 1 # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/var_cksum.h0000664000175000017500000000064615271332515017362 0ustar alastairalastair#ifndef VAR_CKSUM_H #define VAR_CKSUM_H #include #include struct cksum_table { int code; uint32_t cksum; }; /* returns EXIT_SUCCESS if a contains the same entries with the same * checksums as b, EXIT_FAILURE otherwise */ int compare_checksums(struct cksum_table a[], size_t a_size, const char *src_a, struct cksum_table b[], size_t b_size, const char *src_b); #endif cdo-2.6.6.1/libcdi/tests/test_f2003.run.in0000664000175000017500000000437515271332515020146 0ustar alastairalastair#!@SHELL@ @ENABLE_ISOC_INTERFACE_FALSE@exit 77 @ENABLE_NETCDF_FALSE@exit 77 cdi_read_f2003_stdout="$0.cdi_read_f2003.stdout" cdi_read_f2003_stderr="$0.cdi_read_f2003.stderr" @top_builddir@/libtool --mode=execute ${tool_wrap} @top_builddir@/examples/cdi_write_f2003 || exit 1 @top_builddir@/libtool --mode=execute ${tool_wrap} @top_builddir@/examples/cdi_read_f2003 >${cdi_read_f2003_stdout} 2>${cdi_read_f2003_stderr} || exit 1 exec 5<${cdi_read_f2003_stdout} 6<${cdi_read_f2003_stderr} 7<"$0" while read pattern <&7 ; do test "x$pattern" != 'x#PATTERNS' || break done IFS='' while read line <&6; do read pattern <&7 pattern=`echo "$pattern" | sed -e 's/^#//'` echo "$line" | grep "$pattern" || exit 1 done while read line <&5; do read pattern <&7 pattern=`echo "$pattern" | sed -e 's/^#//'` echo "$line" | grep "$pattern" || exit 1 done read pattern <&7 test "x$pattern" = 'x#END PATTERNS' || exit 1 exec 5<&- 6<&- #PATTERNS #^cdi version: @VERSION@$ #^Parameter: *1 *-1 *varname1 *\\|$ #^Parameter: *2 *-2 *varname2 *\\|$ #^Timestep: *1 *19850101 *120000$ #^ *var= *1 *level= *1: *[0-9]*.[0-9]* *[0-9]*.[0-9]* #^ *var= *2 *level= *1: *[0-9]*.[0-9]* *[0-9]*.[0-9]* #^ *var= *2 *level= *2: *[0-9]*.[0-9]* *[0-9]*.[0-9]* #^ *var= *2 *level= *3: *[0-9]*.[0-9]* *[0-9]*.[0-9]* #^ *var= *2 *level= *4: *[0-9]*.[0-9]* *[0-9]*.[0-9]* #^ *var= *2 *level= *5: *[0-9]*.[0-9]* *[0-9]*.[0-9]* #^Timestep: *2 *19850102 *120000$ #^ *var= *1 *level= *1: *[0-9]*.[0-9]* *[0-9]*.[0-9]* #^ *var= *2 *level= *1: *[0-9]*.[0-9]* *[0-9]*.[0-9]* #^ *var= *2 *level= *2: *[0-9]*.[0-9]* *[0-9]*.[0-9]* #^ *var= *2 *level= *3: *[0-9]*.[0-9]* *[0-9]*.[0-9]* #^ *var= *2 *level= *4: *[0-9]*.[0-9]* *[0-9]*.[0-9]* #^ *var= *2 *level= *5: *[0-9]*.[0-9]* *[0-9]*.[0-9]* #^Timestep: *3 *19850103 *120000$ #^ *var= *1 *level= *1: *[0-9]*.[0-9]* *[0-9]*.[0-9]* #^ *var= *2 *level= *1: *[0-9]*.[0-9]* *[0-9]*.[0-9]* #^ *var= *2 *level= *2: *[0-9]*.[0-9]* *[0-9]*.[0-9]* #^ *var= *2 *level= *3: *[0-9]*.[0-9]* *[0-9]*.[0-9]* #^ *var= *2 *level= *4: *[0-9]*.[0-9]* *[0-9]*.[0-9]* #^ *var= *2 *level= *5: *[0-9]*.[0-9]* *[0-9]*.[0-9]* #END PATTERNS # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/test_cksum_nc2.run.in0000664000175000017500000000005115271332515021263 0ustar alastairalastair#!@SHELL@ suffix=nc2 . ./test_cksum_base cdo-2.6.6.1/libcdi/tests/cksum_verify.c0000664000175000017500000000300615271332515020062 0ustar alastairalastair#ifdef HAVE_CONFIG_H #include "config.h" #endif #if defined __cplusplus && !defined __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS #endif #include #include #include #include #include "cksum.h" enum { block_size = 16, }; int main(void) { unsigned char *test_data = NULL, *init_block = NULL; size_t num_blocks = 1000; if (!(init_block = (unsigned char *) calloc(block_size * block_size, 1U)) || !(test_data = (unsigned char *) calloc((size_t) block_size * num_blocks, 1U))) return EXIT_FAILURE; /* this is supposed to be non-random */ srand48(5L); init_block[7] = 15U; /* repeat block and rotate */ for (size_t i = 1; i < block_size; ++i) { memcpy(init_block + block_size * i, init_block + block_size - i, i); memcpy(init_block + block_size * i + i, init_block, block_size - i); } for (size_t i = 0; i < num_blocks; ++i) { size_t block_idx = ((size_t) lrand48()) % block_size; memcpy(test_data + i, init_block + block_idx * block_size, block_size); } uint32_t cksum_result = memcrc(test_data, num_blocks * block_size); if (cksum_result != UINT32_C(0xc47779cd)) { printf("unexpected crc result: 0x%8" PRIx32 "\n", cksum_result); return EXIT_FAILURE; } if (test_data) free(test_data); if (init_block) free(init_block); return EXIT_SUCCESS; } /* * Local Variables: * c-file-style: "Java" * c-basic-offset: 2 * indent-tabs-mode: nil * show-trailing-whitespace: t * require-trailing-newline: t * End: */ cdo-2.6.6.1/libcdi/tests/test_resource_copy.parallel.run.in0000664000175000017500000000034115271332515024055 0ustar alastairalastair#!@SHELL@ @ENABLE_MPI_FALSE@exit 77 test 'x@MPI_LAUNCH@' != xtrue || exit 77 mpi_task_num="${mpi_task_num-1}" @top_builddir@/libtool --mode=execute @MPI_LAUNCH@ -n ${mpi_task_num} \ ./test_resource_copy.parallel || exit 1 cdo-2.6.6.1/libcdi/tests/test_cksum_grb2.run.in0000664000175000017500000000005215271332515021436 0ustar alastairalastair#!@SHELL@ suffix=grb2 . ./test_cksum_base cdo-2.6.6.1/libcdi/tests/pio_write.parallel.run.in0000664000175000017500000000012615271332515022137 0ustar alastairalastair#!@SHELL@ mpi_task_num=4 . ./pio_write.run # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/pio_cksum_grb2.run.in0000664000175000017500000000027415271332515021254 0ustar alastairalastair#! @SHELL@ suffix=grb2 pio_write_args="-w 3" #mpi_task_num=8 mpi_task_num=6 . ./pio_write.run ( . ./pio_write_dist_array.run ) || test $? -eq 77 # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/test_cdf_transformation.run.in0000664000175000017500000000131615271332515023266 0ustar alastairalastair#!@SHELL@ @ENABLE_NETCDF_FALSE@exit 77 ncdatafile="$0.nc" @top_builddir@/libtool --mode=execute ${tool_wrap} ./test_cdf_write "${ncdatafile}" || exit 1 digest=`@top_builddir@/libtool --mode=execute ${tool_wrap} ./test_cdf_read "${ncdatafile}"` || exit 1 missValueCount=`echo "$digest" | @SED@ -n '/^missing values count =/{ s/^missing values count *= *// p q }'` || exit 1 if test "$missValueCount" -ne 1; then echo "Mismatch in expected number of missing values!" >&2 exit 1 fi if ! echo "$digest" | grep 'variable 1 attribute "CDI Text Attribute test, created by", value: "CDI test_cdf_write"' >/dev/null; then echo "Expected attribute not found" >&2 exit 1 fi # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/test_resource_copy.c0000664000175000017500000001504115271332515021276 0ustar alastairalastair#if defined(HAVE_CONFIG_H) #include "config.h" #endif #include #include #include "cdi.h" #include "cdi_uuid.h" #include "dmemory.h" #include "error.h" #include "resource_handle.h" #include "resource_unpack.h" #ifdef USE_MPI #include #include "cdipio.h" #include "pio_serialize.h" #include "pio_util.h" #else typedef int MPI_Comm; #endif enum { DOUBLE_PRECISION = CDI_DATATYPE_FLT64, nlon = 12, nlat = 6, nlev = 5, ntsteps = 3 }; static double lons[nlon] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; static double lats[nlat] = { -75, -45, -15, 15, 45, 75 }; static double levs[nlev] = { 101300, 92500, 85000, 50000, 20000 }; static int defineGrid(void) { int mask_vec[nlon * nlat]; const int *mp = &mask_vec[0]; double area_vec[nlon * nlat]; const double *ap = &area_vec[0]; int i; int gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); gridDefYvals(gridID, lats); gridDefNvertex(gridID, 1); gridDefXbounds(gridID, lons); gridDefYbounds(gridID, lats); for (i = 0; i < nlon * nlat; i++) mask_vec[i] = i % 2; gridDefMaskGME(gridID, mp); for (i = 0; i < nlon * nlat; i++) mask_vec[i] = 1; gridDefMask(gridID, mp); cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_NAME, "myXname"); cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_NAME, "myYname"); cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_LONGNAME, "myXlongname"); cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_LONGNAME, "myYlongname"); cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_UNITS, "myXunits"); cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_UNITS, "myYunits"); cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_DATATYPE, DOUBLE_PRECISION); gridDefTrunc(gridID, 1); gridDefParamGME(gridID, 2, 3, 4, 5); cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDUSED, 6); cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDINREFERENCE, 7); cdiDefKeyString(gridID, CDI_GLOBAL, CDI_KEY_REFERENCEURI, "myReference"); for (i = 0; i < nlon * nlat; i++) area_vec[i] = 0.1 * i; gridDefArea(gridID, ap); for (i = 0; i < nlon * nlat; i++) mask_vec[i] = i; gridDefReducedPoints(gridID, nlon * nlat, mp); gridDefComplexPacking(gridID, 1); { unsigned char uuid[CDI_UUID_SIZE]; cdiCreateUUID(uuid); gridDefUUID(gridID, uuid); } return gridID; } static int defineZaxis(void) { double vct[3] = { 3.0, 3.3, 3.6 }; int zaxisID = zaxisCreate(ZAXIS_PRESSURE, nlev); zaxisDefLevels(zaxisID, levs); zaxisDefLevel(zaxisID, 2, 8507.3); cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_NAME, "myName"); cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_LONGNAME, "myLongname"); cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, "myUnits"); zaxisDefDatatype(zaxisID, DOUBLE_PRECISION); cdiDefKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_TYPEOFFIRSTFIXEDSURFACE, 1); zaxisDefVct(zaxisID, 3, vct); zaxisDefLbounds(zaxisID, &levs[0]); zaxisDefUbounds(zaxisID, &levs[0]); zaxisDefWeights(zaxisID, &levs[0]); { unsigned char uuid[CDI_UUID_SIZE]; cdiCreateUUID(uuid); cdiDefKeyBytes(zaxisID, CDI_GLOBAL, CDI_KEY_UUID, uuid, CDI_UUID_SIZE); } return zaxisID; } static int defineTaxis(void) { int taxisID = taxisCreate(TAXIS_ABSOLUTE); taxisDefType(taxisID, 0); taxisDefVdate(taxisID, 1); taxisDefVtime(taxisID, 2); taxisDefRdate(taxisID, 3); taxisDefRtime(taxisID, 4); taxisDefVdateBounds(taxisID, 5, 6); taxisDefVtimeBounds(taxisID, 7, 8); taxisDefCalendar(taxisID, 1); taxisDefTunit(taxisID, 1); taxisDefNumavg(taxisID, 1); return taxisID; } static void defineStream(int streamID, int vlistID) { streamDefByteorder(streamID, 1); streamDefCompType(streamID, 2); streamDefCompLevel(streamID, 3); streamDefVlist(streamID, vlistID); } struct idPair { int id1, id2; }; static struct idPair defineVlist(int gridID, int zaxisID, int taxisID) { int vlistID = CDI_UNDEFID; int zaxisID2 = zaxisCreate(ZAXIS_SURFACE, 1); vlistID = vlistCreate(); int varID1 = vlistDefVar(vlistID, gridID, zaxisID, TIME_VARIABLE); int varID2 = vlistDefVar(vlistID, gridID, zaxisID2, TIME_VARIABLE); vlistDefVarName(vlistID, varID1, "varname1"); { int globfac[] = { 23, 42 }; cdiDefAttInt(vlistID, varID1, "seer's globule factors", CDI_DATATYPE_INT16, 2, globfac); } vlistDefVarName(vlistID, varID2, "varname2"); cdiDefAttTxt(vlistID, varID2, "txt demo", 6, "banana"); vlistDefTaxis(vlistID, taxisID); int vlistID2 = vlistDuplicate(vlistID); return (struct idPair){ vlistID, vlistID2 }; } static int defineInstitute(void) { int instID = institutDef(0, 0, "MYINSTITUTE", "myInstitute"); return instID; } static int defineModel(int instID) { int modelID = modelDef(instID, 0, "resource_copy"); return modelID; } static int destNamespace; static int modelRun(MPI_Comm comm) { char *recvBuffer, *sendBuffer; int bufferSize; #ifdef USE_MPI const char *fname = "example_resource_copy_mpi.grb"; cdiPioSerializeSetMPI(); #else const char *fname = "example_resource_copy.grb"; #endif int gridID = defineGrid(); int zaxisID = defineZaxis(); int taxisID = defineTaxis(); int instID = defineInstitute(); defineModel(instID); struct idPair temp = defineVlist(gridID, zaxisID, taxisID); int vlistID = temp.id1; int streamID = streamOpenWrite(fname, CDI_FILETYPE_GRB); if (streamID < 0) xabort("Could not open file"); defineStream(streamID, vlistID); vlistDestroy(temp.id1); vlistDestroy(temp.id2); reshPackBufferCreate(&sendBuffer, &bufferSize, &comm); recvBuffer = (char *) Malloc((size_t) bufferSize); #ifdef USE_MPI xmpi(MPI_Sendrecv(sendBuffer, bufferSize, MPI_PACKED, 0, 0, recvBuffer, bufferSize, MPI_PACKED, 0, 0, MPI_COMM_SELF, MPI_STATUS_IGNORE)); #else memcpy(recvBuffer, sendBuffer, (size_t) bufferSize); #endif namespaceSetActive(destNamespace); reshUnpackResources(recvBuffer, bufferSize, &comm, (cdiPostResUpdateHook) 0); free(recvBuffer); reshPackBufferDestroy(&sendBuffer); int differ = reshListCompare(0, 1); namespaceSetActive(0); streamClose(streamID); return differ; } int main(int argc, char *argv[]) { int exitCode = 77; MPI_Comm commModel; #ifdef USE_MPI MPI_Init(&argc, &argv); commModel = MPI_COMM_WORLD; #else (void) argc; (void) argv; commModel = 0; #endif destNamespace = namespaceNew(); exitCode = modelRun(commModel); #ifdef USE_MPI xmpi(MPI_Finalize()); #endif return exitCode; } /* * Local Variables: * c-file-style: "Java" * c-basic-offset: 2 * indent-tabs-mode: nil * show-trailing-whitespace: t * require-trailing-newline: t * End: */ cdo-2.6.6.1/libcdi/tests/cksum_write_chunk.c0000664000175000017500000000111515271332515021077 0ustar alastairalastair/* DO NOT REMOVE the config.h include file under any circumstances, * it's very much needed on some platforms */ #if defined(HAVE_CONFIG_H) #include "config.h" #endif /* DO NOT REMOVE the above config.h include file under any * circumstances as long as it's the autoconf configuration header * used to build this package. When it's missing on some platforms, * some poor person has to do long, tedious debugging sessions, where * struct offsets almost imperceptibly change from one file to the * next to find out what happened */ #define TEST_CHUNK_WRITE 1 #include "cksum_write.c" cdo-2.6.6.1/libcdi/tests/pio_cksum_mpi_fw_at_all.run.in0000664000175000017500000000021315271332515023206 0ustar alastairalastair#!@SHELL@ pio_write_args="-p PIO_MPI_FW_AT_ALL -w 2" mpi_task_num=5 . ./pio_write.run ( . ./pio_write_dist_array.run ) || test $? -eq 77 cdo-2.6.6.1/libcdi/tests/pio_write_dist_array.run.in0000664000175000017500000000032015271332515022561 0ustar alastairalastair#! @SHELL@ test 'x@HAVE_PPM_DIST_ARRAY@' = xyes || exit 77 mpi_task_num=${mpi_task_num-4} variations="'-qcreate-curvilinear-grid -quse-dist-grid'" . ./pio_write.run # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/pio_cksum_nc2.run.in0000664000175000017500000000032015271332515021072 0ustar alastairalastair#!@SHELL@ suffix=nc2 pio_write_args="-w 3 -qtaxis-type=relative" #mpi_task_num=8 mpi_task_num=6 . ./pio_write.run ( . ./pio_write_dist_array.run ) || test $? -eq 77 # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/test_cksum_srv.run.in0000664000175000017500000000005115271332515021413 0ustar alastairalastair#!@SHELL@ suffix=srv . ./test_cksum_base cdo-2.6.6.1/libcdi/tests/test_cdf_const.run.in0000664000175000017500000000453215271332515021351 0ustar alastairalastair#!@SHELL@ @ENABLE_NETCDF_FALSE@exit 77 cdi_app_stdout="$0.cdi_app.stdout" cdi_app_stderr="$0.cdi_app.stderr" @top_builddir@/libtool --mode=execute ${tool_wrap} @top_builddir@/examples/cdi_write_const || exit 1 @top_builddir@/libtool --mode=execute ${tool_wrap} @top_builddir@/app/cdi -s example_const.nc >${cdi_app_stdout} 2>${cdi_app_stderr} || exit 1 @top_builddir@/libtool --mode=execute ${tool_wrap} @top_builddir@/app/cdi example_const.nc >>${cdi_app_stdout} 2>>${cdi_app_stderr} || exit 1 exec 6<${cdi_app_stdout} 7<"$0" while read pattern <&7 ; do test "x$pattern" != 'x#PATTERNS' || break done IFS='' while read line <&6 ; do read pattern <&7 pattern=`echo "$pattern" | sed -e 's/^#//'` echo "$line" | grep "$pattern" || exit 1 done if test -s ${cdi_app_stderr}; then echo "unexpected error message from @top_builddir@/app/cdi:" cat ${cdi_app_stderr} fi read pattern <&7 test "x$pattern" = 'x#END PATTERNS' || exit 1 exec 5<&- 6<&- #PATTERNS #^ File format : NetCDF #^ Var : Institut Source T Steptype Levels Num Points Num Dtype : Parameter ID #^ 1 : unknown unknown c instant 1 1 72 1 F32 : -1 #^ 2 : unknown unknown c instant 5 2 72 1 F32 : -2 #^ Grid coordinates : #^ 1 : lonlat : points=72 (12x6) #^ lon : 0 to 330 by 30 degrees_east cyclic #^ lat : -75 to 75 by 30 degrees_north #^ Vertical coordinates : #^ 1 : surface : levels=1 #^ 2 : pressure : levels=5 #^ plev : 101300 to 20000 Pa #^ Rec : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter ID #^ 1 : 0000-00-00 00:00:00 0 72 0 : 1.1000 1.1000 1.1000 : -1 #^ 2 : 0000-00-00 00:00:00 101300 72 0 : 2.2000 2.2000 2.2000 : -2 #^ 3 : 0000-00-00 00:00:00 92500 72 0 : 2.2000 2.2000 2.2000 : -2 #^ 4 : 0000-00-00 00:00:00 85000 72 0 : 2.2000 2.2000 2.2000 : -2 #^ 5 : 0000-00-00 00:00:00 50000 72 0 : 2.2000 2.2000 2.2000 : -2 #^ 6 : 0000-00-00 00:00:00 20000 72 0 : 2.2000 2.2000 2.2000 : -2 #END PATTERNS # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/test_byteswap.c0000664000175000017500000000133215271332515020251 0ustar alastairalastair/* DO NOT REMOVE the config.h include file under any circumstances, * it's very much needed on some platforms */ #if defined(HAVE_CONFIG_H) #include "config.h" #endif /* DO NOT REMOVE the above config.h include file under any * circumstances as long as it's the autoconf configuration header * used to build this package. When it's missing on some platforms, * some poor person has to do long, tedious debugging sessions, where * struct offsets almost imperceptibly change from one file to the * next to find out what happened */ #include #include #include "cdi.h" /* function called by CDO */ extern int getByteswap(int); int main(void) { assert(getByteswap(-1) == -1); return EXIT_SUCCESS; } cdo-2.6.6.1/libcdi/tests/test_cksum_nc4.run.in0000664000175000017500000000005115271332515021265 0ustar alastairalastair#!@SHELL@ suffix=nc4 . ./test_cksum_base cdo-2.6.6.1/libcdi/tests/cksum_write.c0000664000175000017500000002640015271332515017713 0ustar alastairalastair#ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include "cdi.h" #include "cdi_uuid.h" #include "dmemory.h" #include "cksum.h" #include "simple_model_helper.h" static int parse_intarg(const char msg[]) { char *end; long temp = strtol(optarg, &end, 0); if ((errno == ERANGE && (temp == LONG_MAX || temp == LONG_MIN)) || (errno != 0 && temp == 0)) { perror(msg); exit(EXIT_FAILURE); } if (temp > INT_MAX || temp < INT_MIN) { fprintf(stderr, "range error: %ld\n", temp); exit(EXIT_FAILURE); } return (int) temp; } /* If we're not using GNU C, elide __attribute__ */ #if !defined __GNUC__ && !defined __attribute__ #define __attribute__(x) /*NOTHING*/ #endif static inline void check_positive(int v, const char *msg) { if (v < 1) { fprintf(stderr, "error: number of %s must be positive!\n", msg); exit(EXIT_FAILURE); } } #ifdef TEST_CHUNK_WRITE static void get_chunk(double *chunkBuf, double *var, int varShape[3], int chunk[3][2]) { size_t ofs = 0; size_t start_k = (size_t) chunk[2][0], start_j = (size_t) chunk[1][0], start_i = (size_t) chunk[0][0]; size_t size_k = (size_t) chunk[2][1] - (size_t) chunk[2][0] + 1, size_j = (size_t) chunk[1][1] - (size_t) chunk[1][0] + 1, size_i = (size_t) chunk[0][1] - (size_t) chunk[0][0] + 1; size_t stride_k = (size_t) varShape[0] * (size_t) varShape[1], stride_j = (size_t) varShape[0]; for (size_t k = 0; k < size_k; ++k) for (size_t j = 0; j < size_j; ++j) for (size_t i = 0; i < size_i; ++i) chunkBuf[ofs++] = var[(k + start_k) * stride_k + (j + start_j) * stride_j + (i + start_i)]; } #endif #ifndef TEST_CHUNK_WRITE static const struct { char suffix[5]; int type, defaultDT, defaultGrid; } suffix2type[] = { { "nc", CDI_FILETYPE_NC, CDI_DATATYPE_FLT64, GRID_LONLAT }, { "grb", CDI_FILETYPE_GRB, CDI_DATATYPE_PACK24, GRID_LONLAT }, { "grb2", CDI_FILETYPE_GRB2, CDI_DATATYPE_PACK24, GRID_LONLAT }, { "nc2", CDI_FILETYPE_NC2, CDI_DATATYPE_FLT64, GRID_LONLAT }, { "nc4", CDI_FILETYPE_NC4, CDI_DATATYPE_FLT64, GRID_LONLAT }, { "ext", CDI_FILETYPE_EXT, CDI_DATATYPE_FLT64, GRID_GENERIC, }, { "srv", CDI_FILETYPE_SRV, CDI_DATATYPE_FLT64, GRID_GENERIC, }, { "ieg", CDI_FILETYPE_IEG, CDI_DATATYPE_FLT64, GRID_LONLAT }, }; #endif enum { nvars = 2, }; static const int varCodes[nvars] = { 42, 55 }; int main(int argc, char *argv[]) { int gridID, zaxisID[nvars], taxisID; int vlistID, varID[nvars], streamID; int nlon = 12, //!< Number of longitudes nlat = 6, //!< Number of latitudes nlev = 5, //!< Number of levels nts = 3; //!< Number of time steps enum { nmiss = 0 }; double *restrict var[nvars], mscale, mrscale; size_t varSize[nvars]; const char *varName[nvars] = { "varname1", "varname2" }; #ifndef TEST_CHUNK_WRITE const char *suffix = "grb", *prefix = "example"; int filetype = CDI_FILETYPE_GRB, datatype = CDI_DATATYPE_PACK24; #else const char *suffix = "nc", *prefix = "example"; int filetype = CDI_FILETYPE_NC, datatype = CDI_DATATYPE_FLT64; #endif { int opt; while ((opt = getopt(argc, argv, #ifndef TEST_CHUNK_WRITE "f:" #endif "b:m:n:o:t:")) != -1) switch (opt) { #ifndef TEST_CHUNK_WRITE case 'f': { int found = 0; for (size_t i = 0; i < sizeof(suffix2type) / sizeof(suffix2type[0]); ++i) if (!strcmp(optarg, suffix2type[i].suffix)) { found = 1; filetype = suffix2type[i].type; suffix = suffix2type[i].suffix; datatype = suffix2type[i].defaultDT; break; } if (!found) { fprintf(stderr, "Unsupported format requested: %s\n", optarg); exit(EXIT_FAILURE); } } break; #endif case 'b': prefix = optarg; break; case 'm': nlon = parse_intarg("error parsing number of longitudes"); check_positive(nlon, "longitudes"); #ifdef TEST_CHUNK_WRITE if (nlon < 2) { fputs("number of longitudes must be larger 1 for " "chunk write test\n", stderr); exit(EXIT_FAILURE); } #endif break; case 'n': check_positive(nlat = parse_intarg("error parsing number of latitudes"), "latitudes"); break; case 'o': check_positive(nlev = parse_intarg("error parsing number of levels"), "levels"); break; case 't': check_positive(nts = parse_intarg("error parsing number of timesteps"), "timesteps"); break; default: /* '?' */ fprintf(stderr, "Usage: %s [-m nlon] [-n nlat] [-o nlev] [-t nts]\n", argv[0]); exit(EXIT_FAILURE); } } varSize[0] = (size_t) nlon * (size_t) nlat; varSize[1] = (size_t) nlon * (size_t) nlat * (size_t) nlev; // Create a regular lon/lat grid gridID = createGlobalLatLonGrid(nlon, nlat); // Create a surface level Z-axis zaxisID[0] = zaxisCreate(ZAXIS_SURFACE, 1); // Create a pressure level Z-axis zaxisID[1] = zaxisCreate(ZAXIS_PRESSURE, nlev); { double *levs = (double *) Malloc((size_t) nlev * sizeof(levs[0])); for (size_t i = 0; i < (size_t) nlev; ++i) levs[i] = 101300 - floor(3940.3 * expm1(2.3579 * (double) i / (nlev - 1))); zaxisDefLevels(zaxisID[1], levs); free(levs); } /* add uuids to zaxis and grid */ { unsigned char uuid[CDI_UUID_SIZE]; static char gridUUIDTxt[] = "107d7a5b-348c-4d1a-90a9-d745914f2fb6"; cdiStr2UUID(gridUUIDTxt, uuid); gridDefUUID(gridID, uuid); static char zaxisUUIDTxt[2][37] = { { "d157f399-5496-4097-a3d8-437a6dda6311" }, { "6f784a65-bce8-48c9-afa4-4c40130709c7" } }; for (int i = 0; i < 2; ++i) { cdiStr2UUID(zaxisUUIDTxt[i], uuid); cdiDefKeyBytes(zaxisID[i], CDI_GLOBAL, CDI_KEY_UUID, uuid, CDI_UUID_SIZE); } } // Create a Time axis taxisID = taxisCreate(TAXIS_ABSOLUTE); // Create a variable list vlistID = vlistCreate(); for (size_t i = 0; i < nvars; ++i) { // Define the variables varID[i] = vlistDefVar(vlistID, gridID, zaxisID[i], TIME_VARIABLE); // Define the variable names, vlistDefVarName(vlistID, varID[i], varName[i]); // the codes vlistDefVarCode(vlistID, varID[i], varCodes[i]); // and set the data type vlistDefVarDatatype(vlistID, varID[i], datatype); // create memory for variables var[i] = (double *) Malloc(varSize[i] * sizeof(var[i][0])); } var_scale(datatype, &mscale, &mrscale); // Assign the Time axis to the variable list vlistDefTaxis(vlistID, taxisID); // Create a dataset streamID = composeStream(NULL, prefix, -1, suffix, filetype); // Assign the variable list to the dataset streamDefVlist(streamID, vlistID); { uint32_t checksum_state[nvars] = { 0, 0 }; // Loop over the number of time steps for (size_t tsID = 0; tsID < (size_t) nts; tsID++) { int vdatetime[2] = { 120000, 19850101 + (int) tsID }; // Set the verification date to 1985-01-01 + tsID taxisDefVdate(taxisID, vdatetime[1]); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, vdatetime[0]); // Define the time step streamDefTimestep(streamID, (int) tsID); // Init var1 and var2 for (size_t j = 0; j < (size_t) nlat; j++) for (size_t i = 0; i < (size_t) nlon; i++) var[0][i + j * (size_t) nlon] = dg_wobble((double) ((i + tsID) % (size_t) nlon) / (double) (nlon - 1), (double) j / (double) (nlat - 1), mscale, mrscale); for (size_t k = 0; k < (size_t) nlev; ++k) for (size_t j = 0; j < (size_t) nlat; j++) for (size_t i = 0; i < (size_t) nlon; i++) var[1][i + j * (size_t) nlon + k * (size_t) nlon * (size_t) nlat] = dg_wobble( (double) j / (double) (nlat - 1), (double) ((i + tsID) % (size_t) nlon) / (double) (nlon - 1), mscale, mrscale); if (filetype == CDI_FILETYPE_EXT) { /* EXTRA doesn't store time, only date * set the value to 0 before checksumming, because a * time field of 0 is what reading an EXTRA file will * return */ vdatetime[0] = 0; } memcrc_r(&checksum_state[0], (const unsigned char *) vdatetime, sizeof(vdatetime)); memcrc_r(&checksum_state[0], (const unsigned char *) var[0], varSize[0] * sizeof(var[0][0])); memcrc_r(&checksum_state[1], (const unsigned char *) vdatetime, sizeof(vdatetime)); memcrc_r(&checksum_state[1], (const unsigned char *) var[1], varSize[1] * sizeof(var[1][0])); // Write var1 and var2 #ifdef TEST_CHUNK_WRITE { size_t maxChunkSize = ((size_t) nlon + 1) / 2 * (size_t) nlat * (size_t) nlev; double *chunkBuf = (double *) Malloc(maxChunkSize * sizeof(double)); int varShape[2][3] = { { nlon, nlat, 1 }, { nlon, nlat, nlev } }, chunk[3][2] = { { 0, nlon / 2 - 1 }, { 0, nlat - 1 }, { 0, 0 } }; chunk[0][0] = 0; chunk[0][1] = nlon / 2 - 1; chunk[2][1] = 0; get_chunk(chunkBuf, var[0], varShape[0], chunk); streamWriteVarChunk(streamID, varID[0], (const int(*)[2]) chunk, chunkBuf, nmiss); chunk[2][1] = nlev - 1; get_chunk(chunkBuf, var[1], varShape[1], chunk); streamWriteVarChunk(streamID, varID[1], (const int(*)[2]) chunk, chunkBuf, nmiss); chunk[0][0] = chunk[0][1] + 1; chunk[0][1] = nlon - 1; chunk[2][1] = 0; get_chunk(chunkBuf, var[0], varShape[0], chunk); streamWriteVarChunk(streamID, varID[0], (const int(*)[2]) chunk, chunkBuf, nmiss); chunk[2][1] = nlev - 1; get_chunk(chunkBuf, var[1], varShape[1], chunk); streamWriteVarChunk(streamID, varID[1], (const int(*)[2]) chunk, chunkBuf, nmiss); free(chunkBuf); } #else streamWriteVar(streamID, varID[0], var[0], nmiss); streamWriteVar(streamID, varID[1], var[1], nmiss); #endif } // write checksums to table file { FILE *tablefp; { char *fname = NULL; composeFilename(&fname, prefix, -1, "cksum"); if (!(tablefp = fopen(fname, "w"))) { perror("failed to open table file"); exit(EXIT_FAILURE); } free(fname); } for (size_t i = 0; i < (size_t) nvars; ++i) { uint32_t cksum; int code; cksum = memcrc_finish(&checksum_state[i], (off_t) ((varSize[i] * sizeof(var[i][0]) + sizeof(int) * 2) * (size_t) nts)); code = vlistInqVarCode(vlistID, varID[i]); if (fprintf(tablefp, "%08lx %d\n", (unsigned long) cksum, code) < 0) { perror("failed to write table file"); exit(EXIT_FAILURE); } } fclose(tablefp); } } // Close the output stream streamClose(streamID); // Destroy the objects for (size_t i = 0; i < nvars; ++i) free(var[i]); vlistDestroy(vlistID); taxisDestroy(taxisID); zaxisDestroy(zaxisID[0]); zaxisDestroy(zaxisID[1]); gridDestroy(gridID); return 0; } /* * Local Variables: * c-file-style: "Java" * c-basic-offset: 2 * indent-tabs-mode: nil * show-trailing-whitespace: t * require-trailing-newline: t * End: */ cdo-2.6.6.1/libcdi/tests/pio_cksum_mpinonb.run.in0000664000175000017500000000025215271332515022056 0ustar alastairalastair#!@SHELL@ pio_write_args="-p PIO_MPI -w 2" mpi_task_num=4 . ./pio_write.run ( . ./pio_write_dist_array.run ) || test $? -eq 77 # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/pio_write.c0000664000175000017500000004027315271332515017364 0ustar alastairalastair#ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #ifdef USE_MPI #include #include #ifdef HAVE_PPM_CORE #include #endif #endif #include "cdi.h" #include "error.h" #include "dmemory.h" #include "pio_write.h" #include "simple_model_helper.h" #ifdef USE_MPI #include "cdipio.h" #include "pio_util.h" #endif static const char default_fname_prefix[] = "example"; static const struct model_config default_setup = { .nlon = 12, .nlat = 6, .nts = 3, .max_nlev = 5, .nvars = 5, .filetype = CDI_FILETYPE_GRB, .datatype = CDI_DATATYPE_PACK24, .flags = PIO_WRITE_CONFIG_CHECKSUM_FLAG, .taxistype = TAXIS_ABSOLUTE, .taxisunit = -1, .suffix = "grb", .prefix = default_fname_prefix, }; static const struct { char suffix[5]; int type, defaultDT, defaultGrid; } suffix2type[] = { { "nc", CDI_FILETYPE_NC, CDI_DATATYPE_FLT64, GRID_LONLAT }, { "grb", CDI_FILETYPE_GRB, CDI_DATATYPE_PACK24, GRID_LONLAT }, { "grb2", CDI_FILETYPE_GRB2, CDI_DATATYPE_PACK24, GRID_LONLAT }, { "nc2", CDI_FILETYPE_NC2, CDI_DATATYPE_FLT64, GRID_LONLAT }, { "nc4", CDI_FILETYPE_NC4, CDI_DATATYPE_FLT64, GRID_LONLAT }, { "ext", CDI_FILETYPE_EXT, CDI_DATATYPE_FLT64, GRID_GENERIC, }, { "srv", CDI_FILETYPE_SRV, CDI_DATATYPE_FLT64, GRID_GENERIC, }, { "ieg", CDI_FILETYPE_IEG, CDI_DATATYPE_FLT64, GRID_LONLAT }, }; static void invalidOptionDie(const char *format, ...) __attribute__((noreturn)); static void invalidOptionDie(const char *format, ...) { va_list ap; va_start(ap, format); vfprintf(stderr, format, ap); exit(EXIT_FAILURE); } static int parse_intarg(const char msg[]) { char *end; long temp = strtol(optarg, &end, 0); if ((errno == ERANGE && (temp == LONG_MAX || temp == LONG_MIN)) || (errno != 0 && temp == 0)) { perror(msg); exit(EXIT_FAILURE); } if (temp > INT_MAX || temp < INT_MIN) invalidOptionDie("range error: %ld\n", temp); return (int) temp; } static unsigned parse_unsignedarg(const char msg[]) { char *end; unsigned long temp = strtoul(optarg, &end, 0); if ((errno == ERANGE && (temp == ULONG_MAX)) || (errno != 0 && temp == 0)) { perror(msg); exit(EXIT_FAILURE); } if (temp > UINT_MAX) invalidOptionDie("range error: %ld\n", temp); return (unsigned) temp; } typedef int (*pioRoleFunc)(MPI_Comm commSuper, int IOMode, int nProcsIO); struct boolOptionParse { bool matched, value, invert; }; static struct boolOptionParse parseBooleanLongOption(size_t optionStrSize, const char *optionStr, const char *argStr) { bool invert; struct boolOptionParse result; if ((invert = !strncmp(argStr, optionStr, optionStrSize - 1)) || !strncmp(argStr, optionStr + 3, optionStrSize - 4)) { result.matched = true; result.invert = invert; size_t valOfs = optionStrSize - (invert ? 1 : 4); if (argStr[valOfs] == '\0' || !strcmp(argStr + valOfs, "=true")) result.value = !invert; else if (!strcmp(argStr + valOfs, "=false")) result.value = invert; else invalidOptionDie("invalid option argument to -q%s: %s\n", optionStr + (invert ? 0 : 3), argStr + valOfs); } else result = (struct boolOptionParse){ .matched = false, .value = false }; return result; } struct string2int { const char *key; int val; }; static bool parseLongOptionArgStringToInt(const char *str, size_t optionStrLen, const char *optionStr, size_t mapSize, const struct string2int *map, int argc, char *argv[], int *out) { if (!strncmp(str, optionStr, optionStrLen)) { const char *optargArg; if (str[optionStrLen] == '=') optargArg = str + optionStrLen + 1; else if (str[sizeof(optionStr) - 1] == 0 && optind < argc) optargArg = argv[optind++]; else invalidOptionDie("missing argument to -q%s", optionStr); for (size_t i = 0; i < mapSize; ++i) if (!strcmp(optargArg, map[i].key)) { *out = map[i].val; return true; } invalidOptionDie("unknown argument \"%s\" to -q%s", optargArg, optionStr); } return false; } static void parse_long_option(struct model_config *restrict setup, int pioConfHandle, pioRoleFunc *pioRoleAssign, const char *str, int argc, char *argv[]) { #ifndef USE_MPI (void) pioConfHandle; (void) pioRoleAssign; #endif static const char cacheRedistStr[] = "no-cache-redists", pioRoleSchemeOptionStr[] = "pio-role-scheme", curvilinearGridOptionStr[] = "no-create-curvilinear-grid", uuidCreateOptionStr[] = "no-create-uuid", useDistGridOptionStr[] = "no-use-dist-grid", batchedRmaOptionStr[] = "no-batch-rma", presetDecoOptionStr[] = "no-preset-decomposition", datatypeOptionStr[] = "datatype", prefixOptionStr[] = "prefix", taxistypeOptionStr[] = "taxis-type", taxisunitOptionStr[] = "taxis-unit"; static const struct string2int datatypeArgMap[] = { { "pack", CDI_DATATYPE_PACK }, { "pack1", CDI_DATATYPE_PACK1 }, { "pack2", CDI_DATATYPE_PACK2 }, { "pack3", CDI_DATATYPE_PACK3 }, { "pack4", CDI_DATATYPE_PACK4 }, { "pack5", CDI_DATATYPE_PACK5 }, { "pack6", CDI_DATATYPE_PACK6 }, { "pack7", CDI_DATATYPE_PACK7 }, { "pack8", CDI_DATATYPE_PACK8 }, { "pack9", CDI_DATATYPE_PACK9 }, { "pack10", CDI_DATATYPE_PACK10 }, { "pack11", CDI_DATATYPE_PACK11 }, { "pack12", CDI_DATATYPE_PACK12 }, { "pack13", CDI_DATATYPE_PACK13 }, { "pack14", CDI_DATATYPE_PACK14 }, { "pack15", CDI_DATATYPE_PACK15 }, { "pack16", CDI_DATATYPE_PACK16 }, { "pack17", CDI_DATATYPE_PACK17 }, { "pack18", CDI_DATATYPE_PACK18 }, { "pack19", CDI_DATATYPE_PACK19 }, { "pack20", CDI_DATATYPE_PACK20 }, { "pack21", CDI_DATATYPE_PACK21 }, { "pack22", CDI_DATATYPE_PACK22 }, { "pack23", CDI_DATATYPE_PACK23 }, { "pack24", CDI_DATATYPE_PACK24 }, { "pack25", CDI_DATATYPE_PACK25 }, { "pack26", CDI_DATATYPE_PACK26 }, { "pack27", CDI_DATATYPE_PACK27 }, { "pack28", CDI_DATATYPE_PACK28 }, { "pack29", CDI_DATATYPE_PACK29 }, { "pack30", CDI_DATATYPE_PACK30 }, { "pack31", CDI_DATATYPE_PACK31 }, { "pack32", CDI_DATATYPE_PACK32 }, { "cpx32", CDI_DATATYPE_CPX32 }, { "cpx64", CDI_DATATYPE_CPX64 }, { "flt32", CDI_DATATYPE_FLT32 }, { "flt64", CDI_DATATYPE_FLT64 }, { "int8", CDI_DATATYPE_INT8 }, { "int16", CDI_DATATYPE_INT16 }, { "int32", CDI_DATATYPE_INT32 }, { "uint8", CDI_DATATYPE_UINT8 }, { "uint16", CDI_DATATYPE_UINT16 }, { "uint32", CDI_DATATYPE_UINT32 }, }; static const struct string2int taxistypeArgMap[] = { { "absolute", TAXIS_ABSOLUTE }, { "relative", TAXIS_RELATIVE }, { "forecast", TAXIS_FORECAST }, }; static const struct string2int taxisunitArgMap[] = { { "second", TUNIT_SECOND }, { "minute", TUNIT_MINUTE }, { "quarter", TUNIT_QUARTER }, { "30minutes", TUNIT_30MINUTES }, { "hour", TUNIT_HOUR }, { "3hours", TUNIT_3HOURS }, { "6hours", TUNIT_6HOURS }, { "12hours", TUNIT_12HOURS }, { "day", TUNIT_DAY }, { "month", TUNIT_MONTH }, { "year", TUNIT_YEAR }, }; enum { datatypeArgMapSize = sizeof(datatypeArgMap) / sizeof(datatypeArgMap[0]), taxistypeArgMapSize = sizeof(taxistypeArgMap) / sizeof(taxistypeArgMap[0]), taxisunitArgMapSize = sizeof(taxisunitArgMap) / sizeof(taxisunitArgMap[0]), }; struct boolOptionParse bop; if ((bop = parseBooleanLongOption(sizeof(cacheRedistStr), cacheRedistStr, str)).matched) { #ifdef USE_MPI cdiPioConfSetRedistCache(pioConfHandle, bop.value); #else invalidOptionDie("CDI-PIO option -q%s unavailable in non-MPI mode\n", cacheRedistStr + (bop.invert ? 0 : 3)); #endif } else if (parseLongOptionArgStringToInt(str, sizeof(taxistypeOptionStr) - 1, taxistypeOptionStr, taxistypeArgMapSize, taxistypeArgMap, argc, argv, &setup->taxistype)) ; else if (parseLongOptionArgStringToInt(str, sizeof(taxisunitOptionStr) - 1, taxisunitOptionStr, taxisunitArgMapSize, taxisunitArgMap, argc, argv, &setup->taxisunit)) ; else if (parseLongOptionArgStringToInt(str, sizeof(datatypeOptionStr) - 1, datatypeOptionStr, datatypeArgMapSize, datatypeArgMap, argc, argv, &setup->datatype)) ; else if (!strncmp(str, pioRoleSchemeOptionStr, sizeof(pioRoleSchemeOptionStr) - 1)) { #ifdef USE_MPI static const char pioRoleSchemeLastN[] = "last", pioRoleSchemeFirstN[] = "first", pioRoleSchemeBalanced[] = "balanced"; if (str[sizeof(pioRoleSchemeOptionStr) - 1] == '=') { const char *optargArg = str + sizeof(pioRoleSchemeOptionStr); if (!strcmp(optargArg, pioRoleSchemeLastN)) *pioRoleAssign = cdiPioCSRLastN; else if (!strcmp(optargArg, pioRoleSchemeFirstN)) *pioRoleAssign = cdiPioCSRFirstN; else if (!strcmp(optargArg, pioRoleSchemeBalanced)) *pioRoleAssign = cdiPioCSRBalanced; else invalidOptionDie("unknown scheme argument \"%s\" to -q%s", optargArg, pioRoleSchemeOptionStr); } else invalidOptionDie("long option %s needs argument\n", pioRoleSchemeOptionStr); #else invalidOptionDie("CDI-PIO option -q%s ignored in non-MPI mode\n", pioRoleSchemeOptionStr); #endif } else if (!strncmp(str, prefixOptionStr, sizeof(prefixOptionStr) - 1)) { if (str[sizeof(prefixOptionStr) - 1] == '=') { setup->prefix = str + sizeof(prefixOptionStr); } else invalidOptionDie("long option %s needs argument\n", prefixOptionStr); } else if ((bop = parseBooleanLongOption(sizeof(useDistGridOptionStr), useDistGridOptionStr, str)).matched) { #if defined USE_MPI && defined HAVE_PPM_DIST_ARRAY_H setup->flags = (setup->flags & ~PIO_WRITE_CONFIG_USE_DIST_GRID_FLAG) | (bop.value << PIO_WRITE_CONFIG_USE_DIST_GRID_BIT); #else invalidOptionDie("CDI-PIO option -q%s feature unavailable %s\n", useDistGridOptionStr + (bop.invert ? 0 : 3), #ifndef USE_MPI "in non-MPI mode" #else "without PPM feature distributed multi-array" #endif ); #endif } else if ((bop = parseBooleanLongOption(sizeof(uuidCreateOptionStr), uuidCreateOptionStr, str)).matched) { setup->flags = (setup->flags & ~PIO_WRITE_CONFIG_CREATE_UUID_FLAG) | (bop.value << PIO_WRITE_CONFIG_CREATE_UUID_BIT); } else if ((bop = parseBooleanLongOption(sizeof(presetDecoOptionStr), presetDecoOptionStr, str)).matched) { #ifdef USE_MPI setup->flags = (setup->flags & ~PIO_WRITE_CONFIG_PRESET_DECOMPOSITION_FLAG) | (bop.value << PIO_WRITE_CONFIG_PRESET_DECOMPOSITION_BIT); #else invalidOptionDie("CDI-PIO option -q%s unavailable in non-MPI mode\n", presetDecoOptionStr + (bop.invert ? 0 : 3)); #endif } else if ((bop = parseBooleanLongOption(sizeof(batchedRmaOptionStr), batchedRmaOptionStr, str)).matched) { #ifdef USE_MPI cdiPioConfSetBatchedRMA(pioConfHandle, bop.value); #else invalidOptionDie("CDI-PIO option -q%s unavailable in non-MPI mode\n", batchedRmaOptionStr + (bop.invert ? 0 : 3)); #endif } else if ((bop = parseBooleanLongOption(sizeof(curvilinearGridOptionStr), curvilinearGridOptionStr, str)).matched) { setup->flags = (setup->flags & ~PIO_WRITE_CONFIG_CREATE_CURVILINEAR_GRID_FLAG) | (bop.value << PIO_WRITE_CONFIG_CREATE_CURVILINEAR_GRID_BIT); } else invalidOptionDie("unknown long option: %s\n", str); } int main(int argc, char *argv[]) { struct model_config setup = default_setup; MPI_Comm commModel; int pioConfHandle = 0; pioRoleFunc pioRoleAssign = 0; #ifdef USE_MPI MPI_Comm commGlob; int sizeGlob; int rankGlob; int IOMode = PIO_MPI; int nProcsIO = 2; xmpi(MPI_Init(&argc, &argv)); commGlob = MPI_COMM_WORLD; xt_initialize(commGlob); xmpi(MPI_Comm_set_errhandler(commGlob, MPI_ERRORS_RETURN)); xmpi(MPI_Comm_size(commGlob, &sizeGlob)); xmpi(MPI_Comm_rank(commGlob, &rankGlob)); pioConfHandle = cdiPioConfCreate(); pioRoleAssign = cdiPioCSRLastN; #endif /* seed random generator */ unsigned randSeed; { #ifdef USE_MPI if (rankGlob == 0) #endif { struct timeval tv; int status = gettimeofday(&tv, NULL); if (status != 0) { perror("failed seed generation!"); exit(1); } randSeed = (unsigned) (tv.tv_sec ^ tv.tv_usec); } } { int opt; while ((opt = getopt(argc, argv, "f:m:n:z:t:y:cs:q:" #ifdef USE_MPI "p:w:" #endif )) != -1) switch (opt) { #ifdef USE_MPI case 'p': IOMode = cdiPioStr2IOMode(optarg); if (IOMode < 0) { fprintf(stderr, "Unsupported PIO mode requested: %s\n", optarg); exit(EXIT_FAILURE); } break; case 'w': { long temp = strtol(optarg, NULL, 0); if (temp < 0 || temp > INT_MAX / 2) { fprintf(stderr, "Unsupported number of I/O servers: %ld\n", temp); exit(EXIT_FAILURE); } nProcsIO = (int) temp; } break; #endif case 'q': parse_long_option(&setup, pioConfHandle, &pioRoleAssign, optarg, argc, argv); break; case 'f': { int found = 0; for (size_t i = 0; i < sizeof(suffix2type) / sizeof(suffix2type[0]); ++i) if (!strcmp(optarg, suffix2type[i].suffix)) { found = 1; setup.filetype = suffix2type[i].type; setup.suffix = suffix2type[i].suffix; setup.datatype = suffix2type[i].defaultDT; break; } if (!found) { fprintf(stderr, "Unsupported format requested: %s\n", optarg); exit(EXIT_FAILURE); } } break; case 'm': setup.nlon = parse_intarg("error parsing number of longitudes"); break; case 'n': setup.nlat = parse_intarg("error parsing number of latitudes"); break; case 'y': setup.nvars = parse_intarg("error parsing number of variables"); if (setup.nvars < 1) { fputs("number of variables must be greater than zero!\n", stderr); exit(EXIT_FAILURE); } if (setup.nvars > 127) { fputs("number of variables must not exceed 127!\n", stderr); exit(EXIT_FAILURE); } break; case 'z': setup.max_nlev = parse_intarg("error parsing number of levels"); if (setup.max_nlev < 1) { fputs("number of levels must be greater than zero!\n", stderr); exit(EXIT_FAILURE); } break; case 't': setup.nts = parse_intarg("error parsing number of timesteps"); break; case 'c': setup.flags &= ~PIO_WRITE_CONFIG_CHECKSUM_FLAG; break; case 's': randSeed = parse_unsignedarg("error parsing random seed"); break; default: /* '?' */ fprintf(stderr, "Usage: %s " "[-m nlon] [-n nlat] [-z nlev] [-t nts] [-y num_vars]" #ifdef USE_MPI " [-p PIO_MODE] [-w NIOSERVERS] [-c]" #endif "\n", argv[0]); exit(EXIT_FAILURE); } } #ifdef USE_MPI MPI_Bcast(&randSeed, 1, MPI_UNSIGNED, 0, MPI_COMM_WORLD); #endif cdi_seed_repeatable_random(randSeed); #ifdef USE_MPI if (rankGlob == 0) #endif fprintf(stderr, "random seed=%u\n", randSeed); #ifdef USE_MPI int pioNamespace; cdiPioConfSetIOMode(pioConfHandle, IOMode); cdiPioConfSetCSRole(pioConfHandle, pioRoleAssign(commGlob, IOMode, nProcsIO)); cdiPioConfSetPartInflate(pioConfHandle, 1.0f); int initNamespace = namespaceGetActive(); commModel = cdiPioInit(commGlob, pioConfHandle, &pioNamespace); if (commModel != MPI_COMM_NULL) { namespaceSetActive(pioNamespace); #else commModel = -1; #endif modelRun(&setup, commModel); #ifdef USE_MPI } cdi_repeatable_finalize(); pioFinalize(); namespaceSetActive(initNamespace); cdiPioConfDestroy(pioConfHandle); xt_finalize(); MPI_Finalize(); #endif return 0; } /* * Local Variables: * c-file-style: "Java" * c-basic-offset: 2 * indent-tabs-mode: nil * show-trailing-whitespace: t * require-trailing-newline: t * End: */ cdo-2.6.6.1/libcdi/tests/pio_cksum_fpguard.run.in0000664000175000017500000000025615271332515022050 0ustar alastairalastair#!@SHELL@ pio_write_args="-p PIO_FPGUARD -w 3" mpi_task_num=6 . ./pio_write.run ( . ./pio_write_dist_array.run ) || test $? -eq 77 # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/test_cksum_base.in0000664000175000017500000000163415271332515020720 0ustar alastairalastair# This file is meant to be included for the supported file formats. prefix=`echo "$0" | sed 's@.*/@@'` suffix=${suffix-grb} case ${suffix} in grb) test 'x@ENABLE_GRIB@' = xyes || exit 77 ;; grb2) @HAVE_LIBGRIB_API_FALSE@exit 77 test 'x@ENABLE_GRIB@' = xyes || exit 77 ;; nc) @ENABLE_NETCDF_FALSE@exit 77 ;; nc2) @ENABLE_NETCDF_FALSE@exit 77 ;; nc4) @ENABLE_NETCDF_FALSE@exit 77 ;; srv) test 'x@ENABLE_SERVICE@' = xyes || exit 77 ;; ext) test 'x@ENABLE_EXTRA@' = xyes || exit 77 ;; ieg) test 'x@ENABLE_IEG@' = xyes || exit 77 ;; *) echo "Unsupported suffix '${suffix}'" >&2 exit 1 ;; esac ../libtool --mode=execute ${tool_wrap} ./cksum_write -b "${prefix}" -f ${suffix} || exit 1 ../libtool --mode=execute ${tool_wrap} ./cksum_read "${prefix}.${suffix}" "${prefix}.cksum" || exit 1 # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/ensure_array_size.c0000664000175000017500000000075015271332515021110 0ustar alastairalastair#ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "ensure_array_size.h" #include "error.h" void realloc_array(void **array, size_t elem_size, size_t *curr_array_size, size_t requested_size) { const size_t array_inc_size = (1024 + elem_size - 1) / elem_size; *curr_array_size = array_inc_size * ((requested_size + array_inc_size) / array_inc_size); *array = realloc(*array, *curr_array_size * elem_size); if (!*array) xabort("reallocation failed"); } cdo-2.6.6.1/libcdi/tests/test_cdf_write.c0000664000175000017500000000401115271332515020356 0ustar alastairalastair#ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "cdi.h" #include "dmemory.h" #include "simple_model_helper.h" static double my_gamma_dist(double x); #define missValue (-50.0) int main(int argc, const char **argv) { // todo: handle optional arguments here to increase test coverage const char *fname = (argc > 1) ? argv[1] : "test.nc"; int streamID = streamOpenWrite(fname, CDI_FILETYPE_NC); if (streamID < 0) { fprintf(stderr, "Open failed on %s: %s\n", fname, cdiStringError(streamID)); return EXIT_FAILURE; } enum { sizey = 40, sizex = 2 * sizey, }; int gridID = createLocalCurvilinearGrid(sizex, sizey); int zaxisID = zaxisCreate(ZAXIS_SURFACE, 1); int vlistID = vlistCreate(); int varID = vlistDefVar(vlistID, gridID, zaxisID, TIME_VARYING); vlistDefVarMissval(vlistID, varID, missValue); { static const char creatorText[] = "CDI test_cdf_write"; cdiDefAttTxt(vlistID, varID, "CDI Text Attribute test, created by", sizeof(creatorText) - 1, creatorText); } int taxisID = taxisCreate(TAXIS_ABSOLUTE); vlistDefTaxis(vlistID, taxisID); streamDefVlist(streamID, vlistID); (void) streamDefTimestep(streamID, 0); { double(*data)[sizex] = (double(*)[sizex]) Malloc(sizeof(**data) * sizex * sizey); for (size_t j = 0; j < sizey; ++j) for (size_t i = 0; i < sizex; ++i) { data[j][i] = my_gamma_dist((double) i / (double) (sizex - 1)); } data[sizey / 3][sizex / 2] = missValue; streamWriteVar(streamID, 0, (const double *) data, 1); Free(data); } streamClose(streamID); return EXIT_SUCCESS; } static double my_gamma_dist(double x) { enum { k = 9, }; const double theta = 0.5; x *= 20.0; double pdf_x = 1.0 / (tgamma((double) k) * pow(theta, k)) * pow(x, k - 1) * exp(-x / theta); return pdf_x; } /* * Local Variables: * c-file-style: "Java" * c-basic-offset: 2 * indent-tabs-mode: nil * show-trailing-whitespace: t * require-trailing-newline: t * End: */ cdo-2.6.6.1/libcdi/tests/simple_model_helper.h0000664000175000017500000000701415271332515021374 0ustar alastairalastair#ifndef SIMPLE_MODEL_HELPER_H #define SIMPLE_MODEL_HELPER_H #if defined(HAVE_CONFIG_H) #include "config.h" #endif #include #include #include enum { /* 129 is the first user-defined code of the GRIB format */ GRIB_USERDEF = 129, }; void var_scale(int datatype, double *mscale, double *mrscale); #define DEG2RAD(phi) ((M_PI / 180.0) * (phi)) #define RAD2DEG(phi) ((180. / M_PI) * (phi)) static inline double sign_flat(double v) { #ifdef _CRAYC if (v == 0 && copysign(1.0, v) < 0.0) return 0.0; #else if (!(v < 0.0 || v > 0.0)) return 0.0; #endif // if (v == 0.0) return 0.0; return v; } /* data generator function */ static inline double dg_wobble(double frac_x, double frac_y, double mscale, double mrscale) { double r = sign_flat(round((cos(2.0 * M_PI * frac_x) * sin(2.0 * M_PI * frac_y)) * mscale)) * mrscale; return r; } time_t cditime2time_t(int date, int timeofday); void time_t2cditime(time_t t, int *date, int *timeofday); void composeFilename(char **buf, const char *fname_prefix, int tfID, const char *suffix); int composeStream(char **buf, const char *fname_prefix, int tfID, const char *suffix, int filetype); int createGlobalLatLonGrid(int nlon, int nlat); int createLocalCurvilinearGrid(int sizex, int sizey); struct cart_coord { double lon, lat; }; /* * coords_: points to array of size xyRange[0][0] * xyRange[0][1] * 2, where * the first half of xyRange[0][0] * xyRange[0][1] elements will be * initialized to longitude values and the second half to the latitude values * a: cartesian coordinates of rectangular part of globe in * anti-clockwise order * sizex, sizey: number of grid points in x and y directions respectively * xyRange: subset of the ranges [0,sizex) and [0,sizey) to compute, * given as start in xyRange[0] and count values in xyRange[1] for x * at index 0 and y at index 1 */ void computeCurvilinearChunk(double *coords_, const struct cart_coord a[4], size_t sizex, size_t sizey, const size_t xyRange[2][2]); #if defined USE_MPI && !defined HAVE_PPM_CORE struct PPM_extent { int32_t first, size; }; struct PPM_extent PPM_uniform_partition(struct PPM_extent set_interval, int nparts, int part_idx); int PPM_prime_factorization_32(uint32_t n, uint32_t **factors); #endif #if defined USE_MPI && defined HAVE_PPM_CORE #include #include #ifdef _OPENMP #define cdi_omp_pragma(prg) _Pragma(prg) #else #define cdi_omp_pragma(prg) #endif #define cdi_seed_repeatable_random(seed) \ do { \ int seed_ = (int) seed; \ MPI_Comm comm_ = MPI_COMM_WORLD; \ cdi_omp_pragma("omp parallel") if ((!PPM_initialized() || PPM_finalized())) PPM_initialize(&comm_, &seed_, NULL); \ else PPM_ya_rand_init(MPI_COMM_WORLD, seed_); \ } while (0) #define cdi_repeatable_random() ((long) (PPM_irandp())) #define cdi_repeatable_finalize() PPM_finalize() #else /* add random-wrapper to make call results repeatable, if PPM_random * can't be used */ void cdi_seed_repeatable_random(unsigned seed); long cdi_repeatable_random(void); #define cdi_repeatable_finalize() \ do { \ } while (0) #endif #endif cdo-2.6.6.1/libcdi/tests/test_table.run.in0000664000175000017500000000017615271332515020476 0ustar alastairalastair#!@SHELL@ @top_builddir@/libtool --mode=execute ${tool_wrap} ./test_table || exit 1 # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/pio_cksum_nc4.run.in0000664000175000017500000000032015271332515021074 0ustar alastairalastair#!@SHELL@ suffix=nc4 pio_write_args="-w 3 -qtaxis-type=relative" #mpi_task_num=7 mpi_task_num=6 . ./pio_write.run ( . ./pio_write_dist_array.run ) || test $? -eq 77 # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/test_cksum_nc_chunk.run.in0000664000175000017500000000044515271332515022400 0ustar alastairalastair#!@SHELL@ @ENABLE_NETCDF_FALSE@exit 77 prefix='test_cksum_nc_chunk.run' format=nc @top_builddir@/libtool --mode=execute ${tool_wrap} ./cksum_write_chunk -b ${prefix} -m 17 || exit 1 @top_builddir@/libtool --mode=execute ${tool_wrap} ./cksum_read ${prefix}.${format} ${prefix}.cksum || exit 1 cdo-2.6.6.1/libcdi/tests/test_table.c0000664000175000017500000000135415271332515017506 0ustar alastairalastair/* DO NOT REMOVE the config.h include file under any circumstances, * it's very much needed on some platforms */ #if defined(HAVE_CONFIG_H) #include "config.h" #endif /* DO NOT REMOVE the above config.h include file under any * circumstances as long as it's the autoconf configuration header * used to build this package. When it's missing on some platforms, * some poor person has to do long, tedious debugging sessions, where * struct offsets almost imperceptibly change from one file to the * next to find out what happened */ #include #include #include "cdi.h" int main(void) { tableInqEntry(-1, -1, -1, NULL, NULL, NULL); // assert(tableInqEntry(-1, -1, -1, NULL, NULL, NULL) != 0); return EXIT_SUCCESS; } cdo-2.6.6.1/libcdi/tests/test_cksum_ext.run.in0000664000175000017500000000005115271332515021401 0ustar alastairalastair#!@SHELL@ suffix=ext . ./test_cksum_base cdo-2.6.6.1/libcdi/tests/simple_model.c0000664000175000017500000002617615271332515020042 0ustar alastairalastair#if defined(HAVE_CONFIG_H) #include "config.h" #endif #include #include #include #include #ifdef USE_MPI #include #include #endif #include "cdi.h" #ifdef USE_MPI #include "cdipio.h" #include "pio_util.h" #ifdef HAVE_PPM_CORE #include #endif #endif #include "cksum.h" #include "dmemory.h" #include "error.h" #include "pio_write.h" #include "pio_write_setup_grid.h" #include "simple_model_helper.h" #include "cdi_uuid.h" enum { ntfiles = 2, }; static void modelRegionCompute(double region[], size_t offset, size_t len, int nlev, int nlat, int nlon, int tsID, double mscale, double mrscale) { size_t local_pos; (void) nlev; for (local_pos = 0; local_pos < len; ++local_pos) { size_t global_pos = offset + local_pos; int k = (int) (global_pos / (size_t) (nlon * nlat)); int j = (int) (global_pos % (size_t) (nlon * nlat) / (size_t) nlon); int i = (int) (global_pos % (size_t) nlon); region[local_pos] = dg_wobble((double) ((i + tsID) % nlon) / (double) (nlon - 1), (double) ((j + k) % nlat) / (double) (nlat - 1), mscale, mrscale); } } void modelRun(const struct model_config *setup, MPI_Comm comm) { struct varDesc_t { size_t size; int nlev, zaxisID, id, code; uint32_t checksum_state; #if USE_MPI int chunkSize, start; Xt_idxlist partDesc; #endif bool useFloat; } * varDesc; int gridID, taxisID, vlistID, tsID, tfID = 0; enum { nmiss = 0 }; double *levs; double *var = NULL, *varslice = NULL; float *varsliceF = NULL; double mscale, mrscale; time_t current_time; int vdate = 19850101, vtime = 120000; int rank = 0; char *filename = NULL; int nlon = setup->nlon, nlat = setup->nlat; size_t nVars = (size_t) setup->nvars; size_t varslice_size = 0, varsliceF_size = 0; #if USE_MPI int *chunks = NULL, *displs = NULL, comm_size = 1; Xt_idxlist *partDescPreset = NULL; int *conversion = NULL; #endif #if USE_MPI xmpi(MPI_Comm_rank(comm, &rank)); xmpi(MPI_Comm_size(comm, &comm_size)); if (rank == 0 && (setup->flags & PIO_WRITE_CONFIG_CHECKSUM_FLAG)) { chunks = Malloc((size_t) comm_size * sizeof(chunks[0])); displs = Malloc((size_t) comm_size * sizeof(displs[0])); var = Malloc((size_t) nlon * (size_t) nlat * (size_t) setup->max_nlev * sizeof(var[0])); } #else (void) comm; #endif var_scale(setup->datatype, &mscale, &mrscale); gridID = setupGrid(setup, comm); levs = (double *) Malloc((size_t) setup->max_nlev * sizeof(levs[0])); { double lscale = 1.0 / (double) (setup->max_nlev - 1); for (size_t i = 0; i < (size_t) setup->max_nlev; ++i) levs[i] = 101300.0 - 13000.0 * expm1(2.173 * (double) i * lscale); /* GRIB1 only supports integral hPa values in pressure levels */ if (setup->filetype == CDI_FILETYPE_GRB) for (size_t i = 0; i < (size_t) setup->max_nlev; ++i) levs[i] = round(levs[i] * 0.01) * 100.0; } vlistID = vlistCreate(); varDesc = (struct varDesc_t *) Malloc(nVars * sizeof(varDesc[0])); #if USE_MPI if (setup->flags & PIO_WRITE_CONFIG_PRESET_DECOMPOSITION_FLAG) { partDescPreset = (Xt_idxlist *) Malloc(nVars * sizeof(*partDescPreset)); conversion = (int *) Malloc(nVars * sizeof(*conversion)); } #endif for (size_t varIdx = 0; varIdx < nVars; varIdx++) { int varLevs = (int) cdi_repeatable_random() % 4; switch (varLevs) { case 1: varLevs = setup->max_nlev / 3; break; case 2: varLevs = setup->max_nlev >= 11 ? 11 : setup->max_nlev / 2; break; case 3: varLevs = setup->max_nlev - 1; break; } ++varLevs; varDesc[varIdx].nlev = varLevs; for (size_t i = 0; i < (size_t) varIdx; ++i) if (varDesc[i].nlev == varLevs) { varDesc[varIdx].zaxisID = varDesc[i].zaxisID; goto zaxisIDset; } if (varLevs == 1) varDesc[varIdx].zaxisID = zaxisCreate(ZAXIS_SURFACE, 1); else { varDesc[varIdx].zaxisID = zaxisCreate(ZAXIS_PRESSURE, varDesc[varIdx].nlev); zaxisDefLevels(varDesc[varIdx].zaxisID, levs); } if (setup->flags & PIO_WRITE_CONFIG_CREATE_UUID_FLAG) { unsigned char uuid[CDI_UUID_SIZE]; if (rank == 0) cdiCreateUUID(uuid); #if USE_MPI MPI_Bcast(uuid, CDI_UUID_SIZE, MPI_UNSIGNED_CHAR, 0, comm); #endif cdiDefKeyBytes(varDesc[varIdx].zaxisID, CDI_GLOBAL, CDI_KEY_UUID, uuid, CDI_UUID_SIZE); } zaxisIDset: varDesc[varIdx].id = vlistDefVar(vlistID, gridID, varDesc[varIdx].zaxisID, TIME_VARIABLE); varDesc[varIdx].size = (size_t) nlon * (size_t) nlat * (size_t) varDesc[varIdx].nlev; #ifdef USE_MPI { for (size_t i = 0; i < varIdx; ++i) if (varDesc[i].nlev == varLevs) { varDesc[varIdx].partDesc = varDesc[i].partDesc; varDesc[varIdx].start = varDesc[i].start; varDesc[varIdx].chunkSize = varDesc[i].chunkSize; goto partDescriptionSet; } struct PPM_extent range = PPM_uniform_partition((struct PPM_extent){ 0, (int32_t) varDesc[varIdx].size }, comm_size, rank); int start = range.first; int chunkSize = range.size; varDesc[varIdx].start = start; varDesc[varIdx].chunkSize = chunkSize; varDesc[varIdx].partDesc = xt_idxstripes_new(&(struct Xt_stripe){ .start = start, .nstrides = chunkSize, .stride = 1 }, 1); } partDescriptionSet:; #endif varDesc[varIdx].code = GRIB_USERDEF + (int) varIdx; vlistDefVarCode(vlistID, varDesc[varIdx].id, varDesc[varIdx].code); vlistDefVarDatatype(vlistID, varDesc[varIdx].id, setup->datatype); varDesc[varIdx].useFloat = (bool) (cdi_repeatable_random() & 1); #ifdef USE_MPI if (setup->flags & PIO_WRITE_CONFIG_PRESET_DECOMPOSITION_FLAG) { partDescPreset[varIdx] = varDesc[varIdx].partDesc; conversion[varIdx] = varDesc[varIdx].useFloat ? CDI_DATATYPE_FLT32 : CDI_DATATYPE_FLT64; } #endif } taxisID = taxisCreate(setup->taxistype); if (setup->taxisunit != -1) taxisDefTunit(taxisID, setup->taxisunit); vlistDefTaxis(vlistID, taxisID); for (tfID = 0; tfID < ntfiles; tfID++) { for (size_t varIdx = 0; varIdx < nVars; ++varIdx) varDesc[varIdx].checksum_state = 0; int streamID = composeStream(&filename, setup->prefix, tfID, setup->suffix, setup->filetype); #ifdef USE_MPI if (partDescPreset) cdiPioStreamDefDecomposedVlist(streamID, vlistID, partDescPreset, conversion); else #endif streamDefVlist(streamID, vlistID); vdate = 19850101; vtime = 120000; current_time = cditime2time_t(vdate, vtime); for (tsID = 0; tsID < setup->nts; tsID++) { int vdatetime[2]; time_t2cditime(current_time, &vdatetime[1], &vdatetime[0]); taxisDefVdate(taxisID, vdatetime[1]); taxisDefVtime(taxisID, vdatetime[0]); streamDefTimestep(streamID, tsID); if (setup->filetype == CDI_FILETYPE_EXT) { /* EXTRA doesn't store time, only date * set the value to 0 before checksumming, because a * time field of 0 is what reading an EXTRA file will * return */ vdatetime[0] = 0; } for (size_t varIdx = 0; varIdx < nVars; ++varIdx) { #ifdef USE_MPI int start = varDesc[varIdx].start; size_t chunkSize = (size_t) varDesc[varIdx].chunkSize; #else size_t chunkSize = varDesc[varIdx].size; int start = 0; #endif if (varslice_size < chunkSize) { varslice = (double *) Realloc(varslice, chunkSize * sizeof(var[0])); varslice_size = chunkSize; } modelRegionCompute(varslice, (size_t) start, chunkSize, varDesc[varIdx].nlev, nlat, nlon, tsID, mscale, mrscale); bool useFloat = varDesc[varIdx].useFloat; if (useFloat) { if (varsliceF_size < chunkSize) { varsliceF = (float *) Realloc(varsliceF, chunkSize * sizeof(varsliceF[0])); varsliceF_size = chunkSize; } for (size_t i = 0; i < chunkSize; ++i) varslice[i] = varsliceF[i] = (float) varslice[i]; } if (setup->flags & PIO_WRITE_CONFIG_CHECKSUM_FLAG) { #if USE_MPI int chunk = (int) chunkSize; xmpi(MPI_Gather(&chunk, 1, MPI_INT, chunks, 1, MPI_INT, 0, comm)); if (rank == 0) { int accum = 0; for (size_t i = 0; i < (size_t) comm_size; ++i) { displs[i] = accum; accum += chunks[i]; } } xmpi(MPI_Gatherv(varslice, chunk, MPI_DOUBLE, var, chunks, displs, MPI_DOUBLE, 0, comm)); #else var = varslice; #endif } if (rank == 0 && (setup->flags & PIO_WRITE_CONFIG_CHECKSUM_FLAG)) { memcrc_r(&varDesc[varIdx].checksum_state, (const unsigned char *) vdatetime, sizeof(vdatetime)); memcrc_r(&varDesc[varIdx].checksum_state, (const unsigned char *) var, varDesc[varIdx].size * sizeof(var[0])); } #ifdef USE_MPI if (useFloat) streamWriteVarPartF(streamID, varDesc[varIdx].id, varsliceF, nmiss, varDesc[varIdx].partDesc); else streamWriteVarPart(streamID, varDesc[varIdx].id, varslice, nmiss, varDesc[varIdx].partDesc); #else if (useFloat) streamWriteVarF(streamID, varDesc[varIdx].id, varsliceF, nmiss); else streamWriteVar(streamID, varDesc[varIdx].id, varslice, nmiss); #endif } current_time += 86400; #ifdef USE_MPI pioWriteTimestep(); #endif } streamClose(streamID); if (rank == 0 && (setup->flags & PIO_WRITE_CONFIG_CHECKSUM_FLAG)) { FILE *tablefp; composeFilename(&filename, setup->prefix, tfID, "cksum"); if (!(tablefp = fopen(filename, "w"))) { perror("failed to open table file"); exit(EXIT_FAILURE); } for (size_t varIdx = 0; varIdx < nVars; ++varIdx) { uint32_t cksum = memcrc_finish(&varDesc[varIdx].checksum_state, (off_t) ((varDesc[varIdx].size * sizeof(var[0]) + sizeof(int) * 2) * (size_t) setup->nts)); int code = vlistInqVarCode(vlistID, varDesc[varIdx].id); if (fprintf(tablefp, "%08lx %d\n", (unsigned long) cksum, code) < 0) { perror("failed to write table file"); exit(EXIT_FAILURE); } } if (fclose(tablefp) != 0) { perror("failed to close table file"); exit(EXIT_FAILURE); } } } #ifdef USE_MPI pioEndTimestepping(); #endif Free(varslice); Free(varsliceF); vlistDestroy(vlistID); taxisDestroy(taxisID); for (size_t varIdx = 0; varIdx < nVars; varIdx++) { int zID = varDesc[varIdx].zaxisID; if (zID != CDI_UNDEFID) { zaxisDestroy(zID); #if USE_MPI xt_idxlist_delete(varDesc[varIdx].partDesc); #endif for (size_t j = varIdx + 1; j < nVars; ++j) if (zID == varDesc[j].zaxisID) varDesc[j].zaxisID = CDI_UNDEFID; } } gridDestroy(gridID); #if USE_MPI Free(conversion); Free(partDescPreset); Free(displs); Free(chunks); Free(var); #endif Free(varDesc); Free(levs); Free(filename); } /* * Local Variables: * c-file-style: "Java" * c-basic-offset: 2 * indent-tabs-mode: nil * show-trailing-whitespace: t * require-trailing-newline: t * End: */ cdo-2.6.6.1/libcdi/tests/pio_write.run.in0000664000175000017500000000353615271332515020354 0ustar alastairalastair#! @SHELL@ set -e case "$0" in */*) prefix=`expr "$0" : '.*/\([^/]*\)$'` ;; *) prefix=$0 ;; esac case x"${CDI_PIO_TEST_DIR+${CDI_PIO_TEST_DIR}}" in x) : ;; *) prefix="${CDI_PIO_TEST_DIR}/${prefix}" ;; esac suffix=${suffix-grb} if ${mpi_task_num+:} false; then @ENABLE_MPI_FALSE@exit 77 test 'x@MPI_LAUNCH@' != xtrue || exit 77 pio_write=${pio_write-'./pio_write.parallel'} variations=${variations-"'' -qno-batch-rma -qcache-redists -qcreate-curvilinear-grid -qpreset-decomposition=true"} launch="@MPI_LAUNCH@ -n ${mpi_task_num} ${tool_wrap_mpi}" else pio_write=${pio_write-'./pio_write'} variations=${variations-"'' -qcreate-curvilinear-grid"} launch=${tool_wrap} fi case ${suffix} in grb) test 'x@ENABLE_GRIB@' = xyes || exit 77 ;; grb2) @HAVE_LIBGRIB_API_FALSE@exit 77 test 'x@ENABLE_GRIB@' = xyes || exit 77 ;; nc) @ENABLE_NETCDF_FALSE@exit 77 ;; nc2) @ENABLE_NETCDF_FALSE@exit 77 ;; nc4) @ENABLE_NETCDF_FALSE@exit 77 ;; *) echo "Unsupported suffix '${suffix}'" >&2 exit 1 ;; esac test_variation () { if prefix_dirname=`expr "$prefix" : '\(.*\)/'` ; then mkdir -p "${prefix_dirname}" fi echo "creating data with $1" >&2 variation=$1 @top_builddir@/libtool --mode=execute \ ${launch} \ ${pio_write} "-qprefix=${prefix}" -f ${suffix} \ ${pio_write_args} -s 7 ${variation} || exit 1 tfile=0 ntfiles=2 while [ "$tfile" -lt "$ntfiles" ]; do p="${prefix}_${tfile}" echo "checking ${p}.${suffix}" >&2 @top_builddir@/libtool --mode=execute \ ${tool_wrap} ./cksum_read "${p}.${suffix}" "${p}.cksum" rm "${p}.${suffix}" "${p}.cksum" tfile=`expr "$tfile" + 1` done } eval "set dummy $variations"; shift for variation in "$@"; do test_variation "$variation" done # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/test_cdf_read.c0000664000175000017500000001036415271332515020147 0ustar alastairalastair#ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "cdi.h" #include "dmemory.h" static void printAtts(int vlistID); int main(int argc, const char **argv) { // todo: handle optional arguments here to increase test coverage const char *fname = (argc > 1) ? argv[1] : "test.nc"; int countMissingValues = 1; int streamID = streamOpenRead(fname); if (streamID < 0) { fprintf(stderr, "Open failed for file %s: %s\n", fname, cdiStringError(streamID)); return EXIT_FAILURE; } int vlistID = streamInqVlist(streamID); size_t nVars = (size_t) vlistNvars(vlistID); double *buf = NULL; size_t bufSize = 0; size_t allNmissSum = 0; printAtts(vlistID); for (int tsID = 0; streamInqTimestep(streamID, tsID); ++tsID) { for (size_t varID = 0; varID < nVars; ++varID) { size_t memSize = (size_t) vlistInqVarSize(vlistID, (int) varID) * sizeof(double); SizeType nmiss; if (memSize > bufSize) { double *temp = (double *) Realloc(buf, memSize); if (!temp) { perror("read buffer reallocation failed"); return EXIT_FAILURE; } buf = temp; } streamReadVar(streamID, (int) varID, buf, &nmiss); allNmissSum += (size_t) nmiss; } } if (countMissingValues) printf("missing values count = %zu\n", allNmissSum); free(buf); streamClose(streamID); return EXIT_SUCCESS; } static void printAtts(int vlistID) { size_t nVars = (size_t) vlistNvars(vlistID); static const char globDesc[] = "global", varDescPrefix[] = "variable "; size_t digitsPerInt = 9; size_t bufSize = digitsPerInt + sizeof(varDescPrefix); void *restrict buf = Malloc(bufSize); if (!buf) { perror("attribute buffer resize failed"); exit(EXIT_FAILURE); } for (size_t varIdx = 0; varIdx <= nVars; ++varIdx) { int nAtts, attType, attLen; char attName[CDI_MAX_NAME + 1]; int varID = (int) varIdx - 1; cdiInqNatts(vlistID, varID, &nAtts); for (size_t attIdx = 0; attIdx < (size_t) nAtts; attIdx++) { int rc = cdiInqAtt(vlistID, varID, (int) attIdx, attName, &attType, &attLen); { const char *varDesc = varIdx > 0 ? (snprintf((char *) buf, bufSize, "%s%d", varDescPrefix, vlistInqVarCode(vlistID, varID)), (char *) buf) : globDesc; printf("%s attribute \"%s\", value: ", varDesc, attName); } if (attLen < 0) { puts("error retrieving value"); continue; } size_t elemSize = 0; switch (attType) { case CDI_DATATYPE_TXT: elemSize = 1; break; case CDI_DATATYPE_FLT: elemSize = sizeof(double); break; case CDI_DATATYPE_INT: elemSize = sizeof(int); break; } size_t attSize = elemSize * ((size_t) attLen + 1); if (attSize > bufSize) { if (!(buf = Realloc(buf, attSize))) { perror("attribute buffer resize failed"); exit(EXIT_FAILURE); } } switch (attType) { case CDI_DATATYPE_TXT: rc = cdiInqAttTxt(vlistID, (int) varID, attName, attLen, (char *) buf); if (rc == CDI_NOERR) printf("\"%.*s\"", attLen, (char *) buf); break; case CDI_DATATYPE_FLT: rc = cdiInqAttFlt(vlistID, (int) varID, attName, attLen + 1, (double *) buf); if (rc == CDI_NOERR && attLen) { const double *restrict dp = (const double *) buf; printf("%10g", dp[0]); for (size_t i = 1; i < (size_t) attLen; ++i) printf(", %10g", dp[i]); } break; case CDI_DATATYPE_INT: rc = cdiInqAttInt(vlistID, (int) varID, attName, attLen + 1, (int *) buf); if (rc == CDI_NOERR && attLen) { const int *restrict ip = (const int *) buf; printf("%d", ip[0]); for (size_t i = 1; i < (size_t) attLen; ++i) printf(", %d", ip[i]); } break; } if (rc == CDI_NOERR) { putchar('\n'); } else { puts("error retrieving value"); } } } free(buf); } /* * Local Variables: * c-file-style: "Java" * c-basic-offset: 2 * indent-tabs-mode: nil * show-trailing-whitespace: t * require-trailing-newline: t * End: */ cdo-2.6.6.1/libcdi/tests/test_month_adjust.c0000664000175000017500000000417215271332515021117 0ustar alastairalastair/* DO NOT REMOVE the config.h include file under any circumstances, * it's very much needed on some platforms */ #if defined(HAVE_CONFIG_H) #include "config.h" #endif /* DO NOT REMOVE the above config.h include file under any * circumstances as long as it's the autoconf configuration header * used to build this package. When it's missing on some platforms, * some poor person has to do long, tedious debugging sessions, where * struct offsets almost imperceptibly change from one file to the * next to find out what happened */ #include #include #include #include "normalize_month.h" int main(void) { static const int vals[] = { -12, -17, 17, 11, -769652651 }; enum { numVals = sizeof(vals) / sizeof(vals[0]) }; for (size_t i = 0; i < numVals; ++i) { enum { startYear = 1900 }; int month = vals[i]; struct YearMonth ym = normalize_month(startYear, month); if ((long) ym.year * 12 + ym.month != (long) startYear * 12 + month) { fprintf(stderr, "problem: month=%d, ym.month=%d, ym.year=%d\n" "(long)ym.year * 12 + ym.month = %ld\n" "(long)startYear * 12 + month = %ld\n", month, ym.month, ym.year, (long) ym.year * 12 + ym.month, (long) startYear * 12 + month); abort(); } } { struct timeval tv; if (gettimeofday(&tv, NULL)) { perror("failed to get time for random number generator initialization"); exit(EXIT_FAILURE); } srandom((unsigned) (tv.tv_sec ^ tv.tv_usec)); } for (size_t j = 0; j < 1000000; ++j) { int year = (int) (random() - RAND_MAX / 2), month = (int) (random() - RAND_MAX / 2); struct YearMonth ym = normalize_month(year, month); if ((long) ym.year * 12 + ym.month != (long) year * 12 + month) { fprintf(stderr, "problem: month=%d, ym.month=%d, ym.year=%d\n" "(long)ym.year * 12 + ym.month = %ld\n" "(long)year * 12 + month = %ld\n", month, ym.month, ym.year, (long) ym.year * 12 + ym.month, (long) year * 12 + month); abort(); } } return EXIT_SUCCESS; } cdo-2.6.6.1/libcdi/tests/pio_write_setup_grid.h0000664000175000017500000000075715271332515021621 0ustar alastairalastair#ifndef PIO_WRITE_SETUP_GRID_H #define PIO_WRITE_SETUP_GRID_H #if defined(HAVE_CONFIG_H) #include "config.h" #endif #ifdef USE_MPI #include #endif #include "pio_write.h" #ifdef USE_MPI void findPartition2D(int npart[2], int num_parts); #endif int setupGrid(const struct model_config *setup, MPI_Comm comm); #endif /* * Local Variables: * c-file-style: "Java" * c-basic-offset: 2 * indent-tabs-mode: nil * show-trailing-whitespace: t * require-trailing-newline: t * End: */ cdo-2.6.6.1/libcdi/tests/pio_write_deco2d.run.in0000664000175000017500000000014615271332515021566 0ustar alastairalastair#!@SHELL@ pio_write='./pio_write_deco2d' . ./pio_write.run # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/stream_cksum.c0000664000175000017500000001416615271332515020062 0ustar alastairalastair#ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "cdi.h" #include "cksum.h" #include "stream_cksum.h" #include "dmemory.h" const char *zaxisNamePtr(int zaxistype); struct cksum_table * cksum_stream(const char *fname, size_t *table_len) { int nvars; uint32_t *checksum_state = NULL; enum directionZ { DIRECTION_DOWN = 1, DIRECTION_NONE, DIRECTION_UP }; struct var_desc_t { int x, y, z; enum directionZ zDirection; int code; size_t chars; } *varDesc = NULL; size_t var_size_max_chars = 0; double *buf = NULL; struct cksum_table *file_vars = NULL; do { // Open the dataset int streamID = streamOpenRead(fname); if (streamID < 0) { fprintf(stderr, "Cannot open data input file %s: %s\n", fname, cdiStringError(streamID)); nvars = -1; break; } // Get the variable list of the dataset int vlistID = streamInqVlist(streamID); int fileType = streamInqFiletype(streamID); bool isLegacyFile = fileType == CDI_FILETYPE_SRV || fileType == CDI_FILETYPE_EXT; nvars = vlistNvars(vlistID); int ngrids = vlistNumGrids(vlistID); int nzaxis = vlistNumZaxis(vlistID); if (nzaxis < 0 || ngrids < 0) { fprintf(stderr, "Error in grid/zaxis count query %d:%d\n", ngrids, nzaxis); nvars = -1; break; } checksum_state = (uint32_t *) Calloc((size_t) nvars, sizeof(checksum_state[0])); varDesc = (struct var_desc_t *) Malloc((size_t) nvars * sizeof(varDesc[0])); for (int varIdx = 0; varIdx < nvars; ++varIdx) { int grid = vlistInqVarGrid(vlistID, varIdx), gridType, varCode = vlistInqVarCode(vlistID, varIdx); varDesc[varIdx].code = varCode; int zaxisID = vlistInqVarZaxis(vlistID, varIdx); if (grid == CDI_UNDEFID || zaxisID == CDI_UNDEFID) { fputs("error in axis/grid inquiry\n", stderr); nvars = -1; break; } int zSize; if ((zSize = varDesc[varIdx].z = zaxisInqSize(zaxisID)) <= 0) { fputs("invalid Z-axis found\n", stderr); nvars = -1; break; } if (isLegacyFile) varDesc[varIdx].zDirection = DIRECTION_NONE; else if (zSize > 1) { double lev[2]; for (int levIdx = 0; levIdx < 2; ++levIdx) lev[levIdx] = zaxisInqLevel(zaxisID, levIdx); int zaxistype = zaxisInqType(zaxisID); switch (zaxistype) { case ZAXIS_PRESSURE: if (lev[0] < lev[1]) varDesc[varIdx].zDirection = DIRECTION_DOWN; else if (lev[1] < lev[0]) varDesc[varIdx].zDirection = DIRECTION_UP; else { fprintf(stderr, "unexpected level ordering on z-Axis for variable" " code %d found: lev[0]=%g, lev[1]=%g\n", varCode, lev[0], lev[1]); nvars = -1; } break; default: fprintf(stderr, "unexpected type of z-Axis for variable" " code %d found: %s\n", varCode, zaxisNamePtr(zaxistype)); nvars = -1; } } else varDesc[varIdx].zDirection = DIRECTION_NONE; if (nvars == -1) break; if ((gridType = gridInqType(grid)) != GRID_LONLAT && gridType != GRID_GENERIC && gridType != GRID_CURVILINEAR) { fprintf(stderr, "unexpected non-lonlat grid found: %d\n", gridType); nvars = -1; break; } if ((varDesc[varIdx].x = gridInqXsize(grid)) < 0) { fprintf(stderr, "invalid X-size found: %d\n", varDesc[varIdx].x); nvars = -1; break; } if (varDesc[varIdx].x == 0) varDesc[varIdx].x = 1; if ((varDesc[varIdx].y = gridInqYsize(grid)) < 0) { fprintf(stderr, "invalid Y-size found: %d\n", varDesc[varIdx].y); nvars = -1; break; } if (varDesc[varIdx].y == 0) varDesc[varIdx].y = 1; varDesc[varIdx].chars = (size_t) varDesc[varIdx].x * (size_t) varDesc[varIdx].y * (size_t) varDesc[varIdx].z * sizeof(buf[0]); if (var_size_max_chars < varDesc[varIdx].chars) var_size_max_chars = varDesc[varIdx].chars; } buf = (double *) Malloc(var_size_max_chars); if (nvars == -1) break; // Get the Time axis from the variable list int taxisID = vlistInqTaxis(vlistID); int tsID = 0; // Inquire the time step while (streamInqTimestep(streamID, tsID)) { // Get the verification date and time int vdatetime[2] = { taxisInqVtime(taxisID), (int) taxisInqVdate(taxisID) }; // Read var1 and var2 for (int varIdx = 0; varIdx < nvars; ++varIdx) { SizeType nmiss; streamReadVar(streamID, varIdx, buf, &nmiss); memcrc_r(checksum_state + varIdx, (const unsigned char *) vdatetime, sizeof(vdatetime)); if (varDesc[varIdx].zDirection == DIRECTION_UP || varDesc[varIdx].zDirection == DIRECTION_NONE) memcrc_r(checksum_state + varIdx, (const unsigned char *) buf, varDesc[varIdx].chars); else { size_t nlev = (size_t) varDesc[varIdx].z, charsPerLev = (size_t) varDesc[varIdx].x * (size_t) varDesc[varIdx].y * sizeof(buf[0]); for (size_t lev = 0; lev < nlev; ++lev) memcrc_r(checksum_state + varIdx, (const unsigned char *) buf + (nlev - lev - 1) * charsPerLev, charsPerLev); } } ++tsID; } file_vars = (struct cksum_table *) Malloc((size_t) nvars * sizeof(file_vars[0])); for (int varIdx = 0; varIdx < nvars; ++varIdx) { file_vars[varIdx].code = varDesc[varIdx].code; file_vars[varIdx].cksum = memcrc_finish(checksum_state + varIdx, (off_t) ((varDesc[varIdx].chars + sizeof(int) * 2) * (size_t) tsID)); } // Close the input stream streamClose(streamID); } while (0); // free resources free(checksum_state); free(varDesc); free(buf); *table_len = (size_t) nvars; return file_vars; } /* * Local Variables: * c-file-style: "Java" * c-basic-offset: 2 * indent-tabs-mode: nil * show-trailing-whitespace: t * require-trailing-newline: t * End: */ cdo-2.6.6.1/libcdi/tests/ensure_array_size.h0000664000175000017500000000165015271332515021115 0ustar alastairalastair#ifndef ENSURE_ARRAY_SIZE_H #define ENSURE_ARRAY_SIZE_H void realloc_array(void **array, size_t elem_size, size_t *curr_array_size, size_t requested_size); #define ENSURE_ARRAY_SIZE(arrayp, curr_array_size, req_size) \ do { \ if ((req_size) > (curr_array_size)) \ { \ size_t casize = (curr_array_size); \ \ realloc_array((void **) &(arrayp), sizeof(*(arrayp)), &casize, (req_size)); \ (curr_array_size) = casize; \ } \ } while (0) #endif cdo-2.6.6.1/libcdi/tests/test_cksum_grb.run.in0000664000175000017500000000012315271332515021353 0ustar alastairalastair#!@SHELL@ suffix=grb . ./test_cksum_base # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/stream_cksum.h0000664000175000017500000000031015271332515020051 0ustar alastairalastair#ifndef STREAM_CKSUM_H #define STREAM_CKSUM_H #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "var_cksum.h" struct cksum_table *cksum_stream(const char *fname, size_t *table_len); #endif cdo-2.6.6.1/libcdi/tests/test_grib.run.in0000664000175000017500000000011115271332515020317 0ustar alastairalastair#!@SHELL@ test 'x@ENABLE_GRIB@' = xyes || exit 77 ./test_grib || exit 1 cdo-2.6.6.1/libcdi/tests/test_cksum_ieg.run.in0000664000175000017500000000005115271332515021345 0ustar alastairalastair#!@SHELL@ suffix=ieg . ./test_cksum_base cdo-2.6.6.1/libcdi/tests/var_cksum.c0000664000175000017500000000251715271332515017354 0ustar alastairalastair#ifdef HAVE_CONFIG_H #include "config.h" #endif #include "var_cksum.h" #include #include int compare_checksums(struct cksum_table a[], size_t a_size, const char *src_a, struct cksum_table b[], size_t b_size, const char *src_b) { int checked_a[a_size], checked_b[b_size]; size_t i, j; int retcode = EXIT_SUCCESS; for (i = 0; i < a_size; ++i) checked_a[i] = 0; for (j = 0; j < b_size; ++j) checked_b[j] = 0; for (j = 0; j < b_size; ++j) for (i = 0; i < a_size; ++i) if (a[i].code == b[j].code) { if (a[i].cksum != b[j].cksum) { fprintf(stderr, "checksum error for varID %d, code %d!\n" "%08lx != %08lx\n", (int) i, a[i].code, (unsigned long) a[i].cksum, (unsigned long) b[j].cksum); retcode = EXIT_FAILURE; } checked_a[i] = 1; checked_b[j] = 1; break; } for (i = 0; i < a_size; ++i) if (!checked_a[i]) { fprintf(stderr, "variable %d, code %d from %s not checked!\n", (int) i, a[i].code, src_a); retcode = EXIT_FAILURE; } for (j = 0; j < b_size; ++j) if (!checked_b[j]) { fprintf(stderr, "variable %d, code %d from %s not checked!\n", (int) j, b[j].code, src_b); retcode = EXIT_FAILURE; } return retcode; } cdo-2.6.6.1/libcdi/tests/pio_cksum_nc.run.in0000664000175000017500000000027715271332515021023 0ustar alastairalastair#!@SHELL@ suffix=nc pio_write_args="-w 2 -qtaxis-type=relative" mpi_task_num=5 . ./pio_write.run ( . ./pio_write_dist_array.run ) || test $? -eq 77 # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/test_grib.c0000664000175000017500000000635615271332515017351 0ustar alastairalastair#ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "cdi.h" #include "dmemory.h" int main(void) { char fname[] = "test_grib.grb"; int filetype = CDI_FILETYPE_GRB; enum { nlat = 18, nlon = 2 * nlat, }; double *data = NULL; int nlevel; int varID; int streamID1, streamID2; int gridID, zaxisID; int nvars; int tsID; int levelID; int vlistID, taxisID; SizeType nmiss; size_t datasize = (size_t) nlon * (size_t) nlat; data = (double *) Malloc(datasize * sizeof(double)); memset(data, 0, datasize * sizeof(double)); gridID = gridCreate(GRID_GAUSSIAN, (int) datasize); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); zaxisID = zaxisCreate(ZAXIS_SURFACE, 1); vlistID = vlistCreate(); vlistDefVar(vlistID, gridID, zaxisID, TIME_VARIABLE); taxisID = taxisCreate(TAXIS_ABSOLUTE); vlistDefTaxis(vlistID, taxisID); streamID1 = streamOpenWrite(fname, filetype); if (streamID1 < 0) { fprintf(stderr, "Open failed on %s\n", fname); fprintf(stderr, "%s\n", cdiStringError(streamID1)); return (-1); } streamDefVlist(streamID1, vlistID); (void) streamDefTimestep(streamID1, 0); streamWriteVar(streamID1, 0, data, 0); free(data); return (0); vlistID = streamInqVlist(streamID1); filetype = streamInqFiletype(streamID1); streamID2 = streamOpenWrite(fname, filetype); if (streamID2 < 0) { fprintf(stderr, "Open failed on %s\n", fname); fprintf(stderr, "%s\n", cdiStringError(streamID2)); return (-1); } streamDefVlist(streamID2, vlistID); nvars = vlistNvars(vlistID); for (varID = 0; varID < nvars; varID++) { int varGridID = vlistInqVarGrid(vlistID, varID); int varZaxisID = vlistInqVarZaxis(vlistID, varID); size_t gridsize = (size_t) gridInqSize(varGridID); size_t varNlevel = (size_t) zaxisInqSize(varZaxisID); if (gridsize * varNlevel > datasize) datasize = gridsize * varNlevel; } data = (double *) Realloc(data, datasize * sizeof(double)); memset(data, 0, datasize * sizeof(double)); taxisID = vlistInqTaxis(vlistID); tsID = 0; while (streamInqTimestep(streamID1, tsID)) { /* int vdate = */ taxisInqVdate(taxisID); /* int vtime = */ taxisInqVtime(taxisID); streamDefTimestep(streamID2, tsID); for (varID = 0; varID < nvars; varID++) { streamReadVar(streamID1, varID, data, &nmiss); /* int code = */ vlistInqVarCode(vlistID, varID); gridID = vlistInqVarGrid(vlistID, varID); zaxisID = vlistInqVarZaxis(vlistID, varID); /* int gridtype = */ gridInqType(gridID); /* int gridsize = */ gridInqSize(gridID); nlevel = zaxisInqSize(zaxisID); /* double missval = */ vlistInqVarMissval(vlistID, varID); for (levelID = 0; levelID < nlevel; levelID++) { /* int level = (int) */ zaxisInqLevel(zaxisID, levelID); /* int offset = gridsize*levelID; */ } streamWriteVar(streamID2, varID, data, nmiss); } tsID++; } free(data); streamClose(streamID2); streamClose(streamID1); return (0); } /* * Local Variables: * c-file-style: "Java" * c-basic-offset: 2 * indent-tabs-mode: nil * show-trailing-whitespace: t * require-trailing-newline: t * End: */ cdo-2.6.6.1/libcdi/tests/Makefile.in0000664000175000017500000020223115271332515017256 0ustar alastairalastair# Makefile.in generated by automake 1.18.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2025 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@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) am__rm_f = rm -f $(am__rm_f_notfound) am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 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@ TESTS = calendar_test1$(EXEEXT) cksum_verify$(EXEEXT) pio_write.run \ pio_write_deco2d.run test_byteswap.run test_cdf_const.run \ test_cdf_transformation.run test_cksum_ext.run \ test_cksum_grb.run test_cksum_grb2.run test_cksum_ieg.run \ test_cksum_nc.run test_cksum_nc2.run test_cksum_nc4.run \ test_cksum_nc_chunk.run test_cksum_srv.run test_f2003.run \ test_grib.run test_month_adjust$(EXEEXT) \ test_resource_copy.run test_table.run pio_cksum_asynch.run \ pio_cksum_fpguard.run pio_cksum_grb2.run \ pio_cksum_mpi_fw_at_all.run pio_cksum_mpi_fw_at_reblock.run \ pio_cksum_mpi_fw_ordered.run pio_cksum_mpinonb.run \ pio_cksum_nc.run pio_cksum_nc2.run pio_cksum_nc4.run \ pio_cksum_writer.run pio_write.parallel.run \ pio_write_deco2d.parallel.run pio_write_dist_array.run \ test_resource_copy.parallel.run @ENABLE_NETCDF_TRUE@am__append_1 = \ @ENABLE_NETCDF_TRUE@ test_cdf_read \ @ENABLE_NETCDF_TRUE@ test_cdf_write @ENABLE_MPI_TRUE@am__append_2 = \ @ENABLE_MPI_TRUE@ pio_write.parallel \ @ENABLE_MPI_TRUE@ pio_write_deco2d.parallel \ @ENABLE_MPI_TRUE@ test_resource_copy.parallel @with_on_demand_check_programs_TRUE@check_PROGRAMS = $(am__EXEEXT_3) @with_on_demand_check_programs_FALSE@noinst_PROGRAMS = \ @with_on_demand_check_programs_FALSE@ $(am__EXEEXT_3) @ENABLE_ALL_STATIC_TRUE@am__append_3 = -all-static subdir = tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \ $(top_srcdir)/m4/acx_c_package.m4 \ $(top_srcdir)/m4/acx_cfortran_flags.m4 \ $(top_srcdir)/m4/acx_check_cfortran.m4 \ $(top_srcdir)/m4/acx_check_strptr_convert.m4 \ $(top_srcdir)/m4/acx_execinfo.m4 \ $(top_srcdir)/m4/acx_fortran_check_include.m4 \ $(top_srcdir)/m4/acx_fortran_include_flag.m4 \ $(top_srcdir)/m4/acx_fortran_package.m4 \ $(top_srcdir)/m4/acx_lang_check_include.m4 \ $(top_srcdir)/m4/acx_lang_package.m4 \ $(top_srcdir)/m4/acx_lt_problems.m4 \ $(top_srcdir)/m4/acx_m4_list_to_quoted_strings.m4 \ $(top_srcdir)/m4/acx_mpirun.m4 $(top_srcdir)/m4/acx_mv_obj.m4 \ $(top_srcdir)/m4/acx_option_search_libs.m4 \ $(top_srcdir)/m4/acx_options.m4 \ $(top_srcdir)/m4/acx_prog_cc_posix.m4 \ $(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \ $(top_srcdir)/m4/acx_sl_mod_suffix.m4 \ $(top_srcdir)/m4/acx_tls_xlc_retry.m4 \ $(top_srcdir)/m4/acx_use_libtool_configuration.m4 \ $(top_srcdir)/m4/acx_uuid.m4 $(top_srcdir)/m4/asx_tr_arg.m4 \ $(top_srcdir)/m4/asx_unset.m4 $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_python_devel.m4 $(top_srcdir)/m4/ax_tls.m4 \ $(top_srcdir)/m4/kpse_libtool.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/m4/ac_lang_program_fortran.m4 \ $(top_srcdir)/m4/acx_lang_fortran_check_include.m4 \ $(top_srcdir)/m4/acx_lang_c_check_include.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = test_cksum_base pio_cksum_asynch.run \ pio_cksum_fpguard.run pio_cksum_grb2.run \ pio_cksum_mpi_fw_at_all.run pio_cksum_mpi_fw_at_reblock.run \ pio_cksum_mpi_fw_ordered.run pio_cksum_mpinonb.run \ pio_cksum_nc.run pio_cksum_nc2.run pio_cksum_nc4.run \ pio_cksum_writer.run pio_write.parallel.run pio_write.run \ pio_write_deco2d.parallel.run pio_write_deco2d.run \ pio_write_dist_array.run test_byteswap.run test_cdf_const.run \ test_cdf_transformation.run test_cksum_ext.run \ test_cksum_grb.run test_cksum_grb2.run test_cksum_ieg.run \ test_cksum_nc.run test_cksum_nc2.run test_cksum_nc4.run \ test_cksum_nc_chunk.run test_cksum_srv.run test_f2003.run \ test_grib.run test_resource_copy.parallel.run \ test_resource_copy.run test_table.run CONFIG_CLEAN_VPATH_FILES = @ENABLE_NETCDF_TRUE@am__EXEEXT_1 = test_cdf_read$(EXEEXT) \ @ENABLE_NETCDF_TRUE@ test_cdf_write$(EXEEXT) @ENABLE_MPI_TRUE@am__EXEEXT_2 = pio_write.parallel$(EXEEXT) \ @ENABLE_MPI_TRUE@ pio_write_deco2d.parallel$(EXEEXT) \ @ENABLE_MPI_TRUE@ test_resource_copy.parallel$(EXEEXT) am__EXEEXT_3 = calendar_test1$(EXEEXT) cksum_read$(EXEEXT) \ cksum_verify$(EXEEXT) cksum_write$(EXEEXT) \ cksum_write_chunk$(EXEEXT) pio_write$(EXEEXT) \ pio_write_deco2d$(EXEEXT) test_byteswap$(EXEEXT) \ test_grib$(EXEEXT) test_month_adjust$(EXEEXT) \ test_resource_copy$(EXEEXT) test_table$(EXEEXT) \ $(am__EXEEXT_1) $(am__EXEEXT_2) PROGRAMS = $(noinst_PROGRAMS) am_calendar_test1_OBJECTS = calendar_test1.$(OBJEXT) calendar_test1_OBJECTS = $(am_calendar_test1_OBJECTS) calendar_test1_LDADD = $(LDADD) calendar_test1_DEPENDENCIES = $(top_builddir)/src/libcdi.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am_cksum_read_OBJECTS = cksum_read.$(OBJEXT) \ ensure_array_size.$(OBJEXT) stream_cksum.$(OBJEXT) \ var_cksum.$(OBJEXT) cksum_read_OBJECTS = $(am_cksum_read_OBJECTS) cksum_read_LDADD = $(LDADD) cksum_read_DEPENDENCIES = $(top_builddir)/src/libcdi.la am_cksum_verify_OBJECTS = cksum_verify.$(OBJEXT) cksum_verify_OBJECTS = $(am_cksum_verify_OBJECTS) cksum_verify_LDADD = $(LDADD) cksum_verify_DEPENDENCIES = $(top_builddir)/src/libcdi.la am_cksum_write_OBJECTS = cksum_write.$(OBJEXT) \ simple_model_helper.$(OBJEXT) cksum_write_OBJECTS = $(am_cksum_write_OBJECTS) cksum_write_LDADD = $(LDADD) cksum_write_DEPENDENCIES = $(top_builddir)/src/libcdi.la am_cksum_write_chunk_OBJECTS = cksum_write_chunk.$(OBJEXT) \ simple_model_helper.$(OBJEXT) cksum_write_chunk_OBJECTS = $(am_cksum_write_chunk_OBJECTS) cksum_write_chunk_LDADD = $(LDADD) cksum_write_chunk_DEPENDENCIES = $(top_builddir)/src/libcdi.la am_pio_write_OBJECTS = pio_write.$(OBJEXT) \ pio_write_setup_grid.$(OBJEXT) simple_model.$(OBJEXT) \ simple_model_helper.$(OBJEXT) pio_write_OBJECTS = $(am_pio_write_OBJECTS) pio_write_LDADD = $(LDADD) pio_write_DEPENDENCIES = $(top_builddir)/src/libcdi.la am__objects_1 = pio_write.parallel.$(OBJEXT) \ pio_write_setup_grid.parallel.$(OBJEXT) \ simple_model.parallel.$(OBJEXT) \ simple_model_helper.parallel.$(OBJEXT) nodist_pio_write_parallel_OBJECTS = $(am__objects_1) pio_write_parallel_OBJECTS = $(nodist_pio_write_parallel_OBJECTS) am__DEPENDENCIES_1 = pio_write_parallel_DEPENDENCIES = $(top_builddir)/src/libcdipio.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(LDADD) am_pio_write_deco2d_OBJECTS = deco2d_model.$(OBJEXT) \ pio_write.$(OBJEXT) pio_write_setup_grid.$(OBJEXT) \ simple_model_helper.$(OBJEXT) pio_write_deco2d_OBJECTS = $(am_pio_write_deco2d_OBJECTS) pio_write_deco2d_LDADD = $(LDADD) pio_write_deco2d_DEPENDENCIES = $(top_builddir)/src/libcdi.la am__objects_2 = deco2d_model.parallel.$(OBJEXT) \ pio_write.parallel.$(OBJEXT) \ pio_write_setup_grid.parallel.$(OBJEXT) \ simple_model_helper.parallel.$(OBJEXT) nodist_pio_write_deco2d_parallel_OBJECTS = $(am__objects_2) pio_write_deco2d_parallel_OBJECTS = \ $(nodist_pio_write_deco2d_parallel_OBJECTS) pio_write_deco2d_parallel_DEPENDENCIES = \ $(top_builddir)/src/libcdipio.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(LDADD) am_test_byteswap_OBJECTS = test_byteswap.$(OBJEXT) test_byteswap_OBJECTS = $(am_test_byteswap_OBJECTS) test_byteswap_LDADD = $(LDADD) test_byteswap_DEPENDENCIES = $(top_builddir)/src/libcdi.la am_test_cdf_read_OBJECTS = test_cdf_read.$(OBJEXT) test_cdf_read_OBJECTS = $(am_test_cdf_read_OBJECTS) test_cdf_read_LDADD = $(LDADD) test_cdf_read_DEPENDENCIES = $(top_builddir)/src/libcdi.la am_test_cdf_write_OBJECTS = simple_model_helper.$(OBJEXT) \ test_cdf_write.$(OBJEXT) test_cdf_write_OBJECTS = $(am_test_cdf_write_OBJECTS) test_cdf_write_LDADD = $(LDADD) test_cdf_write_DEPENDENCIES = $(top_builddir)/src/libcdi.la am_test_grib_OBJECTS = test_grib.$(OBJEXT) test_grib_OBJECTS = $(am_test_grib_OBJECTS) test_grib_LDADD = $(LDADD) test_grib_DEPENDENCIES = $(top_builddir)/src/libcdi.la am_test_month_adjust_OBJECTS = test_month_adjust.$(OBJEXT) test_month_adjust_OBJECTS = $(am_test_month_adjust_OBJECTS) test_month_adjust_LDADD = $(LDADD) test_month_adjust_DEPENDENCIES = $(top_builddir)/src/libcdi.la am_test_resource_copy_OBJECTS = test_resource_copy.$(OBJEXT) test_resource_copy_OBJECTS = $(am_test_resource_copy_OBJECTS) test_resource_copy_DEPENDENCIES = \ $(top_builddir)/src/libcdiresunpack.la am__objects_3 = test_resource_copy.parallel.$(OBJEXT) nodist_test_resource_copy_parallel_OBJECTS = $(am__objects_3) test_resource_copy_parallel_OBJECTS = \ $(nodist_test_resource_copy_parallel_OBJECTS) test_resource_copy_parallel_DEPENDENCIES = \ $(top_builddir)/src/libcdipio.la $(LDADD) am_test_table_OBJECTS = test_table.$(OBJEXT) test_table_OBJECTS = $(am_test_table_OBJECTS) test_table_LDADD = $(LDADD) test_table_DEPENDENCIES = $(top_builddir)/src/libcdi.la AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/calendar_test1.Po \ ./$(DEPDIR)/cksum_read.Po ./$(DEPDIR)/cksum_verify.Po \ ./$(DEPDIR)/cksum_write.Po ./$(DEPDIR)/cksum_write_chunk.Po \ ./$(DEPDIR)/deco2d_model.Po \ ./$(DEPDIR)/deco2d_model.parallel.Po \ ./$(DEPDIR)/ensure_array_size.Po ./$(DEPDIR)/pio_write.Po \ ./$(DEPDIR)/pio_write.parallel.Po \ ./$(DEPDIR)/pio_write_setup_grid.Po \ ./$(DEPDIR)/pio_write_setup_grid.parallel.Po \ ./$(DEPDIR)/simple_model.Po \ ./$(DEPDIR)/simple_model.parallel.Po \ ./$(DEPDIR)/simple_model_helper.Po \ ./$(DEPDIR)/simple_model_helper.parallel.Po \ ./$(DEPDIR)/stream_cksum.Po ./$(DEPDIR)/test_byteswap.Po \ ./$(DEPDIR)/test_cdf_read.Po ./$(DEPDIR)/test_cdf_write.Po \ ./$(DEPDIR)/test_grib.Po ./$(DEPDIR)/test_month_adjust.Po \ ./$(DEPDIR)/test_resource_copy.Po \ ./$(DEPDIR)/test_resource_copy.parallel.Po \ ./$(DEPDIR)/test_table.Po ./$(DEPDIR)/var_cksum.Po am__mv = mv -f LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(calendar_test1_SOURCES) $(cksum_read_SOURCES) \ $(cksum_verify_SOURCES) $(cksum_write_SOURCES) \ $(cksum_write_chunk_SOURCES) $(pio_write_SOURCES) \ $(nodist_pio_write_parallel_SOURCES) \ $(pio_write_deco2d_SOURCES) \ $(nodist_pio_write_deco2d_parallel_SOURCES) \ $(test_byteswap_SOURCES) $(test_cdf_read_SOURCES) \ $(test_cdf_write_SOURCES) $(test_grib_SOURCES) \ $(test_month_adjust_SOURCES) $(test_resource_copy_SOURCES) \ $(nodist_test_resource_copy_parallel_SOURCES) \ $(test_table_SOURCES) DIST_SOURCES = $(calendar_test1_SOURCES) $(cksum_read_SOURCES) \ $(cksum_verify_SOURCES) $(cksum_write_SOURCES) \ $(cksum_write_chunk_SOURCES) $(pio_write_SOURCES) \ $(pio_write_deco2d_SOURCES) $(test_byteswap_SOURCES) \ $(test_cdf_read_SOURCES) $(test_cdf_write_SOURCES) \ $(test_grib_SOURCES) $(test_month_adjust_SOURCES) \ $(test_resource_copy_SOURCES) $(test_table_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__extra_recursive_targets = examples-recursive am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } 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 = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ $$am__collect_skipped_logs \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer-defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(IGNORE_SKIPPED_LOGS)'; then \ am__collect_skipped_logs='--collect-skipped-logs no'; \ else \ am__collect_skipped_logs=''; \ fi; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log LOG_DRIVER = $(SHELL) $(top_srcdir)/config/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.run.log=.log) RUN_LOG_DRIVER = $(SHELL) $(top_srcdir)/config/test-driver RUN_LOG_COMPILE = $(RUN_LOG_COMPILER) $(AM_RUN_LOG_FLAGS) \ $(RUN_LOG_FLAGS) am__DIST_COMMON = $(srcdir)/Makefile.in \ $(srcdir)/pio_cksum_asynch.run.in \ $(srcdir)/pio_cksum_fpguard.run.in \ $(srcdir)/pio_cksum_grb2.run.in \ $(srcdir)/pio_cksum_mpi_fw_at_all.run.in \ $(srcdir)/pio_cksum_mpi_fw_at_reblock.run.in \ $(srcdir)/pio_cksum_mpi_fw_ordered.run.in \ $(srcdir)/pio_cksum_mpinonb.run.in \ $(srcdir)/pio_cksum_nc.run.in $(srcdir)/pio_cksum_nc2.run.in \ $(srcdir)/pio_cksum_nc4.run.in \ $(srcdir)/pio_cksum_writer.run.in \ $(srcdir)/pio_write.parallel.run.in $(srcdir)/pio_write.run.in \ $(srcdir)/pio_write_deco2d.parallel.run.in \ $(srcdir)/pio_write_deco2d.run.in \ $(srcdir)/pio_write_dist_array.run.in \ $(srcdir)/test_byteswap.run.in $(srcdir)/test_cdf_const.run.in \ $(srcdir)/test_cdf_transformation.run.in \ $(srcdir)/test_cksum_base.in $(srcdir)/test_cksum_ext.run.in \ $(srcdir)/test_cksum_grb.run.in \ $(srcdir)/test_cksum_grb2.run.in \ $(srcdir)/test_cksum_ieg.run.in $(srcdir)/test_cksum_nc.run.in \ $(srcdir)/test_cksum_nc2.run.in \ $(srcdir)/test_cksum_nc4.run.in \ $(srcdir)/test_cksum_nc_chunk.run.in \ $(srcdir)/test_cksum_srv.run.in $(srcdir)/test_f2003.run.in \ $(srcdir)/test_grib.run.in \ $(srcdir)/test_resource_copy.parallel.run.in \ $(srcdir)/test_resource_copy.run.in \ $(srcdir)/test_table.run.in $(top_srcdir)/config/depcomp \ $(top_srcdir)/config/lt_overrides_Makefile.inc \ $(top_srcdir)/config/test-driver DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DCE_UUIDROOT = @DCE_UUIDROOT@ DCE_UUID_C_INCLUDE = @DCE_UUID_C_INCLUDE@ DCE_UUID_C_LIB = @DCE_UUID_C_LIB@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECCODES_INCLUDE = @ECCODES_INCLUDE@ ECCODES_LIBS = @ECCODES_LIBS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_ACROSS = @ENABLE_ACROSS@ ENABLE_CDI_LIB = @ENABLE_CDI_LIB@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ ENABLE_EXTRA = @ENABLE_EXTRA@ ENABLE_GRIB = @ENABLE_GRIB@ ENABLE_IEG = @ENABLE_IEG@ ENABLE_MPI = @ENABLE_MPI@ ENABLE_NETCDF = @ENABLE_NETCDF@ ENABLE_SERVICE = @ENABLE_SERVICE@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ F77 = @F77@ FC = @FC@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCMODCASE = @FCMODCASE@ FCMODEXT = @FCMODEXT@ FC_DEFINE = @FC_DEFINE@ FC_MOD_FLAG = @FC_MOD_FLAG@ FC_OPTINC = @FC_OPTINC@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBRT = @LIBRT@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPIROOT = @MPIROOT@ MPI_C_INCLUDE = @MPI_C_INCLUDE@ MPI_C_LIB = @MPI_C_LIB@ MPI_FC_LIB = @MPI_FC_LIB@ MPI_FC_MOD = @MPI_FC_MOD@ MPI_LAUNCH = @MPI_LAUNCH@ NETCDF_INCLUDE = @NETCDF_INCLUDE@ NETCDF_LIBS = @NETCDF_LIBS@ NETCDF_ROOT = @NETCDF_ROOT@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OSSP_UUIDROOT = @OSSP_UUIDROOT@ OSSP_UUID_C_INCLUDE = @OSSP_UUID_C_INCLUDE@ OSSP_UUID_C_LIB = @OSSP_UUID_C_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PPM_CORE_C_INCLUDE = @PPM_CORE_C_INCLUDE@ PPM_CORE_C_LIB = @PPM_CORE_C_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_CXX = @PTHREAD_CXX@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PLATFORM_SITE_PKG = @PYTHON_PLATFORM_SITE_PKG@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RUBY = @RUBY@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SYSTEM_TYPE = @SYSTEM_TYPE@ SZLIB_INCLUDE = @SZLIB_INCLUDE@ SZLIB_LIBS = @SZLIB_LIBS@ THREADS_INCLUDE = @THREADS_INCLUDE@ THREADS_LIBS = @THREADS_LIBS@ UTIL_LINUX_UUIDROOT = @UTIL_LINUX_UUIDROOT@ UTIL_LINUX_UUID_C_INCLUDE = @UTIL_LINUX_UUID_C_INCLUDE@ UTIL_LINUX_UUID_C_LIB = @UTIL_LINUX_UUID_C_LIB@ UUID_C_INCLUDE = @UUID_C_INCLUDE@ UUID_C_LIB = @UUID_C_LIB@ VERSION = @VERSION@ YAXT_C_INCLUDE = @YAXT_C_INCLUDE@ YAXT_C_LIB = @YAXT_C_LIB@ YAXT_FC_LIB = @YAXT_FC_LIB@ YAXT_FC_MOD = @YAXT_FC_MOD@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ ac_ct_FC = @ac_ct_FC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ am__xargs_n = @am__xargs_n@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ 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@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ TEST_EXTENSIONS = @EXEEXT@ .run # Update test_cksum_base before running tests that source it: test_cksum_TEST_LOGS_ = \ test_cksum_ext.log \ test_cksum_grb.log \ test_cksum_grb2.log \ test_cksum_ieg.log \ test_cksum_nc.log \ test_cksum_nc2.log \ test_cksum_nc4.log \ test_cksum_srv.log # Update pio_write_dist_array.run before running tests that source it: pio_write_dist_array_TEST_LOGS_ = \ pio_cksum_asynch.log \ pio_cksum_fpguard.log \ pio_cksum_grb2.log \ pio_cksum_mpi_fw_at_all.log \ pio_cksum_mpi_fw_at_reblock.log \ pio_cksum_mpi_fw_ordered.log \ pio_cksum_mpinonb.log \ pio_cksum_nc.log \ pio_cksum_nc2.log \ pio_cksum_nc4.log \ pio_cksum_writer.log # Update pio_write.run before running tests that source it: pio_write_TEST_LOGS_ = \ $(pio_write_dist_array_TEST_LOGS_) \ pio_write.parallel.log \ pio_write_deco2d.log \ pio_write_deco2d.parallel.log \ pio_write_dist_array.log test_PROGRAMS_ = calendar_test1 cksum_read cksum_verify cksum_write \ cksum_write_chunk pio_write pio_write_deco2d test_byteswap \ test_grib test_month_adjust test_resource_copy test_table \ $(am__append_1) $(am__append_2) AM_CPPFLAGS = -I$(top_srcdir)/src AM_CFLAGS = $(PPM_CORE_C_INCLUDE) $(YAXT_C_INCLUDE) $(MPI_C_INCLUDE) AM_LDFLAGS = $(am__append_3) LDADD = $(top_builddir)/src/libcdi.la calendar_test1_SOURCES = calendar_test1.c cksum_read_SOURCES = \ cksum_read.c \ ensure_array_size.c \ ensure_array_size.h \ stream_cksum.c \ stream_cksum.h \ var_cksum.c \ var_cksum.h cksum_verify_SOURCES = cksum_verify.c cksum_write_SOURCES = \ cksum_write.c \ simple_model_helper.c \ simple_model_helper.h cksum_write_chunk_SOURCES = \ cksum_write_chunk.c \ simple_model_helper.c \ simple_model_helper.h pio_write_SOURCES = \ pio_write.c \ pio_write.h \ pio_write_setup_grid.c \ pio_write_setup_grid.h \ simple_model.c \ simple_model_helper.c \ simple_model_helper.h nodist_pio_write_parallel_SOURCES = $(pio_write_SOURCES:.c=.parallel.c) pio_write_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(PPM_CORE_C_LIB) $(YAXT_C_LIB) $(LDADD) pio_write_deco2d_SOURCES = \ deco2d_model.c \ pio_write.c \ pio_write.h \ pio_write_setup_grid.c \ pio_write_setup_grid.h \ simple_model_helper.c \ simple_model_helper.h nodist_pio_write_deco2d_parallel_SOURCES = $(pio_write_deco2d_SOURCES:.c=.parallel.c) pio_write_deco2d_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(PPM_CORE_C_LIB) $(YAXT_C_LIB) $(LDADD) test_byteswap_SOURCES = test_byteswap.c test_grib_SOURCES = test_grib.c test_month_adjust_SOURCES = test_month_adjust.c test_resource_copy_SOURCES = test_resource_copy.c test_resource_copy_LDADD = $(top_builddir)/src/libcdiresunpack.la nodist_test_resource_copy_parallel_SOURCES = $(test_resource_copy_SOURCES:.c=.parallel.c) test_resource_copy_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(LDADD) test_table_SOURCES = test_table.c test_cdf_read_SOURCES = test_cdf_read.c test_cdf_write_SOURCES = \ simple_model_helper.c \ simple_model_helper.h \ test_cdf_write.c AUTOMAKE_OPTIONS = color-tests # Generate source files for parallel versions of the programs. We do this to # avoid target-specific flags, which result into rules that do not use the # compilation commands above. SUFFIXES = .parallel.c # Compile *.F90 without CPPFLAGS, which are normally meant for the C compiler # and might not be compatible with the Fortran compiler: LTPPFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) # Compile programs using Libtool with '-static' (to avoid compiling twice): COMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) -static $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) FCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(FC) -static $(AM_FCFLAGS) $(FCFLAGS) PPFCCOMPILE = $(FCCOMPILE) CXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CXX) -static $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) all: all-am .SUFFIXES: .SUFFIXES: .parallel.c .c .lo .log .o .obj .run .run$(EXEEXT) .trs $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/lt_overrides_Makefile.inc $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign tests/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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_srcdir)/config/lt_overrides_Makefile.inc $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): test_cksum_base: $(top_builddir)/config.status $(srcdir)/test_cksum_base.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ pio_cksum_asynch.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_asynch.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ pio_cksum_fpguard.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_fpguard.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ pio_cksum_grb2.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_grb2.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ pio_cksum_mpi_fw_at_all.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_mpi_fw_at_all.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ pio_cksum_mpi_fw_at_reblock.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_mpi_fw_at_reblock.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ pio_cksum_mpi_fw_ordered.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_mpi_fw_ordered.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ pio_cksum_mpinonb.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_mpinonb.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ pio_cksum_nc.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_nc.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ pio_cksum_nc2.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_nc2.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ pio_cksum_nc4.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_nc4.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ pio_cksum_writer.run: $(top_builddir)/config.status $(srcdir)/pio_cksum_writer.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ pio_write.parallel.run: $(top_builddir)/config.status $(srcdir)/pio_write.parallel.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ pio_write.run: $(top_builddir)/config.status $(srcdir)/pio_write.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ pio_write_deco2d.parallel.run: $(top_builddir)/config.status $(srcdir)/pio_write_deco2d.parallel.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ pio_write_deco2d.run: $(top_builddir)/config.status $(srcdir)/pio_write_deco2d.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ pio_write_dist_array.run: $(top_builddir)/config.status $(srcdir)/pio_write_dist_array.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_byteswap.run: $(top_builddir)/config.status $(srcdir)/test_byteswap.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_cdf_const.run: $(top_builddir)/config.status $(srcdir)/test_cdf_const.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_cdf_transformation.run: $(top_builddir)/config.status $(srcdir)/test_cdf_transformation.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_cksum_ext.run: $(top_builddir)/config.status $(srcdir)/test_cksum_ext.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_cksum_grb.run: $(top_builddir)/config.status $(srcdir)/test_cksum_grb.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_cksum_grb2.run: $(top_builddir)/config.status $(srcdir)/test_cksum_grb2.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_cksum_ieg.run: $(top_builddir)/config.status $(srcdir)/test_cksum_ieg.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_cksum_nc.run: $(top_builddir)/config.status $(srcdir)/test_cksum_nc.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_cksum_nc2.run: $(top_builddir)/config.status $(srcdir)/test_cksum_nc2.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_cksum_nc4.run: $(top_builddir)/config.status $(srcdir)/test_cksum_nc4.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_cksum_nc_chunk.run: $(top_builddir)/config.status $(srcdir)/test_cksum_nc_chunk.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_cksum_srv.run: $(top_builddir)/config.status $(srcdir)/test_cksum_srv.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_f2003.run: $(top_builddir)/config.status $(srcdir)/test_f2003.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_grib.run: $(top_builddir)/config.status $(srcdir)/test_grib.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_resource_copy.parallel.run: $(top_builddir)/config.status $(srcdir)/test_resource_copy.parallel.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_resource_copy.run: $(top_builddir)/config.status $(srcdir)/test_resource_copy.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ test_table.run: $(top_builddir)/config.status $(srcdir)/test_table.run.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ clean-checkPROGRAMS: $(am__rm_f) $(check_PROGRAMS) test -z "$(EXEEXT)" || $(am__rm_f) $(check_PROGRAMS:$(EXEEXT)=) clean-noinstPROGRAMS: $(am__rm_f) $(noinst_PROGRAMS) test -z "$(EXEEXT)" || $(am__rm_f) $(noinst_PROGRAMS:$(EXEEXT)=) calendar_test1$(EXEEXT): $(calendar_test1_OBJECTS) $(calendar_test1_DEPENDENCIES) $(EXTRA_calendar_test1_DEPENDENCIES) @rm -f calendar_test1$(EXEEXT) $(AM_V_CCLD)$(LINK) $(calendar_test1_OBJECTS) $(calendar_test1_LDADD) $(LIBS) cksum_read$(EXEEXT): $(cksum_read_OBJECTS) $(cksum_read_DEPENDENCIES) $(EXTRA_cksum_read_DEPENDENCIES) @rm -f cksum_read$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cksum_read_OBJECTS) $(cksum_read_LDADD) $(LIBS) cksum_verify$(EXEEXT): $(cksum_verify_OBJECTS) $(cksum_verify_DEPENDENCIES) $(EXTRA_cksum_verify_DEPENDENCIES) @rm -f cksum_verify$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cksum_verify_OBJECTS) $(cksum_verify_LDADD) $(LIBS) cksum_write$(EXEEXT): $(cksum_write_OBJECTS) $(cksum_write_DEPENDENCIES) $(EXTRA_cksum_write_DEPENDENCIES) @rm -f cksum_write$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cksum_write_OBJECTS) $(cksum_write_LDADD) $(LIBS) cksum_write_chunk$(EXEEXT): $(cksum_write_chunk_OBJECTS) $(cksum_write_chunk_DEPENDENCIES) $(EXTRA_cksum_write_chunk_DEPENDENCIES) @rm -f cksum_write_chunk$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cksum_write_chunk_OBJECTS) $(cksum_write_chunk_LDADD) $(LIBS) pio_write$(EXEEXT): $(pio_write_OBJECTS) $(pio_write_DEPENDENCIES) $(EXTRA_pio_write_DEPENDENCIES) @rm -f pio_write$(EXEEXT) $(AM_V_CCLD)$(LINK) $(pio_write_OBJECTS) $(pio_write_LDADD) $(LIBS) pio_write.parallel$(EXEEXT): $(pio_write_parallel_OBJECTS) $(pio_write_parallel_DEPENDENCIES) $(EXTRA_pio_write_parallel_DEPENDENCIES) @rm -f pio_write.parallel$(EXEEXT) $(AM_V_CCLD)$(LINK) $(pio_write_parallel_OBJECTS) $(pio_write_parallel_LDADD) $(LIBS) pio_write_deco2d$(EXEEXT): $(pio_write_deco2d_OBJECTS) $(pio_write_deco2d_DEPENDENCIES) $(EXTRA_pio_write_deco2d_DEPENDENCIES) @rm -f pio_write_deco2d$(EXEEXT) $(AM_V_CCLD)$(LINK) $(pio_write_deco2d_OBJECTS) $(pio_write_deco2d_LDADD) $(LIBS) pio_write_deco2d.parallel$(EXEEXT): $(pio_write_deco2d_parallel_OBJECTS) $(pio_write_deco2d_parallel_DEPENDENCIES) $(EXTRA_pio_write_deco2d_parallel_DEPENDENCIES) @rm -f pio_write_deco2d.parallel$(EXEEXT) $(AM_V_CCLD)$(LINK) $(pio_write_deco2d_parallel_OBJECTS) $(pio_write_deco2d_parallel_LDADD) $(LIBS) test_byteswap$(EXEEXT): $(test_byteswap_OBJECTS) $(test_byteswap_DEPENDENCIES) $(EXTRA_test_byteswap_DEPENDENCIES) @rm -f test_byteswap$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_byteswap_OBJECTS) $(test_byteswap_LDADD) $(LIBS) test_cdf_read$(EXEEXT): $(test_cdf_read_OBJECTS) $(test_cdf_read_DEPENDENCIES) $(EXTRA_test_cdf_read_DEPENDENCIES) @rm -f test_cdf_read$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_cdf_read_OBJECTS) $(test_cdf_read_LDADD) $(LIBS) test_cdf_write$(EXEEXT): $(test_cdf_write_OBJECTS) $(test_cdf_write_DEPENDENCIES) $(EXTRA_test_cdf_write_DEPENDENCIES) @rm -f test_cdf_write$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_cdf_write_OBJECTS) $(test_cdf_write_LDADD) $(LIBS) test_grib$(EXEEXT): $(test_grib_OBJECTS) $(test_grib_DEPENDENCIES) $(EXTRA_test_grib_DEPENDENCIES) @rm -f test_grib$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_grib_OBJECTS) $(test_grib_LDADD) $(LIBS) test_month_adjust$(EXEEXT): $(test_month_adjust_OBJECTS) $(test_month_adjust_DEPENDENCIES) $(EXTRA_test_month_adjust_DEPENDENCIES) @rm -f test_month_adjust$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_month_adjust_OBJECTS) $(test_month_adjust_LDADD) $(LIBS) test_resource_copy$(EXEEXT): $(test_resource_copy_OBJECTS) $(test_resource_copy_DEPENDENCIES) $(EXTRA_test_resource_copy_DEPENDENCIES) @rm -f test_resource_copy$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_resource_copy_OBJECTS) $(test_resource_copy_LDADD) $(LIBS) test_resource_copy.parallel$(EXEEXT): $(test_resource_copy_parallel_OBJECTS) $(test_resource_copy_parallel_DEPENDENCIES) $(EXTRA_test_resource_copy_parallel_DEPENDENCIES) @rm -f test_resource_copy.parallel$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_resource_copy_parallel_OBJECTS) $(test_resource_copy_parallel_LDADD) $(LIBS) test_table$(EXEEXT): $(test_table_OBJECTS) $(test_table_DEPENDENCIES) $(EXTRA_test_table_DEPENDENCIES) @rm -f test_table$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_table_OBJECTS) $(test_table_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/calendar_test1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cksum_read.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cksum_verify.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cksum_write.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cksum_write_chunk.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deco2d_model.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deco2d_model.parallel.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ensure_array_size.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_write.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_write.parallel.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_write_setup_grid.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio_write_setup_grid.parallel.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple_model.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple_model.parallel.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple_model_helper.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple_model_helper.parallel.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_cksum.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_byteswap.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_cdf_read.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_cdf_write.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_grib.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_month_adjust.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_resource_copy.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_resource_copy.parallel.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_table.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/var_cksum.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @: >>$@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs examples-local: ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ output_system_information () \ { \ echo; \ { uname -a | $(AWK) '{ \ printf "System information (uname -a):"; \ for (i = 1; i < NF; ++i) \ { \ if (i != 2) \ printf " %s", $$i; \ } \ printf "\n"; \ }'; } 2>&1; \ if test -r /etc/os-release; then \ echo "Distribution information (/etc/os-release):"; \ sed 8q /etc/os-release; \ elif test -r /etc/issue; then \ echo "Distribution information (/etc/issue):"; \ cat /etc/issue; \ fi; \ }; \ please_report () \ { \ echo "Some test(s) failed. Please report this to $(PACKAGE_BUGREPORT),"; \ echo "together with the test-suite.log file (gzipped) and your system"; \ echo "information. Thanks."; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ output_system_information; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG) for debugging.$${std}";\ if test -n "$(PACKAGE_BUGREPORT)"; then \ please_report | sed -e "s/^/$${col}/" -e s/'$$'/"$${std}"/; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: $(check_PROGRAMS) @$(am__rm_f) $(RECHECK_LOGS) @$(am__rm_f) $(RECHECK_LOGS:.log=.trs) @$(am__rm_f) $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @$(am__rm_f) $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? calendar_test1.log: calendar_test1$(EXEEXT) @p='calendar_test1$(EXEEXT)'; \ b='calendar_test1'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cksum_verify.log: cksum_verify$(EXEEXT) @p='cksum_verify$(EXEEXT)'; \ b='cksum_verify'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test_month_adjust.log: test_month_adjust$(EXEEXT) @p='test_month_adjust$(EXEEXT)'; \ b='test_month_adjust'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .run.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(RUN_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_RUN_LOG_DRIVER_FLAGS) $(RUN_LOG_DRIVER_FLAGS) -- $(RUN_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.run$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(RUN_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_RUN_LOG_DRIVER_FLAGS) $(RUN_LOG_DRIVER_FLAGS) -- $(RUN_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(PROGRAMS) installdirs: 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -$(am__rm_f) $(TEST_LOGS) -$(am__rm_f) $(TEST_LOGS:.log=.trs) -$(am__rm_f) $(TEST_SUITE_LOG) clean-generic: distclean-generic: -$(am__rm_f) $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_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-checkPROGRAMS clean-generic clean-libtool clean-local \ clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/calendar_test1.Po -rm -f ./$(DEPDIR)/cksum_read.Po -rm -f ./$(DEPDIR)/cksum_verify.Po -rm -f ./$(DEPDIR)/cksum_write.Po -rm -f ./$(DEPDIR)/cksum_write_chunk.Po -rm -f ./$(DEPDIR)/deco2d_model.Po -rm -f ./$(DEPDIR)/deco2d_model.parallel.Po -rm -f ./$(DEPDIR)/ensure_array_size.Po -rm -f ./$(DEPDIR)/pio_write.Po -rm -f ./$(DEPDIR)/pio_write.parallel.Po -rm -f ./$(DEPDIR)/pio_write_setup_grid.Po -rm -f ./$(DEPDIR)/pio_write_setup_grid.parallel.Po -rm -f ./$(DEPDIR)/simple_model.Po -rm -f ./$(DEPDIR)/simple_model.parallel.Po -rm -f ./$(DEPDIR)/simple_model_helper.Po -rm -f ./$(DEPDIR)/simple_model_helper.parallel.Po -rm -f ./$(DEPDIR)/stream_cksum.Po -rm -f ./$(DEPDIR)/test_byteswap.Po -rm -f ./$(DEPDIR)/test_cdf_read.Po -rm -f ./$(DEPDIR)/test_cdf_write.Po -rm -f ./$(DEPDIR)/test_grib.Po -rm -f ./$(DEPDIR)/test_month_adjust.Po -rm -f ./$(DEPDIR)/test_resource_copy.Po -rm -f ./$(DEPDIR)/test_resource_copy.parallel.Po -rm -f ./$(DEPDIR)/test_table.Po -rm -f ./$(DEPDIR)/var_cksum.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: examples: examples-am examples-am: examples-local html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/calendar_test1.Po -rm -f ./$(DEPDIR)/cksum_read.Po -rm -f ./$(DEPDIR)/cksum_verify.Po -rm -f ./$(DEPDIR)/cksum_write.Po -rm -f ./$(DEPDIR)/cksum_write_chunk.Po -rm -f ./$(DEPDIR)/deco2d_model.Po -rm -f ./$(DEPDIR)/deco2d_model.parallel.Po -rm -f ./$(DEPDIR)/ensure_array_size.Po -rm -f ./$(DEPDIR)/pio_write.Po -rm -f ./$(DEPDIR)/pio_write.parallel.Po -rm -f ./$(DEPDIR)/pio_write_setup_grid.Po -rm -f ./$(DEPDIR)/pio_write_setup_grid.parallel.Po -rm -f ./$(DEPDIR)/simple_model.Po -rm -f ./$(DEPDIR)/simple_model.parallel.Po -rm -f ./$(DEPDIR)/simple_model_helper.Po -rm -f ./$(DEPDIR)/simple_model_helper.parallel.Po -rm -f ./$(DEPDIR)/stream_cksum.Po -rm -f ./$(DEPDIR)/test_byteswap.Po -rm -f ./$(DEPDIR)/test_cdf_read.Po -rm -f ./$(DEPDIR)/test_cdf_write.Po -rm -f ./$(DEPDIR)/test_grib.Po -rm -f ./$(DEPDIR)/test_month_adjust.Po -rm -f ./$(DEPDIR)/test_resource_copy.Po -rm -f ./$(DEPDIR)/test_resource_copy.parallel.Po -rm -f ./$(DEPDIR)/test_table.Po -rm -f ./$(DEPDIR)/var_cksum.Po -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: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ clean-local clean-noinstPROGRAMS cscopelist-am ctags ctags-am \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am \ examples-am examples-local html html-am info info-am install \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am recheck tags tags-am uninstall \ uninstall-am .PRECIOUS: Makefile $(test_cksum_TEST_LOGS_): test_cksum_base $(pio_write_dist_array_TEST_LOGS_): pio_write_dist_array.run $(pio_write_TEST_LOGS_): pio_write.run @with_concurrent_mpi_checks_FALSE@pio_cksum_fpguard.log: pio_cksum_asynch.log @with_concurrent_mpi_checks_FALSE@pio_cksum_grb2.log: pio_cksum_fpguard.log @with_concurrent_mpi_checks_FALSE@pio_cksum_mpi_fw_at_all.log: pio_cksum_grb2.log @with_concurrent_mpi_checks_FALSE@pio_cksum_mpi_fw_at_reblock.log: pio_cksum_mpi_fw_at_all.log @with_concurrent_mpi_checks_FALSE@pio_cksum_mpi_fw_ordered.log: pio_cksum_mpi_fw_at_reblock.log @with_concurrent_mpi_checks_FALSE@pio_cksum_mpinonb.log: pio_cksum_mpi_fw_ordered.log @with_concurrent_mpi_checks_FALSE@pio_cksum_nc.log: pio_cksum_mpinonb.log @with_concurrent_mpi_checks_FALSE@pio_cksum_nc2.log: pio_cksum_nc.log @with_concurrent_mpi_checks_FALSE@pio_cksum_nc4.log: pio_cksum_nc2.log @with_concurrent_mpi_checks_FALSE@pio_cksum_writer.log: pio_cksum_nc4.log @with_concurrent_mpi_checks_FALSE@pio_write.parallel.log: pio_cksum_writer.log @with_concurrent_mpi_checks_FALSE@pio_write_deco2d.parallel.log: pio_write.parallel.log @with_concurrent_mpi_checks_FALSE@pio_write_dist_array.log: pio_write_deco2d.parallel.log @with_concurrent_mpi_checks_FALSE@test_resource_copy.parallel.log: pio_write_dist_array.log clean-local: -rm -f *.parallel.c -rm -f *.grb *.grb2 *.nc *.nc2 *.nc4 *.srv *.ext *.cksum *.ieg *.stderr *.stdout -rm -rf *.dSYM .c.parallel.c: $(AM_V_GEN):;{ \ echo '#define USE_MPI 1'; \ echo '#include "$<"'; \ } >$@ # 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: # Tell GNU make to disable its built-in pattern rules. %:: %,v %:: RCS/%,v %:: RCS/% %:: s.% %:: SCCS/s.% cdo-2.6.6.1/libcdi/tests/pio_cksum_writer.run.in0000664000175000017500000000034215271332515021730 0ustar alastairalastair#!@SHELL@ #pio_write_args="-p PIO_WRITER -w 4" pio_write_args="-p PIO_WRITER -w 3" #mpi_task_num=8 mpi_task_num=6 . ./pio_write.run ( . ./pio_write_dist_array.run ) || test $? -eq 77 # # Local Variables: # mode: sh # End: # cdo-2.6.6.1/libcdi/tests/Makefile.am0000664000175000017500000001336615271332515017256 0ustar alastairalastairTEST_EXTENSIONS = @EXEEXT@ .run # Serial tests: TESTS = \ calendar_test1 \ cksum_verify \ pio_write.run \ pio_write_deco2d.run \ test_byteswap.run \ test_cdf_const.run \ test_cdf_transformation.run \ test_cksum_ext.run \ test_cksum_grb.run \ test_cksum_grb2.run \ test_cksum_ieg.run \ test_cksum_nc.run \ test_cksum_nc2.run \ test_cksum_nc4.run \ test_cksum_nc_chunk.run \ test_cksum_srv.run \ test_f2003.run \ test_grib.run \ test_month_adjust \ test_resource_copy.run \ test_table.run # Update test_cksum_base before running tests that source it: test_cksum_TEST_LOGS_ = \ test_cksum_ext.log \ test_cksum_grb.log \ test_cksum_grb2.log \ test_cksum_ieg.log \ test_cksum_nc.log \ test_cksum_nc2.log \ test_cksum_nc4.log \ test_cksum_srv.log $(test_cksum_TEST_LOGS_): test_cksum_base # Parallel tests: TESTS += \ pio_cksum_asynch.run \ pio_cksum_fpguard.run \ pio_cksum_grb2.run \ pio_cksum_mpi_fw_at_all.run \ pio_cksum_mpi_fw_at_reblock.run \ pio_cksum_mpi_fw_ordered.run \ pio_cksum_mpinonb.run \ pio_cksum_nc.run \ pio_cksum_nc2.run \ pio_cksum_nc4.run \ pio_cksum_writer.run \ pio_write.parallel.run \ pio_write_deco2d.parallel.run \ pio_write_dist_array.run \ test_resource_copy.parallel.run # Update pio_write_dist_array.run before running tests that source it: pio_write_dist_array_TEST_LOGS_ = \ pio_cksum_asynch.log \ pio_cksum_fpguard.log \ pio_cksum_grb2.log \ pio_cksum_mpi_fw_at_all.log \ pio_cksum_mpi_fw_at_reblock.log \ pio_cksum_mpi_fw_ordered.log \ pio_cksum_mpinonb.log \ pio_cksum_nc.log \ pio_cksum_nc2.log \ pio_cksum_nc4.log \ pio_cksum_writer.log $(pio_write_dist_array_TEST_LOGS_): pio_write_dist_array.run # Update pio_write.run before running tests that source it: pio_write_TEST_LOGS_ = \ $(pio_write_dist_array_TEST_LOGS_) \ pio_write.parallel.log \ pio_write_deco2d.log \ pio_write_deco2d.parallel.log \ pio_write_dist_array.log $(pio_write_TEST_LOGS_): pio_write.run if !with_concurrent_mpi_checks pio_cksum_fpguard.log: pio_cksum_asynch.log pio_cksum_grb2.log: pio_cksum_fpguard.log pio_cksum_mpi_fw_at_all.log: pio_cksum_grb2.log pio_cksum_mpi_fw_at_reblock.log: pio_cksum_mpi_fw_at_all.log pio_cksum_mpi_fw_ordered.log: pio_cksum_mpi_fw_at_reblock.log pio_cksum_mpinonb.log: pio_cksum_mpi_fw_ordered.log pio_cksum_nc.log: pio_cksum_mpinonb.log pio_cksum_nc2.log: pio_cksum_nc.log pio_cksum_nc4.log: pio_cksum_nc2.log pio_cksum_writer.log: pio_cksum_nc4.log pio_write.parallel.log: pio_cksum_writer.log pio_write_deco2d.parallel.log: pio_write.parallel.log pio_write_dist_array.log: pio_write_deco2d.parallel.log test_resource_copy.parallel.log: pio_write_dist_array.log endif !with_concurrent_mpi_checks test_PROGRAMS_ = \ calendar_test1 \ cksum_read \ cksum_verify \ cksum_write \ cksum_write_chunk \ pio_write \ pio_write_deco2d \ test_byteswap \ test_grib \ test_month_adjust \ test_resource_copy \ test_table if ENABLE_NETCDF test_PROGRAMS_ += \ test_cdf_read \ test_cdf_write endif if ENABLE_MPI test_PROGRAMS_ += \ pio_write.parallel \ pio_write_deco2d.parallel \ test_resource_copy.parallel endif ENABLE_MPI if with_on_demand_check_programs check_PROGRAMS = $(test_PROGRAMS_) else !with_on_demand_check_programs noinst_PROGRAMS = $(test_PROGRAMS_) endif !with_on_demand_check_programs AM_CPPFLAGS = -I$(top_srcdir)/src AM_CFLAGS = $(PPM_CORE_C_INCLUDE) $(YAXT_C_INCLUDE) $(MPI_C_INCLUDE) AM_LDFLAGS = if ENABLE_ALL_STATIC AM_LDFLAGS += -all-static endif LDADD = $(top_builddir)/src/libcdi.la calendar_test1_SOURCES = calendar_test1.c cksum_read_SOURCES = \ cksum_read.c \ ensure_array_size.c \ ensure_array_size.h \ stream_cksum.c \ stream_cksum.h \ var_cksum.c \ var_cksum.h cksum_verify_SOURCES = cksum_verify.c cksum_write_SOURCES = \ cksum_write.c \ simple_model_helper.c \ simple_model_helper.h cksum_write_chunk_SOURCES = \ cksum_write_chunk.c \ simple_model_helper.c \ simple_model_helper.h pio_write_SOURCES = \ pio_write.c \ pio_write.h \ pio_write_setup_grid.c \ pio_write_setup_grid.h \ simple_model.c \ simple_model_helper.c \ simple_model_helper.h nodist_pio_write_parallel_SOURCES = $(pio_write_SOURCES:.c=.parallel.c) pio_write_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(PPM_CORE_C_LIB) $(YAXT_C_LIB) $(LDADD) pio_write_deco2d_SOURCES = \ deco2d_model.c \ pio_write.c \ pio_write.h \ pio_write_setup_grid.c \ pio_write_setup_grid.h \ simple_model_helper.c \ simple_model_helper.h nodist_pio_write_deco2d_parallel_SOURCES = $(pio_write_deco2d_SOURCES:.c=.parallel.c) pio_write_deco2d_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(PPM_CORE_C_LIB) $(YAXT_C_LIB) $(LDADD) test_byteswap_SOURCES = test_byteswap.c test_grib_SOURCES = test_grib.c test_month_adjust_SOURCES = test_month_adjust.c test_resource_copy_SOURCES = test_resource_copy.c test_resource_copy_LDADD = $(top_builddir)/src/libcdiresunpack.la nodist_test_resource_copy_parallel_SOURCES = $(test_resource_copy_SOURCES:.c=.parallel.c) test_resource_copy_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(LDADD) test_table_SOURCES = test_table.c test_cdf_read_SOURCES = test_cdf_read.c test_cdf_write_SOURCES = \ simple_model_helper.c \ simple_model_helper.h \ test_cdf_write.c clean-local: -rm -f *.parallel.c -rm -f *.grb *.grb2 *.nc *.nc2 *.nc4 *.srv *.ext *.cksum *.ieg *.stderr *.stdout -rm -rf *.dSYM AUTOMAKE_OPTIONS = color-tests # Generate source files for parallel versions of the programs. We do this to # avoid target-specific flags, which result into rules that do not use the # compilation commands above. SUFFIXES = .parallel.c .c.parallel.c: $(AM_V_GEN):;{ \ echo '#define USE_MPI 1'; \ echo '#include "$<"'; \ } >$@ include $(top_srcdir)/config/lt_overrides_Makefile.inc cdo-2.6.6.1/libcdi/tests/calendar_test1.c0000664000175000017500000000624715271332515020257 0ustar alastairalastair/* DO NOT REMOVE the config.h include file under any circumstances, * it's very much needed on some platforms */ #if defined(HAVE_CONFIG_H) #include "config.h" #endif /* DO NOT REMOVE the above config.h include file under any * circumstances as long as it's the autoconf configuration header * used to build this package. When it's missing on some platforms, * some poor person has to do long, tedious debugging sessions, where * struct offsets almost imperceptibly change from one file to the * next to find out what happened */ #include #include #include "cdi.h" #include "julian_date.h" int main(void) { int calendar = CALENDAR_STANDARD; int j = 0; // 1 - Check valid range of years { int nmin = 11000; int vdate0 = -80001201; int vtime0 = 120500; // printf("start time: %8d %4d\n", vdate0, vtime0); CdiDateTime dt = cdiDateTime_set(vdate0, vtime0); for (int i = 0; i < nmin; i++) { JulianDate julianDate = julianDate_encode(calendar, dt); dt = julianDate_decode(calendar, julianDate); int vdate = (int) cdiDate_get(dt.date); int vtime = cdiTime_get(dt.time); if (vdate0 != vdate || vtime0 != vtime) fprintf(stderr, "%4d %8d %4d %8d %4d %9d %g\n", ++j, vdate0, vtime0, vdate, vtime, (int) julianDate.julianDay, julianDate.secondOfDay); dt.date.year++; julianDate = julianDate_encode(calendar, dt); dt = julianDate_decode(calendar, julianDate); vdate0 = (int) cdiDate_get(dt.date); vtime0 = cdiTime_get(dt.time); } // printf("stop time: %8d %4d\n", vdate0, vtime0); } // 2 - Check time increment of one minute { int nmin = 120000; int ijulinc = 60; int vdate0 = 20001201; int vtime0 = 0; // printf("start time: %8d %4d\n", vdate0, vtime0); CdiDateTime dt = cdiDateTime_set(vdate0, vtime0); JulianDate julianDate = julianDate_encode(calendar, dt); for (int i = 0; i < nmin; i++) { int year, mon, day, hour, minute, second; cdiDecodeDate(vdate0, &year, &mon, &day); cdiDecodeTime(vtime0, &hour, &minute, &second); if (++minute >= 60) { minute = 0; if (++hour >= 24) { hour = 0; if (++day >= 32) { day = 1; if (++mon >= 13) { mon = 1; year++; } } } } vdate0 = cdiEncodeDate(year, mon, day); vtime0 = cdiEncodeTime(hour, minute, second); julianDate = julianDate_add_seconds(julianDate, ijulinc); dt = julianDate_decode(calendar, julianDate); int vdate = (int) cdiDate_get(dt.date); int vtime = cdiTime_get(dt.time); if (vdate0 != vdate || vtime0 != vtime) fprintf(stderr, "%4d %8d %4d %8d %4d %9d %g\n", ++j, vdate0, vtime0, vdate, vtime, (int) julianDate.julianDay, julianDate.secondOfDay); } // printf("stop time: %8d %4d\n", vdate0, vtime0); } return j == 0 ? EXIT_SUCCESS : EXIT_FAILURE; } /* * Local Variables: * c-file-style: "Java" * c-basic-offset: 2 * indent-tabs-mode: nil * show-trailing-whitespace: t * require-trailing-newline: t * End: */ cdo-2.6.6.1/libcdi/tests/test_cksum_nc.run.in0000664000175000017500000000005015271332515021200 0ustar alastairalastair#!@SHELL@ suffix=nc . ./test_cksum_base cdo-2.6.6.1/libcdi/tests/pio_cksum_mpi_fw_at_reblock.run.in0000664000175000017500000000021715271332515024063 0ustar alastairalastair#!@SHELL@ pio_write_args="-p PIO_MPI_FW_AT_REBLOCK -w 2" mpi_task_num=5 . ./pio_write.run ( . ./pio_write_dist_array.run ) || test $? -eq 77 cdo-2.6.6.1/libcdi/tests/deco2d_model.c0000664000175000017500000003367615271332515017714 0ustar alastairalastair#if defined(HAVE_CONFIG_H) #include "config.h" #endif #include #include #include #include #include #include #ifdef USE_MPI #include #include #endif #include "cdi.h" #ifdef USE_MPI #include "cdipio.h" #include "pio_util.h" #ifdef HAVE_PPM_CORE #include #include #endif #endif #include "cksum.h" #include "dmemory.h" #include "error.h" #include "pio_write.h" #include "pio_write_setup_grid.h" #include "simple_model_helper.h" #include "cdi_uuid.h" enum { ntfiles = 2, nproma = 16, }; static void modelRegionCompute(double region[], int nlev, int nlat, int nlon, const int chunkStart[3], const int chunkSize[3], int tsID, double mscale, double mrscale) { (void) nlev; int is = chunkStart[0], js = chunkStart[1], ks = chunkStart[2], m = chunkSize[0], n = chunkSize[1], o = chunkSize[2], jstride = chunkSize[0], kstride = ((jstride * chunkSize[1] + nproma - 1) / nproma) * nproma; tsID %= nlon; for (int k = 0; k < o; ++k) for (int j = 0; j < n; ++j) for (int i = 0; i < m; ++i) region[k * kstride + j * jstride + i] = dg_wobble((double) ((i + is + tsID) % nlon) / (double) (nlon - 1), (double) ((j + js + k + ks) % nlat) / (double) (nlat - 1), mscale, mrscale); } void modelRun(const struct model_config *setup, MPI_Comm comm) { struct varDesc_t { size_t size; int nlev, zaxisID, id, code; uint32_t checksum_state; #if USE_MPI int chunkSize[2], start[2]; Xt_idxlist partDesc; Xt_redist redist4gather; #endif bool useFloat; } * varDesc; int gridID, taxisID, vlistID, tsID, tfID = 0; enum { nmiss = 0 }; double *levs; double *var = NULL, *varslice = NULL; float *varsliceF = NULL; #if !USE_MPI float *varF = NULL; #endif double mscale, mrscale; time_t current_time; int vdate = 19850101, vtime = 120000; int rank = 0; char *filename = NULL; int nlon = setup->nlon, nlat = setup->nlat; size_t nVars = setup->nvars > 0 ? (size_t) setup->nvars : 0; size_t varslice_size = 0, varsliceF_size = 0; ; #if USE_MPI int comm_size = 1; int npart[2], rank_coord[2]; int *blk_displ, *blk_lens; #endif #if USE_MPI xmpi(MPI_Comm_rank(comm, &rank)); xmpi(MPI_Comm_size(comm, &comm_size)); #else (void) comm; #endif #if USE_MPI bool needsGather = setup->flags & PIO_WRITE_CONFIG_CHECKSUM_FLAG; #else bool needsGather = true; #endif if (rank == 0 && (setup->flags & PIO_WRITE_CONFIG_CHECKSUM_FLAG)) { var = (double *) Malloc((size_t) nlon * (size_t) nlat * (size_t) setup->max_nlev * sizeof(var[0])); #if !USE_MPI varF = (float *) Malloc((size_t) nlon * (size_t) nlat * (size_t) setup->max_nlev * sizeof(varF[0])); #endif } #if USE_MPI if (comm_size == 1) { npart[0] = 1; npart[1] = 1; rank_coord[0] = 0; rank_coord[1] = 0; } else { findPartition2D(npart, comm_size); rank_coord[0] = rank % npart[0], rank_coord[1] = rank / npart[0]; } blk_displ = Malloc((size_t) setup->max_nlev * sizeof(blk_displ[0]) * 2); blk_lens = blk_displ + setup->max_nlev; #endif var_scale(setup->datatype, &mscale, &mrscale); gridID = setupGrid(setup, comm); levs = (double *) Malloc((size_t) setup->max_nlev * sizeof(levs[0])); { double lscale = 1.0 / (double) (setup->max_nlev - 1); for (size_t i = 0; i < (size_t) setup->max_nlev; ++i) levs[i] = 101300.0 - 13000.0 * expm1(2.173 * (double) i * lscale); /* GRIB1 only supports integral hPa values in pressure levels */ if (setup->filetype == CDI_FILETYPE_GRB) for (size_t i = 0; i < (size_t) setup->max_nlev; ++i) levs[i] = round(levs[i] * 0.01) * 100.0; } vlistID = vlistCreate(); varDesc = (struct varDesc_t *) Malloc(nVars * sizeof(varDesc[0])); for (size_t varIdx = 0; varIdx < nVars; varIdx++) { int varLevs = (int) cdi_repeatable_random() % 4; switch (varLevs) { case 1: varLevs = setup->max_nlev / 3; break; case 2: varLevs = setup->max_nlev >= 11 ? 11 : setup->max_nlev / 2; break; case 3: varLevs = setup->max_nlev - 1; break; } ++varLevs; varDesc[varIdx].nlev = varLevs; for (size_t i = 0; i < (size_t) varIdx; ++i) if (varDesc[i].nlev == varLevs) { varDesc[varIdx].zaxisID = varDesc[i].zaxisID; goto zaxisIDset; } if (varLevs == 1) varDesc[varIdx].zaxisID = zaxisCreate(ZAXIS_SURFACE, 1); else { varDesc[varIdx].zaxisID = zaxisCreate(ZAXIS_PRESSURE, varDesc[varIdx].nlev); zaxisDefLevels(varDesc[varIdx].zaxisID, levs); } if (setup->flags & PIO_WRITE_CONFIG_CREATE_UUID_FLAG) { unsigned char uuid[CDI_UUID_SIZE]; if (rank == 0) cdiCreateUUID(uuid); #if USE_MPI MPI_Bcast(uuid, CDI_UUID_SIZE, MPI_UNSIGNED_CHAR, 0, comm); #endif cdiDefKeyBytes(varDesc[varIdx].zaxisID, CDI_GLOBAL, CDI_KEY_UUID, uuid, CDI_UUID_SIZE); } zaxisIDset: varDesc[varIdx].id = vlistDefVar(vlistID, gridID, varDesc[varIdx].zaxisID, TIME_VARIABLE); varDesc[varIdx].size = (size_t) nlon * (size_t) nlat * (size_t) varDesc[varIdx].nlev; #ifdef USE_MPI { for (size_t i = 0; i < varIdx; ++i) if (varDesc[i].nlev == varLevs) { varDesc[varIdx].redist4gather = varDesc[i].redist4gather; varDesc[varIdx].partDesc = varDesc[i].partDesc; for (size_t j = 0; j < 2; ++j) { varDesc[varIdx].start[j] = varDesc[i].start[j]; varDesc[varIdx].chunkSize[j] = varDesc[i].chunkSize[j]; } goto partDescriptionSet; } int start[2], chunkSize[3], varSize[2] = { nlon, nlat }; for (size_t i = 0; i < 2; ++i) { struct PPM_extent range = PPM_uniform_partition((struct PPM_extent){ 0, varSize[i] }, npart[i], rank_coord[i]); start[i] = range.first; chunkSize[i] = range.size; fprintf(stderr, "%d: start[%zu]=%d, chunkSize[%zu] = %d\n", rank, i, start[i], i, chunkSize[i]); varDesc[varIdx].start[i] = range.first; varDesc[varIdx].chunkSize[i] = range.size; } Xt_int varSizeXt[3] = { (Xt_int) nlon, (Xt_int) nlat, (Xt_int) varLevs }; chunkSize[2] = varLevs; Xt_int varStartXt[3] = { start[0], start[1], 0 }; Xt_idxlist part_idxlist = xt_idxsection_new(0, (varLevs > 1 ? 3 : 2), varSizeXt, chunkSize, varStartXt), gather_idxlist; varDesc[varIdx].partDesc = part_idxlist; if (setup->flags & PIO_WRITE_CONFIG_CHECKSUM_FLAG) { if (rank == 0) { gather_idxlist = xt_idxstripes_new(&(struct Xt_stripe){ .start = 0, .stride = 1, .nstrides = (int) varDesc[varIdx].size }, 1); } else gather_idxlist = xt_idxempty_new(); Xt_xmap xmap4gather = xt_xmap_all2all_new(part_idxlist, gather_idxlist, comm); xt_idxlist_delete(gather_idxlist); struct Xt_offset_ext *src_blocks = Malloc((size_t) varLevs * sizeof(*src_blocks)); struct Xt_offset_ext dst_block = { .start = 0, .size = nlon * nlat * varLevs, .stride = 1 }; size_t levStride = (((size_t) chunkSize[0] * (size_t) chunkSize[1] + nproma - 1) / nproma) * nproma; for (size_t i = 0; i < (size_t) varLevs; ++i) src_blocks[i] = (struct Xt_offset_ext){ .start = (int) (i * levStride), .size = chunkSize[0] * chunkSize[1], .stride = 1 }; varDesc[varIdx].redist4gather = xt_redist_p2p_ext_new(xmap4gather, varLevs, src_blocks, 1, &dst_block, MPI_DOUBLE); Free(src_blocks); xt_xmap_delete(xmap4gather); } } partDescriptionSet:; #endif varDesc[varIdx].code = GRIB_USERDEF + (int) varIdx; vlistDefVarCode(vlistID, varDesc[varIdx].id, varDesc[varIdx].code); vlistDefVarDatatype(vlistID, varDesc[varIdx].id, setup->datatype); varDesc[varIdx].useFloat = (bool) (cdi_repeatable_random() & 1); } taxisID = taxisCreate(setup->taxistype); vlistDefTaxis(vlistID, taxisID); for (tfID = 0; tfID < ntfiles; tfID++) { for (size_t varIdx = 0; varIdx < nVars; ++varIdx) varDesc[varIdx].checksum_state = 0; int streamID = composeStream(&filename, setup->prefix, tfID, setup->suffix, setup->filetype); streamDefVlist(streamID, vlistID); vdate = 19850101; vtime = 120000; current_time = cditime2time_t(vdate, vtime); for (tsID = 0; tsID < setup->nts; tsID++) { int vdatetime[2]; time_t2cditime(current_time, &vdatetime[1], &vdatetime[0]); taxisDefVdate(taxisID, vdatetime[1]); taxisDefVtime(taxisID, vdatetime[0]); streamDefTimestep(streamID, tsID); if (setup->filetype == CDI_FILETYPE_EXT) { /* EXTRA doesn't store time, only date * set the value to 0 before checksumming, because a * time field of 0 is what reading an EXTRA file will * return */ vdatetime[0] = 0; } for (size_t varIdx = 0; varIdx < nVars; ++varIdx) { size_t varLevs = (size_t) varDesc[varIdx].nlev; #ifdef USE_MPI int start[3] = { varDesc[varIdx].start[0], varDesc[varIdx].start[1], 0 }; int chunk[3] = { varDesc[varIdx].chunkSize[0], varDesc[varIdx].chunkSize[1], (int) varLevs }; #else int chunk[3] = { nlon, nlat, (int) varLevs }; int start[3] = { 0, 0, 0 }; #endif size_t chunkSize = (((size_t) chunk[0] * (size_t) chunk[1] + (size_t) (nproma - 1)) / (size_t) nproma) * (size_t) nproma * varLevs; if (varslice_size < chunkSize) { varslice = (double *) Realloc(varslice, chunkSize * sizeof(var[0])); varslice_size = chunkSize; } modelRegionCompute(varslice, (int) varLevs, nlat, nlon, start, chunk, tsID, mscale, mrscale); bool useFloat = varDesc[varIdx].useFloat; if (useFloat) { if (varsliceF_size < chunkSize) { varsliceF = (float *) Realloc(varsliceF, chunkSize * sizeof(varsliceF[0])); varsliceF_size = chunkSize; } for (size_t i = 0; i < chunkSize; ++i) varslice[i] = varsliceF[i] = (float) varslice[i]; } if (needsGather) { #if USE_MPI xt_redist_s_exchange1(varDesc[varIdx].redist4gather, varslice, var); #else size_t layerSize = (size_t) (chunk[0] * chunk[1]); size_t nblk = (layerSize + nproma - 1) / nproma - 1; size_t npromz = layerSize - nblk * nproma; for (size_t k = 0; k < varLevs; ++k) { for (size_t j = 0; j < nblk; ++j) for (size_t i = 0; i < nproma; ++i) var[k * layerSize + j * nproma + i] = varslice[k * (nblk + 1) * nproma + j * nproma + i]; for (size_t i = 0; i < npromz; ++i) var[k * layerSize + nblk * nproma + i] = varslice[k * (nblk + 1) * nproma + nblk * nproma + i]; } if (useFloat) for (size_t k = 0; k < varLevs; ++k) for (size_t i = 0; i < layerSize; ++i) varF[k * layerSize + i] = (float) var[k * layerSize + i]; #endif } if (rank == 0 && (setup->flags & PIO_WRITE_CONFIG_CHECKSUM_FLAG)) { memcrc_r(&varDesc[varIdx].checksum_state, (const unsigned char *) vdatetime, sizeof(vdatetime)); memcrc_r(&varDesc[varIdx].checksum_state, (const unsigned char *) var, varDesc[varIdx].size * sizeof(var[0])); } #ifdef USE_MPI size_t layerSize = (size_t) (chunk[0] * chunk[1]); size_t nblk = (layerSize + nproma - 1) / nproma - 1; for (size_t k = 0; k < varLevs; ++k) { blk_displ[k] = (int) (k * (nblk + 1) * nproma); blk_lens[k] = (int) layerSize; } if (useFloat) streamWriteScatteredVarPartF(streamID, varDesc[varIdx].id, varsliceF, (int) varLevs, blk_lens, blk_displ, nmiss, varDesc[varIdx].partDesc); else streamWriteScatteredVarPart(streamID, varDesc[varIdx].id, varslice, (int) varLevs, blk_lens, blk_displ, nmiss, varDesc[varIdx].partDesc); #else if (useFloat) streamWriteVarF(streamID, varDesc[varIdx].id, varF, nmiss); else streamWriteVar(streamID, varDesc[varIdx].id, var, nmiss); #endif } current_time += 86400; #ifdef USE_MPI pioWriteTimestep(); #endif } streamClose(streamID); if (rank == 0 && (setup->flags & PIO_WRITE_CONFIG_CHECKSUM_FLAG)) { FILE *tablefp; composeFilename(&filename, setup->prefix, tfID, "cksum"); if (!(tablefp = fopen(filename, "w"))) { perror("failed to open table file"); exit(EXIT_FAILURE); } for (size_t varIdx = 0; varIdx < nVars; ++varIdx) { uint32_t cksum; int code; cksum = memcrc_finish(&varDesc[varIdx].checksum_state, (off_t) ((varDesc[varIdx].size * sizeof(var[0]) + sizeof(int) * 2) * (size_t) setup->nts)); code = vlistInqVarCode(vlistID, varDesc[varIdx].id); if (fprintf(tablefp, "%08lx %d\n", (unsigned long) cksum, code) < 0) { perror("failed to write table file"); exit(EXIT_FAILURE); } } fclose(tablefp); } } #ifdef USE_MPI pioEndTimestepping(); #endif Free(varslice); Free(varsliceF); vlistDestroy(vlistID); taxisDestroy(taxisID); for (size_t varIdx = 0; varIdx < nVars; varIdx++) { int zID = varDesc[varIdx].zaxisID; if (zID != CDI_UNDEFID) { zaxisDestroy(zID); #if USE_MPI xt_idxlist_delete(varDesc[varIdx].partDesc); if (setup->flags & PIO_WRITE_CONFIG_CHECKSUM_FLAG) xt_redist_delete(varDesc[varIdx].redist4gather); #endif for (size_t j = varIdx + 1; j < nVars; ++j) if (zID == varDesc[j].zaxisID) varDesc[j].zaxisID = CDI_UNDEFID; } } gridDestroy(gridID); Free(var); #if USE_MPI Free(blk_displ); #else Free(varF); #endif Free(varDesc); Free(levs); Free(filename); } /* * Local Variables: * c-file-style: "Java" * c-basic-offset: 2 * indent-tabs-mode: nil * show-trailing-whitespace: t * require-trailing-newline: t * End: */ cdo-2.6.6.1/libcdi/tests/cksum_read.c0000664000175000017500000000343015271332515017472 0ustar alastairalastair#ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "ensure_array_size.h" #include "var_cksum.h" #include "stream_cksum.h" static struct cksum_table * read_table(const char *table_fname, size_t *table_len) { struct cksum_table *table = NULL; FILE *tablefp; size_t table_size = 0, table_used = 0; uint32_t cksum_temp; int code; if (!(tablefp = fopen(table_fname, "r"))) { perror("failed to open table file"); *table_len = (size_t) -1; return NULL; } while (fscanf(tablefp, "%08" PRIx32 " %d\n", &cksum_temp, &code) == 2) { ENSURE_ARRAY_SIZE(table, table_size, table_used + 1); table[table_used].code = code; table[table_used].cksum = cksum_temp; ++table_used; } fclose(tablefp); *table_len = table_used; return table; } int main(int argc, char *argv[]) { const char *fname = "example.grb", *table_fname = "example.cksum"; if (argc > 1) fname = argv[1]; if (argc > 2) table_fname = argv[2]; // compute checksums from data file size_t nvars; struct cksum_table *file_vars = cksum_stream(fname, &nvars); if (!file_vars) exit(EXIT_FAILURE); // check checksums from table file int retcode; { size_t num_ref_entries; struct cksum_table *ref_var_table = read_table(table_fname, &num_ref_entries); if (num_ref_entries == (size_t) -1) { free(file_vars); exit(EXIT_FAILURE); } retcode = compare_checksums(file_vars, nvars, "file", ref_var_table, num_ref_entries, "reference table"); free(file_vars); free(ref_var_table); } return retcode; } /* * Local Variables: * c-file-style: "Java" * c-basic-offset: 2 * indent-tabs-mode: nil * show-trailing-whitespace: t * require-trailing-newline: t * End: */ cdo-2.6.6.1/libcdi/examples/0000775000175000017500000000000015271332515015665 5ustar alastairalastaircdo-2.6.6.1/libcdi/examples/README0000664000175000017500000000027415271332515016550 0ustar alastairalastairThe following C Source files cdi_read.c cdi_write.c cdi_copy.c cdi_read_f.f cdi_write_f.f cdi_copy_f.f are directly used in the documentation. !!! Please do not change these files !!! cdo-2.6.6.1/libcdi/examples/cdi_write_ens.c0000664000175000017500000000736515271332515020662 0ustar alastairalastair#include #include #include #include "cdi.h" int main(void) { char fname[] = "test_ens.grb2"; int filetype = CDI_FILETYPE_GRB2; int nlat = 18, nlon = 2 * nlat; double *data = NULL; int nlevel; int varID; int streamID1, streamID2; int gridID, zaxisID; int nrecs, nvars; int tsID; int levelID; int vlistID, taxisID; SizeType numMissVals; int instID; size_t datasize = (size_t) nlon * (size_t) nlat; data = (double *) malloc(datasize * sizeof(double)); memset(data, 0, datasize * sizeof(double)); gridID = gridCreate(GRID_GAUSSIAN, (int) datasize); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); zaxisID = zaxisCreate(ZAXIS_SURFACE, 1); instID = institutDef(252, 0, NULL, NULL); vlistID = vlistCreate(); varID = vlistDefVar(vlistID, gridID, zaxisID, TIME_VARYING); int perturbationNumber = 1; int numberOfForecastsInEnsemble = 2; int typeOfEnsembleForecast = 3; cdiDefKeyInt(vlistID, varID, CDI_KEY_TYPEOFENSEMBLEFORECAST, typeOfEnsembleForecast); cdiDefKeyInt(vlistID, varID, CDI_KEY_NUMBEROFFORECASTSINENSEMBLE, numberOfForecastsInEnsemble); cdiDefKeyInt(vlistID, varID, CDI_KEY_PERTURBATIONNUMBER, perturbationNumber); cdiInqKeyInt(vlistID, varID, CDI_KEY_PERTURBATIONNUMBER, &perturbationNumber); cdiInqKeyInt(vlistID, varID, CDI_KEY_NUMBEROFFORECASTSINENSEMBLE, &numberOfForecastsInEnsemble); cdiInqKeyInt(vlistID, varID, CDI_KEY_TYPEOFENSEMBLEFORECAST, &typeOfEnsembleForecast); vlistDefInstitut(vlistID, instID); taxisID = taxisCreate(TAXIS_ABSOLUTE); vlistDefTaxis(vlistID, taxisID); streamID1 = streamOpenWrite(fname, filetype); if (streamID1 < 0) { fprintf(stderr, "Open failed on %s\n", fname); fprintf(stderr, "%s\n", cdiStringError(streamID1)); return (-1); } streamDefVlist(streamID1, vlistID); (void) streamDefTimestep(streamID1, 0); streamWriteVar(streamID1, varID, data, 0); return (0); vlistID = streamInqVlist(streamID1); filetype = streamInqFiletype(streamID1); streamID2 = streamOpenWrite(fname, filetype); if (streamID2 < 0) { fprintf(stderr, "Open failed on %s\n", fname); fprintf(stderr, "%s\n", cdiStringError(streamID2)); return (-1); } streamDefVlist(streamID2, vlistID); nvars = vlistNvars(vlistID); for (varID = 0; varID < nvars; varID++) { int varGridID = vlistInqVarGrid(vlistID, varID); int varZaxisID = vlistInqVarZaxis(vlistID, varID); size_t gridsize = (size_t) gridInqSize(varGridID); size_t varNlevel = (size_t) zaxisInqSize(varZaxisID); if (gridsize * varNlevel > datasize) datasize = gridsize * varNlevel; } data = (double *) malloc(datasize * sizeof(double)); memset(data, 0, datasize * sizeof(double)); taxisID = vlistInqTaxis(vlistID); tsID = 0; while ((nrecs = streamInqTimestep(streamID1, tsID))) { /* int vdate = */ taxisInqVdate(taxisID); /* int vtime = */ taxisInqVtime(taxisID); streamDefTimestep(streamID2, tsID); for (varID = 0; varID < nvars; varID++) { streamReadVar(streamID1, varID, data, &numMissVals); /* int code = */ vlistInqVarCode(vlistID, varID); gridID = vlistInqVarGrid(vlistID, varID); zaxisID = vlistInqVarZaxis(vlistID, varID); /* int gridtype = */ gridInqType(gridID); /* int gridsize = */ gridInqSize(gridID); nlevel = zaxisInqSize(zaxisID); /* double missval = */ vlistInqVarMissval(vlistID, varID); for (levelID = 0; levelID < nlevel; levelID++) { /* int level = (int) */ zaxisInqLevel(zaxisID, levelID); /* int offset = gridsize*levelID; */ } streamWriteVar(streamID2, varID, data, numMissVals); } tsID++; } free(data); streamClose(streamID2); streamClose(streamID1); return (0); } cdo-2.6.6.1/libcdi/examples/pio/0000775000175000017500000000000015271332515016454 5ustar alastairalastaircdo-2.6.6.1/libcdi/examples/pio/collectDataNStreams.c0000664000175000017500000001652215271332515022522 0ustar alastairalastair#if defined(HAVE_CONFIG_H) #include "config.h" #endif #include #include #ifdef USE_MPI #include #else typedef int MPI_Comm; #define MPI_COMM_NULL 0 #endif #include "cdi.h" #include "error.h" #ifdef USE_MPI #include "cdipio.h" #include "pio_util.h" #endif static void hoursPassingHack(int *vdate, int *vtime, int hoursPassed) { int sum, days, hours, oldDays; xassert(hoursPassed % 10000 == 0); sum = *vtime + hoursPassed; days = sum / 240000; hours = sum % 240000; oldDays = *vdate % 100; if (oldDays + days > 28) xabort("UNEXPECTED USE"); *vtime = hours; *vdate = *vdate + days; } #ifdef USE_MPI static int uniform_partition_start(int set_interval[2], int nparts, int part_idx); #endif static void modelRun(MPI_Comm commModel) { enum { filetype = CDI_FILETYPE_GRB, nStreams = 5, MAXNSTREAMS = 25, ntfiles = 2, ntsteps = 3, nVars = 5, nlon = 12, nlat = 6, MAXNLEV = 5 }; static int nlev[nStreams][nVars] = { { 1, 1, 5, 5, 2 }, { 3, 5, 2, 2, 1 }, { 3, 5, 2, 2, 1 }, { 5, 2, 2, 2, 1 }, { 3, 3, 3, 3, 3 } }; static char nameExp[] = "example"; static int asciiA = 65; char filename[1024]; int gridID, zaxisID[nStreams][nVars], taxisID; int streamID[nStreams], vlistID[nStreams], varID[nStreams][nVars], tsID, tfID = 0; int i, j, nmiss = 0; double lons[nlon] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; double lats[nlat] = { -75, -45, -15, 15, 45, 75 }; double levs[MAXNLEV] = { 101300, 92500, 85000, 50000, 20000 }; double *var; int vdate = 19850101, vtime = 120000, hourStep = 20000; size_t varSize[nStreams][nVars]; #if USE_MPI int rank, comm_size; struct var1DDeco { int chunkSize, start; Xt_idxlist partDesc; } varDeco[nStreams][nVars]; #endif #ifndef USE_MPI (void) commModel; #endif xassert(nStreams < MAXNSTREAMS); gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); gridDefYvals(gridID, lats); for (i = 0; i < nStreams; i++) { for (j = 0; j < nVars; j++) { xassert(nlev[i][j] > 0 && nlev[i][j] <= MAXNLEV); zaxisID[i][j] = zaxisCreate(ZAXIS_PRESSURE, nlev[i][j]); zaxisDefLevels(zaxisID[i][j], levs); } vlistID[i] = vlistCreate(); } #if USE_MPI xmpi(MPI_Comm_rank(commModel, &rank)); xmpi(MPI_Comm_size(commModel, &comm_size)); #endif { size_t maxChunkSize = 0; for (i = 0; i < nStreams; i++) for (j = 0; j < nVars; j++) { varID[i][j] = vlistDefVar(vlistID[i], gridID, zaxisID[i][j], TIME_VARIABLE); varSize[i][j] = nlon * nlat * (size_t) nlev[i][j]; #ifdef USE_MPI { int start = uniform_partition_start((int[2]){ 0, (int) varSize[i][j] - 1 }, comm_size, rank), chunkSize = uniform_partition_start((int[2]){ 0, (int) varSize[i][j] - 1 }, comm_size, rank + 1) - start; if (maxChunkSize < (size_t) chunkSize) maxChunkSize = (size_t) chunkSize; fprintf(stderr, "%d: start=%d, chunkSize = %d\n", rank, start, chunkSize); Xt_idxlist idxlist = xt_idxstripes_new(&(struct Xt_stripe){ .start = start, .nstrides = chunkSize, .stride = 1 }, 1); varDeco[i][j] = (struct var1DDeco){ .start = start, .chunkSize = chunkSize, .partDesc = idxlist }; } #else if (maxChunkSize < varSize[i][j]) maxChunkSize = varSize[i][j]; #endif } var = (double *) malloc(maxChunkSize * sizeof(var[0])); } taxisID = taxisCreate(TAXIS_ABSOLUTE); for (i = 0; i < nStreams; i++) vlistDefTaxis(vlistID[i], taxisID); for (i = 0; i < nStreams; i++) { memset(filename, 0, 1024); snprintf(&filename[0], sizeof(filename), "%s%c_%d.grb", nameExp, asciiA + i, tfID); streamID[i] = streamOpenWrite(filename, filetype); xassert(streamID[i] >= 0); streamDefVlist(streamID[i], vlistID[i]); } #ifdef USE_MPI pioEndDef(); #endif for (tfID = 0; tfID < ntfiles; tfID++) { if (tfID > 0) { for (i = 0; i < nStreams; i++) { streamClose(streamID[i]); snprintf(&filename[0], sizeof(filename), "%s%c_%d.grb", nameExp, asciiA + i, tfID); streamID[i] = streamOpenWrite(filename, filetype); xassert(streamID[i] >= 0); streamDefVlist(streamID[i], vlistID[i]); } } for (tsID = 0; tsID < ntsteps; tsID++) { hoursPassingHack(&vdate, &vtime, hourStep); taxisDefVdate(taxisID, vdate); taxisDefVtime(taxisID, vtime); for (i = 0; i < nStreams; i++) { streamDefTimestep(streamID[i], tsID); for (j = 0; j < nVars; j++) { #ifdef USE_MPI int start = varDeco[i][j].start; int chunk = varDeco[i][j].chunkSize; #else int start = 0, chunk = (int) varSize[i][j]; #endif for (int k = 0; k < chunk; k++) var[k] = 3.3 * (double) (k + start); #ifdef USE_MPI streamWriteVarPart(streamID[i], varID[i][j], var, nmiss, varDeco[i][j].partDesc); #else streamWriteVar(streamID[i], varID[i][j], var, nmiss); #endif } } #ifdef USE_MPI pioWriteTimestep(); #endif } #ifdef USE_MPI MPI_Barrier(commModel); #endif } #ifdef USE_MPI for (size_t streamIdx = 0; streamIdx < (size_t) nStreams; ++streamIdx) for (size_t varIdx = 0; varIdx < (size_t) nVars; ++varIdx) xt_idxlist_delete(varDeco[streamIdx][varIdx].partDesc); #endif for (i = 0; i < nStreams; i++) { streamClose(streamID[i]); vlistDestroy(vlistID[i]); } taxisDestroy(taxisID); for (i = 0; i < nStreams; i++) for (j = 0; j < nVars; j++) zaxisDestroy(zaxisID[i][j]); gridDestroy(gridID); free(var); } int main(int argc, char *argv[]) { enum { nProcsIODef = 3, // IOModeDef = PIO_NONE, // IOModeDef = PIO_MPI, #ifdef USE_MPI IOModeDef = PIO_FPGUARD, #endif // IOModeDef = PIO_ASYNCH, // IOModeDef = PIO_WRITER, }; MPI_Comm commModel = MPI_COMM_NULL; #ifdef USE_MPI MPI_Comm commGlob; int sizeGlob; int rankGlob; int IOMode, nProcsIO, pioNamespace; xmpi(MPI_Init(&argc, &argv)); commGlob = MPI_COMM_WORLD; xt_initialize(commGlob); xmpi(MPI_Comm_set_errhandler(commGlob, MPI_ERRORS_RETURN)); xmpi(MPI_Comm_size(commGlob, &sizeGlob)); xmpi(MPI_Comm_rank(commGlob, &rankGlob)); if (argc > 1) { xassert(argc >= 3); IOMode = atoi(argv[1]); nProcsIO = atoi(argv[2]); xassert(IOMode >= PIO_MINIOMODE && IOMode <= PIO_MAXIOMODE && nProcsIO >= 0 && nProcsIO <= sizeGlob); printf("IOMode=%d, nProcsIO=%d", IOMode, nProcsIO); } else { IOMode = IOModeDef; nProcsIO = nProcsIODef; } commModel = pioInit(commGlob, nProcsIO, IOMode, &pioNamespace, 1.0f, cdiPioNoPostCommSetup); if (commModel != MPI_COMM_NULL) { namespaceSetActive(pioNamespace); #else (void) argc; (void) argv; #endif modelRun(commModel); #ifdef USE_MPI } pioFinalize(); xt_finalize(); MPI_Finalize(); #endif return 0; } #ifdef USE_MPI static int uniform_partition_start(int set_interval[2], int nparts, int part_idx) { int part_offset = (int) ((((long long) set_interval[1] - (long long) set_interval[0] + 1LL) * (long long) part_idx) / (long long) nparts); int start = set_interval[0] + part_offset; return start; } #endif /* * Local Variables: * c-file-style: "Java" * c-basic-offset: 2 * indent-tabs-mode: nil * show-trailing-whitespace: t * require-trailing-newline: t * End: */ cdo-2.6.6.1/libcdi/examples/pio/compareResourcesArray.c0000664000175000017500000001533215271332515023144 0ustar alastairalastair#if defined(HAVE_CONFIG_H) #include "config.h" #endif #include #include #include #include "cdi.h" #include "cdipio.h" #include "dmemory.h" #include "pio_util.h" #include "resource_handle.h" #include "resource_unpack.h" extern int reshListCompare(int, int); enum { IOMode = PIO_NONE, nProcsIO = 1, DOUBLE_PRECISION = 8, nlon = 12, nlat = 6, nlev = 5, ntsteps = 3 }; static double lons[nlon] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; static double lats[nlat] = { -75, -45, -15, 15, 45, 75 }; static double levs[nlev] = { 101300, 92500, 85000, 50000, 20000 }; static int defineGrid() { int gridID = CDI_UNDEFID; int mask_vec[nlon * nlat]; const int *mp = &mask_vec[0]; double area_vec[nlon * nlat]; const double *ap = &area_vec[0]; int i; gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); gridDefYvals(gridID, lats); gridDefNvertex(gridID, 1); gridDefXbounds(gridID, lons); gridDefYbounds(gridID, lats); for (i = 0; i < nlon * nlat; i++) mask_vec[i] = i % 2; gridDefMaskGME(gridID, mp); for (i = 0; i < nlon * nlat; i++) mask_vec[i] = 1; gridDefMask(gridID, mp); cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_NAME, "myXname"); cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_NAME, "myYname"); cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_LONGNAME, "myXlongname"); cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_LONGNAME, "myYlongname"); cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_UNITS, "myXunits"); cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_UNITS, "myYunits"); cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_DATATYPE, DOUBLE_PRECISION); gridDefTrunc(gridID, 1); cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDUSED, 6); cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDINREFERENCE, 7); cdiDefKeyString(gridID, CDI_GLOBAL, CDI_KEY_REFERENCEURI, "myReference"); /* gridDefLCC ( gridID, double originLon, double originLat, */ /* double lonParY, double lat1, double lat2, double xinc, double yinc, int projflag, int scanflag); */ /* gridDefLcc2 ( gridID, double earth_radius, double lon_0, */ /* double lat_0, double lat_1,double lat_2);*/ /* gridDefLaea ( gridID, double earth_radius, double lon_0, double lat_0); */ for (i = 0; i < nlon * nlat; i++) area_vec[i] = 0.1 * i; gridDefArea(gridID, ap); for (i = 0; i < nlon * nlat; i++) mask_vec[i] = i; gridDefReducedPoints(gridID, nlon * nlat, mp); gridDefComplexPacking(gridID, 1); return gridID; } static int defineZaxis() { int zaxisID = CDI_UNDEFID; double vct[3] = { 3.0, 3.3, 3.6 }; zaxisID = zaxisCreate(ZAXIS_PRESSURE, nlev); zaxisDefLevels(zaxisID, levs); zaxisDefLevel(zaxisID, 2, 8507.3); cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_NAME, "myName"); cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_LONGNAME, "myLongname"); cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, "myUnits"); zaxisDefDatatype(zaxisID, DOUBLE_PRECISION); cdiDefKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_TYPEOFFIRSTFIXEDSURFACE, 1); zaxisDefVct(zaxisID, 3, vct); zaxisDefLbounds(zaxisID, &levs[0]); zaxisDefUbounds(zaxisID, &levs[0]); zaxisDefWeights(zaxisID, &levs[0]); return zaxisID; } static int defineTaxis() { int taxisID = taxisCreate(TAXIS_ABSOLUTE); taxisDefType(taxisID, 0); taxisDefVdate(taxisID, 1); taxisDefVtime(taxisID, 2); taxisDefRdate(taxisID, 3); taxisDefRtime(taxisID, 4); taxisDefVdateBounds(taxisID, 5, 6); taxisDefVtimeBounds(taxisID, 7, 8); taxisDefCalendar(taxisID, 1); taxisDefTunit(taxisID, 1); taxisDefNumavg(taxisID, 1); return taxisID; } static void defineStream(int streamID, int vlistID) { streamDefByteorder(streamID, 1); streamDefCompType(streamID, 2); streamDefCompLevel(streamID, 3); streamDefVlist(streamID, vlistID); } static int defineVlist(int gridID, int zaxisID, int taxisID) { int vlistID = CDI_UNDEFID; int zaxisID2 = zaxisCreate(ZAXIS_SURFACE, 1); int varID1, varID2; vlistID = vlistCreate(); varID1 = vlistDefVar(vlistID, gridID, zaxisID, TIME_VARIABLE); varID2 = vlistDefVar(vlistID, gridID, zaxisID2, TIME_VARIABLE); vlistDefVarName(vlistID, varID1, "varname1"); { int globfac[] = { 23, 42 }; cdiDefAttInt(vlistID, varID1, "seer's globule factors", CDI_DATATYPE_INT16, 2, globfac); } vlistDefVarName(vlistID, varID2, "varname2"); cdiDefAttTxt(vlistID, varID2, "txt demo", 6, "banana"); vlistDefTaxis(vlistID, taxisID); return vlistID; } static int defineInstitute() { int instID = CDI_UNDEFID; instID = institutDef(0, 0, "MYINSTITUTE", "myInstitute"); return instID; } static void defineModel(int instID) { modelDef(instID, 0, "myModel"); } static void printResources() { FILE *fp = fopen("reshArrayModel.txt", "w"); if (!fp) xabort("%s", "could not open file"); reshListPrint(fp); fclose(fp); } static void modelRun(MPI_Comm comm) { int gridID, zaxisID, taxisID, instID, vlistID, streamID; char *recvBuffer, *sendBuffer; int bufferSize, differ; MPI_Status status; namespaceSetActive(0); gridID = defineGrid(); zaxisID = defineZaxis(); taxisID = defineTaxis(); instID = defineInstitute(); defineModel(instID); vlistID = defineVlist(gridID, zaxisID, taxisID); streamID = streamOpenWrite("example.grb", CDI_FILETYPE_GRB); if (streamID < 0) xabort("Could not open file"); defineStream(streamID, vlistID); reshPackBufferCreate(&sendBuffer, &bufferSize, &comm); xmpi(MPI_Send(sendBuffer, bufferSize, MPI_PACKED, 0, 0, comm)); recvBuffer = Malloc((size_t) bufferSize); xmpi(MPI_Recv(recvBuffer, bufferSize, MPI_PACKED, 0, 0, comm, &status)); namespaceSetActive(1); reshUnpackResources(recvBuffer, bufferSize, &comm, (cdiPostResUpdateHook) 0); Free(recvBuffer); reshPackBufferDestroy(&sendBuffer); differ = reshListCompare(0, 1); printf("The resource arrays %s.\n", differ ? "differ" : "are equal"); printResources(); namespaceSetActive(0); streamClose(streamID); return; } int main(int argc, char *argv[]) { int sizeGlob, pioNamespace; MPI_Comm commGlob, commModel; MPI_Init(&argc, &argv); commGlob = MPI_COMM_WORLD; xt_initialize(commGlob); xmpi(MPI_Comm_set_errhandler(commGlob, MPI_ERRORS_RETURN)); xmpi(MPI_Comm_size(commGlob, &sizeGlob)); if (sizeGlob != 1) xabort("test transition of resource array only with 1 PE."); if (nProcsIO != 1) xabort("bad distribution of tasks on PEs"); commModel = pioInit(commGlob, nProcsIO, IOMode, &pioNamespace, 1.0f, cdiPioNoPostCommSetup); namespaceSetActive(pioNamespace); modelRun(commModel); xt_finalize(); MPI_Finalize(); return 0; } /* * Local Variables: * c-file-style: "Java" * c-basic-offset: 2 * indent-tabs-mode: nil * show-trailing-whitespace: t * require-trailing-newline: t * End: */ cdo-2.6.6.1/libcdi/examples/pio/collectData2003.F900000664000175000017500000001710715271332515021466 0ustar alastairalastairPROGRAM collectdata2003 #ifdef USE_MPI USE yaxt, ONLY: xt_initialize, xt_finalize, xt_idxlist, xt_idxstripes_new, & xt_idxlist_delete, xi => xt_int_kind, xt_stripe USE iso_c_binding, ONLY: c_int USE mpi #endif IMPLICIT NONE INCLUDE 'cdi.inc' #ifdef USE_MPI INCLUDE 'cdipio.inc' INTEGER, PARAMETER :: i4 = SELECTED_INT_KIND(9) INTEGER, PARAMETER :: i8 = SELECTED_INT_KIND(14) #endif #ifdef USE_MPI ! For parallel IO: ! Parameter and variables needed. INTEGER, PARAMETER :: nProcsIO = 3 ! INTEGER, PARAMETER :: IOMode = PIO_NONE ! INTEGER, PARAMETER :: IOMode = PIO_MPI ! INTEGER, PARAMETER :: IOMode = PIO_WRITER ! INTEGER, PARAMETER :: IOMode = PIO_ASYNCH INTEGER, PARAMETER :: IOMode = PIO_FPGUARD #endif INTEGER :: commModel #ifdef USE_MPI LOGICAL :: run_model INTEGER :: commGlob, ierror, pio_namespace #else LOGICAL, PARAMETER :: run_model = .TRUE. #endif ! Start parallel environment #ifdef USE_MPI CALL MPI_INIT ( ierror ) commGlob = MPI_COMM_WORLD CALL xt_initialize(commGlob) ! For parallel IO: ! Initialize environment. commModel = pioInit(commGlob, nProcsIO, IOMode, pio_namespace, 1.1, & cdiPioNoPostCommSetup) run_model = commModel /= MPI_COMM_NULL IF (run_model) CALL namespaceSetActive(pio_namespace) #else commModel = 0 #endif IF (run_model) CALL modelrun ( commModel ) #ifdef USE_MPI ! For parallel IO: ! Cleanup environment. IF (run_model) CALL pioFinalize () CALL xt_finalize CALL MPI_FINALIZE ( ierror ) #endif CONTAINS SUBROUTINE modelrun ( commModel ) INTEGER, INTENT(in) :: commModel INTEGER, PARAMETER :: nlon = 12 ! Number of longitudes INTEGER, PARAMETER :: nlat = 6 ! Number of latitudes INTEGER, PARAMETER :: nlev = 5 ! Number of levels INTEGER, PARAMETER :: nts = 3 ! Number of time steps INTEGER, PARAMETER :: vdate = 19850101 INTEGER, PARAMETER :: vtime = 120000 INTEGER, PARAMETER :: filetype = CDI_FILETYPE_GRB INTEGER :: gridID, zaxisID1, zaxisID2, taxisID INTEGER :: vlistID, varID1, varID2, streamID, tsID INTEGER :: i, nmiss, status DOUBLE PRECISION :: lons ( nlon ), lats ( nlat ), levs ( nlev ) DOUBLE PRECISION :: var1 ( nlon * nlat ), var2 ( nlon * nlat * nlev ) CHARACTER(len=256) :: varname INTEGER :: last, start #ifdef USE_MPI INTEGER :: rank, comm_size, ierror, chunk TYPE var1ddeco INTEGER :: start, chunksize TYPE(xt_idxlist) :: partdesc END TYPE var1ddeco TYPE(var1ddeco) :: vardeco1, vardeco2 #else #define XT_UNUSED(x) IF (SIZE( (/(x)/) ) < 0) CONTINUE XT_UNUSED(commModel) #endif lons = (/0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330/) lats = (/-75, -45, -15, 15, 45, 75/) levs = (/101300, 92500, 85000, 50000, 20000/) nmiss = 0 ! Create a regular lon/lat grid gridID = gridCreate(GRID_LONLAT, nlon*nlat) CALL gridDefXsize(gridID, nlon) CALL gridDefYsize(gridID, nlat) CALL gridDefXvals(gridID, lons) CALL gridDefYvals(gridID, lats) ! Create a surface level Z-axis zaxisID1 = zaxisCreate(ZAXIS_SURFACE, 1) ! Create a pressure level Z-axis zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, nlev) CALL zaxisDefLevels(zaxisID2, levs) ! Create a variable list vlistID = vlistCreate() ! Define the variables varID1 = vlistDefVar(vlistID, gridID, zaxisID1, TIME_VARIABLE) varID2 = vlistDefVar(vlistID, gridID, zaxisID2, TIME_VARIABLE) #ifdef USE_MPI CALL mpi_comm_rank(commModel, rank, ierror) IF (ierror /= mpi_success) STOP 1 CALL mpi_comm_size(commModel, comm_size, ierror) IF (ierror /= mpi_success) STOP 1 start = uniform_partition_start((/ 1, SIZE(var1) /), comm_size, rank + 1) chunk = uniform_partition_start((/ 1, SIZE(var1) /), comm_size, rank + 2) & - start vardeco1 = var1ddeco(start, chunk, & xt_idxstripes_new(xt_stripe(INT(start, xi) - 1_xi, 1_xi, & INT(chunk, c_int)))) start = uniform_partition_start((/ 1, SIZE(var2) /), comm_size, rank + 1) chunk = uniform_partition_start((/ 1, SIZE(var2) /), comm_size, rank + 2) & - start vardeco2 = var1ddeco(start, chunk, & xt_idxstripes_new(xt_stripe(INT(start, xi) - 1_xi, 1_xi, & INT(chunk, c_int)))) #endif ! Define the variable names varname = 'varname1' CALL vlistDefVarName(vlistID, varID1, varname) varname = 'varname2' CALL vlistDefVarName(vlistID, varID2, varname) ! Create a Time axis taxisID = taxisCreate(TAXIS_ABSOLUTE) ! Assign the Time axis to the variable list CALL vlistDefTaxis(vlistID, taxisID) streamID = streamOpenWrite('example.grb', filetype) IF ( streamID < 0 ) THEN WRITE(0,*) cdiStringError(streamID) STOP END IF ! Assign the variable list to the dataset CALL streamDefVlist(streamID, vlistID) #ifdef USE_MPI ! For parallel IO: ! End definition stage for CDI resources, ! balance load of variables among collecting IO server, ! Decompose data on model processes for IO ! Transfer resources to the collecting IO server. CALL pioEndDef (); #endif ! Loop over the number of time steps DO tsID = 0, nts-1 CALL taxisDefVdate ( taxisID, vdate + tsID ) CALL taxisDefVtime ( taxisID, vtime ) status = streamDefTimestep ( streamID, tsID ) ! For parallel IO: ! Inquire start index and chunk for IO transposition of var1 #ifdef USE_MPI start = vardeco1%start last = start + vardeco1%chunksize - 1 #else start = 1 last = SIZE(var1) #endif ! Init decomposed data for var1 DO i = start, last var1(i) = 1.1 END DO ! Write var1 #ifdef USE_MPI CALL streamwritevarpart(streamID, varID1, var1(start:last), nmiss, & vardeco1%partdesc) #else CALL streamWriteVar(streamID, varID1, var1, nmiss) #endif ! For parallel IO: ! Inquire start index and chunk for IO transposition of var2 #ifdef USE_MPI start = vardeco2%start last = start + vardeco2%chunksize - 1 #else start = 1 last = SIZE(var2) #endif ! Init decomposed data for var2 DO i = start, last var2(i) = 2.2 END DO ! Write var2 #ifdef USE_MPI CALL streamwritevarpart(streamID, varID2, var2(start:last), nmiss, & vardeco2%partdesc) #else CALL streamWriteVar(streamID, varID2, var2, nmiss) #endif #ifdef USE_MPI ! For parallel IO: ! Start transmission of all data for output in this timestep to IO server. CALL pioWriteTimestep #endif END DO ! Close the output stream CALL streamClose(streamID) ! Destroy the objects CALL vlistDestroy(vlistID) CALL taxisDestroy(taxisID) CALL zaxisDestroy(zaxisID1) CALL zaxisDestroy(zaxisID2) CALL gridDestroy(gridID) #ifdef USE_MPI CALL xt_idxlist_delete(vardeco1%partdesc) CALL xt_idxlist_delete(vardeco2%partdesc) CALL mpi_barrier(commModel, ierror) IF (ierror /= mpi_success) STOP 1 #endif END SUBROUTINE modelrun #ifdef USE_MPI FUNCTION uniform_partition_start(set_interval, nparts, part_idx) & RESULT(start) INTEGER(i4), INTENT(in) :: nparts INTEGER(i4), INTENT(in) :: set_interval(2) INTEGER(i4), INTENT(in) :: part_idx INTEGER(i4) :: start, part_offset part_offset = INT((INT(set_interval(2) - set_interval(1) + 1, i8) & & * INT(part_idx - 1, i8)) / INT(nparts, i8)) start = set_interval(1) + part_offset END FUNCTION uniform_partition_start #endif END PROGRAM collectdata2003 cdo-2.6.6.1/libcdi/examples/pio/collectData.c0000664000175000017500000001337215271332515021045 0ustar alastairalastair#if defined(HAVE_CONFIG_H) #include "config.h" #endif #include #include #include #ifdef USE_MPI #include #include #include #include "pio_util.h" #else typedef int MPI_Comm; #define MPI_COMM_NULL 0 #endif #include "cdi.h" #include "error.h" #ifdef USE_MPI #include "cdipio.h" static int uniform_partition_start(int set_interval[2], int nparts, int part_idx); #endif static void modelRun(MPI_Comm commModel) { enum { filetype = CDI_FILETYPE_GRB, ntfiles = 2, ntsteps = 3, nVars = 5, nlon = 12, nlat = 6, maxlev = 5 }; static int nlev[nVars] = { 1, 1, 5, 5, 2 }; static const char *name = "example"; int gridID, zaxisID[nVars], taxisID; int vlistID, varID[nVars], streamID, tsID, tfID = 0; int i, j, nmiss = 0; double lons[nlon] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; double lats[nlat] = { -75, -45, -15, 15, 45, 75 }; double levs[maxlev] = { 101300, 92500, 85000, 50000, 20000 }; double var[nlon * nlat * maxlev]; int vdate = 19850101, vtime = 120000; char filename[1024]; size_t varSize[nVars]; #if USE_MPI int rank, comm_size; struct var1DDeco { int chunkSize, start; Xt_idxlist partDesc; } varDeco[nVars]; #endif #ifndef USE_MPI (void) commModel; #endif gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); gridDefYvals(gridID, lats); for (i = 0; i < nVars; i++) { zaxisID[i] = zaxisCreate(ZAXIS_PRESSURE, nlev[i]); zaxisDefLevels(zaxisID[i], levs); varSize[i] = nlon * nlat * (size_t) nlev[i]; } vlistID = vlistCreate(); #if USE_MPI xmpi(MPI_Comm_rank(commModel, &rank)); xmpi(MPI_Comm_size(commModel, &comm_size)); #endif for (i = 0; i < nVars; i++) { varID[i] = vlistDefVar(vlistID, gridID, zaxisID[i], TIME_VARIABLE); #ifdef USE_MPI { int start = uniform_partition_start((int[2]){ 0, (int) varSize[i] - 1 }, comm_size, rank), chunkSize = uniform_partition_start((int[2]){ 0, (int) varSize[i] - 1 }, comm_size, rank + 1) - start; fprintf(stderr, "%d: start=%d, chunkSize = %d\n", rank, start, chunkSize); Xt_idxlist idxlist = xt_idxstripes_new(&(struct Xt_stripe){ .start = start, .nstrides = chunkSize, .stride = 1 }, 1); varDeco[i] = (struct var1DDeco){ .start = start, .chunkSize = chunkSize, .partDesc = idxlist }; } #endif } taxisID = taxisCreate(TAXIS_ABSOLUTE); vlistDefTaxis(vlistID, taxisID); snprintf(&filename[0], sizeof(filename), "%s_%d.grb", name, tfID); streamID = streamOpenWrite(filename, filetype); xassert(streamID >= 0); streamDefVlist(streamID, vlistID); #ifdef USE_MPI pioEndDef(); #endif for (tfID = 0; tfID < ntfiles; tfID++) { /* if ( tfID > 0 ) */ { streamClose(streamID); snprintf(&filename[0], sizeof(filename), "%s_%d.grb", name, tfID); streamID = streamOpenWrite(filename, filetype); xassert(streamID >= 0); streamDefVlist(streamID, vlistID); } for (tsID = 0; tsID < ntsteps; tsID++) { taxisDefVdate(taxisID, vdate); taxisDefVtime(taxisID, vtime); streamDefTimestep(streamID, tsID); for (i = 0; i < nVars; i++) { #ifdef USE_MPI int chunk = varDeco[i].chunkSize; #else int chunk = (int) varSize[i]; #endif for (j = 0; j < chunk; ++j) var[j] = 2.2; #ifdef USE_MPI streamWriteVarPart(streamID, varID[i], var, nmiss, varDeco[i].partDesc); #else streamWriteVar(streamID, varID[i], var, nmiss); #endif } #ifdef USE_MPI pioWriteTimestep(); #endif } } streamClose(streamID); vlistDestroy(vlistID); taxisDestroy(taxisID); for (i = 0; i < nVars; i++) zaxisDestroy(zaxisID[i]); gridDestroy(gridID); #ifdef USE_MPI for (int varIdx = 0; varIdx < nVars; ++varIdx) xt_idxlist_delete(varDeco[varIdx].partDesc); MPI_Barrier(commModel); #endif } int main(int argc, char *argv[]) { MPI_Comm commModel = MPI_COMM_NULL; #ifdef USE_MPI MPI_Comm commGlob; int sizeGlob, rankGlob, pioNamespace; int IOMode = PIO_WRITER; int nProcsIO = 2; xmpi(MPI_Init(&argc, &argv)); commGlob = MPI_COMM_WORLD; xt_initialize(commGlob); xmpi(MPI_Comm_set_errhandler(commGlob, MPI_ERRORS_RETURN)); xmpi(MPI_Comm_size(commGlob, &sizeGlob)); xmpi(MPI_Comm_rank(commGlob, &rankGlob)); { int opt; while ((opt = getopt(argc, argv, "p:w:")) != -1) switch (opt) { case 'p': IOMode = cdiPioStr2IOMode(optarg); if (IOMode < 0) { fprintf(stderr, "Unsupported PIO mode requested: %s\n", optarg); exit(EXIT_FAILURE); } break; case 'w': { long temp = strtol(optarg, NULL, 0); if (temp < 0 || temp > INT_MAX / 2) { fprintf(stderr, "Unsupported number of I/O servers: %ld\n", temp); exit(EXIT_FAILURE); } nProcsIO = (int) temp; break; } } } commModel = pioInit(commGlob, nProcsIO, IOMode, &pioNamespace, 1.0f, cdiPioNoPostCommSetup); if (commModel != MPI_COMM_NULL) { namespaceSetActive(pioNamespace); #else (void) argc; (void) argv; #endif modelRun(commModel); #ifdef USE_MPI } pioFinalize(); xt_finalize(); MPI_Finalize(); #endif return 0; } #ifdef USE_MPI static int uniform_partition_start(int set_interval[2], int nparts, int part_idx) { int part_offset = (int) ((((long long) set_interval[1] - (long long) set_interval[0] + 1LL) * (long long) part_idx) / (long long) nparts); int start = set_interval[0] + part_offset; return start; } #endif /* * Local Variables: * c-file-style: "Java" * c-basic-offset: 2 * indent-tabs-mode: nil * show-trailing-whitespace: t * require-trailing-newline: t * End: */ cdo-2.6.6.1/libcdi/examples/pio/Makefile.in0000664000175000017500000007433315271332515020533 0ustar alastairalastair# Makefile.in generated by automake 1.18.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2025 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@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) am__rm_f = rm -f $(am__rm_f_notfound) am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 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@ EXTRA_PROGRAMS = collectData$(EXEEXT) collectDataNStreams$(EXEEXT) \ $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) @ENABLE_MPI_TRUE@am__append_1 = \ @ENABLE_MPI_TRUE@ collectData.parallel \ @ENABLE_MPI_TRUE@ collectDataNStreams.parallel \ @ENABLE_MPI_TRUE@ compareResourcesArray @BUILD_FC_PROGRAMS_TRUE@@ENABLE_CF_INTERFACE_TRUE@am__append_2 = collectData2003 @BUILD_PIO_FC_PROGRAMS_TRUE@@ENABLE_CF_INTERFACE_TRUE@am__append_3 = collectData2003.parallel @with_example_programs_TRUE@am__append_4 = $(EXTRA_PROGRAMS) @with_example_programs_FALSE@am__append_5 = $(EXTRA_PROGRAMS) @ENABLE_CF_INTERFACE_TRUE@am__append_6 = $(FC_OPTINC)$(top_builddir)/src $(FC_OPTINC)$(top_srcdir)/src @ENABLE_ALL_STATIC_TRUE@am__append_7 = -all-static subdir = examples/pio ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \ $(top_srcdir)/m4/acx_c_package.m4 \ $(top_srcdir)/m4/acx_cfortran_flags.m4 \ $(top_srcdir)/m4/acx_check_cfortran.m4 \ $(top_srcdir)/m4/acx_check_strptr_convert.m4 \ $(top_srcdir)/m4/acx_execinfo.m4 \ $(top_srcdir)/m4/acx_fortran_check_include.m4 \ $(top_srcdir)/m4/acx_fortran_include_flag.m4 \ $(top_srcdir)/m4/acx_fortran_package.m4 \ $(top_srcdir)/m4/acx_lang_check_include.m4 \ $(top_srcdir)/m4/acx_lang_package.m4 \ $(top_srcdir)/m4/acx_lt_problems.m4 \ $(top_srcdir)/m4/acx_m4_list_to_quoted_strings.m4 \ $(top_srcdir)/m4/acx_mpirun.m4 $(top_srcdir)/m4/acx_mv_obj.m4 \ $(top_srcdir)/m4/acx_option_search_libs.m4 \ $(top_srcdir)/m4/acx_options.m4 \ $(top_srcdir)/m4/acx_prog_cc_posix.m4 \ $(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \ $(top_srcdir)/m4/acx_sl_mod_suffix.m4 \ $(top_srcdir)/m4/acx_tls_xlc_retry.m4 \ $(top_srcdir)/m4/acx_use_libtool_configuration.m4 \ $(top_srcdir)/m4/acx_uuid.m4 $(top_srcdir)/m4/asx_tr_arg.m4 \ $(top_srcdir)/m4/asx_unset.m4 $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_python_devel.m4 $(top_srcdir)/m4/ax_tls.m4 \ $(top_srcdir)/m4/kpse_libtool.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/m4/ac_lang_program_fortran.m4 \ $(top_srcdir)/m4/acx_lang_fortran_check_include.m4 \ $(top_srcdir)/m4/acx_lang_c_check_include.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @ENABLE_MPI_TRUE@am__EXEEXT_1 = collectData.parallel$(EXEEXT) \ @ENABLE_MPI_TRUE@ collectDataNStreams.parallel$(EXEEXT) \ @ENABLE_MPI_TRUE@ compareResourcesArray$(EXEEXT) @BUILD_FC_PROGRAMS_TRUE@@ENABLE_CF_INTERFACE_TRUE@am__EXEEXT_2 = collectData2003$(EXEEXT) @BUILD_PIO_FC_PROGRAMS_TRUE@@ENABLE_CF_INTERFACE_TRUE@am__EXEEXT_3 = collectData2003.parallel$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) am_collectData_OBJECTS = collectData.$(OBJEXT) collectData_OBJECTS = $(am_collectData_OBJECTS) collectData_LDADD = $(LDADD) collectData_DEPENDENCIES = $(top_builddir)/src/libcdi.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am__objects_1 = collectData.parallel.$(OBJEXT) nodist_collectData_parallel_OBJECTS = $(am__objects_1) collectData_parallel_OBJECTS = $(nodist_collectData_parallel_OBJECTS) am__DEPENDENCIES_1 = collectData_parallel_DEPENDENCIES = $(top_builddir)/src/libcdipio.la \ $(am__DEPENDENCIES_1) $(LDADD) am_collectData2003_OBJECTS = collectData2003.$(OBJEXT) collectData2003_OBJECTS = $(am_collectData2003_OBJECTS) collectData2003_LDADD = $(LDADD) collectData2003_DEPENDENCIES = $(top_builddir)/src/libcdi.la am__objects_2 = collectData2003.parallel.$(OBJEXT) nodist_collectData2003_parallel_OBJECTS = $(am__objects_2) collectData2003_parallel_OBJECTS = \ $(nodist_collectData2003_parallel_OBJECTS) collectData2003_parallel_DEPENDENCIES = \ $(top_builddir)/src/libcdipio.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(LDADD) am_collectDataNStreams_OBJECTS = collectDataNStreams.$(OBJEXT) collectDataNStreams_OBJECTS = $(am_collectDataNStreams_OBJECTS) collectDataNStreams_LDADD = $(LDADD) collectDataNStreams_DEPENDENCIES = $(top_builddir)/src/libcdi.la am__objects_3 = collectDataNStreams.parallel.$(OBJEXT) nodist_collectDataNStreams_parallel_OBJECTS = $(am__objects_3) collectDataNStreams_parallel_OBJECTS = \ $(nodist_collectDataNStreams_parallel_OBJECTS) collectDataNStreams_parallel_DEPENDENCIES = \ $(top_builddir)/src/libcdipio.la $(am__DEPENDENCIES_1) \ $(LDADD) am_compareResourcesArray_OBJECTS = compareResourcesArray.$(OBJEXT) compareResourcesArray_OBJECTS = $(am_compareResourcesArray_OBJECTS) compareResourcesArray_DEPENDENCIES = $(top_builddir)/src/libcdipio.la \ $(am__DEPENDENCIES_1) $(LDADD) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/collectData.Po \ ./$(DEPDIR)/collectData.parallel.Po \ ./$(DEPDIR)/collectDataNStreams.Po \ ./$(DEPDIR)/collectDataNStreams.parallel.Po \ ./$(DEPDIR)/compareResourcesArray.Po am__mv = mv -f AM_V_PPFC = $(am__v_PPFC_@AM_V@) am__v_PPFC_ = $(am__v_PPFC_@AM_DEFAULT_V@) am__v_PPFC_0 = @echo " PPFC " $@; am__v_PPFC_1 = FCLD = $(FC) FCLINK = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_FCLD = $(am__v_FCLD_@AM_V@) am__v_FCLD_ = $(am__v_FCLD_@AM_DEFAULT_V@) am__v_FCLD_0 = @echo " FCLD " $@; am__v_FCLD_1 = LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(collectData_SOURCES) \ $(nodist_collectData_parallel_SOURCES) \ $(collectData2003_SOURCES) \ $(nodist_collectData2003_parallel_SOURCES) \ $(collectDataNStreams_SOURCES) \ $(nodist_collectDataNStreams_parallel_SOURCES) \ $(compareResourcesArray_SOURCES) DIST_SOURCES = $(collectData_SOURCES) $(collectData2003_SOURCES) \ $(collectDataNStreams_SOURCES) \ $(compareResourcesArray_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__extra_recursive_targets = examples-recursive am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp \ $(top_srcdir)/config/lt_overrides_Makefile.inc DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DCE_UUIDROOT = @DCE_UUIDROOT@ DCE_UUID_C_INCLUDE = @DCE_UUID_C_INCLUDE@ DCE_UUID_C_LIB = @DCE_UUID_C_LIB@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECCODES_INCLUDE = @ECCODES_INCLUDE@ ECCODES_LIBS = @ECCODES_LIBS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_ACROSS = @ENABLE_ACROSS@ ENABLE_CDI_LIB = @ENABLE_CDI_LIB@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ ENABLE_EXTRA = @ENABLE_EXTRA@ ENABLE_GRIB = @ENABLE_GRIB@ ENABLE_IEG = @ENABLE_IEG@ ENABLE_MPI = @ENABLE_MPI@ ENABLE_NETCDF = @ENABLE_NETCDF@ ENABLE_SERVICE = @ENABLE_SERVICE@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ F77 = @F77@ FC = @FC@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCMODCASE = @FCMODCASE@ FCMODEXT = @FCMODEXT@ FC_DEFINE = @FC_DEFINE@ FC_MOD_FLAG = @FC_MOD_FLAG@ FC_OPTINC = @FC_OPTINC@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBRT = @LIBRT@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPIROOT = @MPIROOT@ MPI_C_INCLUDE = @MPI_C_INCLUDE@ MPI_C_LIB = @MPI_C_LIB@ MPI_FC_LIB = @MPI_FC_LIB@ MPI_FC_MOD = @MPI_FC_MOD@ MPI_LAUNCH = @MPI_LAUNCH@ NETCDF_INCLUDE = @NETCDF_INCLUDE@ NETCDF_LIBS = @NETCDF_LIBS@ NETCDF_ROOT = @NETCDF_ROOT@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OSSP_UUIDROOT = @OSSP_UUIDROOT@ OSSP_UUID_C_INCLUDE = @OSSP_UUID_C_INCLUDE@ OSSP_UUID_C_LIB = @OSSP_UUID_C_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PPM_CORE_C_INCLUDE = @PPM_CORE_C_INCLUDE@ PPM_CORE_C_LIB = @PPM_CORE_C_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_CXX = @PTHREAD_CXX@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PLATFORM_SITE_PKG = @PYTHON_PLATFORM_SITE_PKG@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RUBY = @RUBY@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SYSTEM_TYPE = @SYSTEM_TYPE@ SZLIB_INCLUDE = @SZLIB_INCLUDE@ SZLIB_LIBS = @SZLIB_LIBS@ THREADS_INCLUDE = @THREADS_INCLUDE@ THREADS_LIBS = @THREADS_LIBS@ UTIL_LINUX_UUIDROOT = @UTIL_LINUX_UUIDROOT@ UTIL_LINUX_UUID_C_INCLUDE = @UTIL_LINUX_UUID_C_INCLUDE@ UTIL_LINUX_UUID_C_LIB = @UTIL_LINUX_UUID_C_LIB@ UUID_C_INCLUDE = @UUID_C_INCLUDE@ UUID_C_LIB = @UUID_C_LIB@ VERSION = @VERSION@ YAXT_C_INCLUDE = @YAXT_C_INCLUDE@ YAXT_C_LIB = @YAXT_C_LIB@ YAXT_FC_LIB = @YAXT_FC_LIB@ YAXT_FC_MOD = @YAXT_FC_MOD@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ ac_ct_FC = @ac_ct_FC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ am__xargs_n = @am__xargs_n@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ 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@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_PROGRAMS = $(am__append_4) CLEANFILES = $(am__append_5) AM_CPPFLAGS = -I$(top_srcdir)/src $(YAXT_C_INCLUDE) $(MPI_C_INCLUDE) AM_FCFLAGS = $(am__append_6) $(YAXT_FC_MOD) $(MPI_FC_MOD) AM_LDFLAGS = $(am__append_7) LDADD = $(top_builddir)/src/libcdi.la collectData_SOURCES = collectData.c nodist_collectData_parallel_SOURCES = $(collectData_SOURCES:.c=.parallel.c) collectData_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(YAXT_C_LIB) $(LDADD) collectDataNStreams_SOURCES = collectDataNStreams.c nodist_collectDataNStreams_parallel_SOURCES = $(collectDataNStreams_SOURCES:.c=.parallel.c) collectDataNStreams_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(YAXT_C_LIB) $(LDADD) compareResourcesArray_SOURCES = compareResourcesArray.c compareResourcesArray_LDADD = $(top_builddir)/src/libcdipio.la $(YAXT_C_LIB) $(LDADD) collectData2003_SOURCES = collectData2003.F90 nodist_collectData2003_parallel_SOURCES = $(collectData2003_SOURCES:.F90=.parallel.F90) collectData2003_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(YAXT_FC_LIB) $(MPI_FC_LIB) $(LDADD) # Generate source files for parallel versions of the programs. We do this to # avoid target-specific flags, which result into rules that do not use the # compilation commands above. SUFFIXES = .parallel.c .parallel.F90 # Compile *.F90 without CPPFLAGS, which are normally meant for the C compiler # and might not be compatible with the Fortran compiler: LTPPFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) # Compile programs using Libtool with '-static' (to avoid compiling twice): COMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) -static $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) FCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(FC) -static $(AM_FCFLAGS) $(FCFLAGS) PPFCCOMPILE = $(FCCOMPILE) CXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CXX) -static $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) all: all-am .SUFFIXES: .SUFFIXES: .parallel.c .parallel.F90 .F90 .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/lt_overrides_Makefile.inc $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/pio/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign examples/pio/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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_srcdir)/config/lt_overrides_Makefile.inc $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstPROGRAMS: $(am__rm_f) $(noinst_PROGRAMS) test -z "$(EXEEXT)" || $(am__rm_f) $(noinst_PROGRAMS:$(EXEEXT)=) collectData$(EXEEXT): $(collectData_OBJECTS) $(collectData_DEPENDENCIES) $(EXTRA_collectData_DEPENDENCIES) @rm -f collectData$(EXEEXT) $(AM_V_CCLD)$(LINK) $(collectData_OBJECTS) $(collectData_LDADD) $(LIBS) collectData.parallel$(EXEEXT): $(collectData_parallel_OBJECTS) $(collectData_parallel_DEPENDENCIES) $(EXTRA_collectData_parallel_DEPENDENCIES) @rm -f collectData.parallel$(EXEEXT) $(AM_V_CCLD)$(LINK) $(collectData_parallel_OBJECTS) $(collectData_parallel_LDADD) $(LIBS) collectData2003$(EXEEXT): $(collectData2003_OBJECTS) $(collectData2003_DEPENDENCIES) $(EXTRA_collectData2003_DEPENDENCIES) @rm -f collectData2003$(EXEEXT) $(AM_V_FCLD)$(FCLINK) $(collectData2003_OBJECTS) $(collectData2003_LDADD) $(LIBS) collectData2003.parallel$(EXEEXT): $(collectData2003_parallel_OBJECTS) $(collectData2003_parallel_DEPENDENCIES) $(EXTRA_collectData2003_parallel_DEPENDENCIES) @rm -f collectData2003.parallel$(EXEEXT) $(AM_V_FCLD)$(FCLINK) $(collectData2003_parallel_OBJECTS) $(collectData2003_parallel_LDADD) $(LIBS) collectDataNStreams$(EXEEXT): $(collectDataNStreams_OBJECTS) $(collectDataNStreams_DEPENDENCIES) $(EXTRA_collectDataNStreams_DEPENDENCIES) @rm -f collectDataNStreams$(EXEEXT) $(AM_V_CCLD)$(LINK) $(collectDataNStreams_OBJECTS) $(collectDataNStreams_LDADD) $(LIBS) collectDataNStreams.parallel$(EXEEXT): $(collectDataNStreams_parallel_OBJECTS) $(collectDataNStreams_parallel_DEPENDENCIES) $(EXTRA_collectDataNStreams_parallel_DEPENDENCIES) @rm -f collectDataNStreams.parallel$(EXEEXT) $(AM_V_CCLD)$(LINK) $(collectDataNStreams_parallel_OBJECTS) $(collectDataNStreams_parallel_LDADD) $(LIBS) compareResourcesArray$(EXEEXT): $(compareResourcesArray_OBJECTS) $(compareResourcesArray_DEPENDENCIES) $(EXTRA_compareResourcesArray_DEPENDENCIES) @rm -f compareResourcesArray$(EXEEXT) $(AM_V_CCLD)$(LINK) $(compareResourcesArray_OBJECTS) $(compareResourcesArray_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collectData.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collectData.parallel.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collectDataNStreams.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collectDataNStreams.parallel.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compareResourcesArray.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @: >>$@ am--depfiles: $(am__depfiles_remade) .F90.o: $(AM_V_PPFC)$(PPFCCOMPILE) -c -o $@ $< .F90.obj: $(AM_V_PPFC)$(PPFCCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .F90.lo: $(AM_V_PPFC)$(LTPPFCCOMPILE) -c -o $@ $< .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs examples-local: ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -$(am__rm_f) $(CLEANFILES) distclean-generic: -$(am__rm_f) $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_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-libtool clean-local clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/collectData.Po -rm -f ./$(DEPDIR)/collectData.parallel.Po -rm -f ./$(DEPDIR)/collectDataNStreams.Po -rm -f ./$(DEPDIR)/collectDataNStreams.parallel.Po -rm -f ./$(DEPDIR)/compareResourcesArray.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: examples: examples-am examples-am: examples-local html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/collectData.Po -rm -f ./$(DEPDIR)/collectData.parallel.Po -rm -f ./$(DEPDIR)/collectDataNStreams.Po -rm -f ./$(DEPDIR)/collectDataNStreams.parallel.Po -rm -f ./$(DEPDIR)/compareResourcesArray.Po -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: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-local clean-noinstPROGRAMS \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am examples-am examples-local html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile examples-local: $(EXTRA_PROGRAMS) clean-local: -rm -f *.parallel.c *.parallel.F90 -rm -f *.grb -rm -rf *.dSYM .c.parallel.c: $(AM_V_GEN):;{ \ echo '#define USE_MPI 1'; \ echo '#include "$<"'; \ } >$@ .F90.parallel.F90: $(AM_V_GEN):;{ \ echo '#define USE_MPI 1'; \ echo '#include "$<"'; \ } >$@ # 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: # Tell GNU make to disable its built-in pattern rules. %:: %,v %:: RCS/%,v %:: RCS/% %:: s.% %:: SCCS/s.% cdo-2.6.6.1/libcdi/examples/pio/Makefile.am0000664000175000017500000000450415271332515020513 0ustar alastairalastairnoinst_PROGRAMS = CLEANFILES = EXTRA_PROGRAMS = \ collectData \ collectDataNStreams if ENABLE_MPI EXTRA_PROGRAMS += \ collectData.parallel \ collectDataNStreams.parallel \ compareResourcesArray endif ENABLE_MPI if ENABLE_CF_INTERFACE if BUILD_FC_PROGRAMS EXTRA_PROGRAMS += collectData2003 endif BUILD_FC_PROGRAMS if BUILD_PIO_FC_PROGRAMS EXTRA_PROGRAMS += collectData2003.parallel endif BUILD_PIO_FC_PROGRAMS endif ENABLE_CF_INTERFACE if with_example_programs noinst_PROGRAMS += $(EXTRA_PROGRAMS) else !with_example_programs CLEANFILES += $(EXTRA_PROGRAMS) endif !with_example_programs examples-local: $(EXTRA_PROGRAMS) AM_CPPFLAGS = -I$(top_srcdir)/src $(YAXT_C_INCLUDE) $(MPI_C_INCLUDE) AM_FCFLAGS = if ENABLE_CF_INTERFACE AM_FCFLAGS += $(FC_OPTINC)$(top_builddir)/src $(FC_OPTINC)$(top_srcdir)/src endif ENABLE_CF_INTERFACE AM_FCFLAGS += $(YAXT_FC_MOD) $(MPI_FC_MOD) AM_LDFLAGS = if ENABLE_ALL_STATIC AM_LDFLAGS += -all-static endif LDADD = $(top_builddir)/src/libcdi.la collectData_SOURCES = collectData.c nodist_collectData_parallel_SOURCES = $(collectData_SOURCES:.c=.parallel.c) collectData_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(YAXT_C_LIB) $(LDADD) collectDataNStreams_SOURCES = collectDataNStreams.c nodist_collectDataNStreams_parallel_SOURCES = $(collectDataNStreams_SOURCES:.c=.parallel.c) collectDataNStreams_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(YAXT_C_LIB) $(LDADD) compareResourcesArray_SOURCES = compareResourcesArray.c compareResourcesArray_LDADD = $(top_builddir)/src/libcdipio.la $(YAXT_C_LIB) $(LDADD) collectData2003_SOURCES = collectData2003.F90 nodist_collectData2003_parallel_SOURCES = $(collectData2003_SOURCES:.F90=.parallel.F90) collectData2003_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(YAXT_FC_LIB) $(MPI_FC_LIB) $(LDADD) clean-local: -rm -f *.parallel.c *.parallel.F90 -rm -f *.grb -rm -rf *.dSYM # Generate source files for parallel versions of the programs. We do this to # avoid target-specific flags, which result into rules that do not use the # compilation commands above. SUFFIXES = .parallel.c .parallel.F90 .c.parallel.c: $(AM_V_GEN):;{ \ echo '#define USE_MPI 1'; \ echo '#include "$<"'; \ } >$@ .F90.parallel.F90: $(AM_V_GEN):;{ \ echo '#define USE_MPI 1'; \ echo '#include "$<"'; \ } >$@ include $(top_srcdir)/config/lt_overrides_Makefile.inc cdo-2.6.6.1/libcdi/examples/cdi_read_f2003.f900000664000175000017500000000505715271332515020560 0ustar alastairalastairPROGRAM CDIREADF2003 use iso_c_binding use mo_cdi IMPLICIT NONE INTEGER :: gsize, nmiss INTEGER :: nlevel, nvars, code INTEGER :: vdate, vtime, status, ilev INTEGER :: streamID, varID, gridID, zaxisID INTEGER :: tsID, vlistID, taxisID DOUBLE PRECISION, ALLOCATABLE :: field(:,:) CHARACTER(kind=c_char), POINTER, DIMENSION(:) :: & msg, cdi_version CHARACTER(kind=c_char, LEN = cdi_max_name + 1) :: & name, longname, units INTEGER :: name_c_len, longname_c_len, units_c_len cdi_version => cdiLibraryVersion() WRITE (0, '(a,132a)') 'cdi version: ', cdi_version ! Open the dataset streamID = streamOpenRead(C_CHAR_"example_f2003.nc"//C_NULL_CHAR) IF ( streamID < 0 ) THEN PRINT *, 'Could not Read the file.' msg => cdiStringError(streamID) WRITE(0,'(132a)') msg STOP 1 END IF ! Get the variable list of the dataset vlistID = streamInqVlist(streamID) nvars = vlistNvars(vlistID) DO varID = 0, nvars-1 code = vlistInqVarCode(vlistID, varID) CALL vlistInqVarName(vlistID, varID, name) CALL vlistInqVarLongname(vlistID, varID, longname) CALL vlistInqVarUnits(vlistID, varID, units) ! CALL ctrim(name) ! CALL ctrim(longname) ! CALL ctrim(units) longname_c_len = c_len(longname) name_c_len = c_len(name) units_c_len = c_len(units) PRINT '(a,2(i0,a),132a)', 'Parameter: ', varID+1, ' ', code, ' ', & name(1:name_c_len), ' ', longname(1:longname_c_len), ' ', & units(1:units_c_len), ' |' END DO ! Get the Time axis form the variable list taxisID = vlistInqTaxis(vlistID) ! Loop over the time steps DO tsID = 0, 999999 ! Read the time step status = streamInqTimestep(streamID, tsID) IF ( status == 0 ) exit ! Get the verification date and time vdate = taxisInqVdate(taxisID) vtime = taxisInqVtime(taxisID) PRINT '(a,i3,i10,i10)', 'Timestep: ', tsID+1, vdate, vtime ! Read the variables at the current timestep DO varID = 0, nvars-1 gridID = vlistInqVarGrid(vlistID, varID) gsize = gridInqSize(gridID) zaxisID = vlistInqVarZaxis(vlistID, varID) nlevel = zaxisInqSize(zaxisID) ALLOCATE(field(gsize, nlevel)) CALL streamReadVar(streamID, varID, field, nmiss) DO ilev = 1, nlevel PRINT '(a,i3,a,i3,a,f10.5,1x,f10.5)', ' var=', varID+1, & ' level=', ilev, ':', & MINVAL(field(:,ilev)), MAXVAL(field(:,ilev)) END DO DEALLOCATE(field) END DO END DO ! Close the input stream CALL streamClose(streamID) END PROGRAM CDIREADF2003 cdo-2.6.6.1/libcdi/examples/cdi_write_hybrid.c0000664000175000017500000000761715271332515021356 0ustar alastairalastair#include #include "cdi.h" #define nlon 12 // Number of longitudes #define nlat 6 // Number of latitudes #define nhlev 6 // Number of half hybrid levels #define nflev 5 // Number of full hybrid levels #define nts 3 // Number of time steps int main(void) { int gridID, zaxisID1, zaxisID2, zaxisID3, zaxisID4, taxisID; int vlistID, varID1, varID2, varID3, varID4, streamID; SizeType numMissVals = 0; double lons[nlon] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; double lats[nlat] = { -75, -45, -15, 15, 45, 75 }; double levs[nhlev] = { 1, 2, 3, 4, 5, 6 }; double levs2[nhlev] = { 2, 3, 4, 5, 6, -1 }; double vct[2 * nhlev] = { 0, 6000, 10000, 16000, 8000, 0, 0, 0.0004, 0.03, 0.2, 0.7, 1.0 }; double var1[nlon * nlat]; double var2[nlon * nlat * nflev]; double var3[nlon * nlat * nhlev]; double var4[nlon * nlat * nflev]; // Create a regular lon/lat grid gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); gridDefYvals(gridID, lats); // Create a surface level Z-axis zaxisID1 = zaxisCreate(ZAXIS_SURFACE, 1); // Create a hybrid level Z-axis zaxisID2 = zaxisCreate(ZAXIS_HYBRID, nflev); zaxisDefLevels(zaxisID2, levs); zaxisDefVct(zaxisID2, nhlev * 2, vct); // Create a hybrid half level Z-axis zaxisID3 = zaxisCreate(ZAXIS_HYBRID, nhlev); zaxisDefLevels(zaxisID3, levs); zaxisDefVct(zaxisID3, nhlev * 2, vct); // Create a hybrid level Z-axis zaxisID4 = zaxisCreate(ZAXIS_HYBRID, nflev); zaxisDefLevels(zaxisID4, levs); zaxisDefLbounds(zaxisID4, levs); zaxisDefUbounds(zaxisID4, levs2); zaxisDefVct(zaxisID4, nhlev * 2, vct); // Create a variable list vlistID = vlistCreate(); // Define the variables varID1 = vlistDefVar(vlistID, gridID, zaxisID1, TIME_VARYING); varID2 = vlistDefVar(vlistID, gridID, zaxisID2, TIME_VARYING); varID3 = vlistDefVar(vlistID, gridID, zaxisID3, TIME_VARYING); varID4 = vlistDefVar(vlistID, gridID, zaxisID4, TIME_VARYING); // Define the variable names vlistDefVarName(vlistID, varID1, "sp"); vlistDefVarName(vlistID, varID2, "t"); vlistDefVarName(vlistID, varID3, "w"); vlistDefVarName(vlistID, varID4, "u"); // Create a Time axis taxisID = taxisCreate(TAXIS_ABSOLUTE); // Assign the Time axis to the variable list vlistDefTaxis(vlistID, taxisID); // Create a dataset in netCDF format streamID = streamOpenWrite("example.nc", CDI_FILETYPE_NC); if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); return (1); } // Assign the variable list to the dataset streamDefVlist(streamID, vlistID); // Loop over the number of time steps for (int tsID = 0; tsID < nts; tsID++) { // Set the verification date to 1985-01-01 + tsID taxisDefVdate(taxisID, 19850101 + tsID); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step streamDefTimestep(streamID, tsID); // Init var1 and var2 for (size_t i = 0; i < nlon * nlat; ++i) var1[i] = 1.1; for (size_t k = 0; k < nflev; ++k) for (size_t i = 0; i < nlon * nlat; ++i) var2[i + k * nlon * nlat] = 2.2 + (double) k; for (size_t k = 0; k < nhlev; ++k) for (size_t i = 0; i < nlon * nlat; ++i) var3[i + k * nlon * nlat] = -2.2 - (double) k; for (size_t k = 0; k < nflev; ++k) for (size_t i = 0; i < nlon * nlat; ++i) var4[i + k * nlon * nlat] = 100.0 + (double) k; // Write var1 and var2 streamWriteVar(streamID, varID1, var1, numMissVals); streamWriteVar(streamID, varID2, var2, numMissVals); streamWriteVar(streamID, varID3, var3, numMissVals); streamWriteVar(streamID, varID4, var4, numMissVals); } // Close the output stream streamClose(streamID); // Destroy the objects vlistDestroy(vlistID); taxisDestroy(taxisID); zaxisDestroy(zaxisID1); zaxisDestroy(zaxisID2); gridDestroy(gridID); return 0; } cdo-2.6.6.1/libcdi/examples/cdi_write_local.c0000664000175000017500000000613615271332515021162 0ustar alastairalastair#include #include "cdi.h" #define nlon 12 // Number of longitudes #define nlat 6 // Number of latitudes #define nlev 5 // Number of levels #define nts 3 // Number of time steps int main(void) { int gridID, zaxisID1, zaxisID2, taxisID; int vlistID, varID1, varID2, streamID; SizeType numMissVals = 0; double lons[nlon] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; double lats[nlat] = { -75, -45, -15, 15, 45, 75 }; double levs[nlev] = { 101300, 92500, 85000, 50000, 20000 }; double var1[nlon * nlat]; double var2[nlon * nlat * nlev]; // Create a regular lon/lat grid gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); gridDefYvals(gridID, lats); // Create a surface level Z-axis zaxisID1 = zaxisCreate(ZAXIS_SURFACE, 1); // Create a pressure level Z-axis zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, nlev); zaxisDefLevels(zaxisID2, levs); // Create a variable list vlistID = vlistCreate(); // Define the variables varID1 = vlistDefVar(vlistID, gridID, zaxisID1, TIME_VARYING); varID2 = vlistDefVar(vlistID, gridID, zaxisID2, TIME_VARYING); // Define the variable names vlistDefVarName(vlistID, varID1, "T"); vlistDefVarName(vlistID, varID2, "P"); cdiDefKeyInt(vlistID, CDI_GLOBAL, CDI_KEY_CENTRE, 252); cdiDefKeyInt(vlistID, CDI_GLOBAL, CDI_KEY_SUBCENTRE, 0); cdiDefKeyInt(vlistID, CDI_GLOBAL, CDI_KEY_MPIMTYPE, 1); cdiDefKeyInt(vlistID, CDI_GLOBAL, CDI_KEY_MPIMCLASS, 2); cdiDefKeyInt(vlistID, CDI_GLOBAL, CDI_KEY_MPIMUSER, 1403); cdiDefKeyInt(vlistID, CDI_GLOBAL, CDI_KEY_REVSTATUS, 0); unsigned char revNumber[] = { 187, 128, 50, 251, 161, 44, 146, 63, 154, 149, 83, 90, 81, 103, 109, 138, 157, 216, 208, 64 }; cdiDefKeyBytes(vlistID, CDI_GLOBAL, CDI_KEY_REVNUMBER, revNumber, 20); // Create a Time axis taxisID = taxisCreate(TAXIS_ABSOLUTE); // Assign the Time axis to the variable list vlistDefTaxis(vlistID, taxisID); // Create a dataset in netCDF format streamID = streamOpenWrite("example_loc.grb", CDI_FILETYPE_GRB2); if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); return (1); } // Assign the variable list to the dataset streamDefVlist(streamID, vlistID); // Loop over the number of time steps for (int tsID = 0; tsID < nts; tsID++) { // Set the verification date to 1985-01-01 + tsID taxisDefVdate(taxisID, 19850101 + tsID); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step streamDefTimestep(streamID, tsID); // Init var1 and var2 for (size_t i = 0; i < nlon * nlat; i++) var1[i] = 1.1; for (size_t i = 0; i < nlon * nlat * nlev; i++) var2[i] = 2.2; // Write var1 and var2 streamWriteVar(streamID, varID1, var1, numMissVals); streamWriteVar(streamID, varID2, var2, numMissVals); } // Close the output stream streamClose(streamID); // Destroy the objects vlistDestroy(vlistID); taxisDestroy(taxisID); zaxisDestroy(zaxisID1); zaxisDestroy(zaxisID2); gridDestroy(gridID); return 0; } cdo-2.6.6.1/libcdi/examples/cdi_write_f2003.f900000664000175000017500000000631315271332515020773 0ustar alastairalastair PROGRAM CDIWRITEF2003 USE iso_c_binding USE mo_cdi IMPLICIT NONE INTEGER :: nlev, nts INTEGER :: nlon, nlat, nmiss PARAMETER (nlon = 12) ! Number of longitudes PARAMETER (nlat = 6) ! Number of latitudes PARAMETER (nlev = 5) ! Number of levels PARAMETER (nts = 3) ! Number of time steps INTEGER gridID, zaxisID1, zaxisID2, taxisID INTEGER vlistID, varID1, varID2, streamID, tsID INTEGER i, status DOUBLE PRECISION lons(nlon), lats(nlat), levs(nlev) DOUBLE PRECISION var1(nlon*nlat), var2(nlon*nlat*nlev) CHARACTER(len=256, kind=c_char) :: varname CHARACTER(kind=c_char,len=1), POINTER :: msg(:) DATA lons /0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330/ DATA lats /-75, -45, -15, 15, 45, 75/ DATA levs /101300, 92500, 85000, 50000, 20000/ nmiss = 0 ! Create a regular lon/lat grid gridID = gridCreate(GRID_LONLAT, nlon*nlat) CALL gridDefXsize(gridID, nlon) CALL gridDefYsize(gridID, nlat) CALL gridDefXvals(gridID, lons) CALL gridDefYvals(gridID, lats) ! Create a surface level Z-axis zaxisID1 = zaxisCreate(ZAXIS_SURFACE, 1) ! Create a pressure level Z-axis zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, nlev) CALL zaxisDefLevels(zaxisID2, levs) ! Create a variable list vlistID = vlistCreate() ! Define the variables varID1 = vlistDefVar(vlistID, gridID, zaxisID1, TIME_VARYING) varID2 = vlistDefVar(vlistID, gridID, zaxisID2, TIME_VARYING) ! Define the variable names varname = "varname1" // c_null_char CALL vlistDefVarName(vlistID, varID1, varname) CALL vlistDefVarName(vlistID, varID2, C_CHAR_"varname2"//C_NULL_CHAR) ! Create a Time axis taxisID = taxisCreate(TAXIS_ABSOLUTE) ! Assign the Time axis to the variable list CALL vlistDefTaxis(vlistID, taxisID) ! Create a dataset in netCDF format streamID = streamOpenWrite(C_CHAR_"example_f2003.nc"//C_NULL_CHAR, CDI_FILETYPE_NC) IF ( streamID < 0 ) THEN msg => cdiStringError(streamID) WRITE(0,'(132a)') msg STOP 1 END IF ! Assign the variable list to the dataset CALL streamDefVlist(streamID, vlistID) ! Loop over the number of time steps DO tsID = 0, nts-1 ! Set the verification date to 1985-01-01 + tsID CALL taxisDefVdate(taxisID, 19850101+tsID) ! Set the verification time to 12:00:00 CALL taxisDefVtime(taxisID, 120000) ! Define the time step status = streamDefTimestep(streamID, tsID) ! Init var1 and var2 DO i = 1, nlon*nlat var1(i) = 1.1 END DO DO i = 1, nlon*nlat*nlev var2(i) = 2.2 END DO ! Write var1 and var2 CALL streamWriteVar(streamID, varID1, var1, nmiss) CALL streamWriteVar(streamID, varID2, var2, nmiss) END DO ! Close the output stream CALL streamClose(streamID) ! Destroy the objects CALL vlistDestroy(vlistID) CALL taxisDestroy(taxisID) CALL zaxisDestroy(zaxisID1) CALL zaxisDestroy(zaxisID2) CALL gridDestroy(gridID) END PROGRAM CDIWRITEF2003 cdo-2.6.6.1/libcdi/examples/cdi_copy.c0000664000175000017500000000311715271332515017624 0ustar alastairalastair#include #include #include "cdi.h" int main(void) { // Open the input dataset int streamID1 = streamOpenRead("example.nc"); if (streamID1 < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID1)); return 1; } // Get the variable list of the dataset int vlistID1 = streamInqVlist(streamID1); int numVars = vlistNvars(vlistID1); int varDataSize = 0; double *varData = NULL; for (int varID = 0; varID < numVars; ++varID) { int varSize = vlistInqVarSize(vlistID1, varID); varDataSize = varSize > varDataSize ? varSize : varDataSize; } varData = malloc((size_t) varDataSize * sizeof(double)); if (!varData) { perror("cannot allocate temporary copying buffer"); return EXIT_FAILURE; } // Open the output dataset (GRIB format) int streamID2 = streamOpenWrite("example.grb", CDI_FILETYPE_GRB); if (streamID2 < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID2)); return EXIT_FAILURE; } int vlistID2 = vlistDuplicate(vlistID1); streamDefVlist(streamID2, vlistID2); // Loop over the input time steps int tsID = 0; while (streamInqTimestep(streamID1, tsID)) { // Define the output time step streamDefTimestep(streamID2, tsID); for (int varID = 0; varID < numVars; ++varID) { SizeType numMissVals; // Read var streamReadVar(streamID1, varID, varData, &numMissVals); // Write var streamWriteVar(streamID2, varID, varData, numMissVals); } ++tsID; } // Close the streams streamClose(streamID1); streamClose(streamID2); return EXIT_SUCCESS; } cdo-2.6.6.1/libcdi/examples/cdi_write_relativ.c0000664000175000017500000000476615271332515021545 0ustar alastairalastair#include #include "cdi.h" int main(void) { enum { nlon = 12, // Number of longitudes nlat = 6, // Number of latitudes nlev = 5, // Number of levels nts = 3, // Number of time steps }; int numMissVals = 0; double lons[] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; double lats[] = { -75, -45, -15, 15, 45, 75 }; double levs[] = { 101300, 92500, 85000, 50000, 20000 }; double var1[nlon * nlat]; double var2[nlon * nlat * nlev]; // Create a regular lon/lat grid int gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); gridDefYvals(gridID, lats); // Create a surface level Z-axis int zaxisID1 = zaxisCreate(ZAXIS_SURFACE, 1); // Create a pressure level Z-axis int zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, nlev); zaxisDefLevels(zaxisID2, levs); // Create a variable list int vlistID = vlistCreate(); // Define the variables int varID1 = vlistDefVar(vlistID, gridID, zaxisID1, TIME_VARYING); int varID2 = vlistDefVar(vlistID, gridID, zaxisID2, TIME_VARYING); // Define the variable names vlistDefVarName(vlistID, varID1, "varname1"); vlistDefVarName(vlistID, varID2, "varname2"); // Create a Time axis int taxisID = taxisCreate(TAXIS_RELATIVE); // Assign the Time axis to the variable list vlistDefTaxis(vlistID, taxisID); // Create a dataset in netCDF format int streamID = streamOpenWrite("example.nc", CDI_FILETYPE_NC); if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); return 1; } // Assign the variable list to the dataset streamDefVlist(streamID, vlistID); // Loop over the number of time steps for (int tsID = 0; tsID < nts; tsID++) { // Set the verification date to 1985-01-01 + tsID taxisDefVdate(taxisID, 19850101 + tsID); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step streamDefTimestep(streamID, tsID); // Init var1 and var2 for (int i = 0; i < nlon * nlat; i++) var1[i] = 1.1; for (int i = 0; i < nlon * nlat * nlev; i++) var2[i] = 2.2; // Write var1 and var2 streamWriteVar(streamID, varID1, var1, numMissVals); streamWriteVar(streamID, varID2, var2, numMissVals); } // Close the output stream streamClose(streamID); // Destroy the objects vlistDestroy(vlistID); taxisDestroy(taxisID); zaxisDestroy(zaxisID1); zaxisDestroy(zaxisID2); gridDestroy(gridID); return 0; } cdo-2.6.6.1/libcdi/examples/cdi_write_const.c0000664000175000017500000000456515271332515021222 0ustar alastairalastair#include #include "cdi.h" #define nlon 12 // Number of longitudes #define nlat 6 // Number of latitudes #define nlev 5 // Number of levels int main(void) { int gridID, zaxisID1, zaxisID2; int vlistID, varID1, varID2, streamID; SizeType numMissVals = 0; double lons[nlon] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; double lats[nlat] = { -75, -45, -15, 15, 45, 75 }; double levs[nlev] = { 101300, 92500, 85000, 50000, 20000 }; double var1[nlon * nlat]; double var2[nlon * nlat * nlev]; // Create a regular lon/lat grid gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); gridDefYvals(gridID, lats); // Create a surface level Z-axis zaxisID1 = zaxisCreate(ZAXIS_SURFACE, 1); // Create a pressure level Z-axis zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, nlev); zaxisDefLevels(zaxisID2, levs); // Create a variable list vlistID = vlistCreate(); // Define the variables varID1 = vlistDefVar(vlistID, gridID, zaxisID1, TIME_CONSTANT); varID2 = vlistDefVar(vlistID, gridID, zaxisID2, TIME_CONSTANT); // Define the variable names vlistDefVarName(vlistID, varID1, "varname1"); vlistDefVarName(vlistID, varID2, "varname2"); // Create a Time axis int taxisID = taxisCreate(TAXIS_RELATIVE); // Assign the Time axis to the variable list vlistDefTaxis(vlistID, taxisID); // Create a dataset in netCDF format streamID = streamOpenWrite("example_const.nc", CDI_FILETYPE_NC); if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); return 1; } // Assign the variable list to the dataset streamDefVlist(streamID, vlistID); // Set the verification date to 1985-01-01 taxisDefVdate(taxisID, 19850101); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step streamDefTimestep(streamID, 0); // Init var1 and var2 for (size_t i = 0; i < nlon * nlat; i++) var1[i] = 1.1; for (size_t i = 0; i < nlon * nlat * nlev; i++) var2[i] = 2.2; // Write var1 and var2 streamWriteVar(streamID, varID1, var1, numMissVals); streamWriteVar(streamID, varID2, var2, numMissVals); // Close the output stream streamClose(streamID); // Destroy the objects vlistDestroy(vlistID); zaxisDestroy(zaxisID1); zaxisDestroy(zaxisID2); gridDestroy(gridID); return 0; } cdo-2.6.6.1/libcdi/examples/cdi_write.c0000664000175000017500000000500515271332515020002 0ustar alastairalastair#include #include "cdi.h" int main(void) { enum { nlon = 12, // Number of longitudes nlat = 6, // Number of latitudes nlev = 5, // Number of levels nts = 3, // Number of time steps }; SizeType numMissVals = 0; double lons[] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; double lats[] = { -75, -45, -15, 15, 45, 75 }; double levels[] = { 101300, 92500, 85000, 50000, 20000 }; double var1[nlon * nlat]; double var2[nlon * nlat * nlev]; // Create a regular lon/lat grid int gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); gridDefYvals(gridID, lats); // Create a surface level Z-axis int zaxisID1 = zaxisCreate(ZAXIS_SURFACE, 1); // Create a pressure level Z-axis int zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, nlev); zaxisDefLevels(zaxisID2, levels); // Create a variable list int vlistID = vlistCreate(); // Define the variables int varID1 = vlistDefVar(vlistID, gridID, zaxisID1, TIME_VARYING); int varID2 = vlistDefVar(vlistID, gridID, zaxisID2, TIME_VARYING); // Define the variable names vlistDefVarName(vlistID, varID1, "varname1"); vlistDefVarName(vlistID, varID2, "varname2"); // Create a Time axis int taxisID = taxisCreate(TAXIS_ABSOLUTE); // Assign the Time axis to the variable list vlistDefTaxis(vlistID, taxisID); // Create a dataset in netCDF format int streamID = streamOpenWrite("example.nc", CDI_FILETYPE_NC); if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); return 1; } // Assign the variable list to the dataset streamDefVlist(streamID, vlistID); // Loop over the number of time steps for (int tsID = 0; tsID < nts; tsID++) { // Set the verification date to 1985-01-01 + tsID taxisDefVdate(taxisID, 19850101 + tsID); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step streamDefTimestep(streamID, tsID); // Init var1 and var2 for (size_t i = 0; i < nlon * nlat; i++) var1[i] = 1.1; for (size_t i = 0; i < nlon * nlat * nlev; i++) var2[i] = 2.2; // Write var1 and var2 streamWriteVar(streamID, varID1, var1, numMissVals); streamWriteVar(streamID, varID2, var2, numMissVals); } // Close the output stream streamClose(streamID); // Destroy the objects vlistDestroy(vlistID); taxisDestroy(taxisID); zaxisDestroy(zaxisID1); zaxisDestroy(zaxisID2); gridDestroy(gridID); return 0; } cdo-2.6.6.1/libcdi/examples/Makefile.in0000664000175000017500000011003015271332515017725 0ustar alastairalastair# Makefile.in generated by automake 1.18.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2025 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@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) am__rm_f = rm -f $(am__rm_f_notfound) am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 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@ noinst_PROGRAMS = $(am__EXEEXT_5) $(am__append_5) check_PROGRAMS = $(am__EXEEXT_4) EXTRA_PROGRAMS = cdi_append$(EXEEXT) cdi_copy$(EXEEXT) \ cdi_read$(EXEEXT) cdi_write$(EXEEXT) cdi_write_ens$(EXEEXT) \ cdi_write_hybrid$(EXEEXT) cdi_write_local$(EXEEXT) \ cdi_write_relativ$(EXEEXT) @ENABLE_NETCDF_TRUE@am__append_1 = cdi_write_const @ENABLE_ISOC_INTERFACE_TRUE@am__append_2 = cdi_read_f2003 cdi_write_f2003 @with_on_demand_check_programs_TRUE@am__append_3 = $(test_PROGRAMS_) @with_on_demand_check_programs_FALSE@am__append_4 = $(test_PROGRAMS_) @with_example_programs_TRUE@am__append_5 = $(EXTRA_PROGRAMS) @with_example_programs_FALSE@am__append_6 = $(EXTRA_PROGRAMS) @ENABLE_ISOC_INTERFACE_TRUE@am__append_7 = $(FC_MOD_FLAG)$(top_builddir)/src @ENABLE_ALL_STATIC_TRUE@am__append_8 = -all-static subdir = examples ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/acx_assert_lang_is_fortran_variant.m4 \ $(top_srcdir)/m4/acx_c_package.m4 \ $(top_srcdir)/m4/acx_cfortran_flags.m4 \ $(top_srcdir)/m4/acx_check_cfortran.m4 \ $(top_srcdir)/m4/acx_check_strptr_convert.m4 \ $(top_srcdir)/m4/acx_execinfo.m4 \ $(top_srcdir)/m4/acx_fortran_check_include.m4 \ $(top_srcdir)/m4/acx_fortran_include_flag.m4 \ $(top_srcdir)/m4/acx_fortran_package.m4 \ $(top_srcdir)/m4/acx_lang_check_include.m4 \ $(top_srcdir)/m4/acx_lang_package.m4 \ $(top_srcdir)/m4/acx_lt_problems.m4 \ $(top_srcdir)/m4/acx_m4_list_to_quoted_strings.m4 \ $(top_srcdir)/m4/acx_mpirun.m4 $(top_srcdir)/m4/acx_mv_obj.m4 \ $(top_srcdir)/m4/acx_option_search_libs.m4 \ $(top_srcdir)/m4/acx_options.m4 \ $(top_srcdir)/m4/acx_prog_cc_posix.m4 \ $(top_srcdir)/m4/acx_sl_fc_mod_path_flag.m4 \ $(top_srcdir)/m4/acx_sl_mod_suffix.m4 \ $(top_srcdir)/m4/acx_tls_xlc_retry.m4 \ $(top_srcdir)/m4/acx_use_libtool_configuration.m4 \ $(top_srcdir)/m4/acx_uuid.m4 $(top_srcdir)/m4/asx_tr_arg.m4 \ $(top_srcdir)/m4/asx_unset.m4 $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_python_devel.m4 $(top_srcdir)/m4/ax_tls.m4 \ $(top_srcdir)/m4/kpse_libtool.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/m4/ac_lang_program_fortran.m4 \ $(top_srcdir)/m4/acx_lang_fortran_check_include.m4 \ $(top_srcdir)/m4/acx_lang_c_check_include.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @ENABLE_NETCDF_TRUE@am__EXEEXT_1 = cdi_write_const$(EXEEXT) @ENABLE_ISOC_INTERFACE_TRUE@am__EXEEXT_2 = cdi_read_f2003$(EXEEXT) \ @ENABLE_ISOC_INTERFACE_TRUE@ cdi_write_f2003$(EXEEXT) am__EXEEXT_3 = $(am__EXEEXT_1) $(am__EXEEXT_2) @with_on_demand_check_programs_TRUE@am__EXEEXT_4 = $(am__EXEEXT_3) @with_on_demand_check_programs_FALSE@am__EXEEXT_5 = $(am__EXEEXT_3) PROGRAMS = $(noinst_PROGRAMS) am_cdi_append_OBJECTS = cdi_append.$(OBJEXT) cdi_append_OBJECTS = $(am_cdi_append_OBJECTS) cdi_append_LDADD = $(LDADD) cdi_append_DEPENDENCIES = $(top_builddir)/src/libcdi.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am_cdi_copy_OBJECTS = cdi_copy.$(OBJEXT) cdi_copy_OBJECTS = $(am_cdi_copy_OBJECTS) cdi_copy_LDADD = $(LDADD) cdi_copy_DEPENDENCIES = $(top_builddir)/src/libcdi.la am_cdi_read_OBJECTS = cdi_read.$(OBJEXT) cdi_read_OBJECTS = $(am_cdi_read_OBJECTS) cdi_read_LDADD = $(LDADD) cdi_read_DEPENDENCIES = $(top_builddir)/src/libcdi.la am_cdi_read_f2003_OBJECTS = cdi_read_f2003.$(OBJEXT) cdi_read_f2003_OBJECTS = $(am_cdi_read_f2003_OBJECTS) cdi_read_f2003_DEPENDENCIES = $(top_builddir)/src/libcdi_f2003.la \ $(LDADD) am_cdi_write_OBJECTS = cdi_write.$(OBJEXT) cdi_write_OBJECTS = $(am_cdi_write_OBJECTS) cdi_write_LDADD = $(LDADD) cdi_write_DEPENDENCIES = $(top_builddir)/src/libcdi.la am_cdi_write_const_OBJECTS = cdi_write_const.$(OBJEXT) cdi_write_const_OBJECTS = $(am_cdi_write_const_OBJECTS) cdi_write_const_LDADD = $(LDADD) cdi_write_const_DEPENDENCIES = $(top_builddir)/src/libcdi.la am_cdi_write_ens_OBJECTS = cdi_write_ens.$(OBJEXT) cdi_write_ens_OBJECTS = $(am_cdi_write_ens_OBJECTS) cdi_write_ens_LDADD = $(LDADD) cdi_write_ens_DEPENDENCIES = $(top_builddir)/src/libcdi.la am_cdi_write_f2003_OBJECTS = cdi_write_f2003.$(OBJEXT) cdi_write_f2003_OBJECTS = $(am_cdi_write_f2003_OBJECTS) cdi_write_f2003_DEPENDENCIES = $(top_builddir)/src/libcdi_f2003.la \ $(LDADD) am_cdi_write_hybrid_OBJECTS = cdi_write_hybrid.$(OBJEXT) cdi_write_hybrid_OBJECTS = $(am_cdi_write_hybrid_OBJECTS) cdi_write_hybrid_LDADD = $(LDADD) cdi_write_hybrid_DEPENDENCIES = $(top_builddir)/src/libcdi.la am_cdi_write_local_OBJECTS = cdi_write_local.$(OBJEXT) cdi_write_local_OBJECTS = $(am_cdi_write_local_OBJECTS) cdi_write_local_LDADD = $(LDADD) cdi_write_local_DEPENDENCIES = $(top_builddir)/src/libcdi.la am_cdi_write_relativ_OBJECTS = cdi_write_relativ.$(OBJEXT) cdi_write_relativ_OBJECTS = $(am_cdi_write_relativ_OBJECTS) cdi_write_relativ_LDADD = $(LDADD) cdi_write_relativ_DEPENDENCIES = $(top_builddir)/src/libcdi.la AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/cdi_append.Po \ ./$(DEPDIR)/cdi_copy.Po ./$(DEPDIR)/cdi_read.Po \ ./$(DEPDIR)/cdi_write.Po ./$(DEPDIR)/cdi_write_const.Po \ ./$(DEPDIR)/cdi_write_ens.Po ./$(DEPDIR)/cdi_write_hybrid.Po \ ./$(DEPDIR)/cdi_write_local.Po \ ./$(DEPDIR)/cdi_write_relativ.Po am__mv = mv -f LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = LTFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) AM_V_FC = $(am__v_FC_@AM_V@) am__v_FC_ = $(am__v_FC_@AM_DEFAULT_V@) am__v_FC_0 = @echo " FC " $@; am__v_FC_1 = FCLD = $(FC) FCLINK = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_FCLD = $(am__v_FCLD_@AM_V@) am__v_FCLD_ = $(am__v_FCLD_@AM_DEFAULT_V@) am__v_FCLD_0 = @echo " FCLD " $@; am__v_FCLD_1 = SOURCES = $(cdi_append_SOURCES) $(cdi_copy_SOURCES) \ $(cdi_read_SOURCES) $(cdi_read_f2003_SOURCES) \ $(cdi_write_SOURCES) $(cdi_write_const_SOURCES) \ $(cdi_write_ens_SOURCES) $(cdi_write_f2003_SOURCES) \ $(cdi_write_hybrid_SOURCES) $(cdi_write_local_SOURCES) \ $(cdi_write_relativ_SOURCES) DIST_SOURCES = $(cdi_append_SOURCES) $(cdi_copy_SOURCES) \ $(cdi_read_SOURCES) $(cdi_read_f2003_SOURCES) \ $(cdi_write_SOURCES) $(cdi_write_const_SOURCES) \ $(cdi_write_ens_SOURCES) $(cdi_write_f2003_SOURCES) \ $(cdi_write_hybrid_SOURCES) $(cdi_write_local_SOURCES) \ $(cdi_write_relativ_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__extra_recursive_targets = examples-recursive am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp \ $(top_srcdir)/config/lt_overrides_Makefile.inc README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DCE_UUIDROOT = @DCE_UUIDROOT@ DCE_UUID_C_INCLUDE = @DCE_UUID_C_INCLUDE@ DCE_UUID_C_LIB = @DCE_UUID_C_LIB@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECCODES_INCLUDE = @ECCODES_INCLUDE@ ECCODES_LIBS = @ECCODES_LIBS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_ACROSS = @ENABLE_ACROSS@ ENABLE_CDI_LIB = @ENABLE_CDI_LIB@ ENABLE_CGRIBEX = @ENABLE_CGRIBEX@ ENABLE_EXTRA = @ENABLE_EXTRA@ ENABLE_GRIB = @ENABLE_GRIB@ ENABLE_IEG = @ENABLE_IEG@ ENABLE_MPI = @ENABLE_MPI@ ENABLE_NETCDF = @ENABLE_NETCDF@ ENABLE_SERVICE = @ENABLE_SERVICE@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ F77 = @F77@ FC = @FC@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCMODCASE = @FCMODCASE@ FCMODEXT = @FCMODEXT@ FC_DEFINE = @FC_DEFINE@ FC_MOD_FLAG = @FC_MOD_FLAG@ FC_OPTINC = @FC_OPTINC@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ FILECMD = @FILECMD@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBRT = @LIBRT@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPIROOT = @MPIROOT@ MPI_C_INCLUDE = @MPI_C_INCLUDE@ MPI_C_LIB = @MPI_C_LIB@ MPI_FC_LIB = @MPI_FC_LIB@ MPI_FC_MOD = @MPI_FC_MOD@ MPI_LAUNCH = @MPI_LAUNCH@ NETCDF_INCLUDE = @NETCDF_INCLUDE@ NETCDF_LIBS = @NETCDF_LIBS@ NETCDF_ROOT = @NETCDF_ROOT@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPENMP_CFLAGS = @OPENMP_CFLAGS@ OSSP_UUIDROOT = @OSSP_UUIDROOT@ OSSP_UUID_C_INCLUDE = @OSSP_UUID_C_INCLUDE@ OSSP_UUID_C_LIB = @OSSP_UUID_C_LIB@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PPM_CORE_C_INCLUDE = @PPM_CORE_C_INCLUDE@ PPM_CORE_C_LIB = @PPM_CORE_C_LIB@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_CXX = @PTHREAD_CXX@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PLATFORM_SITE_PKG = @PYTHON_PLATFORM_SITE_PKG@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RUBY = @RUBY@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SYSTEM_TYPE = @SYSTEM_TYPE@ SZLIB_INCLUDE = @SZLIB_INCLUDE@ SZLIB_LIBS = @SZLIB_LIBS@ THREADS_INCLUDE = @THREADS_INCLUDE@ THREADS_LIBS = @THREADS_LIBS@ UTIL_LINUX_UUIDROOT = @UTIL_LINUX_UUIDROOT@ UTIL_LINUX_UUID_C_INCLUDE = @UTIL_LINUX_UUID_C_INCLUDE@ UTIL_LINUX_UUID_C_LIB = @UTIL_LINUX_UUID_C_LIB@ UUID_C_INCLUDE = @UUID_C_INCLUDE@ UUID_C_LIB = @UUID_C_LIB@ VERSION = @VERSION@ YAXT_C_INCLUDE = @YAXT_C_INCLUDE@ YAXT_C_LIB = @YAXT_C_LIB@ YAXT_FC_LIB = @YAXT_FC_LIB@ YAXT_FC_MOD = @YAXT_FC_MOD@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ ac_ct_FC = @ac_ct_FC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ am__xargs_n = @am__xargs_n@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ 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@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = pio CLEANFILES = $(am__append_6) # Examples that are part of the test suite: test_PROGRAMS_ = $(am__append_1) $(am__append_2) AM_CPPFLAGS = -I$(top_srcdir)/src AM_FCFLAGS = $(am__append_7) AM_LDFLAGS = $(am__append_8) LDADD = $(top_builddir)/src/libcdi.la cdi_append_SOURCES = cdi_append.c cdi_copy_SOURCES = cdi_copy.c cdi_read_SOURCES = cdi_read.c cdi_write_SOURCES = cdi_write.c cdi_write_ens_SOURCES = cdi_write_ens.c cdi_write_hybrid_SOURCES = cdi_write_hybrid.c cdi_write_local_SOURCES = cdi_write_local.c cdi_write_relativ_SOURCES = cdi_write_relativ.c cdi_write_const_SOURCES = cdi_write_const.c cdi_read_f2003_SOURCES = cdi_read_f2003.f90 cdi_read_f2003_LDADD = $(top_builddir)/src/libcdi_f2003.la $(LDADD) cdi_write_f2003_SOURCES = cdi_write_f2003.f90 cdi_write_f2003_LDADD = $(top_builddir)/src/libcdi_f2003.la $(LDADD) @FC_MOD_UPPERCASE_FALSE@mo_cdi_mod = mo_cdi.$(FCMODEXT) @FC_MOD_UPPERCASE_TRUE@mo_cdi_mod = MO_CDI.$(FCMODEXT) # Compile *.F90 without CPPFLAGS, which are normally meant for the C compiler # and might not be compatible with the Fortran compiler: LTPPFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) # Compile programs using Libtool with '-static' (to avoid compiling twice): COMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) -static $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) FCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(FC) -static $(AM_FCFLAGS) $(FCFLAGS) PPFCCOMPILE = $(FCCOMPILE) CXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CXX) -static $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) all: all-recursive .SUFFIXES: .SUFFIXES: .c .f90 .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/lt_overrides_Makefile.inc $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign examples/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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_srcdir)/config/lt_overrides_Makefile.inc $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: $(am__rm_f) $(check_PROGRAMS) test -z "$(EXEEXT)" || $(am__rm_f) $(check_PROGRAMS:$(EXEEXT)=) clean-noinstPROGRAMS: $(am__rm_f) $(noinst_PROGRAMS) test -z "$(EXEEXT)" || $(am__rm_f) $(noinst_PROGRAMS:$(EXEEXT)=) cdi_append$(EXEEXT): $(cdi_append_OBJECTS) $(cdi_append_DEPENDENCIES) $(EXTRA_cdi_append_DEPENDENCIES) @rm -f cdi_append$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cdi_append_OBJECTS) $(cdi_append_LDADD) $(LIBS) cdi_copy$(EXEEXT): $(cdi_copy_OBJECTS) $(cdi_copy_DEPENDENCIES) $(EXTRA_cdi_copy_DEPENDENCIES) @rm -f cdi_copy$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cdi_copy_OBJECTS) $(cdi_copy_LDADD) $(LIBS) cdi_read$(EXEEXT): $(cdi_read_OBJECTS) $(cdi_read_DEPENDENCIES) $(EXTRA_cdi_read_DEPENDENCIES) @rm -f cdi_read$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cdi_read_OBJECTS) $(cdi_read_LDADD) $(LIBS) cdi_read_f2003$(EXEEXT): $(cdi_read_f2003_OBJECTS) $(cdi_read_f2003_DEPENDENCIES) $(EXTRA_cdi_read_f2003_DEPENDENCIES) @rm -f cdi_read_f2003$(EXEEXT) $(AM_V_FCLD)$(FCLINK) $(cdi_read_f2003_OBJECTS) $(cdi_read_f2003_LDADD) $(LIBS) cdi_write$(EXEEXT): $(cdi_write_OBJECTS) $(cdi_write_DEPENDENCIES) $(EXTRA_cdi_write_DEPENDENCIES) @rm -f cdi_write$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cdi_write_OBJECTS) $(cdi_write_LDADD) $(LIBS) cdi_write_const$(EXEEXT): $(cdi_write_const_OBJECTS) $(cdi_write_const_DEPENDENCIES) $(EXTRA_cdi_write_const_DEPENDENCIES) @rm -f cdi_write_const$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cdi_write_const_OBJECTS) $(cdi_write_const_LDADD) $(LIBS) cdi_write_ens$(EXEEXT): $(cdi_write_ens_OBJECTS) $(cdi_write_ens_DEPENDENCIES) $(EXTRA_cdi_write_ens_DEPENDENCIES) @rm -f cdi_write_ens$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cdi_write_ens_OBJECTS) $(cdi_write_ens_LDADD) $(LIBS) cdi_write_f2003$(EXEEXT): $(cdi_write_f2003_OBJECTS) $(cdi_write_f2003_DEPENDENCIES) $(EXTRA_cdi_write_f2003_DEPENDENCIES) @rm -f cdi_write_f2003$(EXEEXT) $(AM_V_FCLD)$(FCLINK) $(cdi_write_f2003_OBJECTS) $(cdi_write_f2003_LDADD) $(LIBS) cdi_write_hybrid$(EXEEXT): $(cdi_write_hybrid_OBJECTS) $(cdi_write_hybrid_DEPENDENCIES) $(EXTRA_cdi_write_hybrid_DEPENDENCIES) @rm -f cdi_write_hybrid$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cdi_write_hybrid_OBJECTS) $(cdi_write_hybrid_LDADD) $(LIBS) cdi_write_local$(EXEEXT): $(cdi_write_local_OBJECTS) $(cdi_write_local_DEPENDENCIES) $(EXTRA_cdi_write_local_DEPENDENCIES) @rm -f cdi_write_local$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cdi_write_local_OBJECTS) $(cdi_write_local_LDADD) $(LIBS) cdi_write_relativ$(EXEEXT): $(cdi_write_relativ_OBJECTS) $(cdi_write_relativ_DEPENDENCIES) $(EXTRA_cdi_write_relativ_DEPENDENCIES) @rm -f cdi_write_relativ$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cdi_write_relativ_OBJECTS) $(cdi_write_relativ_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_append.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_copy.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_read.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_write.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_write_const.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_write_ens.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_write_hybrid.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_write_local.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_write_relativ.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @: >>$@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< .f90.o: $(AM_V_FC)$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) $< .f90.obj: $(AM_V_FC)$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) `$(CYGPATH_W) '$<'` .f90.lo: $(AM_V_FC)$(LTFCCOMPILE) -c -o $@ $(FCFLAGS_f90) $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" examples-local: ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ 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 || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$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 \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) check: check-recursive all-am: Makefile $(PROGRAMS) installdirs: installdirs-recursive installdirs-am: 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -$(am__rm_f) $(CLEANFILES) distclean-generic: -$(am__rm_f) $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_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-checkPROGRAMS clean-generic clean-libtool clean-local \ clean-noinstPROGRAMS mostlyclean-am distclean: distclean-recursive -rm -f ./$(DEPDIR)/cdi_append.Po -rm -f ./$(DEPDIR)/cdi_copy.Po -rm -f ./$(DEPDIR)/cdi_read.Po -rm -f ./$(DEPDIR)/cdi_write.Po -rm -f ./$(DEPDIR)/cdi_write_const.Po -rm -f ./$(DEPDIR)/cdi_write_ens.Po -rm -f ./$(DEPDIR)/cdi_write_hybrid.Po -rm -f ./$(DEPDIR)/cdi_write_local.Po -rm -f ./$(DEPDIR)/cdi_write_relativ.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: examples: examples-recursive examples-am: examples-local html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/cdi_append.Po -rm -f ./$(DEPDIR)/cdi_copy.Po -rm -f ./$(DEPDIR)/cdi_read.Po -rm -f ./$(DEPDIR)/cdi_write.Po -rm -f ./$(DEPDIR)/cdi_write_const.Po -rm -f ./$(DEPDIR)/cdi_write_ens.Po -rm -f ./$(DEPDIR)/cdi_write_hybrid.Po -rm -f ./$(DEPDIR)/cdi_write_local.Po -rm -f ./$(DEPDIR)/cdi_write_relativ.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) check-am install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--depfiles check check-am clean clean-checkPROGRAMS \ clean-generic clean-libtool clean-local clean-noinstPROGRAMS \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am examples-am examples-local html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am .PRECIOUS: Makefile examples-local: $(test_PROGRAMS_) $(EXTRA_PROGRAMS) cdi_read_f2003.$(OBJEXT) cdi_write_f2003.$(OBJEXT): $(top_builddir)/src/$(mo_cdi_mod) clean-local: -rm -f *.grb *.grb2 *.nc -rm -rf *.dSYM # 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: # Tell GNU make to disable its built-in pattern rules. %:: %,v %:: RCS/%,v %:: RCS/% %:: s.% %:: SCCS/s.% cdo-2.6.6.1/libcdi/examples/Makefile.am0000664000175000017500000000371515271332515017727 0ustar alastairalastairSUBDIRS = pio noinst_PROGRAMS = check_PROGRAMS = CLEANFILES = EXTRA_PROGRAMS = \ cdi_append \ cdi_copy \ cdi_read \ cdi_write \ cdi_write_ens \ cdi_write_hybrid \ cdi_write_local \ cdi_write_relativ # Examples that are part of the test suite: test_PROGRAMS_ = if ENABLE_NETCDF test_PROGRAMS_ += cdi_write_const endif if ENABLE_ISOC_INTERFACE test_PROGRAMS_ += cdi_read_f2003 cdi_write_f2003 endif ENABLE_ISOC_INTERFACE if with_on_demand_check_programs check_PROGRAMS += $(test_PROGRAMS_) else !with_on_demand_check_programs noinst_PROGRAMS += $(test_PROGRAMS_) endif !with_on_demand_check_programs if with_example_programs noinst_PROGRAMS += $(EXTRA_PROGRAMS) else !with_example_programs CLEANFILES += $(EXTRA_PROGRAMS) endif !with_example_programs examples-local: $(test_PROGRAMS_) $(EXTRA_PROGRAMS) AM_CPPFLAGS = -I$(top_srcdir)/src AM_FCFLAGS = if ENABLE_ISOC_INTERFACE AM_FCFLAGS += $(FC_MOD_FLAG)$(top_builddir)/src endif ENABLE_ISOC_INTERFACE AM_LDFLAGS = if ENABLE_ALL_STATIC AM_LDFLAGS += -all-static endif LDADD = $(top_builddir)/src/libcdi.la cdi_append_SOURCES = cdi_append.c cdi_copy_SOURCES = cdi_copy.c cdi_read_SOURCES = cdi_read.c cdi_write_SOURCES = cdi_write.c cdi_write_ens_SOURCES = cdi_write_ens.c cdi_write_hybrid_SOURCES = cdi_write_hybrid.c cdi_write_local_SOURCES = cdi_write_local.c cdi_write_relativ_SOURCES = cdi_write_relativ.c cdi_write_const_SOURCES = cdi_write_const.c cdi_read_f2003_SOURCES = cdi_read_f2003.f90 cdi_read_f2003_LDADD = $(top_builddir)/src/libcdi_f2003.la $(LDADD) cdi_write_f2003_SOURCES = cdi_write_f2003.f90 cdi_write_f2003_LDADD = $(top_builddir)/src/libcdi_f2003.la $(LDADD) if FC_MOD_UPPERCASE mo_cdi_mod = MO_CDI.$(FCMODEXT) else !FC_MOD_UPPERCASE mo_cdi_mod = mo_cdi.$(FCMODEXT) endif !FC_MOD_UPPERCASE cdi_read_f2003.$(OBJEXT) cdi_write_f2003.$(OBJEXT): $(top_builddir)/src/$(mo_cdi_mod) clean-local: -rm -f *.grb *.grb2 *.nc -rm -rf *.dSYM include $(top_srcdir)/config/lt_overrides_Makefile.inc cdo-2.6.6.1/libcdi/examples/cdi_read.c0000664000175000017500000000240215271332515017561 0ustar alastairalastair#include #include "cdi.h" int main(void) { enum { nlon = 12, // Number of longitudes nlat = 6, // Number of latitudes nlev = 5, // Number of levels nts = 3, // Number of time steps }; SizeType numMissVals; double var1[nlon * nlat]; double var2[nlon * nlat * nlev]; // Open the dataset int streamID = streamOpenRead("example.nc"); if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); return 1; } // Get the variable list of the dataset int vlistID = streamInqVlist(streamID); // Set the variable IDs int varID1 = 0; int varID2 = 1; // Get the Time axis from the variable list int taxisID = vlistInqTaxis(vlistID); // Loop over the number of time steps for (int tsID = 0; tsID < nts; tsID++) { // Inquire the time step streamInqTimestep(streamID, tsID); // Get the verification date and time int vdate = taxisInqVdate(taxisID); int vtime = taxisInqVtime(taxisID); printf("read timestep %d: date=%d time=%d\n", tsID + 1, vdate, vtime); // Read var1 and var2 streamReadVar(streamID, varID1, var1, &numMissVals); streamReadVar(streamID, varID2, var2, &numMissVals); } // Close the input stream streamClose(streamID); return 0; } cdo-2.6.6.1/libcdi/examples/cdi_append.c0000664000175000017500000000413115271332515020116 0ustar alastairalastair#include #include "cdi.h" int main(void) { enum { nlon = 12, // Number of longitudes nlat = 6, // Number of latitudes nlev = 5, // Number of levels nts = 3, // Number of time steps }; SizeType numMissVals = 0; double var1[nlon * nlat]; double var2[nlon * nlat * nlev]; // Append a dataset (created by cdi_write) int streamID = streamOpenAppend("example.nc"); if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); return 1; } // Get the variable list of the dataset int vlistID = streamInqVlist(streamID); int numVars = vlistNvars(vlistID); if (numVars != 2) { fprintf(stderr, "Unexpected number of variables: %d\n", numVars); return 1; } int varID1 = 0; int varID2 = 1; SizeType varSize1 = gridInqSize(vlistInqVarGrid(vlistID, varID1)) * zaxisInqSize(vlistInqVarZaxis(vlistID, varID1)); if (varSize1 != nlon * nlat) { fprintf(stderr, "Unexpected size of variable 1: %ld\n", (long) varSize1); return 1; } SizeType varSize2 = gridInqSize(vlistInqVarGrid(vlistID, varID2)) * zaxisInqSize(vlistInqVarZaxis(vlistID, varID2)); if (varSize2 != nlon * nlat * nlev) { fprintf(stderr, "Unexpected size of variable 2: %ld\n", (long) varSize2); return 1; } int taxisID = vlistInqTaxis(vlistID); int nsteps = vlistNtsteps(vlistID); printf("Number of timesteps: %d\n", nsteps); // Loop over the number of time steps for (int tsID = 0; tsID < nts; tsID++) { // Set the verification date to 1985-01-01 + tsID taxisDefVdate(taxisID, 19850101 + nsteps + tsID); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step streamDefTimestep(streamID, nsteps + tsID); // Init var1 and var2 for (size_t i = 0; i < nlon * nlat; i++) var1[i] = 1.1; for (size_t i = 0; i < nlon * nlat * nlev; i++) var2[i] = 2.2; // Write var1 and var2 streamWriteVar(streamID, varID1, var1, numMissVals); streamWriteVar(streamID, varID2, var2, numMissVals); } // Close the output stream streamClose(streamID); return 0; } cdo-2.6.6.1/libcdi/cdi.settings.in0000664000175000017500000000346615271332515017006 0ustar alastairalastair{ "build" : { "tools" : { "CC" : "@CC@", "CPP" : "@CPP@", "CPPFLAGS" : "@CPPFLAGS@", "CFLAGS" : "@CFLAGS@", "LDFLAGS" : "@LDFLAGS@", "LIBS" : "@LIBS@", "FC" : "@FC@", "F77" : "@F77@", "FCFLAGS" : "@FCFLAGS@", "LD" : "@LD@", "NM" : "@NM@", "AR" : "@AR@", "DLLTOOL" : "@DLLTOOL@", "OBJDUMP" : "@OBJDUMP@", "STRIP" : "@STRIP@", "RANLIB" : "@RANLIB@", "INSTALL" : "@INSTALL@" }, "libraries" : { "threads" : { "lib" : "@THREADS_LIBS@", "include" : "@THREADS_INCLUDE@" }, "mpi" : { "libs" : "@MPI_C_LIB@", "cflags" : "@MPI_C_INCLUDE@", "fclibs" : "@MPI_FC_LIB@", "fcflags" : "@MPI_FC_MOD@" }, "fdb5" : { "lib" : "@FDB5_LIBS@", "include" : "@FDB5_INCLUDE@" }, "szlib" : { "lib" : "@SZLIB_LIBS@", "include" : "@SZLIB_INCLUDE@" }, "netcdf" : { "lib" : "@NETCDF_LIBS@", "include" : "@NETCDF_INCLUDE@" }, "eccodes" : { "lib" : "@ECCODES_LIBS@", "include" : "@ECCODES_INCLUDE@" } }, "platform" : { "SYSTEM_TYPE" : "@SYSTEM_TYPE@" } }, "features" : { "enable_cdi_lib" : @ENABLE_CDI_LIB@, "grib" : "@ENABLE_GRIB@", "cgribex" : "@ENABLE_CGRIBEX@", "service" : "@ENABLE_SERVICE@", "extra" : "@ENABLE_EXTRA@", "ieg" : "@ENABLE_IEG@", "enable_mpi" : @ENABLE_MPI@, "parallel_nc4" : @HAVE_PARALLEL_NC4@, "enable_python" : @ENABLE_PYTHON_INTERFACE@, "enable_ruby" : @ENABLE_RUBY_INTERFACE@, "across" : "@ENABLE_ACROSS@" } } cdo-2.6.6.1/libcdi/LICENSE0000664000175000017500000000301615271332515015054 0ustar alastairalastairCopyright 2002-2023, MPI für Meteorologie Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. 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. 3. Neither the name of the copyright holder 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 HOLDER 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. Copyright notice ©2002-2023 MPI-M, see list in the AUTHORS file cdo-2.6.6.1/libcdi/aclocal.m40000664000175000017500000020421715271332515015715 0ustar alastairalastair# generated automatically by aclocal 1.18.1 -*- Autoconf -*- # Copyright (C) 1996-2025 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. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.73],, [m4_warning([this file was generated for autoconf 2.73. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # Copyright (C) 2002-2025 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. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.18' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.18.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.18.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2025 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], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2025 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_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl 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-2025 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. # 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", "OBJC", "OBJCXX", "UPC", or "GJC". # 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 m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$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". rm -rf conftest.dir 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 am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) 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 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # 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. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; 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 ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj 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 thus: # 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], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2025 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_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. AS_CASE([$CONFIG_FILES], [*\'*], [eval set x "$CONFIG_FILES"], [*], [set x $CONFIG_FILES]) shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`AS_DIRNAME(["$am_mf"])` am_filepart=`AS_BASENAME(["$am_mf"])` AM_RUN_LOG([cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles]) || am_rc=$? done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE="gmake" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi AS_UNSET([am_dirpart]) AS_UNSET([am_filepart]) AS_UNSET([am_mf]) AS_UNSET([am_rc]) rm -f conftest-deps.mk } ])# _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. # This creates each '.Po' and '.Plo' makefile fragment that we'll 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" MAKE="${MAKE-make}"])]) # AM_EXTRA_RECURSIVE_TARGETS -*- Autoconf -*- # Copyright (C) 2012-2025 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_EXTRA_RECURSIVE_TARGETS # -------------------------- # Define the list of user recursive targets. This macro exists only to # be traced by Automake, which will ensure that a proper definition of # user-defined recursive targets (and associated rules) is propagated # into all the generated Makefiles. # TODO: We should really reject non-literal arguments here... AC_DEFUN([AM_EXTRA_RECURSIVE_TARGETS], []) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2025 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 macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # 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.65])dnl m4_ifdef([_$0_ALREADY_INIT], [m4_fatal([$0 expanded multiple times ]m4_defn([_$0_ALREADY_INIT]))], [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])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 if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi 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], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])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]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). 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_IF_OPTION([tar-v7], [_AM_PROG_TAR([v7])], [_AM_PROG_TAR([ustar])])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) # Variables for tags utilities; see am/tags.am if test -z "$CTAGS"; then CTAGS=ctags fi AC_SUBST([CTAGS]) if test -z "$ETAGS"; then ETAGS=etags fi AC_SUBST([ETAGS]) if test -z "$CSCOPE"; then CSCOPE=cscope fi AC_SUBST([CSCOPE]) AC_REQUIRE([_AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl AC_REQUIRE([_AM_PROG_RM_F]) AC_REQUIRE([_AM_PROG_XARGS_N]) dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # 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_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2025 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 if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2025 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. # 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])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996-2025 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_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless 'enable' is passed literally. # For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], am_maintainer_other[ make rules and dependencies not useful (and sometimes confusing) to the casual installer])], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2025 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_MAKE_INCLUDE() # ----------------- # Check whether make has an 'include' directive that can support all # the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) AS_CASE([$?:`cat confinc.out 2>/dev/null`], ['0:this is the am__doit target'], [AS_CASE([$s], [BSD], [am__include='.include' am__quote='"'], [am__include='include' am__quote=''])]) if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* AC_MSG_RESULT([${_am_result}]) AC_SUBST([am__include])]) AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2025 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_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 is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2025 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_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], [m4_foreach_w([_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])]) # Copyright (C) 1999-2025 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_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done # aligned with autoconf, so not including core; see bug#72225. rm -f -r a.out a.exe b.out conftest.$ac_ext conftest.$ac_objext \ conftest.dSYM conftest1.$ac_ext conftest1.$ac_objext conftest1.dSYM \ conftest2.$ac_ext conftest2.$ac_objext conftest2.dSYM unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 1999-2025 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_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # --------------------------------------------------------------------------- # Adds support for distributing Python modules and packages. To # install modules, copy them to $(pythondir), using the python_PYTHON # automake variable. To install a package with the same name as the # automake package, install to $(pkgpythondir), or use the # pkgpython_PYTHON automake variable. # # The variables $(pyexecdir) and $(pkgpyexecdir) are provided as # locations to install python extension modules (shared libraries). # Another macro is required to find the appropriate flags to compile # extension modules. # # If your package is configured with a different prefix to python, # users will have to add the install directory to the PYTHONPATH # environment variable, or create a .pth file (see the python # documentation for details). # # If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will # cause an error if the version of python installed on the system # doesn't meet the requirement. MINIMUM-VERSION should consist of # numbers and dots only. AC_DEFUN([AM_PATH_PYTHON], [ dnl Find a Python interpreter. Python versions prior to 2.0 are not dnl supported. (2.0 was released on October 16, 2000). m4_define_default([_AM_PYTHON_INTERPRETER_LIST], [python python3 dnl python3.20 python3.19 python3.18 python3.17 python3.16 dnl python3.15 python3.14 python3.13 python3.12 python3.11 python3.10 dnl python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 dnl python3.2 python3.1 python3.0 dnl python2 dnl python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 dnl python2.0]) AC_ARG_VAR([PYTHON], [the Python interpreter]) m4_if([$1],[],[ dnl No version check is needed. # Find any Python interpreter. if test -z "$PYTHON"; then AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :) fi am_display_PYTHON=python ], [ dnl A version check is needed. if test -n "$PYTHON"; then # If the user set $PYTHON, use it and don't search something else. AC_MSG_CHECKING([whether $PYTHON version is >= $1]) AM_PYTHON_CHECK_VERSION([$PYTHON], [$1], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]) AC_MSG_ERROR([Python interpreter is too old])]) am_display_PYTHON=$PYTHON else # Otherwise, try each interpreter until we find one that satisfies # VERSION. AC_CACHE_CHECK([for a Python interpreter with version >= $1], [am_cv_pathless_PYTHON],[ for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do test "$am_cv_pathless_PYTHON" = none && break AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break]) done]) # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. if test "$am_cv_pathless_PYTHON" = none; then PYTHON=: else AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON]) fi am_display_PYTHON=$am_cv_pathless_PYTHON fi ]) if test "$PYTHON" = :; then dnl Run any user-specified action, or abort. m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])]) else dnl Query Python for its version number. Although site.py simply uses dnl sys.version[:3], printing that failed with Python 3.10, since the dnl trailing zero was eliminated. So now we output just the major dnl and minor version numbers, as numbers. Apparently the tertiary dnl version is not of interest. dnl AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], [am_cv_python_version=`$PYTHON -c "import sys; print ('%u.%u' % sys.version_info[[:2]])"`]) AC_SUBST([PYTHON_VERSION], [$am_cv_python_version]) dnl At times, e.g., when building shared libraries, you may want dnl to know which OS platform Python thinks this is. dnl AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform], [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`]) AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) dnl emacs-page dnl If --with-python-sys-prefix is given, use the values of sys.prefix dnl and sys.exec_prefix for the corresponding values of PYTHON_PREFIX dnl and PYTHON_EXEC_PREFIX. Otherwise, use the GNU ${prefix} and dnl ${exec_prefix} variables. dnl dnl The two are made distinct variables so they can be overridden if dnl need be, although general consensus is that you shouldn't need dnl this separation. dnl dnl Also allow directly setting the prefixes via configure options, dnl overriding any default. dnl if test "x$prefix" = xNONE; then am__usable_prefix=$ac_default_prefix else am__usable_prefix=$prefix fi # Allow user to request using sys.* values from Python, # instead of the GNU $prefix values. AC_ARG_WITH([python-sys-prefix], [AS_HELP_STRING([--with-python-sys-prefix], [use Python's sys.prefix and sys.exec_prefix values])], [am_use_python_sys=:], [am_use_python_sys=false]) # Allow user to override whatever the default Python prefix is. AC_ARG_WITH([python_prefix], [AS_HELP_STRING([--with-python_prefix], [override the default PYTHON_PREFIX])], [am_python_prefix_subst=$withval am_cv_python_prefix=$withval AC_MSG_CHECKING([for explicit $am_display_PYTHON prefix]) AC_MSG_RESULT([$am_cv_python_prefix])], [ if $am_use_python_sys; then # using python sys.prefix value, not GNU AC_CACHE_CHECK([for python default $am_display_PYTHON prefix], [am_cv_python_prefix], [am_cv_python_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"`]) dnl If sys.prefix is a subdir of $prefix, replace the literal value of dnl $prefix with a variable reference so it can be overridden. case $am_cv_python_prefix in $am__usable_prefix*) am__strip_prefix=`echo "$am__usable_prefix" | sed 's|.|.|g'` am_python_prefix_subst=`echo "$am_cv_python_prefix" | sed "s,^$am__strip_prefix,\\${prefix},"` ;; *) am_python_prefix_subst=$am_cv_python_prefix ;; esac else # using GNU prefix value, not python sys.prefix am_python_prefix_subst='${prefix}' am_python_prefix=$am_python_prefix_subst AC_MSG_CHECKING([for GNU default $am_display_PYTHON prefix]) AC_MSG_RESULT([$am_python_prefix]) fi]) # Substituting python_prefix_subst value. AC_SUBST([PYTHON_PREFIX], [$am_python_prefix_subst]) # emacs-page Now do it all over again for Python exec_prefix, but with yet # another conditional: fall back to regular prefix if that was specified. AC_ARG_WITH([python_exec_prefix], [AS_HELP_STRING([--with-python_exec_prefix], [override the default PYTHON_EXEC_PREFIX])], [am_python_exec_prefix_subst=$withval am_cv_python_exec_prefix=$withval AC_MSG_CHECKING([for explicit $am_display_PYTHON exec_prefix]) AC_MSG_RESULT([$am_cv_python_exec_prefix])], [ # no explicit --with-python_exec_prefix, but if # --with-python_prefix was given, use its value for python_exec_prefix too. AS_IF([test -n "$with_python_prefix"], [am_python_exec_prefix_subst=$with_python_prefix am_cv_python_exec_prefix=$with_python_prefix AC_MSG_CHECKING([for python_prefix-given $am_display_PYTHON exec_prefix]) AC_MSG_RESULT([$am_cv_python_exec_prefix])], [ # Set am__usable_exec_prefix whether using GNU or Python values, # since we use that variable for pyexecdir. if test "x$exec_prefix" = xNONE; then am__usable_exec_prefix=$am__usable_prefix else am__usable_exec_prefix=$exec_prefix fi # if $am_use_python_sys; then # using python sys.exec_prefix, not GNU AC_CACHE_CHECK([for python default $am_display_PYTHON exec_prefix], [am_cv_python_exec_prefix], [am_cv_python_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"`]) dnl If sys.exec_prefix is a subdir of $exec_prefix, replace the dnl literal value of $exec_prefix with a variable reference so it can dnl be overridden. case $am_cv_python_exec_prefix in $am__usable_exec_prefix*) am__strip_prefix=`echo "$am__usable_exec_prefix" | sed 's|.|.|g'` am_python_exec_prefix_subst=`echo "$am_cv_python_exec_prefix" | sed "s,^$am__strip_prefix,\\${exec_prefix},"` ;; *) am_python_exec_prefix_subst=$am_cv_python_exec_prefix ;; esac else # using GNU $exec_prefix, not python sys.exec_prefix am_python_exec_prefix_subst='${exec_prefix}' am_python_exec_prefix=$am_python_exec_prefix_subst AC_MSG_CHECKING([for GNU default $am_display_PYTHON exec_prefix]) AC_MSG_RESULT([$am_python_exec_prefix]) fi])]) # Substituting python_exec_prefix_subst. AC_SUBST([PYTHON_EXEC_PREFIX], [$am_python_exec_prefix_subst]) # Factor out some code duplication into this shell variable. am_python_setup_sysconfig="\ import sys # Prefer sysconfig over distutils.sysconfig, for better compatibility # with python 3.x. See automake bug#10227. try: import sysconfig except ImportError: can_use_sysconfig = 0 else: can_use_sysconfig = 1 # Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: # try: from platform import python_implementation if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7': can_use_sysconfig = 0 except ImportError: pass" # end of am_python_setup_sysconfig # More repeated code, for figuring out the installation scheme to use. am_python_setup_scheme="if hasattr(sysconfig, 'get_default_scheme'): scheme = sysconfig.get_default_scheme() else: scheme = sysconfig._get_default_scheme() if scheme == 'posix_local': if '$am_py_prefix' == '/usr': scheme = 'deb_system' # should only happen during Debian package builds else: # Debian's default scheme installs to /usr/local/ but we want to # follow the prefix, as we always have. # See bugs#54412, #64837, et al. scheme = 'posix_prefix'" # end of am_python_setup_scheme dnl emacs-page Set up 4 directories: dnl 1. pythondir: where to install python scripts. This is the dnl site-packages directory, not the python standard library dnl directory as in early automake betas. This behavior dnl is more consistent with lispdir.m4 for example. dnl Query sysconfig or distutils (per above) for this directory. dnl AC_CACHE_CHECK([for $am_display_PYTHON script directory (pythondir)], [am_cv_python_pythondir], [if test "x$am_cv_python_prefix" = x; then am_py_prefix=$am__usable_prefix else am_py_prefix=$am_cv_python_prefix fi am_cv_python_pythondir=`$PYTHON -c " $am_python_setup_sysconfig if can_use_sysconfig: try: $am_python_setup_scheme sitedir = sysconfig.get_path('purelib', scheme, vars={'base':'$am_py_prefix'}) except: sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) else: from distutils import sysconfig sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') sys.stdout.write(sitedir)"` # case $am_cv_python_pythondir in $am_py_prefix*) am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,\\${PYTHON_PREFIX},"` ;; *) case $am_py_prefix in /usr|/System*) ;; *) am_cv_python_pythondir="\${PYTHON_PREFIX}/lib/python$PYTHON_VERSION/site-packages" ;; esac ;; esac ]) AC_SUBST([pythondir], [$am_cv_python_pythondir]) dnl 2. pkgpythondir: $PACKAGE directory under pythondir. Was dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is dnl more consistent with the rest of automake. dnl AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE]) dnl 3. pyexecdir: directory for installing python extension modules dnl (shared libraries). dnl Query sysconfig or distutils for this directory. dnl Much of this is the same as for prefix setup above. dnl AC_CACHE_CHECK([for $am_display_PYTHON extension module directory (pyexecdir)], [am_cv_python_pyexecdir], [if test "x$am_cv_python_exec_prefix" = x; then am_py_exec_prefix=$am__usable_exec_prefix else am_py_exec_prefix=$am_cv_python_exec_prefix fi am_cv_python_pyexecdir=`$PYTHON -c " $am_python_setup_sysconfig if can_use_sysconfig: try: $am_python_setup_scheme sitedir = sysconfig.get_path('platlib', scheme, vars={'platbase':'$am_py_exec_prefix'}) except: sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_exec_prefix'}) else: from distutils import sysconfig sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_exec_prefix') sys.stdout.write(sitedir)"` # case $am_cv_python_pyexecdir in $am_py_exec_prefix*) am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,\\${PYTHON_EXEC_PREFIX},"` ;; *) case $am_py_exec_prefix in /usr|/System*) ;; *) am_cv_python_pyexecdir="\${PYTHON_EXEC_PREFIX}/lib/python$PYTHON_VERSION/site-packages" ;; esac ;; esac ]) AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) dnl 4. pkgpyexecdir: $(pyexecdir)/$(PACKAGE) dnl AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE]) dnl Run any user-specified action. $2 fi ]) # AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) # --------------------------------------------------------------------------- # Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION. # Run ACTION-IF-FALSE otherwise. # This test uses sys.hexversion instead of the string equivalent (first # word of sys.version), in order to cope with versions such as 2.2c1. # This supports Python 2.0 or higher. (2.0 was released on October 16, 2000). AC_DEFUN([AM_PYTHON_CHECK_VERSION], [prog="import sys # split strings by '.' and convert to numeric. Append some zeros # because we need at least 4 digits for the hex conversion. # map returns an iterator in Python 3.0 and a list in 2.x minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]] minverhex = 0 # xrange is not present in Python 3.0 and range returns an iterator for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]] sys.exit(sys.hexversion < minverhex)" AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) # Copyright (C) 2022-2025 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_RM_F # --------------- # Check whether 'rm -f' without any arguments works. # https://bugs.gnu.org/10828 AC_DEFUN([_AM_PROG_RM_F], [am__rm_f_notfound= AS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""']) AC_SUBST(am__rm_f_notfound) ]) # Copyright (C) 2001-2025 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_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2025 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_SLEEP_FRACTIONAL_SECONDS # ---------------------------- AC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl AC_CACHE_CHECK([whether sleep supports fractional seconds], am_cv_sleep_fractional_seconds, [dnl AS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes], [am_cv_sleep_fractional_seconds=no]) ])]) # _AM_FILESYSTEM_TIMESTAMP_RESOLUTION # ----------------------------------- # Determine the filesystem's resolution for file modification # timestamps. The coarsest we know of is FAT, with a resolution # of only two seconds, even with the most recent "exFAT" extensions. # The finest (e.g. ext4 with large inodes, XFS, ZFS) is one # nanosecond, matching clock_gettime. However, it is probably not # possible to delay execution of a shell script for less than one # millisecond, due to process creation overhead and scheduling # granularity, so we don't check for anything finer than that. (See below.) AC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl AC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS]) AC_CACHE_CHECK([filesystem timestamp resolution], am_cv_filesystem_timestamp_resolution, [dnl # Default to the worst case. am_cv_filesystem_timestamp_resolution=2 # Only try to go finer than 1 sec if sleep can do it. # Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work, # - 1 sec is not much of a win compared to 2 sec, and # - it takes 2 seconds to perform the test whether 1 sec works. # # Instead, just use the default 2s on platforms that have 1s resolution, # accept the extra 1s delay when using $sleep in the Automake tests, in # exchange for not incurring the 2s delay for running the test for all # packages. # am_try_resolutions= if test "$am_cv_sleep_fractional_seconds" = yes; then # Even a millisecond often causes a bunch of false positives, # so just try a hundredth of a second. The time saved between .001 and # .01 is not terribly consequential. am_try_resolutions="0.01 0.1 $am_try_resolutions" fi # In order to catch current-generation FAT out, we must *modify* files # that already exist; the *creation* timestamp is finer. Use names # that make ls -t sort them differently when they have equal # timestamps than when they have distinct timestamps, keeping # in mind that ls -t prints the *newest* file first. rm -f conftest.ts? : > conftest.ts1 : > conftest.ts2 : > conftest.ts3 # Make sure ls -t actually works. Do 'set' in a subshell so we don't # clobber the current shell's arguments. (Outer-level square brackets # are removed by m4; they're present so that m4 does not expand # ; be careful, easy to get confused.) if ( set X `[ls -t conftest.ts[12]]` && { test "$[]*" != "X conftest.ts1 conftest.ts2" || test "$[]*" != "X conftest.ts2 conftest.ts1"; } ); then :; else # 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". _AS_ECHO_UNQUOTED( ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""], [AS_MESSAGE_LOG_FD]) AC_MSG_FAILURE([ls -t produces unexpected output. Make sure there is not a broken ls alias in your environment.]) fi for am_try_res in $am_try_resolutions; do # Any one fine-grained sleep might happen to cross the boundary # between two values of a coarser actual resolution, but if we do # two fine-grained sleeps in a row, at least one of them will fall # entirely within a coarse interval. echo alpha > conftest.ts1 sleep $am_try_res echo beta > conftest.ts2 sleep $am_try_res echo gamma > conftest.ts3 # We assume that 'ls -t' will make use of high-resolution # timestamps if the operating system supports them at all. if (set X `ls -t conftest.ts?` && test "$[]2" = conftest.ts3 && test "$[]3" = conftest.ts2 && test "$[]4" = conftest.ts1); then # # Ok, ls -t worked. If we're at a resolution of 1 second, we're done, # because we don't need to test make. make_ok=true if test $am_try_res != 1; then # But if we've succeeded so far with a subsecond resolution, we # have one more thing to check: make. It can happen that # everything else supports the subsecond mtimes, but make doesn't; # notably on macOS, which ships make 3.81 from 2006 (the last one # released under GPLv2). https://bugs.gnu.org/68808 # # We test $MAKE if it is defined in the environment, else "make". # It might get overridden later, but our hope is that in practice # it does not matter: it is the system "make" which is (by far) # the most likely to be broken, whereas if the user overrides it, # probably they did so with a better, or at least not worse, make. # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html # # Create a Makefile (real tab character here): rm -f conftest.mk echo 'conftest.ts1: conftest.ts2' >conftest.mk echo ' touch conftest.ts2' >>conftest.mk # # Now, running # touch conftest.ts1; touch conftest.ts2; make # should touch ts1 because ts2 is newer. This could happen by luck, # but most often, it will fail if make's support is insufficient. So # test for several consecutive successes. # # (We reuse conftest.ts[12] because we still want to modify existing # files, not create new ones, per above.) n=0 make=${MAKE-make} until test $n -eq 3; do echo one > conftest.ts1 sleep $am_try_res echo two > conftest.ts2 # ts2 should now be newer than ts1 if $make -f conftest.mk | grep 'up to date' >/dev/null; then make_ok=false break # out of $n loop fi n=`expr $n + 1` done fi # if $make_ok; then # Everything we know to check worked out, so call this resolution good. am_cv_filesystem_timestamp_resolution=$am_try_res break # out of $am_try_res loop fi # Otherwise, we'll go on to check the next resolution. fi done rm -f conftest.ts? # (end _am_filesystem_timestamp_resolution) ])]) # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION]) # This check should not be cached, as it may vary across builds of # different projects. AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_RESULT([no]) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_RESULT([no]) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # 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). am_build_env_is_sane=no am_has_slept=no rm -f conftest.file for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file 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 test "$[]2" = conftest.file ); then am_build_env_is_sane=yes break fi # Just in case. sleep "$am_cv_filesystem_timestamp_resolution" am_has_slept=yes done AC_MSG_RESULT([$am_build_env_is_sane]) if test "$am_build_env_is_sane" = no; then AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= AS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl ( sleep "$am_cv_filesystem_timestamp_resolution" ) & am_sleep_pid=$! ]) AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2025 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_SILENT_RULES # ---------------- # Enable less verbose build rules support. AC_DEFUN([_AM_SILENT_RULES], [AM_DEFAULT_VERBOSITY=1 AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl dnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls dnl to AM_SILENT_RULES to change the default value. AC_CONFIG_COMMANDS_PRE([dnl case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; esac if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi ])dnl ]) # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or # empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_REQUIRE([_AM_SILENT_RULES]) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])m4_newline dnl We intentionally force a newline after the assignment, since a) nothing dnl good can come of more text following, and b) that was the behavior dnl before 1.17. See https://bugs.gnu.org/72267. ]) # Copyright (C) 2001-2025 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="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2025 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_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2025 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_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. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test x$am_uid = xunknown; then AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work]) elif test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test x$gm_gid = xunknown; then AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work]) elif test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} 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 /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 # Copyright (C) 2022-2025 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_XARGS_N # ---------------- # Check whether 'xargs -n' works. It should work everywhere, so the fallback # is not optimized at all as we never expect to use it. AC_DEFUN([_AM_PROG_XARGS_N], [AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl AS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2 3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])]) AS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }' ])dnl AC_SUBST(am__xargs_n) ]) m4_include([m4/acx_assert_lang_is_fortran_variant.m4]) m4_include([m4/acx_c_package.m4]) m4_include([m4/acx_cfortran_flags.m4]) m4_include([m4/acx_check_cfortran.m4]) m4_include([m4/acx_check_strptr_convert.m4]) m4_include([m4/acx_execinfo.m4]) m4_include([m4/acx_fortran_check_include.m4]) m4_include([m4/acx_fortran_include_flag.m4]) m4_include([m4/acx_fortran_package.m4]) m4_include([m4/acx_lang_check_include.m4]) m4_include([m4/acx_lang_package.m4]) m4_include([m4/acx_lt_problems.m4]) m4_include([m4/acx_m4_list_to_quoted_strings.m4]) m4_include([m4/acx_mpirun.m4]) m4_include([m4/acx_mv_obj.m4]) m4_include([m4/acx_option_search_libs.m4]) m4_include([m4/acx_options.m4]) m4_include([m4/acx_prog_cc_posix.m4]) m4_include([m4/acx_sl_fc_mod_path_flag.m4]) m4_include([m4/acx_sl_mod_suffix.m4]) m4_include([m4/acx_tls_xlc_retry.m4]) m4_include([m4/acx_use_libtool_configuration.m4]) m4_include([m4/acx_uuid.m4]) m4_include([m4/asx_tr_arg.m4]) m4_include([m4/asx_unset.m4]) m4_include([m4/ax_pthread.m4]) m4_include([m4/ax_python_devel.m4]) m4_include([m4/ax_tls.m4]) m4_include([m4/kpse_libtool.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) m4_include([m4/pkg.m4]) m4_include([acinclude.m4]) cdo-2.6.6.1/libcdi/configure.ac0000664000175000017500000007714615271332515016354 0ustar alastairalastair# Process this file with autoconf to produce a configure script. # # automake 1.16.1 # autoconf 2.69 # libtool 2.4.6 AC_PREREQ([2.69]) LT_PREREQ([2.4.6]) AC_INIT([cdi],[2.6.6],[https://mpimet.mpg.de/cdi]) AC_DEFINE_UNQUOTED(CDI, ["$PACKAGE_VERSION"], [CDI version]) AC_CONFIG_AUX_DIR([config]) AC_CONFIG_MACRO_DIR([m4]) dnl forbid acx macro names from remaining unexpanded m4_pattern_forbid([^ACX_]) AC_CANONICAL_HOST AC_CANONICAL_BUILD AM_INIT_AUTOMAKE([1.16.1 foreign]) AM_MAINTAINER_MODE([enable]) AM_EXTRA_RECURSIVE_TARGETS([examples]) dnl Tests for the C compiler: dnl Make sure conftest.dSYM is removed when configured on MacOS with dnl CFLAGS='-g': m4_pushdef([_AM_PROG_CC_C_O], m4_bpatsubst(m4_dquote(m4_defn([_AM_PROG_CC_C_O])), [rm -f\(.* conftest\*.*\)], [rm -rf\1]))dnl dnl Check for ISO C99 support dnl (Autoconf 2.69- and 2.70+ have different documented ways for this): m4_case(m4_version_compare(AC_AUTOCONF_VERSION,[2.70]), [-1], [AC_PROG_CC_C99], [0], [dnl dnl Fix a bug in Autoconf 2.70 (see https://savannah.gnu.org/support/?110396): m4_pushdef([_AC_PROG_CC_C99], m4_bpatsubst(m4_dquote(m4_defn([_AC_PROG_CC_C99])), [\[ac_c_conftest_c89_program\]], [[ac_c_conftest_c99_program]]))dnl AC_PROG_CC m4_popdef([_AC_PROG_CC_C99])], [1], [AC_PROG_CC]) AS_VAR_IF([ac_cv_prog_cc_c99], [no], [AC_MSG_FAILURE([unable to detect C compiler flag needed to accept ISO C99])]) m4_popdef([AC_PROG_CC_C_O])dnl ACX_PROG_CC_POSIX([2001]) AC_C_RESTRICT dnl Compile with MPI support (we declare the option here because its value dnl affects values of the auto options below): AC_ARG_ENABLE([mpi], [AS_HELP_STRING([--enable-mpi], [enable parallel I/O with MPI @<:@default=no@:>@])], [test "x$enableval" != xno && enable_mpi=yes], [enable_mpi=no]) AC_ARG_ENABLE([iso-c-interface], [AS_HELP_STRING([--enable-iso-c-interface], [create Fortran 90 interface using Fortran 2003 ISO_C_BINDING facility ]dnl [@<:@default=no@:>@])], [test "x$enableval" != xno && enable_iso_c_interface=yes], [enable_iso_c_interface=no]) AM_CONDITIONAL([ENABLE_ISOC_INTERFACE], [test "x$enable_iso_c_interface" = xyes]) AC_ARG_ENABLE([cf-interface], [AS_HELP_STRING([--enable-cf-interface], [create Fortran 77 interface using cfortran.h @<:@default=auto@:>@])], [AS_IF([test "x$enableval" != xno && test "x$enableval" != xauto], [enable_cf_interface=yes])], [enable_cf_interface=auto]) AS_IF([test "x${enable_mpi}${enable_cf_interface}" = xnoauto], [enable_cf_interface=no]) dnl We need FC for the Fortran 90 and for the Fortran 77 interfaces. In the dnl latter case, the compiler is used for testing. Note that we use neither dnl AS_IF nor AS_VAR_IF here to prevent checking for FC when we do not need it: if test "x$enable_iso_c_interface" = xyes || \ test "x$enable_cf_interface" != xno; then if test "x$FC" != xno; then AC_PROG_FC test -z $FC 2>/dev/null && FC=no AS_IF([test "x$FC" != xno], [AC_FC_SRCEXT([f90], [], [FC=no])]) AS_IF([test "x$FC" != xno], [AC_CACHE_CHECK([whether the Fortran compiler works], [acx_cv_fc_works], [acx_cv_fc_works=no AC_LANG_PUSH([Fortran]) AC_RUN_IFELSE([AC_LANG_PROGRAM], [acx_cv_fc_works=yes], [], [acx_cv_fc_works=yes]) AC_LANG_POP([Fortran])]) AS_VAR_IF([acx_cv_fc_works], [no], [FC=no])]) dnl Additional tests with fallback values: AS_IF([test "x$FC" != xno], [AC_LANG_PUSH([Fortran]) ACX_SL_FC_CHECK_MOD_PATH_FLAG([], [FC_MOD_FLAG=-I]) ACX_FORTRAN_INCLUDE_FLAG( [AC_SUBST([FC_OPTINC], [$acx_cv_fc_ftn_include_flag])], [FC_OPTINC=-I]) ACX_SL_FC_MOD_SUFFIX([], [FCMODEXT=mod]) dnl Find the Fortran compiler flag needed to specify a preprocessor macro dnl definition for *.F90 source files: m4_pushdef([AC_FC_PP_SRCEXT])dnl saved_ac_fc_srcext=$ac_fc_srcext ac_fc_srcext='F90' AC_FC_PP_DEFINE([], [FC_DEFINE=-D]) ac_fc_srcext=$saved_ac_fc_srcext m4_popdef([AC_FC_PP_DEFINE]) AC_LANG_POP([Fortran])]) fi else FC=no fi AM_CONDITIONAL([FC_MOD_UPPERCASE], [test "x$FCMODCASE" = xuc]) dnl Additional checks required for the Fortran 2003 interface: AS_VAR_IF([enable_iso_c_interface], [yes], [AS_IF([test "x$FC" != xno], [ACX_FC_CHECK_STRPTR_CONVERT([], [FC=no])]) AS_VAR_IF([FC], [no], [AC_MSG_FAILURE([the Fortran 2003 interface is requested but the ]dnl [Fortran compiler is disabled, missing or lacks the required features])])]) AM_CONDITIONAL([BUILD_FC_PROGRAMS], [test "x$FC" != xno]) dnl We need Fortran 77 if either FC is not available or the user has specified dnl F77 explicitly to make sure that the generated Fortran 77 interface is dnl compatible with it: if test "x$enable_cf_interface" != xno; then AS_IF([test -n "$F77" && test "x$F77" != xno], [requested_F77=yes], [requested_F77=no]) if test "x$FC" = xno || test "x$requested_F77" = xyes; then AC_PROG_F77 test -z $F77 2>/dev/null && F77=no AS_IF([test "x$F77" != xno], [AC_CACHE_CHECK([whether the Fortran 77 compiler works], [acx_cv_f77_works], [acx_cv_f77_works=no AC_LANG_PUSH([Fortran 77]) AC_RUN_IFELSE([AC_LANG_PROGRAM], [acx_cv_f77_works=yes], [], [acx_cv_f77_works=yes]) AC_LANG_POP([Fortran 77])]) AS_VAR_IF([acx_cv_f77_works], [no], [F77=no])]) else F77=no fi AS_IF([test "x$F77" = xno && test "x$requested_F77" = xyes], [AC_MSG_FAILURE([the explicitly requested Fortran 77 compiler is ]dnl [missing or lacks the required features])]) AS_UNSET([requested_F77]) else F77=no fi dnl Additional checks required for the Fortran 77 interface: AS_IF([test "x$enable_cf_interface" != xno], [dnl dnl The following macro make sure that the user's request for the Fortran 77 dnl interface compatibility is fulfilled: ACX_FIND_CFORTRAN_DEF ACX_XLF_QEXTNAME_ADD_APPENDUS ACX_CHECK_CFORTRAN([$srcdir/src], [AC_DEFINE([HAVE_CF_INTERFACE], [1], [Defined to 1 if C / Fortran interface cfortran.h works])]) AS_IF([test "x$F77" != xno], [AC_LANG_PUSH([Fortran 77]) ACX_FORTRAN_INCLUDE_FLAG AC_LANG_POP([Fortran 77]) AS_IF([test "x$FC" != xno && dnl test "x$acx_cv_f77_ftn_include_flag" != "x$FC_OPTINC"], [AC_MSG_ERROR([Fortran and Fortran 77 compilers require different ]dnl [flags needed to specify search paths for the "INCLUDE" statements])])]) AS_IF([test "x$FC" = xno && test "x$F77" = xno], [AS_VAR_IF([enable_cf_interface], [auto], [enable_cf_interface=no], [AC_MSG_FAILURE([the Fortran 77 interface is requested but both ]dnl [Fortran and Fortran 77 compilers are disabled, missing or lack the ]dnl [required features])])])]) AS_VAR_IF([enable_cf_interface], [auto], [enable_cf_interface=yes]) AM_CONDITIONAL([ENABLE_CF_INTERFACE], [test "x$enable_cf_interface" = xyes]) AC_ARG_ENABLE([ruby-interface], [AS_HELP_STRING([--enable-ruby-interface], [create Ruby language interface (EXPERIMENTAL) @<:@default=no@:>@])], [test "x$enableval" != xno && enable_ruby_interface=yes], [enable_ruby_interface=no]) AC_ARG_ENABLE([python-interface], [AS_HELP_STRING([--enable-python-interface], [create Python language interface (EXPERIMENTAL) @<:@default=no@:>@])], [test "x$enableval" != xno && enable_python_interface=yes], [enable_python_interface=no]) if test "x$enable_ruby_interface" = xyes || \ test "x$enable_python_interface" = xyes; then if test "x$CXX" != xno; then AC_PROG_CXX test -z $CXX 2>/dev/null && CXX=no AS_IF([test "x$CXX" != xno], [AC_CACHE_CHECK([whether the C++ compiler works], [acx_cv_cxx_works], [acx_cv_cxx_works=no AC_LANG_PUSH([C++]) dnl Do not use AC_RUN_IFELSE for now: AC_LINK_IFELSE([AC_LANG_PROGRAM], [acx_cv_cxx_works=yes]) AC_LANG_POP([C++])]) AS_VAR_IF([acx_cv_cxx_works], [no], [CXX=no])]) fi AS_VAR_IF([CXX], [no], [AC_MSG_FAILURE([either the Ruby or the Python interface is requested ]dnl [but the C++ compiler is disabled, missing or lacks the required features])]) else CXX=no dnl The Automake conditional "am__fastdepCXX" is not set in this case because dnl we skipped the check for CXX. Prevent the configure script from failing: AM_CONDITIONAL([am__fastdepCXX], [false]) fi AC_PROG_INSTALL dnl Override the option set by AC_OPENMP: AC_ARG_ENABLE([openmp], [AS_HELP_STRING([--enable-openmp], [enable OpenMP support @<:@default=no@:>@])], [test "x$enableval" != xno && enable_openmp=yes], dnl TODO: decide whether we want to compile with OpenMP support by default. dnl Before this change, we ran AC_OPENMP but did not append OPENMP_CFLAGS to dnl CFLAGS, which resulted in no OpenMP support. We preserve that behaviour: [enable_openmp=no]) m4_pushdef([AC_ARG_ENABLE])dnl AC_OPENMP m4_popdef([AC_ARG_ENABLE])dnl AS_IF( [test "x$enable_openmp" = xno], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ #ifndef _OPENMP choke me #endif]])], [AC_MSG_ERROR([OpenMP support is disabled but the compiler enables it dnl by default: change CFLAGS to disable it])])], [test "x$ac_cv_prog_c_openmp" = xunsupported], [AC_MSG_FAILURE([cannot link C OpenMP programs])], [test -n "$OPENMP_CFLAGS"], [AS_VAR_APPEND([CFLAGS], [" $OPENMP_CFLAGS"])]) dnl Set up libtool: AC_MSG_NOTICE([setting up libtool]) ACX_USE_LIBTOOL_CONFIGURATION([pic-only]) dnl LT_INIT is expanded by the macro above (after the required patches). dnl The following suppresses the warning: dnl libtoolize: Remember to add 'LT_INIT' to configure.ac. m4_pushdef([LT_INIT])dnl LT_INIT[]dnl m4_popdef([LT_INIT])dnl dnl Check endianess of system: AC_C_BIGENDIAN dnl Check large file support on 32 bit systems: AC_SYS_LARGEFILE dnl Checks for library functions: AC_FUNC_MMAP dnl Check for structures: AC_CHECK_MEMBERS([struct stat.st_blksize]) dnl Checks for header files: AC_CHECK_HEADERS([malloc.h sys/time.h],,,[AC_INCLUDES_DEFAULT]) AX_EXECINFO dnl Checks for the availability of functions: AC_CHECK_FUNCS([mallinfo pwrite timegm]) AC_REPLACE_FUNCS([getline]) dnl Check for UUID library: ACX_UUID AS_IF([test -n "$UUID_C_INCLUDE"], [AS_VAR_APPEND([CPPFLAGS], [" $UUID_C_INCLUDE"])]) LIBS="$UUID_C_LIB $LIBS" dnl Checks for the availability of ANSI-C99 functions: AC_CHECK_DECLS([isnan], [], [], [AC_INCLUDES_DEFAULT @%:@include ]) dnl Check for sysconf names: AC_CHECK_DECLS( [_SC_LARGE_PAGESIZE, PAGESIZE, PAGE_SIZE, _SC_PAGE_SIZE, _SC_PAGESIZE, dnl _PC_REC_XFER_ALIGN, POSIX_REC_XFER_ALIGN], [], [], [AC_INCLUDES_DEFAULT @%:@include @%:@include ]) dnl Check for math library: AC_SEARCH_LIBS(floor, m) dnl Check for non-standard builtin: AS_FOR([builtin_macro], [builtin], [__builtin_ctz], [AS_VAR_PUSHDEF([builtin_cache], [acx_cv_have_decl_]builtin_macro) AC_CACHE_CHECK([whether ]builtin_macro[ is declared], [builtin_cache], [AC_LINK_IFELSE( [AC_LANG_PROGRAM([], [ unsigned lbz = builtin_macro][[(56U)]])], [AS_VAR_SET([builtin_cache], [yes])], [AS_VAR_SET([builtin_cache], [no])])]) AS_VAR_IF([builtin_cache], [yes], [AC_DEFINE_UNQUOTED([HAVE_DECL_]AS_TR_CPP([builtin_macro]), [1]) break], [AC_DEFINE_UNQUOTED([HAVE_DECL_]AS_TR_CPP([builtin_macro]), [0])])]) AH_TEMPLATE([HAVE_DECL___BUILTIN_CTZ], [Define to 1 if __builtin_ctz is available, 0 if not]) dnl TODO: add comments on why we do not have all options in one place: dnl Add basic configure options: ACX_CDI_OPTIONS AM_CONDITIONAL([ENABLE_NETCDF], [test "x$ENABLE_NETCDF" = xyes]) AC_CHECK_FUNCS([grib_get_length]) dnl TODO: check whether we really need all the following information. Is it just dnl for 'app/cdi -d'? If so, we can skip this when we are not going to install dnl the executable: AC_DEFINE_UNQUOTED(COMPILER, ["$CC $CFLAGS"], [Compiler]) dnl TODO: replace the following with a macro that can do the detection better: dnl Check compiler version: COMP_VERSION= AS_CASE([$CC], [pgcc*], [COMP_VERSION=`$CC -V | head -2 | tail -n 1`], [*gcc*], [COMP_VERSION=`$CC --version | head -n 1`], [g++*], [COMP_VERSION=`$CC --version | head -n 1`], [clang*], [COMP_VERSION=`$CC --version | head -n 1`], [sxc*], [COMP_VERSION=`$CC -V 2>&1 | tail -n 1`], [xlc*], [COMP_VERSION=`$CC -qversion 2>&1 | head -n 1`], [COMP_VERSION=`$CC -V 2>&1 | sed -n 1p`]) test -z "$COMP_VERSION" && COMP_VERSION=unknown AC_DEFINE_UNQUOTED([COMP_VERSION], ["$COMP_VERSION"], [Compiler version]) dnl dnl Checks for system type: AC_DEFINE_UNQUOTED([SYSTEM_TYPE], ["$ac_cv_build"], [System type]) AC_SUBST([SYSTEM_TYPE], ["$ac_cv_build"]) dnl MPI-related options and checks: AC_ARG_ENABLE([ppm-dist-array], [AS_HELP_STRING([--enable-ppm-dist-array], [enable usage of the PPM distributed array @<:@default=auto@:>@])], [AS_CASE([$enableval], [no|auto], [], [AS_VAR_IF([enable_mpi], [no], [AC_MSG_ERROR([usage of the PPM distributed array can be enabled dnl (--enable-ppm-dist-array) only if the parallel I/O with MPI is enabled dnl (--enable-mpi)])]) enable_ppm_dist_array=yes])], [enable_ppm_dist_array=auto]) build_pio_fc_programs=no have_ppm=no AC_SUBST([HAVE_PPM_DIST_ARRAY], [no]) AM_SUBST_NOTMAKE([HAVE_PPM_DIST_ARRAY]) have_parallel_nc4=no AS_VAR_IF([enable_mpi], [yes], [dnl dnl Check for MPI C interface: ACX_C_PACKAGE([MPI], [mpi.h],,, [AC_MSG_FAILURE([required header mpi.h not found or not compilable])], [MPI_Waitall],[mpi mpich], [], [], [AC_MSG_FAILURE([cannot link C MPI programs])]) dnl Check for MPI_LAUNCH command: saved_CPPFLAGS=$CPPFLAGS saved_LIBS=$LIBS AS_VAR_APPEND([CPPFLAGS], [" $MPI_C_INCLUDE"]) LIBS="$MPI_C_LIB $LIBS" ACX_MPIRUN(,,[AC_MSG_WARN([MPI launch command not found or not compilable])]) CPPFLAGS=$saved_CPPFLAGS LIBS=$saved_LIBS dnl Check for MPI Fortran interface (if needed): build_pio_fc_programs=$enable_cf_interface test "x$FC" = xno && build_pio_fc_programs=no AS_VAR_IF([build_pio_fc_programs], [yes], [ACX_F90_PACKAGE([MPI], [mpi],,, [AC_MSG_WARN([required Fortran module mpi not found or not compilable]) build_pio_fc_programs=no], [mpi_waitall], [mpi mpi_f90 mpi_f77 mpich], [[-lmpi_f77 -lmpi],[-lmpi]],, [AC_MSG_WARN([cannot link Fortran MPI programs]) build_pio_fc_programs=no],, [[INTEGER :: req(1), stat(mpi_status_size, 1), ierror]], [[(1, req, stat, ierror)]])]) dnl Check for YAXT C interface: dnl dnl Declare pkg-config precious variables: PKG_PROG_PKG_CONFIG dnl Set precious variables following the naming convention of ACX_C_PACKAGE: AC_ARG_VAR([YAXT_C_INCLUDE], [specifically set flags to use when compiling sources using YAXT ]dnl [includes.])dnl AC_ARG_VAR([YAXT_C_LIB], [specifically set flags to use when linking YAXT.])dnl dnl Prevent PKG_CHECK_MODULES from declaring package-specific precious dnl variables, which names do not follow our convention: m4_pushdef([AC_ARG_VAR])dnl dnl PKG_CHECK_MODULES relies on yaxt_c_CFLAGS and yaxt_c_LIBS, which in our case dnl have names YAXT_C_INCLUDE and YAXT_C_LIB, respectively: yaxt_c_CFLAGS=$YAXT_C_INCLUDE yaxt_c_LIBS=$YAXT_C_LIB PKG_CHECK_MODULES([yaxt_c],[yaxt_c], [YAXT_C_INCLUDE=$yaxt_c_CFLAGS YAXT_C_LIB=$yaxt_c_LIBS], [dnl dnl There was no yaxt_c.pc before version 0.5.2, therefore we try with yaxt.pc. dnl PKG_CHECK_MODULES relies on yaxt_CFLAGS and yaxt_LIBS, which in our case dnl have names YAXT_C_INCLUDE and YAXT_C_LIB, respectively: yaxt_CFLAGS=$YAXT_C_INCLUDE yaxt_LIBS=$YAXT_C_LIB PKG_CHECK_MODULES([yaxt], [yaxt], [YAXT_VERSION=`$PKG_CONFIG --modversion yaxt` YAXT_MAJOR_VERSION=`expr X"$YAXT_VERSION" : "X\(@<:@0-9@:>@*\)"` YAXT_MINOR_VERSION=`echo "$YAXT_VERSION" | sed -e 's/^@<:@0-9@:>@*\.\(@<:@0-9@:>@*\).*/\1/'` AS_IF([test "$YAXT_MAJOR_VERSION" -gt 0 -o "$YAXT_MINOR_VERSION" -gt 4], [YAXT_C_INCLUDE=$yaxt_CFLAGS YAXT_C_LIB=`echo "$yaxt_LIBS" | sed -e 's/-lyaxt *$/-lyaxt_c/'`])], [:])]) m4_popdef([AC_ARG_VAR])dnl saved_CPPFLAGS=$CPPFLAGS saved_LIBS=$LIBS AS_VAR_APPEND([CPPFLAGS], [" $MPI_C_INCLUDE"]) LIBS="$MPI_C_LIB $LIBS" dnl The following is extracted from ACX_GENERIC_PACKAGE, which is expanded by dnl ACX_C_PACKAGE. We do not use the latter macro here to avoid introduction of dnl the '--with-yaxt-XXX' configure options, which might be very confusing since dnl whatever pkg-config finds will be used instead. ACX_LANG_CHECK_INCLUDE_PATHS_IFELSE([yaxt.h],, [YAXT_C_INCLUDE=$acx_cv_c_include_yaxt_h ACX_OPTION_SEARCH_LIBS_MULTI([xt_initialized], [yaxt_c yaxt], [YAXT_C_LIB=$acx_cv_option_search_xt_initialized_c], [AC_MSG_FAILURE([cannot link C YAXT programs])],,[$YAXT_C_LIB])], [AC_MSG_FAILURE([required header yaxt.h not found or not compilable])],, [$YAXT_C_INCLUDE],[[]]) dnl the following tests can rely on having yaxt.h and C libs available AS_VAR_APPEND([CPPFLAGS], [" $YAXT_C_INCLUDE"]) LIBS="$YAXT_C_LIB $LIBS" dnl determine how to xfer Xt_uid values by MPI AH_TEMPLATE([YAXT_UID_DT], [Defined to MPI datatype to be used for Xt_uid])dnl defined_Xt_uid=no AC_CHECK_DECL([MPI_UINT64_T], [AC_DEFINE([YAXT_UID_DT], [MPI_UINT64_T]) defined_Xt_uid=yes], [AC_CHECK_SIZEOF([Xt_uid],, [AC_INCLUDES_DEFAULT @%:@include ]) AC_CHECK_SIZEOF([unsigned long]) AS_IF([test "$ac_cv_sizeof_unsigned_long" -eq "$ac_cv_sizeof_Xt_uid"], [AC_DEFINE([YAXT_UID_DT], [MPI_UNSIGNED_LONG]) defined_Xt_uid=yes], [AC_CHECK_DECLS([MPI_UNSIGNED_LONG_LONG], [AC_CHECK_SIZEOF([unsigned long long]) AS_IF([test "$ac_cv_sizeof_unsigned_long_long" -eq "$ac_cv_sizeof_Xt_uid"], [AC_DEFINE([YAXT_UID_DT],[MPI_UNSIGNED_LONG_LONG]) defined_Xt_uid=yes])],, [AC_INCLUDES_DEFAULT @%:@include ])])], [AC_INCLUDES_DEFAULT @%:@include ]) AS_VAR_IF([defined_Xt_uid], [no], [AC_MSG_FAILURE([no way to communicate Xt_uid found])]) AS_UNSET([defined_Xt_uid]) dnl determine if xt_redist_p2p_aext_new is available AC_CHECK_FUNC([xt_redist_p2p_aext_new], [AC_CHECK_SIZEOF([MPI_Aint],,[AC_INCLUDES_DEFAULT @%:@include ]) AC_CHECK_SIZEOF([int]) AS_IF([test $ac_cv_sizeof_MPI_Aint -gt $ac_cv_sizeof_int], [AC_DEFINE([USE_XT_REDIST_P2P_AEXT_NEW],[1],[Defined if aext alternatives should be tested])])]) CPPFLAGS=$saved_CPPFLAGS LIBS=$saved_LIBS dnl Check for YAXT Fortran interface (if needed): AS_VAR_IF([build_pio_fc_programs], [yes], [dnl dnl Set precious variables following the naming convention of ACX_F90_PACKAGE: AC_ARG_VAR([YAXT_FC_MOD], [flags to enable 'USE YAXT' in Fortran program.])dnl AC_ARG_VAR([YAXT_FC_LIB], [specifically set flags to use when linking YAXT.])dnl dnl Prevent PKG_CHECK_MODULES from declaring package-specific precious dnl variables, which names do not follow our convention: m4_pushdef([AC_ARG_VAR])dnl dnl PKG_CHECK_MODULES relies on yaxt_CFLAGS and yaxt_LIBS, which in our case dnl have names YAXT_FC_MOD and YAXT_FC_LIB, respectively: yaxt_CFLAGS=$YAXT_FC_MOD yaxt_LIBS=$YAXT_FC_LIB PKG_CHECK_MODULES([yaxt],[yaxt], [YAXT_FC_MOD=$yaxt_CFLAGS YAXT_FC_LIB=$yaxt_LIBS], [:]) m4_popdef([AC_ARG_VAR])dnl saved_FCFLAGS=$FCFLAGS saved_LIBS=$LIBS AS_VAR_APPEND([FCFLAGS], [" $MPI_FC_MOD"]) LIBS="$MPI_FC_LIB $LIBS" dnl The following is extracted from ACX_F90_PACKAGE. We do not use the dnl aforementioned macro here to avoid introduction of the '--with-yaxt-XXX' dnl configure options, which might be very confusing since whatever pkg-config dnl finds will be used instead. AC_LANG_PUSH([Fortran])dnl ACX_FORTRAN_CHECK_MOD_PATHS_IFELSE([yaxt],, [YAXT_FC_MOD=$acx_cv_fortran_mod_yaxt AS_VAR_APPEND([FCFLAGS], [" $YAXT_FC_MOD"]) dnl Note that the following test must check for a function implemented in the dnl Fortran library, as well as for a function implemented in the C library and dnl available via C bindings: ACX_OPTION_SEARCH_LIBS_MULTI([xt_initialized],[yaxt], [YAXT_FC_LIB=$acx_cv_option_search_xt_initialized_fc], [AC_MSG_WARN([cannot link Fortran YAXT programs]) build_pio_fc_programs=no],[[-lyaxt_c]], [$YAXT_FC_LIB], [[ use yaxt logical is_initialized]], [[ is_initialized = xt_initialized() call xt_finalize()]])], [AC_MSG_WARN([required Fortran module yaxt not found or not compilable]) build_pio_fc_programs=no],, [$YAXT_FC_MOD]) AC_LANG_POP([Fortran])dnl FCFLAGS=$saved_FCFLAGS LIBS=$saved_LIBS]) dnl Parallel netCDF support still requires ScalES-PPM and YAXT to re-arrange the dnl data when running with more than one collector. dnl dnl TODO: check whether it makes sense to check for PPM when configuring with dnl --disable-ppm-dist-array. dnl dnl Set precious variables following the naming convention of ACX_C_PACKAGE: AC_ARG_VAR([PPM_CORE_C_INCLUDE], [specifically set flags to use when compiling sources using PPM_CORE ]dnl [includes.])dnl AC_ARG_VAR([PPM_CORE_C_LIB], [specifically set flags to use when linking PPM_CODE.])dnl dnl Prevent PKG_CHECK_MODULES from declaring package-specific precious dnl variables, which names do not follow our convention: m4_pushdef([AC_ARG_VAR])dnl dnl PKG_CHECK_MODULES relies on ppm_core_CFLAGS and ppm_core_LIBS, which in our dnl case have names PPM_CORE_C_INCLUDE and PPM_CORE_C_LIB, respectively: ppm_core_CFLAGS=$PPM_CORE_C_INCLUDE ppm_core_LIBS=$PPM_CORE_C_LIB PKG_CHECK_MODULES([ppm_core],[scales-ppm-core], [PPM_CORE_C_INCLUDE=$ppm_core_CFLAGS PPM_CORE_C_LIB=$ppm_core_LIBS], [:]) m4_popdef([AC_ARG_VAR])dnl saved_CPPFLAGS=$CPPFLAGS saved_LIBS=$LIBS AS_VAR_APPEND([CPPFLAGS], [" $MPI_C_INCLUDE"]) LIBS="$MPI_C_LIB $LIBS" dnl The following is extracted from ACX_GENERIC_PACKAGE, which is expanded by dnl ACX_C_PACKAGE. We do not use the latter macro here to avoid introduction of dnl the '--with-ppm-core-XXX' configure options, which might be very confusing dnl since whatever pkg-config finds will be used instead. ACX_LANG_CHECK_INCLUDE_PATHS_IFELSE([ppm/ppm.h],, [PPM_CORE_C_INCLUDE=$acx_cv_c_include_ppm_ppm_h ACX_OPTION_SEARCH_LIBS_MULTI([PPM_initialize], [scalesppmcore], [PPM_CORE_C_LIB=$acx_cv_option_search_PPM_initialize_c have_ppm=yes AC_DEFINE([HAVE_PPM_CORE],,[ScalES PPM C core library is available]) AS_VAR_APPEND([CPPFLAGS], [" $PPM_CORE_C_INCLUDE"]) AS_IF([test "x$enable_ppm_dist_array" != xno], [AC_CHECK_HEADERS([ppm/dist_array.h], [HAVE_PPM_DIST_ARRAY=yes], [], [AC_INCLUDES_DEFAULT])])], [AC_MSG_WARN([cannot link C SCALES-PPM-CORE programs])],, [$PPM_CORE_C_LIB])], [AC_MSG_WARN([required header ppm/ppm.h not found or not compilable])],, [$PPM_CORE_C_INCLUDE],[[]]) CPPFLAGS=$saved_CPPFLAGS LIBS=$saved_LIBS dnl NC_HAS_PNETCDF is useful when available to short-circuit some tests AS_VAR_IF([ENABLE_NETCDF], [yes], [AC_CHECK_HEADERS([netcdf_meta.h],,, [AC_INCLUDES_DEFAULT @%:@include ]) dnl The following test is relevant only for older versions of netCDF. Starting dnl version 4.3.3, netCDF provides the NC_HAS_PNETCDF macro and its value dnl overrides the result of the test. AC_CACHE_CHECK([parallel netcdf's pnetcdf support], [acx_cv_have_pnetcdf], [acx_cv_have_pnetcdf=no test "x$NC_CONFIG" != "x" && \ test "x$($NC_CONFIG --has-pnetcdf)" = "xyes" && \ acx_cv_have_pnetcdf=yes]) AS_VAR_IF([acx_cv_have_pnetcdf], [yes], [AC_DEFINE([HAVE_NETCDF_PAR_PNETCDF], [1], [Defined to 1 if NetCDF parallel open supports NC_PNETCDF])])]) dnl If scales-ppm is not available, netcdf can only be used in serial mode: AS_IF([test "x$ENABLE_NC4" = xyes && test "x$have_ppm" = xyes], [saved_CPPFLAGS=$CPPFLAGS AS_VAR_APPEND([CPPFLAGS], [" $MPI_C_INCLUDE"]) AC_CHECK_HEADERS([netcdf_par.h],,, [AC_INCLUDES_DEFAULT @%:@include ]) AC_CHECK_DECL([MPI_Bcast], [have_parallel_nc4=yes AC_CHECK_DECLS([nc_inq_format_extended],, [AC_MSG_NOTICE([The supplied netCDF library does not support ]dnl [nc_inq_format_extended.])], [AC_INCLUDES_DEFAULT @%:@include ]) AC_DEFINE([HAVE_PARALLEL_NC4], [1], [netCDF library does support MPI parallel invocations])], [AC_MSG_WARN([the supplied netCDF library does not support MPI ]dnl [parallel invocations])], [AC_INCLUDES_DEFAULT @%:@include @%:@ifdef HAVE_NETCDF_PAR_H @%:@include @%:@endif]) CPPFLAGS=$saved_CPPFLAGS dnl WARNING: the following macro overwrites saved_CFLAGS shell variable and dnl modifies CFLAGS: ACX_TLS_XLC_RETRY]) dnl Check for librt: AC_SUBST([LIBRT], ['']) AC_CHECK_DECL([_POSIX_ASYNCHRONOUS_IO], [saved_LIBS=$LIBS AC_SEARCH_LIBS([aio_suspend], [rt], [test "$ac_res" = "none required" || LIBRT=$ac_res]) LIBS=$saved_LIBS])], [YAXT_C_INCLUDE=; YAXT_C_LIB= MPI_C_INCLUDE=; MPI_C_LIB=]) AS_CASE(["$enable_ppm_dist_array$HAVE_PPM_DIST_ARRAY"], [yesyes|no*], [], [auto*], [enable_ppm_dist_array=$HAVE_PPM_DIST_ARRAY], [AC_MSG_FAILURE([usage of the PPM distributed array is requested but the ]dnl [required headers and libraries are not found])]) AS_VAR_IF([have_ppm], [no], [PPM_CORE_C_INCLUDE=; PPM_CORE_C_LIB=]) AS_VAR_IF([build_pio_fc_programs], [no], [YAXT_FC_MOD=; YAXT_FC_LIB= MPI_FC_MOD=; MPI_FC_LIB=]) AM_CONDITIONAL([BUILD_PIO_FC_PROGRAMS], [test "x$build_pio_fc_programs" = xyes]) AM_CONDITIONAL([ENABLE_MPI], [test "x$enable_mpi" = xyes]) AM_CONDITIONAL([HAVE_PARALLEL_NC4], [test "x$have_parallel_nc4" = xyes]) AM_MISSING_PROG([SWIG], [swig]) AS_VAR_IF([enable_ruby_interface], [yes], [AC_ARG_VAR([RUBY], [the Ruby interpreter]) AC_PATH_PROGS([RUBY], [ruby]) ruby_CPPFLAGS=`$RUBY $srcdir/config/interface.rb 2>/dev/null` AS_IF([test $? -ne 0], [AC_MSG_ERROR([Ruby interface is requested but the Ruby interpreter is ]dnl [not found])]) saved_CPPFLAGS=$CPPFLAGS AS_VAR_APPEND([CPPFLAGS], [" $ruby_CPPFLAGS"]) AC_CHECK_HEADER([ruby.h], [], [AC_MSG_FAILURE([Ruby interface is requested but the required header ]dnl [ruby.h not found or not compilable])], [AC_INCLUDES_DEFAULT]) CPPFLAGS=$saved_CPPFLAGS], [AM_MISSING_PROG([RUBY], [ruby])]) AM_CONDITIONAL([ENABLE_RUBY_INTERFACE], [test "x$enable_ruby_interface" = xyes]) AS_VAR_IF([enable_python_interface], [yes], [dnl dnl For consistency with the other commands (MPI_LAUNCH, SWIG, RUBY, etc.), we dnl ignore $PYTHON if it is not an absolute path: AS_VAR_SET_IF([PYTHON], [AS_CASE([$PYTHON], [[[\\/]]* | ?:[[\\/]]*], [], [PYTHON=])]) AM_PATH_PYTHON([], [], [:]) dnl AM_PATH_PYTHON does not check whether $PYTHON really works and dnl AX_PYTHON_DEVEL fails with a misleading message if it doesn't: AS_IF([$PYTHON -c 'import sys' >/dev/null 2>&1], [], [AC_MSG_ERROR([Python interface is requested but the Python ]dnl [interpreter is not found])]) dnl Do not check for extra flags by default: PYTHON_EXTRA_LDFLAGS=${PYTHON_EXTRA_LDFLAGS-' '} PYTHON_EXTRA_LIBS=${PYTHON_EXTRA_LIBS-' '} AX_PYTHON_DEVEL]) AM_CONDITIONAL([ENABLE_PYTHON_INTERFACE], [test "x$enable_python_interface" = xyes]) AC_ARG_WITH([on-demand-check-programs], [AS_HELP_STRING([--with-on-demand-check-programs], [only build test programs when calling 'make check' @<:@default: build ]dnl [during 'make all'@:>@])], [test "x$withval" != xno && with_on_demand_check_programs=yes], [with_on_demand_check_programs=no]) AM_CONDITIONAL([with_on_demand_check_programs], [test "x$with_on_demand_check_programs" = xyes]) AC_ARG_WITH([concurrent-mpi-checks], [AS_HELP_STRING([--with-concurrent-mpi-checks], [allow for simultaneous runs of MPI tests @<:@default: run MPI test ]dnl [programs one after another@:>@])], [test "x$withval" != xno && with_concurrent_mpi_checks=yes], [with_concurrent_mpi_checks=no]) AM_CONDITIONAL([with_concurrent_mpi_checks], [test "x$with_concurrent_mpi_checks" = xyes]) AC_ARG_WITH([example-programs], [AS_HELP_STRING([--without-example-programs], [only build example programs when calling 'make examples' ]dnl [@<:@default: build during 'make all'@:>@])], [test "x$withval" != xno && with_example_programs=yes], [with_example_programs=yes]) AM_CONDITIONAL([with_example_programs], [test "x$with_example_programs" = xyes]) m4_foreach([build_flag_var],[[BUILD_CFLAGS],[BUILD_FCFLAGS],[BUILD_LDFLAGS],[BUILD_LIBS],[BUILD_MPI_C_LIB],[BUILD_MPI_FC_LIB]], [AC_ARG_VAR(build_flag_var, [append to ]m4_bpatsubst(build_flag_var, [BUILD_], [])[ during build but not in configure phase])dnl AC_CONFIG_COMMANDS_PRE(m4_bpatsubst(build_flag_var, [BUILD_], [])[="$]m4_bpatsubst(build_flag_var, [BUILD_], [])[$]{build_flag_var:+ $build_flag_var[}"])dnl AM_SUBST_NOTMAKE(build_flag_var)])dnl m4_foreach([build_tool_var],[[BUILD_CC],[BUILD_CXX],[BUILD_FC],[BUILD_F77]], [AC_ARG_VAR(build_tool_var, [replace ]m4_bpatsubst(build_tool_var, [BUILD_], [])[ with expansion of $]build_tool_var[ during build but not in configure phase])dnl AC_CONFIG_COMMANDS_PRE(m4_bpatsubst(build_tool_var, [BUILD_], [])[="$]{build_tool_var:-$[]m4_bpatsubst(build_tool_var, [BUILD_], [])}["])dnl AM_SUBST_NOTMAKE(build_tool_var)])dnl dnl Additional output variables for cdi.settings: AS_VAR_IF([enable_mpi],[yes], [ENABLE_MPI=true], [ENABLE_MPI=false]) AC_SUBST([ENABLE_MPI]) AM_SUBST_NOTMAKE([ENABLE_MPI)]) AS_VAR_IF([have_parallel_nc4],[yes], [HAVE_PARALLEL_NC4=1], [HAVE_PARALLEL_NC4=0]) AC_SUBST([HAVE_PARALLEL_NC4]) AM_SUBST_NOTMAKE([HAVE_PARALLEL_NC4]) AS_VAR_IF([enable_ruby_interface],[yes], [ENABLE_RUBY_INTERFACE=true], [ENABLE_RUBY_INTERFACE=false]) AC_SUBST([ENABLE_RUBY_INTERFACE]) AM_SUBST_NOTMAKE([ENABLE_RUBY_INTERFACE]) AS_VAR_IF([enable_python_interface],[yes], [ENABLE_PYTHON_INTERFACE=true], [ENABLE_PYTHON_INTERFACE=false]) AC_SUBST([ENABLE_PYTHON_INTERFACE]) AM_SUBST_NOTMAKE([ENABLE_PYTHON_INTERFACE]) AC_CONFIG_HEADERS([src/config.h]) AC_CONFIG_FILES([ Makefile app/Makefile cdi.settings examples/Makefile examples/pio/Makefile interfaces/Makefile interfaces/python/Makefile src/Makefile src/cmake/cdi/cdi-config-version.cmake src/cmake/cdi/cdi-config.cmake src/pkgconfig/cdi.pc src/pkgconfig/cdi_f2003.pc src/pkgconfig/cdipio.pc tests/Makefile tests/test_cksum_base ]) AC_CONFIG_FILES([ interfaces/test_cpp_nc.run interfaces/test_python_grb.run interfaces/test_python_nc.run interfaces/test_ruby_grb.run interfaces/test_ruby_nc.run tables/gen_tableheaderfile tests/pio_cksum_asynch.run tests/pio_cksum_fpguard.run tests/pio_cksum_grb2.run tests/pio_cksum_mpi_fw_at_all.run tests/pio_cksum_mpi_fw_at_reblock.run tests/pio_cksum_mpi_fw_ordered.run tests/pio_cksum_mpinonb.run tests/pio_cksum_nc.run tests/pio_cksum_nc2.run tests/pio_cksum_nc4.run tests/pio_cksum_writer.run tests/pio_write.parallel.run tests/pio_write.run tests/pio_write_deco2d.parallel.run tests/pio_write_deco2d.run tests/pio_write_dist_array.run tests/test_byteswap.run tests/test_cdf_const.run tests/test_cdf_transformation.run tests/test_cksum_ext.run tests/test_cksum_grb.run tests/test_cksum_grb2.run tests/test_cksum_ieg.run tests/test_cksum_nc.run tests/test_cksum_nc2.run tests/test_cksum_nc4.run tests/test_cksum_nc_chunk.run tests/test_cksum_srv.run tests/test_f2003.run tests/test_grib.run tests/test_resource_copy.parallel.run tests/test_resource_copy.run tests/test_table.run ], [chmod a+x "$ac_file"]) AC_OUTPUT AC_MSG_NOTICE([CDI is configured with the following options:]) cat cdi.settings >&AS_MESSAGE_FD AC_MSG_NOTICE([ Configuration completed. You can now run 'make' to compile the CDI package and 'make install' to install it afterwards. ]) cdo-2.6.6.1/libcdi/config/0000775000175000017500000000000015271332515015314 5ustar alastairalastaircdo-2.6.6.1/libcdi/config/lt_overrides_Makefile.inc0000664000175000017500000000163215271332515022307 0ustar alastairalastair# Compile *.F90 without CPPFLAGS, which are normally meant for the C compiler # and might not be compatible with the Fortran compiler: LTPPFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) # Compile programs using Libtool with '-static' (to avoid compiling twice): COMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) -static $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) FCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(FC) -static $(AM_FCFLAGS) $(FCFLAGS) PPFCCOMPILE = $(FCCOMPILE) CXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CXX) -static $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) cdo-2.6.6.1/libcdi/config/interface.rb0000664000175000017500000000054515271332515017605 0ustar alastairalastairrequire 'mkmf' require 'rbconfig' if RUBY_VERSION[0,3] == '1.8' puts "-I#{Config::expand(CONFIG['archdir'])}" elsif RbConfig::CONFIG['MAJOR'].to_i >= 2 puts "-I#{RbConfig::CONFIG['rubyhdrdir']} -I#{RbConfig::CONFIG['rubyarchhdrdir']}" else puts "-I#{RbConfig::CONFIG['rubyhdrdir']} -I#{RbConfig::CONFIG['rubyhdrdir']}/#{RbConfig::CONFIG['arch']}" end cdo-2.6.6.1/libcdi/config/config.sub0000775000175000017500000011544115271332515017305 0ustar alastairalastair#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2024 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268,SC2162 # see below for rationale timestamp='2024-05-27' # 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 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # 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. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # 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. # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.sub # 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. # The "shellcheck disable" line above the timestamp inhibits complaints # about features and limitations of the classic Bourne shell that were # superseded or lifted in POSIX. However, this script identifies a wide # variety of pre-POSIX systems that do not have POSIX shells at all, and # even some reasonably current systems (Solaris 10 as case-in-point) still # have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -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 ." version="\ GNU config.sub ($timestamp) Copyright 1992-2024 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 ;; *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 # Split fields of configuration type saved_IFS=$IFS IFS="-" read field1 field2 field3 field4 <&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 basic_os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in cloudabi*-eabi* \ | kfreebsd*-gnu* \ | knetbsd*-gnu* \ | kopensolaris*-gnu* \ | linux-* \ | managarm-* \ | netbsd*-eabi* \ | netbsd*-gnu* \ | nto-qnx* \ | os2-emx* \ | rtmk-nova* \ | storm-chaos* \ | uclinux-gnu* \ | uclinux-uclibc* \ | windows-* ) basic_machine=$field1 basic_os=$maybe_os ;; android-linux) basic_machine=$field1-unknown basic_os=linux-android ;; *) basic_machine=$field1-$field2 basic_os=$field3 ;; esac ;; *-*) case $field1-$field2 in # Shorthands that happen to contain a single dash convex-c[12] | convex-c3[248]) basic_machine=$field2-convex basic_os= ;; decstation-3100) basic_machine=mips-dec basic_os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Do not treat sunos as a manufacturer sun*os*) basic_machine=$field1 basic_os=$field2 ;; # Manufacturers 3100* \ | 32* \ | 3300* \ | 3600* \ | 7300* \ | acorn \ | altos* \ | apollo \ | apple \ | atari \ | att* \ | axis \ | be \ | bull \ | cbm \ | ccur \ | cisco \ | commodore \ | convergent* \ | convex* \ | cray \ | crds \ | dec* \ | delta* \ | dg \ | digital \ | dolphin \ | encore* \ | gould \ | harris \ | highlevel \ | hitachi* \ | hp \ | ibm* \ | intergraph \ | isi* \ | knuth \ | masscomp \ | microblaze* \ | mips* \ | motorola* \ | ncr* \ | news \ | next \ | ns \ | oki \ | omron* \ | pc533* \ | rebel \ | rom68k \ | rombug \ | semi \ | sequent* \ | siemens \ | sgi* \ | siemens \ | sim \ | sni \ | sony* \ | stratus \ | sun \ | sun[234]* \ | tektronix \ | tti* \ | ultra \ | unicom* \ | wec \ | winbond \ | wrs) basic_machine=$field1-$field2 basic_os= ;; zephyr*) basic_machine=$field1-unknown basic_os=$field2 ;; *) basic_machine=$field1 basic_os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc basic_os=bsd ;; a29khif) basic_machine=a29k-amd basic_os=udi ;; adobe68k) basic_machine=m68010-adobe basic_os=scout ;; alliant) basic_machine=fx80-alliant basic_os= ;; altos | altos3068) basic_machine=m68k-altos basic_os= ;; am29k) basic_machine=a29k-none basic_os=bsd ;; amdahl) basic_machine=580-amdahl basic_os=sysv ;; amiga) basic_machine=m68k-unknown basic_os= ;; amigaos | amigados) basic_machine=m68k-unknown basic_os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown basic_os=sysv4 ;; apollo68) basic_machine=m68k-apollo basic_os=sysv ;; apollo68bsd) basic_machine=m68k-apollo basic_os=bsd ;; aros) basic_machine=i386-pc basic_os=aros ;; aux) basic_machine=m68k-apple basic_os=aux ;; balance) basic_machine=ns32k-sequent basic_os=dynix ;; blackfin) basic_machine=bfin-unknown basic_os=linux ;; cegcc) basic_machine=arm-unknown basic_os=cegcc ;; cray) basic_machine=j90-cray basic_os=unicos ;; crds | unos) basic_machine=m68k-crds basic_os= ;; da30) basic_machine=m68k-da30 basic_os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec basic_os= ;; delta88) basic_machine=m88k-motorola basic_os=sysv3 ;; dicos) basic_machine=i686-pc basic_os=dicos ;; djgpp) basic_machine=i586-pc basic_os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd basic_os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson basic_os=ose ;; gmicro) basic_machine=tron-gmicro basic_os=sysv ;; go32) basic_machine=i386-pc basic_os=go32 ;; h8300hms) basic_machine=h8300-hitachi basic_os=hms ;; h8300xray) basic_machine=h8300-hitachi basic_os=xray ;; h8500hms) basic_machine=h8500-hitachi basic_os=hms ;; harris) basic_machine=m88k-harris basic_os=sysv3 ;; hp300 | hp300hpux) basic_machine=m68k-hp basic_os=hpux ;; hp300bsd) basic_machine=m68k-hp basic_os=bsd ;; hppaosf) basic_machine=hppa1.1-hp basic_os=osf ;; hppro) basic_machine=hppa1.1-hp basic_os=proelf ;; i386mach) basic_machine=i386-mach basic_os=mach ;; isi68 | isi) basic_machine=m68k-isi basic_os=sysv ;; m68knommu) basic_machine=m68k-unknown basic_os=linux ;; magnum | m3230) basic_machine=mips-mips basic_os=sysv ;; merlin) basic_machine=ns32k-utek basic_os=sysv ;; mingw64) basic_machine=x86_64-pc basic_os=mingw64 ;; mingw32) basic_machine=i686-pc basic_os=mingw32 ;; mingw32ce) basic_machine=arm-unknown basic_os=mingw32ce ;; monitor) basic_machine=m68k-rom68k basic_os=coff ;; morphos) basic_machine=powerpc-unknown basic_os=morphos ;; moxiebox) basic_machine=moxie-unknown basic_os=moxiebox ;; msdos) basic_machine=i386-pc basic_os=msdos ;; msys) basic_machine=i686-pc basic_os=msys ;; mvs) basic_machine=i370-ibm basic_os=mvs ;; nacl) basic_machine=le32-unknown basic_os=nacl ;; ncr3000) basic_machine=i486-ncr basic_os=sysv4 ;; netbsd386) basic_machine=i386-pc basic_os=netbsd ;; netwinder) basic_machine=armv4l-rebel basic_os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony basic_os=newsos ;; news1000) basic_machine=m68030-sony basic_os=newsos ;; necv70) basic_machine=v70-nec basic_os=sysv ;; nh3000) basic_machine=m68k-harris basic_os=cxux ;; nh[45]000) basic_machine=m88k-harris basic_os=cxux ;; nindy960) basic_machine=i960-intel basic_os=nindy ;; mon960) basic_machine=i960-intel basic_os=mon960 ;; nonstopux) basic_machine=mips-compaq basic_os=nonstopux ;; os400) basic_machine=powerpc-ibm basic_os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson basic_os=ose ;; os68k) basic_machine=m68k-none basic_os=os68k ;; paragon) basic_machine=i860-intel basic_os=osf ;; parisc) basic_machine=hppa-unknown basic_os=linux ;; psp) basic_machine=mipsallegrexel-sony basic_os=psp ;; pw32) basic_machine=i586-unknown basic_os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc basic_os=rdos ;; rdos32) basic_machine=i386-pc basic_os=rdos ;; rom68k) basic_machine=m68k-rom68k basic_os=coff ;; sa29200) basic_machine=a29k-amd basic_os=udi ;; sei) basic_machine=mips-sei basic_os=seiux ;; sequent) basic_machine=i386-sequent basic_os= ;; sps7) basic_machine=m68k-bull basic_os=sysv2 ;; st2000) basic_machine=m68k-tandem basic_os= ;; stratus) basic_machine=i860-stratus basic_os=sysv4 ;; sun2) basic_machine=m68000-sun basic_os= ;; sun2os3) basic_machine=m68000-sun basic_os=sunos3 ;; sun2os4) basic_machine=m68000-sun basic_os=sunos4 ;; sun3) basic_machine=m68k-sun basic_os= ;; sun3os3) basic_machine=m68k-sun basic_os=sunos3 ;; sun3os4) basic_machine=m68k-sun basic_os=sunos4 ;; sun4) basic_machine=sparc-sun basic_os= ;; sun4os3) basic_machine=sparc-sun basic_os=sunos3 ;; sun4os4) basic_machine=sparc-sun basic_os=sunos4 ;; sun4sol2) basic_machine=sparc-sun basic_os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun basic_os= ;; sv1) basic_machine=sv1-cray basic_os=unicos ;; symmetry) basic_machine=i386-sequent basic_os=dynix ;; t3e) basic_machine=alphaev5-cray basic_os=unicos ;; t90) basic_machine=t90-cray basic_os=unicos ;; toad1) basic_machine=pdp10-xkl basic_os=tops20 ;; tpf) basic_machine=s390x-ibm basic_os=tpf ;; udi29k) basic_machine=a29k-amd basic_os=udi ;; ultra3) basic_machine=a29k-nyu basic_os=sym1 ;; v810 | necv810) basic_machine=v810-nec basic_os=none ;; vaxv) basic_machine=vax-dec basic_os=sysv ;; vms) basic_machine=vax-dec basic_os=vms ;; vsta) basic_machine=i386-pc basic_os=vsta ;; vxworks960) basic_machine=i960-wrs basic_os=vxworks ;; vxworks68) basic_machine=m68k-wrs basic_os=vxworks ;; vxworks29k) basic_machine=a29k-wrs basic_os=vxworks ;; xbox) basic_machine=i686-pc basic_os=mingw32 ;; ymp) basic_machine=ymp-cray basic_os=unicos ;; *) basic_machine=$1 basic_os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # 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) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm basic_os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec basic_os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec basic_os=tops20 ;; delta | 3300 | delta-motorola | 3300-motorola | motorola-delta | motorola-3300) cpu=m68k vendor=motorola ;; # This used to be dpx2*, but that gets the RS6000-based # DPX/20 and the x86-based DPX/2-100 wrong. See # https://oldskool.silicium.org/stations/bull_dpx20.htm # https://www.feb-patrimoine.com/english/bull_dpx2.htm # https://www.feb-patrimoine.com/english/unix_and_bull.htm dpx2 | dpx2[23]00 | dpx2[23]xx) cpu=m68k vendor=bull ;; dpx2100 | dpx21xx) cpu=i386 vendor=bull ;; dpx20) cpu=rs6000 vendor=bull ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi basic_os=${basic_os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv32 ;; i*86v4*) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv4 ;; i*86v) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv ;; i*86sol2) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray basic_os=${basic_os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $basic_os in irix*) ;; *) basic_os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari basic_os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony basic_os=newsos ;; next | m*-next) cpu=m68k vendor=next ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki basic_os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde basic_os=${basic_os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs basic_os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond basic_os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; *-*) saved_IFS=$IFS IFS="-" read cpu vendor <&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=cbm ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if test x"$basic_os" != x then # First recognize some ad-hoc cases, or perhaps split kernel-os, or else just # set os. obj= case $basic_os in gnu/linux*) kernel=linux os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` ;; os2-emx) kernel=os2 os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` ;; nto-qnx*) kernel=nto os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` ;; *-*) saved_IFS=$IFS IFS="-" read kernel os <&2 fi ;; *) echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 exit 1 ;; esac case $obj in aout* | coff* | elf* | pe*) ;; '') # empty is fine ;; *) echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 exit 1 ;; esac # Here we handle the constraint that a (synthetic) cpu and os are # valid only in combination with each other and nowhere else. case $cpu-$os in # The "javascript-unknown-ghcjs" triple is used by GHC; we # accept it here in order to tolerate that, but reject any # variations. javascript-ghcjs) ;; javascript-* | *-ghcjs) echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 exit 1 ;; esac # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. case $kernel-$os-$obj in linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ | linux-mlibc*- | linux-musl*- | linux-newlib*- \ | linux-relibc*- | linux-uclibc*- | linux-ohos*- ) ;; uclinux-uclibc*- | uclinux-gnu*- ) ;; managarm-mlibc*- | managarm-kernel*- ) ;; windows*-msvc*-) ;; -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ | -uclibc*- ) # These are just libc implementations, not actual OSes, and thus # require a kernel. echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 exit 1 ;; -kernel*- ) echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 exit 1 ;; *-kernel*- ) echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 exit 1 ;; *-msvc*- ) echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 exit 1 ;; kfreebsd*-gnu*- | knetbsd*-gnu*- | netbsd*-gnu*- | kopensolaris*-gnu*-) ;; vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) ;; nto-qnx*-) ;; os2-emx-) ;; rtmk-nova-) ;; *-eabi*- | *-gnueabi*-) ;; none--*) # None (no kernel, i.e. freestanding / bare metal), # can be paired with an machine code file format ;; -*-) # Blank kernel with real OS is always fine. ;; --*) # Blank kernel and OS with real machine code file format is always fine. ;; *-*-*) echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 exit 1 ;; esac # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $cpu-$os in *-riscix*) vendor=acorn ;; *-sunos* | *-solaris*) vendor=sun ;; *-cnk* | *-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 ;; *-clix*) vendor=intergraph ;; *-mvs* | *-opened*) vendor=ibm ;; *-os400*) vendor=ibm ;; s390-* | s390x-*) 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 ;; esac echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: cdo-2.6.6.1/libcdi/config/py-compile0000775000175000017500000001216215271332515017322 0ustar alastairalastair#!/bin/sh # py-compile - Compile a Python program scriptversion=2021-02-27.01; # UTC # Copyright (C) 2000-2021 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, see . # 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. # This file is maintained in Automake, please report # bugs to or send patches to # . if test -z "$PYTHON"; then PYTHON=python fi me=py-compile usage_error () { echo "$me: $*" >&2 echo "Try '$me --help' for more information." >&2 exit 1 } basedir= destdir= while test $# -ne 0; do case "$1" in --basedir) if test $# -lt 2; then usage_error "option '--basedir' requires an argument" else basedir=$2 fi shift ;; --destdir) if test $# -lt 2; then usage_error "option '--destdir' requires an argument" else destdir=$2 fi shift ;; -h|--help) cat <<\EOF Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] FILES..." Byte compile some python scripts FILES. Use --destdir to specify any leading directory path to the FILES that you don't want to include in the byte compiled file. Specify --basedir for any additional path information you do want to be shown in the byte compiled file. Example: py-compile --destdir /tmp/pkg-root --basedir /usr/share/test test.py test2.py Report bugs to . EOF exit $? ;; -v|--version) echo "$me $scriptversion" exit $? ;; --) shift break ;; -*) usage_error "unrecognized option '$1'" ;; *) break ;; esac shift done files=$* if test -z "$files"; then usage_error "no files given" fi # if basedir was given, then it should be prepended to filenames before # byte compilation. if test -z "$basedir"; then pathtrans="path = file" else pathtrans="path = os.path.join('$basedir', file)" fi # if destdir was given, then it needs to be prepended to the filename to # byte compile but not go into the compiled file. if test -z "$destdir"; then filetrans="filepath = path" else filetrans="filepath = os.path.normpath('$destdir' + os.sep + path)" fi python_major=`$PYTHON -V 2>&1 | sed -e 's/.* //;s/\..*$//;1q'` if test -z "$python_major"; then echo "$me: could not determine $PYTHON major version, guessing 3" >&2 python_major=3 fi # The old way to import libraries was deprecated. if test "$python_major" -le 2; then import_lib=imp import_test="hasattr(imp, 'get_tag')" import_call=imp.cache_from_source import_arg2=', False' # needed in one call and not the other else import_lib=importlib import_test="hasattr(sys.implementation, 'cache_tag')" import_call=importlib.util.cache_from_source import_arg2= fi $PYTHON -c " import sys, os, py_compile, $import_lib files = '''$files''' sys.stdout.write('Byte-compiling python modules...\n') for file in files.split(): $pathtrans $filetrans if not os.path.exists(filepath) or not (len(filepath) >= 3 and filepath[-3:] == '.py'): continue sys.stdout.write(file) sys.stdout.flush() if $import_test: py_compile.compile(filepath, $import_call(filepath), path) else: py_compile.compile(filepath, filepath + 'c', path) sys.stdout.write('\n')" || exit $? # this will fail for python < 1.5, but that doesn't matter ... $PYTHON -O -c " import sys, os, py_compile, $import_lib # pypy does not use .pyo optimization if hasattr(sys, 'pypy_translation_info'): sys.exit(0) files = '''$files''' sys.stdout.write('Byte-compiling python modules (optimized versions) ...\n') for file in files.split(): $pathtrans $filetrans if not os.path.exists(filepath) or not (len(filepath) >= 3 and filepath[-3:] == '.py'): continue sys.stdout.write(file) sys.stdout.flush() if $import_test: py_compile.compile(filepath, $import_call(filepath$import_arg2), path) else: py_compile.compile(filepath, filepath + 'o', path) sys.stdout.write('\n')" 2>/dev/null || exit $? # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: cdo-2.6.6.1/libcdi/config/ltmain.sh0000664000175000017500000122322215271332515017140 0ustar alastairalastair#! /usr/bin/env sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2019-02-19.15 # libtool (GNU libtool) 2.5.4 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996-2019, 2021-2024 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. # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . PROGRAM=libtool PACKAGE=libtool VERSION=2.5.4 package_revision=2.5.4 ## ------ ## ## Usage. ## ## ------ ## # Run './libtool --help' for help with using this script from the # command line. ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # After configure completes, it has a better idea of some of the # shell tools we need than the defaults used by the functions shared # with bootstrap, so set those here where they can still be over- # ridden by the user, but otherwise take precedence. : ${AUTOCONF="autoconf"} : ${AUTOMAKE="automake"} ## -------------------------- ## ## Source external libraries. ## ## -------------------------- ## # Much of our low-level functionality needs to be sourced from external # libraries, which are installed to $pkgauxdir. # Set a version string for this script. scriptversion=2019-02-19.15; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 # This is free software. There is NO warranty; not even for # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # Copyright (C) 2004-2019, 2021, 2023-2024 Bootstrap Authors # # This file is dual licensed under the terms of the MIT license # , and GPL version 2 or later # . You must apply one of # these licenses when using or redistributing this software or any of # the files within it. See the URLs above, or the file `LICENSE` # included in the Bootstrap distribution for the full license texts. # Please report bugs or propose patches to: # ## ------ ## ## Usage. ## ## ------ ## # Evaluate this file near the top of your script to gain access to # the functions and variables defined here: # # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh # # If you need to override any of the default environment variable # settings, do that before evaluating this file. ## -------------------- ## ## Shell normalisation. ## ## -------------------- ## # Some shells need a little help to be as Bourne compatible as possible. # Before doing anything else, make sure all that help has been provided! DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # NLS nuisances: We save the old values in case they are required later. _G_user_locale= _G_safe_locale= for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test set = \"\${$_G_var+set}\"; then save_$_G_var=\$$_G_var $_G_var=C export $_G_var _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done # These NLS vars are set unconditionally (bootstrap issue #24). Unset those # in case the environment reset is needed later and the $save_* variant is not # defined (see the code above). LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL # Make sure IFS has a sensible default sp=' ' nl=' ' IFS="$sp $nl" # There are apparently some systems that use ';' as a PATH separator! if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # func_unset VAR # -------------- # Portably unset VAR. # In some shells, an 'unset VAR' statement leaves a non-zero return # status if VAR is already unset, which might be problematic if the # statement is used at the end of a function (thus poisoning its return # value) or when 'set -e' is active (causing even a spurious abort of # the script in this case). func_unset () { { eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; } } # Make sure CDPATH doesn't cause `cd` commands to output the target dir. func_unset CDPATH # Make sure ${,E,F}GREP behave sanely. func_unset GREP_OPTIONS ## ------------------------- ## ## Locate command utilities. ## ## ------------------------- ## # func_executable_p FILE # ---------------------- # Check that FILE is an executable regular file. func_executable_p () { test -f "$1" && test -x "$1" } # func_path_progs PROGS_LIST CHECK_FUNC [PATH] # -------------------------------------------- # Search for either a program that responds to --version with output # containing "GNU", or else returned by CHECK_FUNC otherwise, by # trying all the directories in PATH with each of the elements of # PROGS_LIST. # # CHECK_FUNC should accept the path to a candidate program, and # set $func_check_prog_result if it truncates its output less than # $_G_path_prog_max characters. func_path_progs () { _G_progs_list=$1 _G_check_func=$2 _G_PATH=${3-"$PATH"} _G_path_prog_max=0 _G_path_prog_found=false _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} for _G_dir in $_G_PATH; do IFS=$_G_save_IFS test -z "$_G_dir" && _G_dir=. for _G_prog_name in $_G_progs_list; do for _exeext in '' .EXE; do _G_path_prog=$_G_dir/$_G_prog_name$_exeext func_executable_p "$_G_path_prog" || continue case `"$_G_path_prog" --version 2>&1` in *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; *) $_G_check_func $_G_path_prog func_path_progs_result=$func_check_prog_result ;; esac $_G_path_prog_found && break 3 done done done IFS=$_G_save_IFS test -z "$func_path_progs_result" && { echo "no acceptable sed could be found in \$PATH" >&2 exit 1 } } # We want to be able to use the functions in this file before configure # has figured out where the best binaries are kept, which means we have # to search for them ourselves - except when the results are already set # where we skip the searches. # Unless the user overrides by setting SED, search the path for either GNU # sed, or the sed that truncates its output the least. test -z "$SED" && { _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for _G_i in 1 2 3 4 5 6 7; do _G_sed_script=$_G_sed_script$nl$_G_sed_script done echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed _G_sed_script= func_check_prog_sed () { _G_path_prog=$1 _G_count=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo '' >> conftest.nl "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "sed gsed" func_check_prog_sed "$PATH:/usr/xpg4/bin" rm -f conftest.sed SED=$func_path_progs_result } # Unless the user overrides by setting GREP, search the path for either GNU # grep, or the grep that truncates its output the least. test -z "$GREP" && { func_check_prog_grep () { _G_path_prog=$1 _G_count=0 _G_path_prog_max=0 printf 0123456789 >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 "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "grep ggrep" func_check_prog_grep "$PATH:/usr/xpg4/bin" GREP=$func_path_progs_result } ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # All uppercase variable names are used for environment variables. These # variables can be overridden by the user before calling a script that # uses them if a suitable command of that name is not already available # in the command search PATH. : ${CP="cp -f"} : ${ECHO="printf %s\n"} : ${EGREP="$GREP -E"} : ${FGREP="$GREP -F"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} ## -------------------- ## ## Useful sed snippets. ## ## -------------------- ## sed_dirname='s|/[^/]*$||' sed_basename='s|^.*/||' # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s|\([`"$\\]\)|\\\1|g' # Same as above, but do not quote variable references. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' # Sed substitution that converts a w32 file name or path # that contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-'\' parameter expansions in output of sed_double_quote_subst that # were '\'-ed in input to the same. If an odd number of '\' preceded a # '$' in input to sed_double_quote_subst, that '$' was protected from # expansion. Since each input '\' is now two '\'s, look for any number # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. _G_bs='\\' _G_bs2='\\\\' _G_bs4='\\\\\\\\' _G_dollar='\$' sed_double_backslash="\ s/$_G_bs4/&\\ /g s/^$_G_bs2$_G_dollar/$_G_bs&/ s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" # require_check_ifs_backslash # --------------------------- # Check if we can use backslash as IFS='\' separator, and set # $check_ifs_backshlash_broken to ':' or 'false'. require_check_ifs_backslash=func_require_check_ifs_backslash func_require_check_ifs_backslash () { _G_save_IFS=$IFS IFS='\' _G_check_ifs_backshlash='a\\b' for _G_i in $_G_check_ifs_backshlash do case $_G_i in a) check_ifs_backshlash_broken=false ;; '') break ;; *) check_ifs_backshlash_broken=: break ;; esac done IFS=$_G_save_IFS require_check_ifs_backslash=: } ## ----------------- ## ## Global variables. ## ## ----------------- ## # Except for the global variables explicitly listed below, the following # functions in the '^func_' namespace, and the '^require_' namespace # variables initialised in the 'Resource management' section, sourcing # this file will not pollute your global namespace with anything # else. There's no portable way to scope variables in Bourne shell # though, so actually running these functions will sometimes place # results into a variable named after the function, and often use # temporary variables in the '^_G_' namespace. If you are careful to # avoid using those namespaces casually in your sourcing script, things # should continue to work as you expect. And, of course, you can freely # overwrite any of the functions or variables defined here before # calling anything to customize them. EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. # Allow overriding, eg assuming that you follow the convention of # putting '$debug_cmd' at the start of all your functions, you can get # bash to show function call trace with: # # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name debug_cmd=${debug_cmd-":"} exit_cmd=: # By convention, finish your script with: # # exit $exit_status # # so that you can set exit_status to non-zero if you want to indicate # something went wrong during execution without actually bailing out at # the point of failure. exit_status=$EXIT_SUCCESS # 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 "$sed_basename"` # Make sure we have an absolute progpath for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` progdir=`cd "$progdir" && pwd` progpath=$progdir/$progname ;; *) _G_IFS=$IFS IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS=$_G_IFS test -x "$progdir/$progname" && break done IFS=$_G_IFS test -n "$progdir" || progdir=`pwd` progpath=$progdir/$progname ;; esac ## ----------------- ## ## Standard options. ## ## ----------------- ## # The following options affect the operation of the functions defined # below, and should be set appropriately depending on run-time para- # meters passed on the command line. opt_dry_run=false opt_quiet=false opt_verbose=false # Categories 'all' and 'none' are always available. Append any others # you will pass as the first argument to func_warning from your own # code. warning_categories= # By default, display warnings according to 'opt_warning_types'. Set # 'warning_func' to ':' to elide all warnings, or func_fatal_error to # treat the next displayed warning as a fatal error. warning_func=func_warn_and_continue # Set to 'all' to display all warnings, 'none' to suppress all # warnings, or a space delimited list of some subset of # 'warning_categories' to display only the listed warnings. opt_warning_types=all ## -------------------- ## ## Resource management. ## ## -------------------- ## # This section contains definitions for functions that each ensure a # particular resource (a file, or a non-empty configuration variable for # example) is available, and if appropriate to extract default values # from pertinent package files. Call them using their associated # 'require_*' variable to ensure that they are executed, at most, once. # # It's entirely deliberate that calling these functions can set # variables that don't obey the namespace limitations obeyed by the rest # of this file, in order that that they be as useful as possible to # callers. # require_term_colors # ------------------- # Allow display of bold text on terminals that support it. require_term_colors=func_require_term_colors func_require_term_colors () { $debug_cmd test -t 1 && { # COLORTERM and USE_ANSI_COLORS environment variables take # precedence, because most terminfo databases neglect to describe # whether color sequences are supported. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} if test 1 = "$USE_ANSI_COLORS"; then # Standard ANSI escape sequences tc_reset='' tc_bold=''; tc_standout='' tc_red=''; tc_green='' tc_blue=''; tc_cyan='' else # Otherwise trust the terminfo database after all. test -n "`tput sgr0 2>/dev/null`" && { tc_reset=`tput sgr0` test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` tc_standout=$tc_bold test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` } fi } require_term_colors=: } ## ----------------- ## ## Function library. ## ## ----------------- ## # This section contains a variety of useful functions to call in your # scripts. Take note of the portable wrappers for features provided by # some modern shells, which will fall back to slower equivalents on # less featureful shells. # func_append VAR VALUE # --------------------- # Append VALUE onto the existing contents of VAR. # We should try to minimise forks, especially on Windows where they are # unreasonably slow, so skip the feature probes when bash or zsh are # being used: if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then : ${_G_HAVE_ARITH_OP="yes"} : ${_G_HAVE_XSI_OPS="yes"} # The += operator was introduced in bash 3.1 case $BASH_VERSION in [12].* | 3.0 | 3.0*) ;; *) : ${_G_HAVE_PLUSEQ_OP="yes"} ;; esac fi # _G_HAVE_PLUSEQ_OP # Can be empty, in which case the shell is probed, "yes" if += is # usable or anything else if it does not work. test -z "$_G_HAVE_PLUSEQ_OP" \ && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ && _G_HAVE_PLUSEQ_OP=yes if test yes = "$_G_HAVE_PLUSEQ_OP" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_append () { $debug_cmd eval "$1+=\$2" }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_append () { $debug_cmd eval "$1=\$$1\$2" } fi # func_append_quoted VAR VALUE # ---------------------------- # Quote VALUE and append to the end of shell variable VAR, separated # by a space. if test yes = "$_G_HAVE_PLUSEQ_OP"; then eval 'func_append_quoted () { $debug_cmd func_quote_arg pretty "$2" eval "$1+=\\ \$func_quote_arg_result" }' else func_append_quoted () { $debug_cmd func_quote_arg pretty "$2" eval "$1=\$$1\\ \$func_quote_arg_result" } fi # func_append_uniq VAR VALUE # -------------------------- # Append unique VALUE onto the existing contents of VAR, assuming # entries are delimited by the first character of VALUE. For example: # # func_append_uniq options " --another-option option-argument" # # will only append to $options if " --another-option option-argument " # is not already present somewhere in $options already (note spaces at # each end implied by leading space in second argument). func_append_uniq () { $debug_cmd eval _G_current_value='`$ECHO $'$1'`' _G_delim=`expr "$2" : '\(.\)'` case $_G_delim$_G_current_value$_G_delim in *"$2$_G_delim"*) ;; *) func_append "$@" ;; esac } # func_arith TERM... # ------------------ # Set func_arith_result to the result of evaluating TERMs. test -z "$_G_HAVE_ARITH_OP" \ && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ && _G_HAVE_ARITH_OP=yes if test yes = "$_G_HAVE_ARITH_OP"; then eval 'func_arith () { $debug_cmd func_arith_result=$(( $* )) }' else func_arith () { $debug_cmd func_arith_result=`expr "$@"` } fi # func_basename FILE # ------------------ # Set func_basename_result to FILE with everything up to and including # the last / stripped. if test yes = "$_G_HAVE_XSI_OPS"; then # If this shell supports suffix pattern removal, then use it to avoid # forking. Hide the definitions single quotes in case the shell chokes # on unsupported syntax... _b='func_basename_result=${1##*/}' _d='case $1 in */*) func_dirname_result=${1%/*}$2 ;; * ) func_dirname_result=$3 ;; esac' else # ...otherwise fall back to using sed. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` if test "X$func_dirname_result" = "X$1"; then func_dirname_result=$3 else func_append func_dirname_result "$2" fi' fi eval 'func_basename () { $debug_cmd '"$_b"' }' # func_dirname FILE APPEND NONDIR_REPLACEMENT # ------------------------------------------- # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. eval 'func_dirname () { $debug_cmd '"$_d"' }' # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT # -------------------------------------------------------- # Perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value returned in "$func_basename_result" # For efficiency, we do not delegate to the functions above but instead # duplicate the functionality here. eval 'func_dirname_and_basename () { $debug_cmd '"$_b"' '"$_d"' }' # func_echo ARG... # ---------------- # Echo program name prefixed message. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname: $_G_line" done IFS=$func_echo_IFS } # func_echo_all ARG... # -------------------- # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_echo_infix_1 INFIX ARG... # ------------------------------ # Echo program name, followed by INFIX on the first line, with any # additional lines not showing INFIX. func_echo_infix_1 () { $debug_cmd $require_term_colors _G_infix=$1; shift _G_indent=$_G_infix _G_prefix="$progname: $_G_infix: " _G_message=$* # Strip color escape sequences before counting printable length for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" do test -n "$_G_tc" && { _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` } done _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes func_echo_infix_1_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_infix_1_IFS $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 _G_prefix=$_G_indent done IFS=$func_echo_infix_1_IFS } # func_error ARG... # ----------------- # Echo program name prefixed message to standard error. func_error () { $debug_cmd $require_term_colors func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 } # func_fatal_error ARG... # ----------------------- # Echo program name prefixed message to standard error, and exit. func_fatal_error () { $debug_cmd func_error "$*" exit $EXIT_FAILURE } # func_grep EXPRESSION FILENAME # ----------------------------- # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $debug_cmd $GREP "$1" "$2" >/dev/null 2>&1 } # func_len STRING # --------------- # Set func_len_result to the length of STRING. STRING may not # start with a hyphen. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_len () { $debug_cmd func_len_result=${#1} }' else func_len () { $debug_cmd func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } fi # func_mkdir_p DIRECTORY-PATH # --------------------------- # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { $debug_cmd _G_directory_path=$1 _G_dir_list= if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then # Protect directory names starting with '-' case $_G_directory_path in -*) _G_directory_path=./$_G_directory_path ;; esac # While some portion of DIR does not yet exist... while test ! -d "$_G_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list in case some portion of path contains whitespace. _G_dir_list=$_G_directory_path:$_G_dir_list # If the last portion added has no slash in it, the list is done case $_G_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` done _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` func_mkdir_p_IFS=$IFS; IFS=: for _G_dir in $_G_dir_list; do IFS=$func_mkdir_p_IFS # mkdir can fail with a 'File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$_G_dir" 2>/dev/null || : done IFS=$func_mkdir_p_IFS # Bail out if we (or some other process) failed to create a directory. test -d "$_G_directory_path" || \ func_fatal_error "Failed to create '$1'" fi } # func_mktempdir [BASENAME] # ------------------------- # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, BASENAME is the basename for that directory. func_mktempdir () { $debug_cmd _G_template=${TMPDIR-/tmp}/${1-$progname} if test : = "$opt_dry_run"; then # Return a directory name, but don't create it in dry-run mode _G_tmpdir=$_G_template-$$ else # If mktemp works, use that first and foremost _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` if test ! -d "$_G_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race _G_tmpdir=$_G_template-${RANDOM-0}$$ func_mktempdir_umask=`umask` umask 0077 $MKDIR "$_G_tmpdir" umask $func_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$_G_tmpdir" || \ func_fatal_error "cannot create temporary directory '$_G_tmpdir'" fi $ECHO "$_G_tmpdir" } # func_normal_abspath PATH # ------------------------ # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. func_normal_abspath () { $debug_cmd # These SED scripts presuppose an absolute path with a trailing slash. _G_pathcar='s|^/\([^/]*\).*$|\1|' _G_pathcdr='s|^/[^/]*||' _G_removedotparts=':dotsl s|/\./|/|g t dotsl s|/\.$|/|' _G_collapseslashes='s|/\{1,\}|/|g' _G_finalslash='s|/*$|/|' # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` while :; do # Processed it all yet? if test / = "$func_normal_abspath_tpath"; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result"; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_notquiet ARG... # -------------------- # Echo program name prefixed message only when not in quiet mode. func_notquiet () { $debug_cmd $opt_quiet || func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_relative_path SRCDIR DSTDIR # -------------------------------- # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. func_relative_path () { $debug_cmd func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=$func_dirname_result if test -z "$func_relative_path_tlibdir"; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test -n "$func_stripname_result"; then func_append func_relative_path_result "/$func_stripname_result" fi # Normalisation. If bindir is libdir, return '.' else relative path. if test -n "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result" func_relative_path_result=$func_stripname_result fi test -n "$func_relative_path_result" || func_relative_path_result=. : } # func_quote_portable EVAL ARG # ---------------------------- # Internal function to portably implement func_quote_arg. Note that we still # keep attention to performance here so we as much as possible try to avoid # calling sed binary (so far O(N) complexity as long as func_append is O(1)). func_quote_portable () { $debug_cmd $require_check_ifs_backslash func_quote_portable_result=$2 # one-time-loop (easy break) while true do if $1; then func_quote_portable_result=`$ECHO "$2" | $SED \ -e "$sed_double_quote_subst" -e "$sed_double_backslash"` break fi # Quote for eval. case $func_quote_portable_result in *[\\\`\"\$]*) # Fallback to sed for $func_check_bs_ifs_broken=:, or when the string # contains the shell wildcard characters. case $check_ifs_backshlash_broken$func_quote_portable_result in :*|*[\[\*\?]*) func_quote_portable_result=`$ECHO "$func_quote_portable_result" \ | $SED "$sed_quote_subst"` break ;; esac func_quote_portable_old_IFS=$IFS for _G_char in '\' '`' '"' '$' do # STATE($1) PREV($2) SEPARATOR($3) set start "" "" func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy IFS=$_G_char for _G_part in $func_quote_portable_result do case $1 in quote) func_append func_quote_portable_result "$3$2" set quote "$_G_part" "\\$_G_char" ;; start) set first "" "" func_quote_portable_result= ;; first) set quote "$_G_part" "" ;; esac done done IFS=$func_quote_portable_old_IFS ;; *) ;; esac break done func_quote_portable_unquoted_result=$func_quote_portable_result case $func_quote_portable_result in # double-quote args containing shell metacharacters to delay # word splitting, command substitution and variable expansion # for a subsequent eval. # many bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_portable_result=\"$func_quote_portable_result\" ;; esac } # func_quotefast_eval ARG # ----------------------- # Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG', # but optimized for speed. Result is stored in $func_quotefast_eval. if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then printf -v _GL_test_printf_tilde %q '~' if test '\~' = "$_GL_test_printf_tilde"; then func_quotefast_eval () { printf -v func_quotefast_eval_result %q "$1" } else # Broken older Bash implementations. Make those faster too if possible. func_quotefast_eval () { case $1 in '~'*) func_quote_portable false "$1" func_quotefast_eval_result=$func_quote_portable_result ;; *) printf -v func_quotefast_eval_result %q "$1" ;; esac } fi else func_quotefast_eval () { func_quote_portable false "$1" func_quotefast_eval_result=$func_quote_portable_result } fi # func_quote_arg MODEs ARG # ------------------------ # Quote one ARG to be evaled later. MODEs argument may contain zero or more # specifiers listed below separated by ',' character. This function returns two # values: # i) func_quote_arg_result # double-quoted (when needed), suitable for a subsequent eval # ii) func_quote_arg_unquoted_result # has all characters that are still active within double # quotes backslashified. Available only if 'unquoted' is specified. # # Available modes: # ---------------- # 'eval' (default) # - escape shell special characters # 'expand' # - the same as 'eval'; but do not quote variable references # 'pretty' # - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might # be used later in func_quote to get output like: 'echo "a b"' instead # of 'echo a\ b'. This is slower than default on some shells. # 'unquoted' # - produce also $func_quote_arg_unquoted_result which does not contain # wrapping double-quotes. # # Examples for 'func_quote_arg pretty,unquoted string': # # string | *_result | *_unquoted_result # ------------+-----------------------+------------------- # " | \" | \" # a b | "a b" | a b # "a b" | "\"a b\"" | \"a b\" # * | "*" | * # z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\" # # Examples for 'func_quote_arg pretty,unquoted,expand string': # # string | *_result | *_unquoted_result # --------------+---------------------+-------------------- # z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\" func_quote_arg () { _G_quote_expand=false case ,$1, in *,expand,*) _G_quote_expand=: ;; esac case ,$1, in *,pretty,*|*,expand,*|*,unquoted,*) func_quote_portable $_G_quote_expand "$2" func_quote_arg_result=$func_quote_portable_result func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result ;; *) # Faster quote-for-eval for some shells. func_quotefast_eval "$2" func_quote_arg_result=$func_quotefast_eval_result ;; esac } # func_quote MODEs ARGs... # ------------------------ # Quote all ARGs to be evaled later and join them into single command. See # func_quote_arg's description for more info. func_quote () { $debug_cmd _G_func_quote_mode=$1 ; shift func_quote_result= while test 0 -lt $#; do func_quote_arg "$_G_func_quote_mode" "$1" if test -n "$func_quote_result"; then func_append func_quote_result " $func_quote_arg_result" else func_append func_quote_result "$func_quote_arg_result" fi shift done } # func_stripname PREFIX SUFFIX NAME # --------------------------------- # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_stripname () { $debug_cmd # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary variable first. func_stripname_result=$3 func_stripname_result=${func_stripname_result#"$1"} func_stripname_result=${func_stripname_result%"$2"} }' else func_stripname () { $debug_cmd case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; esac } fi # func_show_eval CMD [FAIL_EXP] # ----------------------------- # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} func_quote_arg pretty,expand "$_G_cmd" eval "func_notquiet $func_quote_arg_result" $opt_dry_run || { eval "$_G_cmd" _G_status=$? if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_show_eval_locale CMD [FAIL_EXP] # ------------------------------------ # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} $opt_quiet || { func_quote_arg expand,pretty "$_G_cmd" eval "func_echo $func_quote_arg_result" } $opt_dry_run || { eval "$_G_user_locale $_G_cmd" _G_status=$? eval "$_G_safe_locale" if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_tr_sh # ---------- # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { $debug_cmd case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_verbose ARG... # ------------------- # Echo program name prefixed message in verbose mode only. func_verbose () { $debug_cmd $opt_verbose && func_echo "$*" : } # func_warn_and_continue ARG... # ----------------------------- # Echo program name prefixed warning message to standard error. func_warn_and_continue () { $debug_cmd $require_term_colors func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 } # func_warning CATEGORY ARG... # ---------------------------- # Echo program name prefixed warning message to standard error. Warning # messages can be filtered according to CATEGORY, where this function # elides messages where CATEGORY is not listed in the global variable # 'opt_warning_types'. func_warning () { $debug_cmd # CATEGORY must be in the warning_categories list! case " $warning_categories " in *" $1 "*) ;; *) func_internal_error "invalid warning category '$1'" ;; esac _G_category=$1 shift case " $opt_warning_types " in *" $_G_category "*) $warning_func ${1+"$@"} ;; esac } # func_sort_ver VER1 VER2 # ----------------------- # 'sort -V' is not generally available. # Note this deviates from the version comparison in automake # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a # but this should suffice as we won't be specifying old # version formats or redundant trailing .0 in bootstrap.conf. # If we did want full compatibility then we should probably # use m4_version_compare from autoconf. func_sort_ver () { $debug_cmd printf '%s\n%s\n' "$1" "$2" \ | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n } # func_lt_ver PREV CURR # --------------------- # Return true if PREV and CURR are in the correct order according to # func_sort_ver, otherwise false. Use it like this: # # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." func_lt_ver () { $debug_cmd test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: #! /bin/sh # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 # This is free software. There is NO warranty; not even for # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # Copyright (C) 2010-2019, 2021, 2023-2024 Bootstrap Authors # # This file is dual licensed under the terms of the MIT license # , and GPL version 2 or later # . You must apply one of # these licenses when using or redistributing this software or any of # the files within it. See the URLs above, or the file `LICENSE` # included in the Bootstrap distribution for the full license texts. # Please report bugs or propose patches to: # # Set a version string for this script. scriptversion=2019-02-19.15; # UTC ## ------ ## ## Usage. ## ## ------ ## # This file is a library for parsing options in your shell scripts along # with assorted other useful supporting features that you can make use # of too. # # For the simplest scripts you might need only: # # #!/bin/sh # . relative/path/to/funclib.sh # . relative/path/to/options-parser # scriptversion=1.0 # func_options ${1+"$@"} # eval set dummy "$func_options_result"; shift # ...rest of your script... # # In order for the '--version' option to work, you will need to have a # suitably formatted comment like the one at the top of this file # starting with '# Written by ' and ending with '# Copyright'. # # For '-h' and '--help' to work, you will also need a one line # description of your script's purpose in a comment directly above the # '# Written by ' line, like the one at the top of this file. # # The default options also support '--debug', which will turn on shell # execution tracing (see the comment above debug_cmd below for another # use), and '--verbose' and the func_verbose function to allow your script # to display verbose messages only when your user has specified # '--verbose'. # # After sourcing this file, you can plug in processing for additional # options by amending the variables from the 'Configuration' section # below, and following the instructions in the 'Option parsing' # section further down. ## -------------- ## ## Configuration. ## ## -------------- ## # You should override these variables in your script after sourcing this # file so that they reflect the customisations you have added to the # option parser. # The usage line for option parsing errors and the start of '-h' and # '--help' output messages. You can embed shell variables for delayed # expansion at the time the message is displayed, but you will need to # quote other shell meta-characters carefully to prevent them being # expanded when the contents are evaled. usage='$progpath [OPTION]...' # Short help message in response to '-h' and '--help'. Add to this or # override it after sourcing this library to reflect the full set of # options your script accepts. usage_message="\ --debug enable verbose shell tracing -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -v, --verbose verbosely report processing --version print version information and exit -h, --help print short or long help message and exit " # Additional text appended to 'usage_message' in response to '--help'. long_help_message=" Warning categories include: 'all' show all warnings 'none' turn off all the warnings 'error' warnings are treated as fatal errors" # Help message printed before fatal option parsing errors. fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## ## Hook function management. ## ## ------------------------- ## # This section contains functions for adding, removing, and running hooks # in the main code. A hook is just a list of function names that can be # run in order later on. # func_hookable FUNC_NAME # ----------------------- # Declare that FUNC_NAME will run hooks added with # 'func_add_hook FUNC_NAME ...'. func_hookable () { $debug_cmd func_append hookable_fns " $1" } # func_add_hook FUNC_NAME HOOK_FUNC # --------------------------------- # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must # first have been declared "hookable" by a call to 'func_hookable'. func_add_hook () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not accept hook functions." ;; esac eval func_append ${1}_hooks '" $2"' } # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ # Remove HOOK_FUNC from the list of hook functions to be called by # FUNC_NAME. func_remove_hook () { $debug_cmd eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } # func_propagate_result FUNC_NAME_A FUNC_NAME_B # --------------------------------------------- # If the *_result variable of FUNC_NAME_A _is set_, assign its value to # *_result variable of FUNC_NAME_B. func_propagate_result () { $debug_cmd func_propagate_result_result=: if eval "test \"\${${1}_result+set}\" = set" then eval "${2}_result=\$${1}_result" else func_propagate_result_result=false fi } # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. # It's assumed that the list of hook functions contains nothing more # than a whitespace-delimited list of legal shell function names, and # no effort is wasted trying to catch shell meta-characters or preserve # whitespace. func_run_hooks () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook functions." ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do func_unset "${_G_hook}_result" eval $_G_hook '${1+"$@"}' func_propagate_result $_G_hook func_run_hooks if $func_propagate_result_result; then eval set dummy "$func_run_hooks_result"; shift fi done } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list from your hook function. You may remove # or edit any options that you action, and then pass back the remaining # unprocessed options in '_result', escaped # suitably for 'eval'. # # The '_result' variable is automatically unset # before your hook gets called; for best performance, only set the # *_result variable when necessary (i.e. don't call the 'func_quote' # function unnecessarily because it can be an expensive operation on some # machines). # # Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # No change in '$@' (ignored completely by this hook). Leave # # my_options_prep_result variable intact. # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # args_changed=false # # # Note that, for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in # --silent|-s) opt_silent=: # args_changed=: # ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift # args_changed=: # ;; # *) # Make sure the first unrecognised option "$_G_opt" # # is added back to "$@" in case we need it later, # # if $args_changed was set to 'true'. # set dummy "$_G_opt" ${1+"$@"}; shift; break ;; # esac # done # # # Only call 'func_quote' here if we processed at least one argument. # if $args_changed; then # func_quote eval ${1+"$@"} # my_silent_option_result=$func_quote_result # fi # } # func_add_hook func_parse_options my_silent_option # # # my_option_validation () # { # $debug_cmd # # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." # } # func_add_hook func_validate_options my_option_validation # # You'll also need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. # func_options_finish [ARG]... # ---------------------------- # Finishing the option parse loop (call 'func_options' hooks ATM). func_options_finish () { $debug_cmd func_run_hooks func_options ${1+"$@"} func_propagate_result func_run_hooks func_options_finish } # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the # individual implementations for details. func_hookable func_options func_options () { $debug_cmd _G_options_quoted=false for my_func in options_prep parse_options validate_options options_finish do func_unset func_${my_func}_result func_unset func_run_hooks_result eval func_$my_func '${1+"$@"}' func_propagate_result func_$my_func func_options if $func_propagate_result_result; then eval set dummy "$func_options_result"; shift _G_options_quoted=: fi done $_G_options_quoted || { # As we (func_options) are top-level options-parser function and # nobody quoted "$@" for us yet, we need to do it explicitly for # caller. func_quote eval ${1+"$@"} func_options_result=$func_quote_result } } # func_options_prep [ARG]... # -------------------------- # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and # needs to propagate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before returning. func_hookable func_options_prep func_options_prep () { $debug_cmd # Option defaults: opt_verbose=false opt_warning_types= func_run_hooks func_options_prep ${1+"$@"} func_propagate_result func_run_hooks func_options_prep } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd _G_parse_options_requote=false # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. func_run_hooks func_parse_options ${1+"$@"} func_propagate_result func_run_hooks func_parse_options if $func_propagate_result_result; then eval set dummy "$func_parse_options_result"; shift # Even though we may have changed "$@", we passed the "$@" array # down into the hook and it quoted it for us (because we are in # this if-branch). No need to quote it again. _G_parse_options_requote=false fi # Break out of the loop if we already parsed every option. test $# -gt 0 || break # We expect that one of the options parsed in this function matches # and thus we remove _G_opt from "$@" and need to re-quote. _G_match_parse_options=: _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' func_echo "enabling shell trace mode" >&2 $debug_cmd ;; --no-warnings|--no-warning|--no-warn) set dummy --warnings none ${1+"$@"} shift ;; --warnings|--warning|-W) if test $# = 0 && func_missing_arg $_G_opt; then _G_parse_options_requote=: break fi case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above func_append_uniq opt_warning_types " $1" ;; *all) opt_warning_types=$warning_categories ;; *none) opt_warning_types=none warning_func=: ;; *error) opt_warning_types=$warning_categories warning_func=func_fatal_error ;; *) func_fatal_error \ "unsupported warning category: '$1'" ;; esac shift ;; --verbose|-v) opt_verbose=: ;; --version) func_version ;; -\?|-h) func_usage ;; --help) func_help ;; # Separate optargs to long options (plugins may need this): --*=*) func_split_equals "$_G_opt" set dummy "$func_split_equals_lhs" \ "$func_split_equals_rhs" ${1+"$@"} shift ;; # Separate optargs to short options: -W*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "$func_split_short_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-v*|-x*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) _G_parse_options_requote=: ; break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift _G_match_parse_options=false break ;; esac if $_G_match_parse_options; then _G_parse_options_requote=: fi done if $_G_parse_options_requote; then # save modified positional parameters for caller func_quote eval ${1+"$@"} func_parse_options_result=$func_quote_result fi } # func_validate_options [ARG]... # ------------------------------ # Perform any sanity checks on option settings and/or unconsumed # arguments. func_hookable func_validate_options func_validate_options () { $debug_cmd # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" func_run_hooks func_validate_options ${1+"$@"} func_propagate_result func_run_hooks func_validate_options # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE } ## ----------------- ## ## Helper functions. ## ## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. # func_fatal_help ARG... # ---------------------- # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { $debug_cmd eval \$ECHO \""Usage: $usage"\" eval \$ECHO \""$fatal_help"\" func_error ${1+"$@"} exit $EXIT_FAILURE } # func_help # --------- # Echo long help message to standard output and exit. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message" exit 0 } # func_missing_arg ARGNAME # ------------------------ # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $debug_cmd func_error "Missing argument for '$1'." exit_cmd=exit } # func_split_equals STRING # ------------------------ # Set func_split_equals_lhs and func_split_equals_rhs shell variables # after splitting STRING at the '=' sign. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_equals () { $debug_cmd func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} if test "x$func_split_equals_lhs" = "x$1"; then func_split_equals_rhs= fi }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_equals () { $debug_cmd func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` func_split_equals_rhs= test "x$func_split_equals_lhs=" = "x$1" \ || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` } fi #func_split_equals # func_split_short_opt SHORTOPT # ----------------------------- # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_short_opt () { $debug_cmd func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"} }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_short_opt () { $debug_cmd func_split_short_opt_name=`expr "x$1" : 'x\(-.\)'` func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` } fi #func_split_short_opt # func_usage # ---------- # Echo short help message to standard output and exit. func_usage () { $debug_cmd func_usage_message $ECHO "Run '$progname --help |${PAGER-more}' for full usage" exit 0 } # func_usage_message # ------------------ # Echo short help message to standard output. func_usage_message () { $debug_cmd eval \$ECHO \""Usage: $usage"\" echo $SED -n 's|^# || /^Written by/{ x;p;x } h /^Written by/q' < "$progpath" echo eval \$ECHO \""$usage_message"\" } # func_version # ------------ # Echo version message to standard output and exit. # The version message is extracted from the calling file's header # comments, with leading '# ' stripped: # 1. First display the progname and version # 2. Followed by the header comment line matching /^# Written by / # 3. Then a blank line followed by the first following line matching # /^# Copyright / # 4. Immediately followed by any lines between the previous matches, # except lines preceding the intervening completely blank line. # For example, see the header comments of this file. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' /^# Written by /!b s|^# ||; p; n :fwd2blnk /./ { n b fwd2blnk } p; n :holdwrnt s|^# || s|^# *$|| /^Copyright /!{ /./H n b holdwrnt } s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| G s|\(\n\)\n*|\1|g p; q' < "$progpath" exit $? } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. scriptversion='(GNU libtool) 2.5.4' # func_version # ------------ # Echo version message to standard output and exit. func_version () { $debug_cmd year=`date +%Y` cat < This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Originally written by Gordon Matzigkeit, 1996 (See AUTHORS for complete contributor listing) EOF exit $? } # func_echo ARG... # ---------------- # Libtool also displays the current mode in messages, so override # funclib.sh func_echo with this custom definition. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" done IFS=$func_echo_IFS } ## ---------------- ## ## Options parsing. ## ## ---------------- ## # Hook in the functions to make sure our own options are parsed during # the option parsing loop. usage='$progpath [OPTION]... [MODE-ARG]...' # Short help message in response to '-h'. usage_message="Options: --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information --finish use operation '--mode=finish' --mode=MODE use operation mode MODE --no-finish don't update shared library cache --no-quiet, --no-silent print default informational messages --no-warnings equivalent to '-Wnone' --preserve-dup-deps don't remove duplicate dependency libraries --quiet, --silent don't print informational messages --reorder-cache=DIRS reorder shared library cache for preferred DIRS --tag=TAG use configuration variables from tag TAG -v, --verbose print more informational messages than default --version print version information -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -h, --help, --help-all print short, long, or detailed help message " # Additional text appended to 'usage_message' in response to '--help'. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message 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. When passed as first option, '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. Try '$progname --help --mode=MODE' for a more detailed description of MODE. When reporting a bug, please describe a test case to reproduce it and include the following information: host-triplet: $host shell: $SHELL compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) version: $progname $scriptversion automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . GNU libtool home page: . General help using GNU software: ." exit 0 } # func_lo2o OBJECT-NAME # --------------------- # Transform OBJECT-NAME from a '.lo' suffix to the platform specific # object suffix. lo2o=s/\\.lo\$/.$objext/ o2lo=s/\\.$objext\$/.lo/ if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_lo2o () { case $1 in *.lo) func_lo2o_result=${1%.lo}.$objext ;; * ) func_lo2o_result=$1 ;; esac }' # func_xform LIBOBJ-OR-SOURCE # --------------------------- # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) # suffix to a '.lo' libtool-object suffix. eval 'func_xform () { func_xform_result=${1%.*}.lo }' else # ...otherwise fall back to using sed. func_lo2o () { func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` } func_xform () { func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` } fi # func_fatal_configuration ARG... # ------------------------------- # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } # func_config # ----------- # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # ------------- # Display the features supported by this script. func_features () { echo "host: $host" if test yes = "$build_libtool_libs"; then echo "enable shared libraries" else echo "disable shared libraries" fi if test yes = "$build_old_libs"; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag TAGNAME # ----------------------- # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname=$1 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf=/$re_begincf/,/$re_endcf/p # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # ------------------------ # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # libtool_options_prep [ARG]... # ----------------------------- # Preparation for options parsed by libtool. libtool_options_prep () { $debug_mode # Option defaults: opt_config=false opt_dlopen= opt_dry_run=false opt_help=false opt_mode= opt_reorder_cache=false opt_preserve_dup_deps=false opt_quiet=false opt_finishing=true opt_warning= nonopt= preserve_args= _G_rc_lt_options_prep=: # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; *) _G_rc_lt_options_prep=false ;; esac if $_G_rc_lt_options_prep; then # Pass back the list of options. func_quote eval ${1+"$@"} libtool_options_prep_result=$func_quote_result fi } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd _G_rc_lt_parse_options=false # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _G_match_lt_parse_options=: _G_opt=$1 shift case $_G_opt in --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) func_config ;; --dlopen|-dlopen) opt_dlopen="${opt_dlopen+$opt_dlopen }$1" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) func_features ;; --finish) set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $_G_opt && break opt_mode=$1 case $1 in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument '$1' for $_G_opt" exit_cmd=exit ;; esac shift ;; --no-finish) opt_finishing=false func_append preserve_args " $_G_opt" ;; --no-silent|--no-quiet) opt_quiet=false func_append preserve_args " $_G_opt" ;; --no-warnings|--no-warning|--no-warn) opt_warning=false func_append preserve_args " $_G_opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $_G_opt" ;; --reorder-cache) opt_reorder_cache=true shared_lib_dirs=$1 if test -n "$shared_lib_dirs"; then case $1 in # Must begin with /: /*) ;; # Catch anything else as an error (relative paths) *) func_error "invalid argument '$1' for $_G_opt" func_error "absolute paths are required for $_G_opt" exit_cmd=exit ;; esac fi shift ;; --silent|--quiet) opt_quiet=: opt_verbose=false func_append preserve_args " $_G_opt" ;; --tag) test $# = 0 && func_missing_arg $_G_opt && break opt_tag=$1 func_append preserve_args " $_G_opt $1" func_enable_tag "$1" shift ;; --verbose|-v) opt_quiet=false opt_verbose=: func_append preserve_args " $_G_opt" ;; # An option not handled by this hook function: *) set dummy "$_G_opt" ${1+"$@"} ; shift _G_match_lt_parse_options=false break ;; esac $_G_match_lt_parse_options && _G_rc_lt_parse_options=: done if $_G_rc_lt_parse_options; then # save modified positional parameters for caller func_quote eval ${1+"$@"} libtool_parse_options_result=$func_quote_result fi } func_add_hook func_parse_options libtool_parse_options # func_warning ARG... # ------------------- # Libtool warnings are not categorized, so override funclib.sh # func_warning with this simpler definition. func_warning () { if $opt_warning; then $debug_cmd $warning_func ${1+"$@"} fi } # libtool_validate_options [ARG]... # --------------------------------- # Perform any sanity checks on option settings and/or unconsumed # arguments. libtool_validate_options () { # save first non-option argument if test 0 -lt $#; then nonopt=$1 shift fi # preserve --debug test : = "$debug_cmd" || func_append preserve_args " --debug" case $host_os in # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 cygwin* | mingw* | windows* | pw32* | cegcc* | solaris2* | os2*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match test yes != "$build_libtool_libs" \ && test yes != "$build_old_libs" \ && func_fatal_configuration "not configured to build any kind of library" # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then func_error "unrecognized option '-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help=$help help="Try '$progname --help --mode=$opt_mode' for more information." } # Pass back the unparsed argument list func_quote eval ${1+"$@"} libtool_validate_options_result=$func_quote_result } func_add_hook func_validate_options libtool_validate_options # Process options as early as possible so that --help and --version # can return quickly. func_options ${1+"$@"} eval set dummy "$func_options_result"; shift ## ----------- ## ## Main. ## ## ----------- ## magic='%%%MAGIC variable%%%' magic_exe='%%%MAGIC EXE variable%%%' # Global variables. extracted_archives= extracted_serial=0 # 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= # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # func_generated_by_libtool # True iff stdin has been generated by Libtool. This function is only # a basic sanity check; it will hardly flush out determined imposters. func_generated_by_libtool_p () { $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p } # func_lalib_unsafe_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if 'file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case $lalib_p_line in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test yes = "$lalib_p" } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { test -f "$1" && $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $debug_cmd save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE 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. func_source () { $debug_cmd case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case $lt_sysroot:$1 in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result='='$func_stripname_result ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # 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 () { $debug_cmd if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` 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 "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # 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. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # 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 func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with '--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=$1 if test yes = "$build_libtool_libs"; then write_lobj=\'$2\' else write_lobj=none fi if test yes = "$build_old_libs"; then write_oldobj=\'$3\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, windows, cygwin, or some other w32 environment. Relies on a # correctly configured wine environment available, with the winepath program # in $build's $PATH. Assumes ARG has no leading or trailing path separator # characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $debug_cmd # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result= if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result"; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $debug_cmd if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $debug_cmd # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $debug_cmd if test -z "$2" && test -n "$1"; then func_error "Could not determine host file name corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result=$1 fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $debug_cmd if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " '$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result=$3 fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $debug_cmd case $4 in $1 ) func_to_host_path_result=$3$func_to_host_path_result ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep # func_convert_delimited_path PATH ORIG_DELIMITER NEW_DELIMITER # Replaces a delimiter for a given path. func_convert_delimited_path () { converted_path=`$ECHO "$1" | $SED "s#$2#$3#g"` } # end func_convert_delimited_path ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via '$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $debug_cmd $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $debug_cmd case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result=$1 } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result=$func_convert_core_msys_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result=$func_convert_core_file_wine_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via '$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $debug_cmd if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd=func_convert_path_$func_stripname_result fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $debug_cmd func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result=$1 } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_msys_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_path_wine_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_dll_def_p FILE # True iff FILE is a Windows DLL '.def' file. # Keep in sync with _LT_DLL_DEF_P in libtool.m4 func_dll_def_p () { $debug_cmd func_dll_def_p_tmp=`$SED -n \ -e 's/^[ ]*//' \ -e '/^\(;.*\)*$/d' \ -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ -e q \ "$1"` test DEF = "$func_dll_def_p_tmp" } # func_reorder_shared_lib_cache DIRS # Reorder the shared library cache by unconfiguring previous shared library cache # and configuring preferred search directories before previous search directories. # Previous shared library cache: /usr/lib /usr/local/lib # Preferred search directories: /tmp/testing # Reordered shared library cache: /tmp/testing /usr/lib /usr/local/lib func_reorder_shared_lib_cache () { $debug_cmd case $host_os in openbsd*) get_search_directories=`PATH="$PATH:/sbin" ldconfig -r | $GREP "search directories" | $SED "s#.*search directories:\ ##g"` func_convert_delimited_path "$get_search_directories" ':' '\ ' save_search_directories=$converted_path func_convert_delimited_path "$1" ':' '\ ' # Ensure directories exist for dir in $converted_path; do # Ensure each directory is an absolute path case $dir in /*) ;; *) func_error "Directory '$dir' is not an absolute path" exit $EXIT_FAILURE ;; esac # Ensure no trailing slashes func_stripname '' '/' "$dir" dir=$func_stripname_result if test -d "$dir"; then if test -n "$preferred_search_directories"; then preferred_search_directories="$preferred_search_directories $dir" else preferred_search_directories=$dir fi else func_error "Directory '$dir' does not exist" exit $EXIT_FAILURE fi done PATH="$PATH:/sbin" ldconfig -U $save_search_directories PATH="$PATH:/sbin" ldconfig -m $preferred_search_directories $save_search_directories get_search_directories=`PATH="$PATH:/sbin" ldconfig -r | $GREP "search directories" | $SED "s#.*search directories:\ ##g"` func_convert_delimited_path "$get_search_directories" ':' '\ ' reordered_search_directories=$converted_path $ECHO "Original: $save_search_directories" $ECHO "Reordered: $reordered_search_directories" exit $EXIT_SUCCESS ;; *) func_error "--reorder-cache is not supported for host_os=$host_os." exit $EXIT_FAILURE ;; esac } # end func_reorder_shared_lib_cache # func_mode_compile arg... func_mode_compile () { $debug_cmd # 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= pie_flag= 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) test -n "$libobj" && \ func_fatal_error "you cannot specify '-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append 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,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs=$IFS; IFS=, for arg in $args; do IFS=$save_ifs func_append_quoted lastarg "$arg" done IFS=$save_ifs func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append 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. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with '-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj=$func_basename_result } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from '$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test yes = "$build_libtool_libs" \ || func_fatal_configuration "cannot build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_arg pretty "$libobj" test "X$libobj" != "X$func_quote_arg_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname=$func_basename_result xdir=$func_dirname_result lobj=$xdir$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test yes = "$build_old_libs"; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | windows* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; 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 no = "$compiler_c_o"; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext lockfile=$output_obj.lock 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 yes = "$need_locks"; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test warn = "$need_locks"; 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." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_arg pretty "$srcfile" qsrcfile=$func_quote_arg_result # Only build a PIC object if we are building libtool libraries. if test yes = "$build_libtool_libs"; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test no != "$pic_mode"; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && 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." $opt_dry_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 func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test yes = "$suppress_opt"; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test yes = "$build_old_libs"; then if test yes != "$pic_mode"; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test yes = "$compiler_c_o"; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && 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." $opt_dry_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 func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test no != "$need_locks"; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test compile = "$opt_mode" && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [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: $progname [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 -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a '.o' file suitable for static linking -static only build a '.o' file suitable for static linking -Wc,FLAG -Xcompiler FLAG pass FLAG directly to the compiler 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: $progname [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: $progname [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: $progname [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 following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [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 -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -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 -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) -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 -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wa,FLAG -Xassembler FLAG pass linker-specific FLAG directly to the assembler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) 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: $progname [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." ;; *) func_fatal_help "invalid operation mode '$opt_mode'" ;; esac echo $ECHO "Try '$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test : = "$opt_help"; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | $SED -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | $SED '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # If option '--reorder-cache', reorder the shared library cache and exit. if $opt_reorder_cache; then func_reorder_shared_lib_cache $shared_lib_dirs fi # func_mode_execute arg... func_mode_execute () { $debug_cmd # The first argument is the command name. cmd=$nonopt test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "'$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "'$file' was not linked with '-export-dynamic'" continue fi func_dirname "$file" "" "." dir=$func_dirname_result if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir=$func_dirname_result ;; *) func_warning "'-dlopen' is ignored for non-libtool libraries and objects" 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 -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file=$progdir/$program elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file=$progdir/$program fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if $opt_dry_run; then # 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 else if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd=\$cmd$args fi } test execute = "$opt_mode" && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $debug_cmd libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "'$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument '$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and '=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs" && $opt_finishing; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_quiet && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done if test "false" = "$opt_finishing"; then echo echo "NOTE: finish_cmds were not executed during testing, so you must" echo "manually run ldconfig to add a given test directory, LIBDIR, to" echo "the search path for generated executables." fi 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" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test finish = "$opt_mode" && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $debug_cmd # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. func_quote_arg pretty "$nonopt" install_prog="$func_quote_arg_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_arg pretty "$arg" func_append install_prog "$func_quote_arg_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=false stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=: ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test X-m = "X$prev" && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_arg pretty "$arg" func_append install_prog " $func_quote_arg_result" if test -n "$arg2"; then func_quote_arg pretty "$arg2" fi func_append install_shared_prog " $func_quote_arg_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the '$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_arg pretty "$install_override_mode" func_append install_shared_prog " -m $func_quote_arg_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=: if $isdir; then destdir=$dest destname= else func_dirname_and_basename "$dest" "" "." destdir=$func_dirname_result destname=$func_basename_result # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "'$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "'$destdir' must be an absolute directory name" ;; 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. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir=$func_dirname_result func_append dir "$objdir" if test -n "$relink_command"; then # Strip any trailing slash from the destination. func_stripname '' '/' "$libdir" destlibdir=$func_stripname_result func_stripname '' '/' "$destdir" s_destdir=$func_stripname_result # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "X$s_destdir" | $Xsed -e "s%$destlibdir\$%%"` # 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. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" 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 func_warning "relinking '$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname=$1 shift srcname=$realname test -n "$relink_command" && srcname=${realname}T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme=$stripme case $host_os in cygwin* | mingw* | windows* | pw32* | cegcc*) case $realname in *.dll.a) tstripme= ;; esac ;; os2*) case $realname in *_dll.a) tstripme= ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_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 test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib=$destdir/$realname func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name=$func_basename_result instname=$dir/${name}i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append 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 func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest=$destfile destfile= ;; *) func_fatal_help "cannot copy a libtool object to '$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test yes = "$build_old_libs"; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_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 func_basename "$file" destfile=$func_basename_result 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 func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=.exe fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw* | *windows*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script '$wrapper'" finalize=: for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` if test -n "$libdir" && test ! -f "$libfile"; then func_warning "'$lib' has not been installed in '$libdir'" finalize=false fi done relink_command= func_source "$wrapper" outputname= if test no = "$fast_install" && test -n "$relink_command"; then $opt_dry_run || { if $finalize; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file=$func_basename_result outputname=$tmpdir/$file # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { func_quote_arg expand,pretty "$relink_command" eval "func_echo $func_quote_arg_result" } if eval "$relink_command"; then : else func_error "error: relink '$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file=$outputname else func_warning "cannot relink '$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "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) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name=$func_basename_result # Set up the ranlib parameters. oldlib=$destdir/$name func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run '$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test install = "$opt_mode" && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $debug_cmd my_outputname=$1 my_originator=$2 my_pic_p=${3-false} my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms=${my_outputname}S.c else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist=$output_objdir/$my_outputname.nm func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* External symbol declarations for the compiler. */\ " if test yes = "$dlself"; then func_verbose "generating symbol list for '$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from '$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols=$output_objdir/$outputname.exp $opt_dry_run || { $RM $export_symbols eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *windows* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *windows* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from '$dlprefile'" func_basename "$dlprefile" name=$func_basename_result case $host in *cygwin* | *mingw* | *windows* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename= if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname"; then func_basename "$dlprefile_dlname" dlprefile_dlbasename=$func_basename_result else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename"; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 case $host in i[3456]86-*-mingw32*) eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" ;; *) eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/__nm_//' >> '$nlist'" ;; esac } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # 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 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/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi func_show_eval '$RM "${nlist}I"' if test -n "$global_symbol_to_import"; then eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[];\ " if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ static void lt_syminit(void) { LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; for (; symbol->name; ++symbol) {" $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" echo >> "$output_objdir/$my_dlsyms" "\ } }" fi echo >> "$output_objdir/$my_dlsyms" "\ LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = { {\"$my_originator\", (void *) 0}," if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ {\"@INIT@\", (void *) <_syminit}," fi case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) 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*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) $my_pic_p && pic_flag_for_symtable=" $pic_flag" ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' # Transform the symbol file into the correct name. symfileobj=$output_objdir/${my_outputname}S.$objext case $host in *cygwin* | *mingw* | *windows* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for '$my_dlsyms'" ;; 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 "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # 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. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $debug_cmd 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 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64|pe-aarch64)' >/dev/null; then case $nm_interface in "MS dumpbin") if func_cygming_ms_implib_p "$1" || func_cygming_gnu_implib_p "$1" then win32_nmres=import else win32_nmres= fi ;; *) func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s|.*|import| p q } }'` ;; esac 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_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $debug_cmd sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $debug_cmd match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive that possess that section. Heuristic: eliminate # all those that have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $debug_cmd if func_cygming_gnu_implib_p "$1"; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1"; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result= fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $debug_cmd f_ex_an_ar_dir=$1; shift f_ex_an_ar_oldlib=$1 if test yes = "$lock_old_archive_extraction"; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test yes = "$lock_old_archive_extraction"; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $debug_cmd my_gentop=$1; shift my_oldlibs=${1+"$@"} my_oldobjs= my_xlib= my_xabs= my_xdir= 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 func_basename "$my_xlib" my_xlib=$func_basename_result my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir=$my_gentop/$my_xlib_u func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` func_basename "$darwin_archive" darwin_base_archive=$func_basename_result darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches; do func_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've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result=$my_oldobjs } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw/windows # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory where it is stored is # the $objdir directory. This is a cygwin/mingw/windows-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # 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. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible 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 BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # 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 variables: generated_by_libtool_version='$macro_version' 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 file=\"\$0\"" func_quote_arg pretty "$ECHO" qECHO=$func_quote_arg_result $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=$qECHO fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ that is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options that match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw* | *-*-windows* | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED '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 \"\$file\" | $SED '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 \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw/windows when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test yes = "$fast_install"; then $ECHO "\ 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 "\ # 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 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # 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 \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${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 $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #if defined _WIN32 && !defined __GNUC__ # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* declarations of non-ANSI functions */ #if defined __MINGW32__ # ifdef __STRICT_ANSI__ _CRTIMP int __cdecl _putenv (const char *); # endif #elif defined __CYGWIN__ # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined other_platform || defined ... */ #endif /* portability defines, excluding path handling macros */ #if defined _MSC_VER # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC #elif defined __MINGW32__ # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined __CYGWIN__ # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined other platforms ... */ #endif #if defined PATH_MAX # define LT_PATHMAX PATH_MAX #elif defined MAXPATHLEN # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #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 # define FOPEN_WB "wb" # 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 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free (stale); stale = 0; } \ } while (0) #if defined LT_DEBUGWRAPPER static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ 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]; size_t tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); 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 = (size_t) (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 (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); 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 (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); 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 * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } 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 (STREQ (str, pat)) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else size_t len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { size_t orig_value_len = strlen (orig_value); size_t add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ size_t len = strlen (new_value); while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[--len] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw* | windows*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $debug_cmd case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_suncc_cstd_abi # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! # Several compiler flags select an ABI that is incompatible with the # Cstd library. Avoid specifying it if any are in CXXFLAGS. func_suncc_cstd_abi () { $debug_cmd case " $compile_command " in *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) suncc_use_cstd_abi=no ;; *) suncc_use_cstd_abi=yes ;; esac } # func_mode_link arg... func_mode_link () { $debug_cmd case $host in *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # what 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 that 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= compile_rpath_tail= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= os2dllname= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=false prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= temp_rpath_tail= thread_safe=no vinfo= vinfo_number=no weak_libs= rpath_arg= single_module=$wl-single_module func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test yes != "$build_libtool_libs" \ && func_fatal_configuration "cannot build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac 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 func_quote_arg pretty,unquoted "$arg" qarg=$func_quote_arg_unquoted_result func_append libtool_args " $func_quote_arg_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir=$arg prev= continue ;; dlfiles|dlprefiles) $preload || { # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=: } case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test no = "$dlself"; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test dlprefiles = "$prev"; then dlself=yes elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test dlfiles = "$prev"; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols=$arg test -f "$arg" \ || func_fatal_error "symbol file '$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex=$arg prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir=$arg prev= continue ;; mllvm) # Clang does not use LLVM to link, so we can simply discard any # '-mllvm $arg' options when doing the link step. prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result if test none != "$pic_object"; then # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append 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 dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object fi # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; 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 func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file '$arg' does not exist" fi arg=$save_arg prev= continue ;; os2dllname) os2dllname=$arg prev= continue ;; precious_regex) precious_files_regex=$arg prev= continue ;; release) release=-$arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "argument to -rpath is not absolute: $arg" ;; esac if test rpath = "$prev"; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds=$arg prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xassembler) func_append compiler_flags " -Xassembler $qarg" prev= func_append compile_command " -Xassembler $qarg" func_append finalize_command " -Xassembler $qarg" continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" 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 # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "'-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir 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 func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test X-export-symbols = "X$arg"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework 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*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between '-L' and '$1'" else func_fatal_error "need path for '-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of '$dir'" dir=$absdir ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test X-lc = "X$arg" || test X-lm = "X$arg"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # 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-lc = "X$arg" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test X-lc = "X$arg" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test X-lc = "X$arg" && continue ;; esac elif test X-lc_r = "X$arg"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -mllvm) prev=mllvm continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. # -q