You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ph...@apache.org on 2018/06/06 14:15:14 UTC
[46/51] [partial] nifi-minifi-cpp git commit: MINIFICPP-512 - upgrade
to librdkafka 0.11.4
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/7528d23e/thirdparty/librdkafka-0.11.1/examples/rdkafka_zookeeper_example.c
----------------------------------------------------------------------
diff --git a/thirdparty/librdkafka-0.11.1/examples/rdkafka_zookeeper_example.c b/thirdparty/librdkafka-0.11.1/examples/rdkafka_zookeeper_example.c
deleted file mode 100644
index 2f9a61e..0000000
--- a/thirdparty/librdkafka-0.11.1/examples/rdkafka_zookeeper_example.c
+++ /dev/null
@@ -1,728 +0,0 @@
-/*
- * librdkafka - Apache Kafka C library
- *
- * Copyright (c) 2012, Magnus Edenhill
- * All rights reserved.
- *
- * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * Apache Kafka consumer & producer example programs
- * using the Kafka driver from librdkafka
- * (https://github.com/edenhill/librdkafka)
- */
-
-#include <ctype.h>
-#include <signal.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <syslog.h>
-#include <sys/time.h>
-#include <errno.h>
-
-/* Typical include path would be <librdkafka/rdkafka.h>, but this program
- * is builtin from within the librdkafka source tree and thus differs. */
-#include "rdkafka.h" /* for Kafka driver */
-
-#include <zookeeper.h>
-#include <zookeeper.jute.h>
-#include <jansson.h>
-
-#define BROKER_PATH "/brokers/ids"
-
-static int run = 1;
-static rd_kafka_t *rk;
-static int exit_eof = 0;
-static int quiet = 0;
-static enum {
- OUTPUT_HEXDUMP,
- OUTPUT_RAW,
-} output = OUTPUT_HEXDUMP;
-
-static void stop (int sig) {
- run = 0;
- fclose(stdin); /* abort fgets() */
-}
-
-
-static void hexdump (FILE *fp, const char *name, const void *ptr, size_t len) {
- const char *p = (const char *)ptr;
- int of = 0;
-
-
- if (name)
- fprintf(fp, "%s hexdump (%zd bytes):\n", name, len);
-
- for (of = 0 ; of < len ; of += 16) {
- char hexen[16*3+1];
- char charen[16+1];
- int hof = 0;
-
- int cof = 0;
- int i;
-
- for (i = of ; i < of + 16 && i < len ; i++) {
- hof += sprintf(hexen+hof, "%02x ", p[i] & 0xff);
- cof += sprintf(charen+cof, "%c",
- isprint((int)p[i]) ? p[i] : '.');
- }
- fprintf(fp, "%08x: %-48s %-16s\n",
- of, hexen, charen);
- }
-}
-
-/**
- * Kafka logger callback (optional)
- */
-static void logger (const rd_kafka_t *rk, int level,
- const char *fac, const char *buf) {
- struct timeval tv;
- gettimeofday(&tv, NULL);
- fprintf(stderr, "%u.%03u RDKAFKA-%i-%s: %s: %s\n",
- (int)tv.tv_sec, (int)(tv.tv_usec / 1000),
- level, fac, rd_kafka_name(rk), buf);
-}
-
-/**
- * Message delivery report callback.
- * Called once for each message.
- * See rdkafka.h for more information.
- */
-static void msg_delivered (rd_kafka_t *rk,
- void *payload, size_t len,
- int error_code,
- void *opaque, void *msg_opaque) {
-
- if (error_code)
- fprintf(stderr, "%% Message delivery failed: %s\n",
- rd_kafka_err2str(error_code));
- else if (!quiet)
- fprintf(stderr, "%% Message delivered (%zd bytes)\n", len);
-}
-
-
-static void msg_consume (rd_kafka_message_t *rkmessage,
- void *opaque) {
- if (rkmessage->err) {
- if (rkmessage->err == RD_KAFKA_RESP_ERR__PARTITION_EOF) {
- fprintf(stderr,
- "%% Consumer reached end of %s [%"PRId32"] "
- "message queue at offset %"PRId64"\n",
- rd_kafka_topic_name(rkmessage->rkt),
- rkmessage->partition, rkmessage->offset);
-
- if (exit_eof)
- run = 0;
-
- return;
- }
-
- fprintf(stderr, "%% Consume error for topic \"%s\" [%"PRId32"] "
- "offset %"PRId64": %s\n",
- rd_kafka_topic_name(rkmessage->rkt),
- rkmessage->partition,
- rkmessage->offset,
- rd_kafka_message_errstr(rkmessage));
- return;
- }
-
- if (!quiet)
- fprintf(stdout, "%% Message (offset %"PRId64", %zd bytes):\n",
- rkmessage->offset, rkmessage->len);
-
- if (rkmessage->key_len) {
- if (output == OUTPUT_HEXDUMP)
- hexdump(stdout, "Message Key",
- rkmessage->key, rkmessage->key_len);
- else
- printf("Key: %.*s\n",
- (int)rkmessage->key_len, (char *)rkmessage->key);
- }
-
- if (output == OUTPUT_HEXDUMP)
- hexdump(stdout, "Message Payload",
- rkmessage->payload, rkmessage->len);
- else
- printf("%.*s\n",
- (int)rkmessage->len, (char *)rkmessage->payload);
-}
-
-
-static void metadata_print (const char *topic,
- const struct rd_kafka_metadata *metadata) {
- int i, j, k;
-
- printf("Metadata for %s (from broker %"PRId32": %s):\n",
- topic ? : "all topics",
- metadata->orig_broker_id,
- metadata->orig_broker_name);
-
-
- /* Iterate brokers */
- printf(" %i brokers:\n", metadata->broker_cnt);
- for (i = 0 ; i < metadata->broker_cnt ; i++)
- printf(" broker %"PRId32" at %s:%i\n",
- metadata->brokers[i].id,
- metadata->brokers[i].host,
- metadata->brokers[i].port);
-
- /* Iterate topics */
- printf(" %i topics:\n", metadata->topic_cnt);
- for (i = 0 ; i < metadata->topic_cnt ; i++) {
- const struct rd_kafka_metadata_topic *t = &metadata->topics[i];
- printf(" topic \"%s\" with %i partitions:",
- t->topic,
- t->partition_cnt);
- if (t->err) {
- printf(" %s", rd_kafka_err2str(t->err));
- if (t->err == RD_KAFKA_RESP_ERR_LEADER_NOT_AVAILABLE)
- printf(" (try again)");
- }
- printf("\n");
-
- /* Iterate topic's partitions */
- for (j = 0 ; j < t->partition_cnt ; j++) {
- const struct rd_kafka_metadata_partition *p;
- p = &t->partitions[j];
- printf(" partition %"PRId32", "
- "leader %"PRId32", replicas: ",
- p->id, p->leader);
-
- /* Iterate partition's replicas */
- for (k = 0 ; k < p->replica_cnt ; k++)
- printf("%s%"PRId32,
- k > 0 ? ",":"", p->replicas[k]);
-
- /* Iterate partition's ISRs */
- printf(", isrs: ");
- for (k = 0 ; k < p->isr_cnt ; k++)
- printf("%s%"PRId32,
- k > 0 ? ",":"", p->isrs[k]);
- if (p->err)
- printf(", %s\n", rd_kafka_err2str(p->err));
- else
- printf("\n");
- }
- }
-}
-
-
-static void set_brokerlist_from_zookeeper(zhandle_t *zzh, char *brokers)
-{
- if (zzh)
- {
- struct String_vector brokerlist;
- if (zoo_get_children(zzh, BROKER_PATH, 1, &brokerlist) != ZOK)
- {
- fprintf(stderr, "No brokers found on path %s\n", BROKER_PATH);
- return;
- }
-
- int i;
- char *brokerptr = brokers;
- for (i = 0; i < brokerlist.count; i++)
- {
- char path[255], cfg[1024];
- sprintf(path, "/brokers/ids/%s", brokerlist.data[i]);
- int len = sizeof(cfg);
- zoo_get(zzh, path, 0, cfg, &len, NULL);
-
- if (len > 0)
- {
- cfg[len] = '\0';
- json_error_t jerror;
- json_t *jobj = json_loads(cfg, 0, &jerror);
- if (jobj)
- {
- json_t *jhost = json_object_get(jobj, "host");
- json_t *jport = json_object_get(jobj, "port");
-
- if (jhost && jport)
- {
- const char *host = json_string_value(jhost);
- const int port = json_integer_value(jport);
- sprintf(brokerptr, "%s:%d", host, port);
-
- brokerptr += strlen(brokerptr);
- if (i < brokerlist.count - 1)
- {
- *brokerptr++ = ',';
- }
- }
- json_decref(jobj);
- }
- }
- }
- deallocate_String_vector(&brokerlist);
- printf("Found brokers %s\n", brokers);
- }
-}
-
-
-static void watcher(zhandle_t *zh, int type, int state, const char *path, void *watcherCtx)
-{
- char brokers[1024];
- if (type == ZOO_CHILD_EVENT && strncmp(path, BROKER_PATH, sizeof(BROKER_PATH) - 1) == 0)
- {
- brokers[0] = '\0';
- set_brokerlist_from_zookeeper(zh, brokers);
- if (brokers[0] != '\0' && rk != NULL)
- {
- rd_kafka_brokers_add(rk, brokers);
- rd_kafka_poll(rk, 10);
- }
- }
-}
-
-
-static zhandle_t* initialize_zookeeper(const char * zookeeper, const int debug)
-{
- zhandle_t *zh;
- if (debug)
- {
- zoo_set_debug_level(ZOO_LOG_LEVEL_DEBUG);
- }
- zh = zookeeper_init(zookeeper, watcher, 10000, 0, 0, 0);
- if (zh == NULL)
- {
- fprintf(stderr, "Zookeeper connection not established.");
- exit(1);
- }
- return zh;
-}
-
-
-static void sig_usr1 (int sig) {
- rd_kafka_dump(stdout, rk);
-}
-
-int main (int argc, char **argv) {
- rd_kafka_topic_t *rkt;
- char *zookeeper = "localhost:2181";
- zhandle_t *zh = NULL;
- char brokers[1024];
- char mode = 'C';
- char *topic = NULL;
- int partition = RD_KAFKA_PARTITION_UA;
- int opt;
- rd_kafka_conf_t *conf;
- rd_kafka_topic_conf_t *topic_conf;
- char errstr[512];
- const char *debug = NULL;
- int64_t start_offset = 0;
- int do_conf_dump = 0;
-
- memset(brokers, 0, sizeof(brokers));
- quiet = !isatty(STDIN_FILENO);
-
- /* Kafka configuration */
- conf = rd_kafka_conf_new();
-
- /* Topic configuration */
- topic_conf = rd_kafka_topic_conf_new();
-
- while ((opt = getopt(argc, argv, "PCLt:p:k:z:qd:o:eX:A")) != -1) {
- switch (opt) {
- case 'P':
- case 'C':
- case 'L':
- mode = opt;
- break;
- case 't':
- topic = optarg;
- break;
- case 'p':
- partition = atoi(optarg);
- break;
- case 'k':
- zookeeper = optarg;
- break;
- case 'z':
- if (rd_kafka_conf_set(conf, "compression.codec",
- optarg,
- errstr, sizeof(errstr)) !=
- RD_KAFKA_CONF_OK) {
- fprintf(stderr, "%% %s\n", errstr);
- exit(1);
- }
- break;
- case 'o':
- if (!strcmp(optarg, "end"))
- start_offset = RD_KAFKA_OFFSET_END;
- else if (!strcmp(optarg, "beginning"))
- start_offset = RD_KAFKA_OFFSET_BEGINNING;
- else if (!strcmp(optarg, "stored"))
- start_offset = RD_KAFKA_OFFSET_STORED;
- else
- start_offset = strtoll(optarg, NULL, 10);
- break;
- case 'e':
- exit_eof = 1;
- break;
- case 'd':
- debug = optarg;
- break;
- case 'q':
- quiet = 1;
- break;
- case 'A':
- output = OUTPUT_RAW;
- break;
- case 'X':
- {
- char *name, *val;
- rd_kafka_conf_res_t res;
-
- if (!strcmp(optarg, "list") ||
- !strcmp(optarg, "help")) {
- rd_kafka_conf_properties_show(stdout);
- exit(0);
- }
-
- if (!strcmp(optarg, "dump")) {
- do_conf_dump = 1;
- continue;
- }
-
- name = optarg;
- if (!(val = strchr(name, '='))) {
- fprintf(stderr, "%% Expected "
- "-X property=value, not %s\n", name);
- exit(1);
- }
-
- *val = '\0';
- val++;
-
- res = RD_KAFKA_CONF_UNKNOWN;
- /* Try "topic." prefixed properties on topic
- * conf first, and then fall through to global if
- * it didnt match a topic configuration property. */
- if (!strncmp(name, "topic.", strlen("topic.")))
- res = rd_kafka_topic_conf_set(topic_conf,
- name+
- strlen("topic."),
- val,
- errstr,
- sizeof(errstr));
-
- if (res == RD_KAFKA_CONF_UNKNOWN)
- res = rd_kafka_conf_set(conf, name, val,
- errstr, sizeof(errstr));
-
- if (res != RD_KAFKA_CONF_OK) {
- fprintf(stderr, "%% %s\n", errstr);
- exit(1);
- }
- }
- break;
-
- default:
- goto usage;
- }
- }
-
-
- if (do_conf_dump) {
- const char **arr;
- size_t cnt;
- int pass;
-
- for (pass = 0 ; pass < 2 ; pass++) {
- int i;
-
- if (pass == 0) {
- arr = rd_kafka_conf_dump(conf, &cnt);
- printf("# Global config\n");
- } else {
- printf("# Topic config\n");
- arr = rd_kafka_topic_conf_dump(topic_conf,
- &cnt);
- }
-
- for (i = 0 ; i < cnt ; i += 2)
- printf("%s = %s\n",
- arr[i], arr[i+1]);
-
- printf("\n");
-
- rd_kafka_conf_dump_free(arr, cnt);
- }
-
- exit(0);
- }
-
-
- if (optind != argc || (mode != 'L' && !topic)) {
- usage:
- fprintf(stderr,
- "Usage: %s -C|-P|-L -t <topic> "
- "[-p <partition>] [-b <host1:port1,host2:port2,..>]\n"
- "\n"
- "librdkafka version %s (0x%08x)\n"
- "\n"
- " Options:\n"
- " -C | -P Consumer or Producer mode\n"
- " -L Metadata list mode\n"
- " -t <topic> Topic to fetch / produce\n"
- " -p <num> Partition (random partitioner)\n"
- " -k <zookeepers> Zookeeper address (localhost:2181)\n"
- " -z <codec> Enable compression:\n"
- " none|gzip|snappy\n"
- " -o <offset> Start offset (consumer)\n"
- " -e Exit consumer when last message\n"
- " in partition has been received.\n"
- " -d [facs..] Enable debugging contexts:\n"
- " -q Be quiet\n"
- " -A Raw payload output (consumer)\n"
- " %s\n"
- " -X <prop=name> Set arbitrary librdkafka "
- "configuration property\n"
- " Properties prefixed with \"topic.\" "
- "will be set on topic object.\n"
- " Use '-X list' to see the full list\n"
- " of supported properties.\n"
- "\n"
- " In Consumer mode:\n"
- " writes fetched messages to stdout\n"
- " In Producer mode:\n"
- " reads messages from stdin and sends to broker\n"
- " In List mode:\n"
- " queries broker for metadata information, "
- "topic is optional.\n"
- "\n"
- "\n"
- "\n",
- argv[0],
- rd_kafka_version_str(), rd_kafka_version(),
- RD_KAFKA_DEBUG_CONTEXTS);
- exit(1);
- }
-
-
- signal(SIGINT, stop);
- signal(SIGUSR1, sig_usr1);
-
- if (debug &&
- rd_kafka_conf_set(conf, "debug", debug, errstr, sizeof(errstr)) !=
- RD_KAFKA_CONF_OK) {
- fprintf(stderr, "%% Debug configuration failed: %s: %s\n",
- errstr, debug);
- exit(1);
- }
-
- /* Set logger */
- rd_kafka_conf_set_log_cb(conf, logger);
-
- /** Initialize zookeeper */
- zh = initialize_zookeeper(zookeeper, debug != NULL);
-
- /* Add brokers */
- set_brokerlist_from_zookeeper(zh, brokers);
- if (rd_kafka_conf_set(conf, "metadata.broker.list",
- brokers, errstr, sizeof(errstr) !=
- RD_KAFKA_CONF_OK)) {
- fprintf(stderr, "%% Failed to set brokers: %s\n", errstr);
- exit(1);
- }
-
- if (debug) {
- printf("Broker list from zookeeper cluster %s: %s\n", zookeeper, brokers);
- }
-
- if (mode == 'P') {
- /*
- * Producer
- */
- char buf[2048];
- int sendcnt = 0;
-
- /* Set up a message delivery report callback.
- * It will be called once for each message, either on successful
- * delivery to broker, or upon failure to deliver to broker. */
- rd_kafka_conf_set_dr_cb(conf, msg_delivered);
-
- /* Create Kafka handle */
- if (!(rk = rd_kafka_new(RD_KAFKA_PRODUCER, conf,
- errstr, sizeof(errstr)))) {
- fprintf(stderr,
- "%% Failed to create new producer: %s\n",
- errstr);
- exit(1);
- }
-
- /* Create topic */
- rkt = rd_kafka_topic_new(rk, topic, topic_conf);
-
- if (!quiet)
- fprintf(stderr,
- "%% Type stuff and hit enter to send\n");
-
- while (run && fgets(buf, sizeof(buf), stdin)) {
- size_t len = strlen(buf);
- if (buf[len-1] == '\n')
- buf[--len] = '\0';
-
- /* Send/Produce message. */
- if (rd_kafka_produce(rkt, partition,
- RD_KAFKA_MSG_F_COPY,
- /* Payload and length */
- buf, len,
- /* Optional key and its length */
- NULL, 0,
- /* Message opaque, provided in
- * delivery report callback as
- * msg_opaque. */
- NULL) == -1) {
- fprintf(stderr,
- "%% Failed to produce to topic %s "
- "partition %i: %s\n",
- rd_kafka_topic_name(rkt), partition,
- rd_kafka_err2str(
- rd_kafka_errno2err(errno)));
- /* Poll to handle delivery reports */
- rd_kafka_poll(rk, 0);
- continue;
- }
-
- if (!quiet)
- fprintf(stderr, "%% Sent %zd bytes to topic "
- "%s partition %i\n",
- len, rd_kafka_topic_name(rkt), partition);
- sendcnt++;
- /* Poll to handle delivery reports */
- rd_kafka_poll(rk, 0);
- }
-
- /* Poll to handle delivery reports */
- rd_kafka_poll(rk, 0);
-
- /* Wait for messages to be delivered */
- while (run && rd_kafka_outq_len(rk) > 0)
- rd_kafka_poll(rk, 100);
-
- /* Destroy the handle */
- rd_kafka_destroy(rk);
-
- } else if (mode == 'C') {
- /*
- * Consumer
- */
-
- /* Create Kafka handle */
- if (!(rk = rd_kafka_new(RD_KAFKA_CONSUMER, conf,
- errstr, sizeof(errstr)))) {
- fprintf(stderr,
- "%% Failed to create new consumer: %s\n",
- errstr);
- exit(1);
- }
-
- /* Create topic */
- rkt = rd_kafka_topic_new(rk, topic, topic_conf);
-
- /* Start consuming */
- if (rd_kafka_consume_start(rkt, partition, start_offset) == -1){
- fprintf(stderr, "%% Failed to start consuming: %s\n",
- rd_kafka_err2str(rd_kafka_errno2err(errno)));
- exit(1);
- }
-
- while (run) {
- rd_kafka_message_t *rkmessage;
-
- /* Consume single message.
- * See rdkafka_performance.c for high speed
- * consuming of messages. */
- rkmessage = rd_kafka_consume(rkt, partition, 1000);
- if (!rkmessage) /* timeout */
- continue;
-
- msg_consume(rkmessage, NULL);
-
- /* Return message to rdkafka */
- rd_kafka_message_destroy(rkmessage);
- }
-
- /* Stop consuming */
- rd_kafka_consume_stop(rkt, partition);
-
- rd_kafka_topic_destroy(rkt);
-
- rd_kafka_destroy(rk);
-
- } else if (mode == 'L') {
- rd_kafka_resp_err_t err = RD_KAFKA_RESP_ERR_NO_ERROR;
-
- /* Create Kafka handle */
- if (!(rk = rd_kafka_new(RD_KAFKA_PRODUCER, conf,
- errstr, sizeof(errstr)))) {
- fprintf(stderr,
- "%% Failed to create new producer: %s\n",
- errstr);
- exit(1);
- }
-
- /* Create topic */
- if (topic)
- rkt = rd_kafka_topic_new(rk, topic, topic_conf);
- else
- rkt = NULL;
-
- while (run) {
- const struct rd_kafka_metadata *metadata;
-
- /* Fetch metadata */
- err = rd_kafka_metadata(rk, rkt ? 0 : 1, rkt,
- &metadata, 5000);
- if (err != RD_KAFKA_RESP_ERR_NO_ERROR) {
- fprintf(stderr,
- "%% Failed to acquire metadata: %s\n",
- rd_kafka_err2str(err));
- run = 0;
- break;
- }
-
- metadata_print(topic, metadata);
-
- rd_kafka_metadata_destroy(metadata);
- run = 0;
- }
-
- /* Destroy the handle */
- rd_kafka_destroy(rk);
-
- /* Exit right away, dont wait for background cleanup, we haven't
- * done anything important anyway. */
- exit(err ? 2 : 0);
- }
-
- /* Let background threads clean up and terminate cleanly. */
- rd_kafka_wait_destroyed(2000);
-
- /** Free the zookeeper data. */
- zookeeper_close(zh);
-
- return 0;
-}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/7528d23e/thirdparty/librdkafka-0.11.1/lds-gen.py
----------------------------------------------------------------------
diff --git a/thirdparty/librdkafka-0.11.1/lds-gen.py b/thirdparty/librdkafka-0.11.1/lds-gen.py
deleted file mode 100755
index 1136580..0000000
--- a/thirdparty/librdkafka-0.11.1/lds-gen.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env python
-#
-#
-# Generate linker script to only expose symbols of the public API
-#
-
-import sys
-import re
-
-
-if __name__ == '__main__':
-
- funcs = list()
- last_line = ''
-
- for line in sys.stdin:
- m = re.match(r'^(\S+.*\s+\**)?(rd_kafka_\S+)\s*\(', line)
- if m:
- sym = m.group(2)
- # Ignore static (unused) functions
- m2 = re.match(r'(RD_UNUSED|__attribute__\(\(unused\)\))', last_line)
- if not m2:
- funcs.append(sym)
- last_line = ''
- else:
- last_line = line
-
- print('# Automatically generated by lds-gen.py - DO NOT EDIT')
- print('{\n global:')
- if len(funcs) == 0:
- print(' *;')
- else:
- for f in sorted(funcs):
- print(' %s;' % f)
-
- print('local:\n *;')
-
- print('};')
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/7528d23e/thirdparty/librdkafka-0.11.1/mainpage.doxy
----------------------------------------------------------------------
diff --git a/thirdparty/librdkafka-0.11.1/mainpage.doxy b/thirdparty/librdkafka-0.11.1/mainpage.doxy
deleted file mode 100644
index 97f2456..0000000
--- a/thirdparty/librdkafka-0.11.1/mainpage.doxy
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * @mainpage librdkafka documentation
- *
- * librdkafka is the Apache Kafka C/C++ client library.
- *
- * @section intro Introduction
- *
- * For an introduction and manual to librdkafka see INTRODUCTION.md
- *
- * @section conf Configuration
- *
- * librdkafka is highly configurable to meet any deployment demands.
- * It is usually safe to leave most configuration properties to their default
- * values.
- *
- * See CONFIGURATION.md for the full list of supported configuration properties.
- *
- * @remark Application developers are recommended to provide a non-hardcoded
- * interface to librdkafka's string based name-value configuration
- * property interface, allowing users to configure any librdkafka
- * property directly without alterations to the application.
- * This allows for seamless upgrades where linking to a new version
- * of librdkafka automatically provides new configuration
- * based features.
-
- *
- * @section c_api C API
- *
- * The C API is documented in rdkafka.h
- *
- * @section cpp_api C++ API
- *
- * The C++ API is documented in rdkafkacpp.h
- */
-
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/7528d23e/thirdparty/librdkafka-0.11.1/mklove/Makefile.base
----------------------------------------------------------------------
diff --git a/thirdparty/librdkafka-0.11.1/mklove/Makefile.base b/thirdparty/librdkafka-0.11.1/mklove/Makefile.base
deleted file mode 100755
index 5f2b775..0000000
--- a/thirdparty/librdkafka-0.11.1/mklove/Makefile.base
+++ /dev/null
@@ -1,193 +0,0 @@
-# Base Makefile providing various standard targets
-# Part of mklove suite but may be used independently.
-
-MKL_RED?= \033[031m
-MKL_GREEN?= \033[032m
-MKL_YELLOW?= \033[033m
-MKL_BLUE?= \033[034m
-MKL_CLR_RESET?= \033[0m
-
-DEPS= $(OBJS:%.o=%.d)
-
-# TOPDIR is "TOPDIR/mklove/../" i.e., TOPDIR.
-# We do it with two dir calls instead of /.. to support mklove being symlinked.
-MKLOVE_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
-TOPDIR = $(MKLOVE_DIR:mklove/=.)
-
-
-# Convert LIBNAME ("libxyz") to "xyz"
-LIBNAME0=$(LIBNAME:lib%=%)
-
-# Silence lousy default ARFLAGS (rv)
-ARFLAGS=
-
-ifndef MKL_MAKEFILE_CONFIG
--include $(TOPDIR)/Makefile.config
-endif
-
-_UNAME_S := $(shell uname -s)
-ifeq ($(_UNAME_S),Darwin)
- LIBFILENAME=$(LIBNAME).$(LIBVER)$(SOLIB_EXT)
- LIBFILENAMELINK=$(LIBNAME)$(SOLIB_EXT)
-else
- LIBFILENAME=$(LIBNAME)$(SOLIB_EXT).$(LIBVER)
- LIBFILENAMELINK=$(LIBNAME)$(SOLIB_EXT)
-endif
-
-INSTALL?= install
-INSTALL_PROGRAM?= $(INSTALL)
-INSTALL_DATA?= $(INSTALL) -m 644
-
-prefix?= /usr/local
-exec_prefix?= $(prefix)
-bindir?= $(exec_prefix)/bin
-sbindir?= $(exec_prefix)/sbin
-libexecdir?= $(exec_prefix)/libexec/ # append PKGNAME on install
-datarootdir?= $(prefix)/share
-datadir?= $(datarootdir) # append PKGNAME on install
-sysconfdir?= $(prefix)/etc
-sharedstatedir?=$(prefix)/com
-localestatedir?=$(prefix)/var
-runstatedir?= $(localestatedir)/run
-includedir?= $(prefix)/include
-docdir?= $(datarootdir)/doc/$(PKGNAME)
-infodir?= $(datarootdir)/info
-libdir?= $(prefix)/lib
-localedir?= $(datarootdir)/locale
-pkgconfigdir?= $(libdir)/pkgconfig
-mandir?= $(datarootdir)/man
-man1dir?= $(mandir)/man1
-man2dir?= $(mandir)/man2
-man3dir?= $(mandir)/man3
-man4dir?= $(mandir)/man4
-man5dir?= $(mandir)/man5
-man6dir?= $(mandir)/man6
-man7dir?= $(mandir)/man7
-man8dir?= $(mandir)/man8
-
-
-# Checks that mklove is set up and ready for building
-mklove-check:
- @if [ ! -f "$(TOPDIR)/Makefile.config" ]; then \
- printf "$(MKL_RED)$(TOPDIR)/Makefile.config missing: please run ./configure$(MKL_CLR_RESET)\n" ; \
- exit 1 ; \
- fi
-
-%.o: %.c
- $(CC) -MD -MP $(CPPFLAGS) $(CFLAGS) -c $< -o $@
-
-%.o: %.cpp
- $(CXX) -MD -MP $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
-
-
-lib: $(LIBFILENAME) $(LIBNAME).a $(LIBFILENAMELINK) lib-gen-pkg-config
-
-$(LIBNAME).lds: #overridable
-
-$(LIBFILENAME): $(OBJS) $(LIBNAME).lds
- @printf "$(MKL_YELLOW)Creating shared library $@$(MKL_CLR_RESET)\n"
- $(CC) $(LDFLAGS) $(LIB_LDFLAGS) $(OBJS) -o $@ $(LIBS)
-
-$(LIBNAME).a: $(OBJS)
- @printf "$(MKL_YELLOW)Creating static library $@$(MKL_CLR_RESET)\n"
- $(AR) rcs$(ARFLAGS) $@ $(OBJS)
-
-$(LIBFILENAMELINK): $(LIBFILENAME)
- @printf "$(MKL_YELLOW)Creating $@ symlink$(MKL_CLR_RESET)\n"
- rm -f "$@" && ln -s "$^" "$@"
-
-
-# pkg-config .pc file definition
-ifeq ($(GEN_PKG_CONFIG),y)
-define _PKG_CONFIG_DEF
-prefix=$(prefix)
-libdir=$(libdir)
-includedir=$(includedir)
-
-Name: $(LIBNAME)
-Description: $(MKL_APP_DESC_ONELINE)
-Version: $(MKL_APP_VERSION)
-Cflags: -I$${includedir}
-Libs: -L$${libdir} -l$(LIBNAME0)
-Libs.private: $(patsubst -L%,,$(LIBS))
-endef
-
-export _PKG_CONFIG_DEF
-
-$(LIBNAME0).pc: $(TOPDIR)/Makefile.config
- @printf "$(MKL_YELLOW)Generating pkg-config file $@$(MKL_CLR_RESET)\n"
- @echo "$$_PKG_CONFIG_DEF" > $@
-
-lib-gen-pkg-config: $(LIBNAME0).pc
-
-lib-clean-pkg-config:
- rm -f $(LIBNAME0).pc
-else
-lib-gen-pkg-config:
-lib-clean-pkg-config:
-endif
-
-
-$(BIN): $(OBJS)
- @printf "$(MKL_YELLOW)Creating program $@$(MKL_CLR_RESET)\n"
- $(CC) $(CPPFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(LIBS)
-
-
-file-check:
- @printf "$(MKL_YELLOW)Checking $(LIBNAME) integrity$(MKL_CLR_RESET)\n"
- @RET=true ; \
- for f in $(CHECK_FILES) ; do \
- printf "%-30s " $$f ; \
- if [ -f "$$f" ]; then \
- printf "$(MKL_GREEN)OK$(MKL_CLR_RESET)\n" ; \
- else \
- printf "$(MKL_RED)MISSING$(MKL_CLR_RESET)\n" ; \
- RET=false ; \
- fi ; \
- done ; \
- $$RET
-
-
-lib-install:
- @printf "$(MKL_YELLOW)Install $(LIBNAME) to $$DESTDIR$(prefix)$(MKL_CLR_RESET)\n"
- $(INSTALL) -d $$DESTDIR$(includedir)/$(PKGNAME) ; \
- $(INSTALL) -d $$DESTDIR$(libdir) ; \
- $(INSTALL) $(HDRS) $$DESTDIR$(includedir)/$(PKGNAME) ; \
- $(INSTALL) $(LIBNAME).a $$DESTDIR$(libdir) ; \
- $(INSTALL) $(LIBFILENAME) $$DESTDIR$(libdir) ; \
- [ -f "$(LIBNAME0).pc" ] && ( \
- $(INSTALL) -d $$DESTDIR$(pkgconfigdir) ; \
- $(INSTALL) -m 0644 $(LIBNAME0).pc $$DESTDIR$(pkgconfigdir) \
- ) ; \
- (cd $$DESTDIR$(libdir) && ln -sf $(LIBFILENAME) $(LIBFILENAMELINK))
-
-lib-uninstall:
- @printf "$(MKL_YELLOW)Uninstall $(LIBNAME) from $$DESTDIR$(prefix)$(MKL_CLR_RESET)\n"
- for hdr in $(HDRS) ; do \
- rm -f $$DESTDIR$(includedir)/$(PKGNAME)/$$hdr ; done
- rm -f $$DESTDIR$(libdir)/$(LIBNAME).a
- rm -f $$DESTDIR$(libdir)/$(LIBFILENAME)
- rm -f $$DESTDIR$(libdir)/$(LIBFILENAMELINK)
- rmdir $$DESTDIR$(includedir)/$(PKGNAME) || true
-
-
-
-bin-install:
- @printf "$(MKL_YELLOW)Install $(BIN) to $$DESTDIR$(prefix)$(MKL_CLR_RESET)\n"
- $(INSTALL) -d $$DESTDIR$(bindir) && \
- $(INSTALL) $(BIN) $$DESTDIR$(bindir)
-
-bin-uninstall:
- @printf "$(MKL_YELLOW)Uninstall $(BIN) from $$DESTDIR$(prefix)$(MKL_CLR_RESET)\n"
- rm -f $$DESTDIR$(bindir)/$(BIN)
-
-
-generic-clean:
- rm -f $(OBJS) $(DEPS)
-
-lib-clean: generic-clean lib-clean-pkg-config
- rm -f $(LIBNAME)*.a $(LIBFILENAME) $(LIBFILENAMELINK) \
- $(LIBNAME).lds
-
-bin-clean: generic-clean
- rm -f $(BIN)
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/7528d23e/thirdparty/librdkafka-0.11.1/mklove/modules/configure.atomics
----------------------------------------------------------------------
diff --git a/thirdparty/librdkafka-0.11.1/mklove/modules/configure.atomics b/thirdparty/librdkafka-0.11.1/mklove/modules/configure.atomics
deleted file mode 100644
index 31639a7..0000000
--- a/thirdparty/librdkafka-0.11.1/mklove/modules/configure.atomics
+++ /dev/null
@@ -1,144 +0,0 @@
-#!/bin/bash
-#
-# Checks for atomic ops:
-# compiler builtin (__sync_..) and portable libatomic's (__atomic_..)
-# Will also provide abstraction by defining the prefix to use.
-#
-# Sets:
-# HAVE_ATOMICS
-# HAVE_ATOMICS_32
-# HAVE_ATOMICS_64
-# HAVE_ATOMICS_32_ATOMIC __atomic interface
-# HAVE_ATOMICS_32_SYNC __sync interface
-# HAVE_ATOMICS_64_ATOMIC __atomic interface
-# HAVE_ATOMICS_64_SYNC __sync interface
-# WITH_LIBATOMIC
-# LIBS
-#
-# ATOMIC_OP(OP1,OP2,PTR,VAL)
-# ATOMIC_OP32(OP1,OP2,PTR,VAL)
-# ATOMIC_OP64(OP1,OP2,PTR,VAL)
-# where op* is 'add,sub,fetch'
-# e.g: ATOMIC_OP32(add, fetch, &i, 10)
-# becomes __atomic_add_fetch(&i, 10, ..) or
-# __sync_add_and_fetch(&i, 10)
-#
-
-function checks {
-
-
- # We prefer the newer __atomic stuff, but 64-bit atomics might
- # require linking with -latomic, so we need to perform these tests
- # in the proper order:
- # __atomic 32
- # __atomic 32 -latomic
- # __sync 32
- #
- # __atomic 64
- # __atomic 64 -latomic
- # __sync 64
-
- local _libs=
- local _a32="__atomic_ ## OP1 ## _ ## OP2(PTR, VAL, __ATOMIC_SEQ_CST)"
- local _a64="__atomic_ ## OP1 ## _ ## OP2(PTR, VAL, __ATOMIC_SEQ_CST)"
-
- # 32-bit:
- # Try fully builtin __atomic
- if ! mkl_compile_check __atomic_32 HAVE_ATOMICS_32 cont CC "" \
- "
-#include <inttypes.h>
-int32_t foo (int32_t i) {
- return __atomic_add_fetch(&i, 1, __ATOMIC_SEQ_CST);
-}"
- then
- # Try __atomic with -latomic
- if mkl_compile_check --ldflags="-latomic" __atomic_32_lib HAVE_ATOMICS_32 \
- cont CC "" \
- "
-#include <inttypes.h>
-int32_t foo (int32_t i) {
- return __atomic_add_fetch(&i, 1, __ATOMIC_SEQ_CST);
-}"
- then
- _libs="-latomic"
- mkl_allvar_set "__atomic_32_lib" "HAVE_ATOMICS_32_ATOMIC" "y"
- else
- # Try __sync interface
- if mkl_compile_check __sync_32 HAVE_ATOMICS_32 disable CC "" \
- "
-#include <inttypes.h>
-int32_t foo (int32_t i) {
- return __sync_add_and_fetch(&i, 1);
-}"
- then
- _a32="__sync_ ## OP1 ## _and_ ## OP2(PTR, VAL)"
- mkl_allvar_set "__sync_32" "HAVE_ATOMICS_32_SYNC" "y"
- else
- _a32=""
- fi
- fi
- else
- mkl_allvar_set "__atomic_32" "HAVE_ATOMICS_32_ATOMIC" "y"
- fi
-
-
- if [[ ! -z $_a32 ]]; then
- mkl_define_set "atomic_32" "ATOMIC_OP32(OP1,OP2,PTR,VAL)" "code:$_a32"
- fi
-
-
-
- # 64-bit:
- # Try fully builtin __atomic
- if ! mkl_compile_check __atomic_64 HAVE_ATOMICS_64 cont CC "" \
- "
-#include <inttypes.h>
-int64_t foo (int64_t i) {
- return __atomic_add_fetch(&i, 1, __ATOMIC_SEQ_CST);
-}"
- then
- # Try __atomic with -latomic
- if mkl_compile_check --ldflags="-latomic" __atomic_64_lib HAVE_ATOMICS_64 \
- cont CC "" \
- "
-#include <inttypes.h>
-int64_t foo (int64_t i) {
- return __atomic_add_fetch(&i, 1, __ATOMIC_SEQ_CST);
-}"
- then
- _libs="-latomic"
- mkl_allvar_set "__atomic_64_lib" "HAVE_ATOMICS_64_ATOMIC" "y"
- else
- # Try __sync interface
- if mkl_compile_check __sync_64 HAVE_ATOMICS_64 disable CC "" \
- "
-#include <inttypes.h>
-int64_t foo (int64_t i) {
- return __sync_add_and_fetch(&i, 1);
-}"
- then
- _a64="__sync_ ## OP1 ## _and_ ## OP2 (PTR, VAL)"
- mkl_allvar_set "__sync_64" "HAVE_ATOMICS_64_SYNC" "y"
- else
- _a64=""
- fi
- fi
- else
- mkl_allvar_set "__atomic_64" "HAVE_ATOMICS_64_ATOMIC" "y"
- fi
-
-
- if [[ ! -z $_a64 ]]; then
- mkl_define_set "atomic_64" "ATOMIC_OP64(OP1,OP2,PTR,VAL)" "code:$_a64"
-
- # Define generic ATOMIC() macro identical to 64-bit atomics"
- mkl_define_set "atomic_64" "ATOMIC_OP(OP1,OP2,PTR,VAL)" "code:$_a64"
- fi
-
-
- if [[ ! -z $_libs ]]; then
- mkl_mkvar_append LDFLAGS LDFLAGS "-Wl,--as-needed"
- mkl_mkvar_append LIBS LIBS "$_libs"
- fi
-
-}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/7528d23e/thirdparty/librdkafka-0.11.1/mklove/modules/configure.base
----------------------------------------------------------------------
diff --git a/thirdparty/librdkafka-0.11.1/mklove/modules/configure.base b/thirdparty/librdkafka-0.11.1/mklove/modules/configure.base
deleted file mode 100644
index df9c779..0000000
--- a/thirdparty/librdkafka-0.11.1/mklove/modules/configure.base
+++ /dev/null
@@ -1,1772 +0,0 @@
-#!/bin/bash
-#
-#
-# mklove base configure module, implements the mklove configure framework
-#
-
-MKL_MODULES="base"
-MKL_CACHEVARS=""
-MKL_MKVARS=""
-MKL_DEFINES=""
-MKL_CHECKS=""
-MKL_LOAD_STACK=""
-
-MKL_IDNEXT=1
-
-MKL_OUTMK=_mklout.mk
-MKL_OUTH=_mklout.h
-MKL_OUTDBG=config.log
-
-MKL_GENERATORS="base:mkl_generate_late_vars"
-MKL_CLEANERS=""
-
-MKL_FAILS=""
-MKL_LATE_VARS=""
-
-MKL_OPTS_SET=""
-
-MKL_RED=""
-MKL_GREEN=""
-MKL_YELLOW=""
-MKL_BLUE=""
-MKL_CLR_RESET=""
-
-
-MKL_NO_DOWNLOAD=0
-
-if [[ -z "$MKL_REPO_URL" ]]; then
- MKL_REPO_URL="http://github.com/edenhill/mklove/raw/master"
-fi
-
-
-
-# Default mklove directory to PWD/mklove
-[[ -z "$MKLOVE_DIR" ]] && MKLOVE_DIR=mklove
-
-
-###########################################################################
-#
-# Variable types:
-# env - Standard environment variables.
-# var - mklove runtime variable, cached or not.
-# mkvar - Makefile variables, also sets runvar
-# define - config.h variables/defines
-#
-###########################################################################
-
-# Low level variable assignment
-# Arguments:
-# variable name
-# variable value
-function mkl_var0_set {
- export "$1"="$2"
-}
-
-# Sets a runtime variable (only used during configure)
-# If cache=1 these variables are cached to config.cache.
-# Arguments:
-# variable name
-# variable value
-# [ "cache" ]
-function mkl_var_set {
- mkl_var0_set "$1" "$2"
- if [[ $3 == "cache" ]]; then
- if ! mkl_in_list "$MKL_CACHEVARS" "$1" ; then
- MKL_CACHEVARS="$MKL_CACHEVARS $1"
- fi
- fi
-}
-
-# Unsets a mkl variable
-# Arguments:
-# variable name
-function mkl_var_unset {
- unset $1
-}
-
-# Appends to a mkl variable (space delimited)
-# Arguments:
-# variable name
-# variable value
-function mkl_var_append {
- if [[ -z ${!1} ]]; then
- mkl_var_set "$1" "$2"
- else
- mkl_var0_set "$1" "${!1} $2"
- fi
-}
-
-
-# Prepends to a mkl variable (space delimited)
-# Arguments:
-# variable name
-# variable value
-function mkl_var_prepend {
- if [[ -z ${!1} ]]; then
- mkl_var_set "$1" "$2"
- else
- mkl_var0_set "$1" "$2 ${!1}"
- fi
-}
-
-# Shift the first word off a variable.
-# Arguments:
-# variable name
-function mkl_var_shift {
- local n="${!1}"
- mkl_var0_set "$1" "${n#* }"
- return 0
-}
-
-
-# Returns the contents of mkl variable
-# Arguments:
-# variable name
-function mkl_var_get {
- echo "${!1}"
-}
-
-
-
-
-# Set environment variable (runtime)
-# These variables are not cached nor written to any of the output files,
-# its just simply a helper wrapper for standard envs.
-# Arguments:
-# varname
-# varvalue
-function mkl_env_set {
- mkl_var0_set "$1" "$2"
-}
-
-# Append to environment variable
-# Arguments:
-# varname
-# varvalue
-# [ separator (" ") ]
-function mkl_env_append {
- local sep=" "
- if [[ -z ${!1} ]]; then
- mkl_env_set "$1" "$2"
- else
- [ ! -z ${3} ] && sep="$3"
- mkl_var0_set "$1" "${!1}${sep}$2"
- fi
-
-}
-
-# Prepend to environment variable
-# Arguments:
-# varname
-# varvalue
-# [ separator (" ") ]
-function mkl_env_prepend {
- local sep=" "
- if [[ -z ${!1} ]]; then
- mkl_env_set "$1" "$2"
- else
- [ ! -z ${3} ] && sep="$3"
- mkl_var0_set "$1" "$2${sep}${!1}"
- fi
-
-}
-
-
-
-
-# Set a make variable (Makefile.config)
-# Arguments:
-# config name
-# variable name
-# value
-function mkl_mkvar_set {
- if [[ ! -z $2 ]]; then
- mkl_env_set "$2" "$3"
- mkl_in_list "$MKL_MKVARS" "$2"|| mkl_env_append MKL_MKVARS $2
- fi
-}
-
-
-# Prepends to a make variable (Makefile.config)
-# Arguments:
-# config name
-# variable name
-# value
-function mkl_mkvar_prepend {
- if [[ ! -z $2 ]]; then
- mkl_env_prepend "$2" "$3"
- mkl_in_list "$MKL_MKVARS" "$2"|| mkl_env_append MKL_MKVARS $2
- fi
-}
-
-
-# Appends to a make variable (Makefile.config)
-# Arguments:
-# config name
-# variable name
-# value
-function mkl_mkvar_append {
- if [[ ! -z $2 ]]; then
- mkl_env_append "$2" "$3"
- mkl_in_list "$MKL_MKVARS" "$2"|| mkl_env_append MKL_MKVARS $2
- fi
-}
-
-
-# Prepends to a make variable (Makefile.config)
-# Arguments:
-# config name
-# variable name
-# value
-function mkl_mkvar_prepend {
- if [[ ! -z $2 ]]; then
- mkl_env_prepend "$2" "$3"
- mkl_in_list "$MKL_MKVARS" "$2"|| mkl_env_append MKL_MKVARS $2
- fi
-}
-
-# Return mkvar variable value
-# Arguments:
-# variable name
-function mkl_mkvar_get {
- [[ -z ${!1} ]] && return 1
- echo ${!1}
- return 0
-}
-
-
-
-# Defines a config header define (config.h)
-# Arguments:
-# config name
-# define name
-# define value (optional, default: 1)
-# if value starts with code: then no "" are added
-function mkl_define_set {
-
- if [[ -z $2 ]]; then
- return 0
- fi
-
- local stmt=""
- local defid=
- if [[ $2 = *\(* ]]; then
- # macro
- defid="def_${2%%(*}"
- else
- # define
- defid="def_$2"
- fi
-
- [[ -z $1 ]] || stmt="// $1\n"
-
- local val="$3"
- if [[ -z "$val" ]]; then
- val="$(mkl_def $2 1)"
- fi
-
- # Define as code, string or integer?
- if [[ $val == code:* ]]; then
- # Code block, copy verbatim without quotes, strip code: prefix
- val=${val#code:}
- elif [[ ! ( "$val" =~ ^[0-9]+([lL]?[lL][dDuU]?)?$ || \
- "$val" =~ ^0x[0-9a-fA-F]+([lL]?[lL][dDuU]?)?$ ) ]]; then
- # String: quote
- val="\"$val\""
- fi
- # else: unquoted integer/hex
-
- stmt="${stmt}#define $2 $val"
- mkl_env_set "$defid" "$stmt"
- mkl_env_append MKL_DEFINES "$defid"
-}
-
-
-
-
-
-# Sets "all" configuration variables, that is:
-# for name set: Makefile variable, config.h define
-# Will convert value "y"|"n" to 1|0 for config.h
-# Arguments:
-# config name
-# variable name
-# value
-function mkl_allvar_set {
- mkl_mkvar_set "$1" "$2" "$3"
- local val=$3
- if [[ $3 = "y" ]]; then
- val=1
- elif [[ $3 = "n" ]]; then
- val=0
- fi
- mkl_define_set "$1" "$2" "$val"
-}
-
-
-
-
-###########################################################################
-#
-#
-# Check failure functionality
-#
-#
-###########################################################################
-
-
-# Summarize all fatal failures and then exits.
-function mkl_fail_summary {
- echo "
-
-"
-
- local pkg_cmd=""
- local install_pkgs=""
- mkl_err "###########################################################"
- mkl_err "### Configure failed ###"
- mkl_err "###########################################################"
- mkl_err "### Accumulated failures: ###"
- mkl_err "###########################################################"
- local n
- for n in $MKL_FAILS ; do
- local conf=$(mkl_var_get MKL_FAIL__${n}__conf)
- mkl_err " $conf ($(mkl_var_get MKL_FAIL__${n}__define)) $(mkl_meta_get $conf name)"
- if mkl_meta_exists $conf desc; then
- mkl_err0 " desc: $MKL_YELLOW$(mkl_meta_get $conf desc)$MKL_CLR_RESET"
- fi
- mkl_err0 " module: $(mkl_var_get MKL_FAIL__${n}__module)"
- mkl_err0 " action: $(mkl_var_get MKL_FAIL__${n}__action)"
- mkl_err0 " reason:
-$(mkl_var_get MKL_FAIL__${n}__reason)
-"
- # Dig up some metadata to assist the user
- case $MKL_DISTRO in
- Debian|Ubuntu|*)
- local debs=$(mkl_meta_get $conf "deb")
- pkg_cmd="sudo apt-get install"
- if [[ ${#debs} > 0 ]]; then
- install_pkgs="$install_pkgs $debs"
- fi
- ;;
- esac
- done
-
- if [[ ! -z $install_pkgs ]]; then
- mkl_err "###########################################################"
- mkl_err "### Installing the following packages might help: ###"
- mkl_err "###########################################################"
- mkl_err0 "$pkg_cmd $install_pkgs"
- mkl_err0 ""
- fi
- exit 1
-}
-
-
-# Checks if there were failures.
-# Returns 0 if there were no failures, else calls failure summary and exits.
-function mkl_check_fails {
- if [[ ${#MKL_FAILS} = 0 ]]; then
- return 0
- fi
- mkl_fail_summary
-}
-
-# A check has failed but we want to carry on (and we should!).
-# We fail it all later.
-# Arguments:
-# config name
-# define name
-# action
-# reason
-function mkl_fail {
- local n="$(mkl_env_esc "$1")"
- mkl_var_set "MKL_FAIL__${n}__conf" "$1"
- mkl_var_set "MKL_FAIL__${n}__module" $MKL_MODULE
- mkl_var_set "MKL_FAIL__${n}__define" $2
- mkl_var_set "MKL_FAIL__${n}__action" "$3"
- if [[ -z $(mkl_var_get "MKL_FAIL__${n}__reason") ]]; then
- mkl_var_set "MKL_FAIL__${n}__reason" "$4"
- else
- mkl_var_append "MKL_FAIL__${n}__reason" "
-And also:
-$4"
- fi
- mkl_in_list "$MKL_FAILS" "$n" || mkl_var_append MKL_FAILS "$n"
-}
-
-
-# A check failed, handle it
-# Arguments:
-# config name
-# define name
-# action (fail|disable|ignore|cont)
-# reason
-function mkl_check_failed {
- # Override action based on require directives, unless the action is
- # set to cont (for fallthrough to sub-sequent tests).
- local action="$3"
- if [[ $3 != "cont" ]]; then
- action=$(mkl_meta_get "MOD__$MKL_MODULE" "override_action" $3)
- fi
-
- # --fail-fatal option
- [[ $MKL_FAILFATAL ]] && action="fail"
-
- mkl_check_done "$1" "$2" "$action" "failed"
-
- mkl_dbg "Check $1 ($2, action $action (originally $3)) failed: $4"
-
-
- case $action in
- fail)
- # Check failed fatally, fail everything eventually
- mkl_fail "$1" "$2" "$3" "$4$extra"
- return 1
- ;;
-
- disable)
- # Check failed, disable
- [[ ! -z $2 ]] && mkl_mkvar_set "$1" "$2" "n"
- return 1
- ;;
- ignore)
- # Check failed but we ignore the results and set it anyway.
- [[ ! -z $2 ]] && mkl_define_set "$1" "$2" "1"
- [[ ! -z $2 ]] && mkl_mkvar_set "$1" "$2" "y"
- return 1
- ;;
- cont)
- # Check failed but we ignore the results and do nothing.
- return 0
- ;;
- esac
-}
-
-
-
-
-###########################################################################
-#
-#
-# Output generators
-#
-#
-###########################################################################
-
-# Generate late variables.
-# Late variables are those referenced in command line option defaults
-# but then never set by --option.
-function mkl_generate_late_vars {
- local n
- for n in $MKL_LATE_VARS ; do
- local func=${n%:*}
- local safeopt=${func#opt_}
- local val=${n#*:}
- if mkl_in_list "$MKL_OPTS_SET" "$safeopt" ; then
- # Skip options set explicitly with --option
- continue
- fi
- # Expand variable references "\$foo" by calling eval
- # and pass it opt_... function.
- $func "$(eval echo $val)"
- done
-}
-
-# Generate output files.
-# Must be called following a succesful configure run.
-function mkl_generate {
- local mf=
- for mf in $MKL_GENERATORS ; do
- MKL_MODULE=${mf%:*}
- local func=${mf#*:}
- $func || exit 1
- done
-
- mkl_write_mk "# Automatically generated by $0 $*"
- mkl_write_mk "# Config variables"
- mkl_write_mk "#"
- mkl_write_mk "# Generated by:"
- mkl_write_mk "# $MKL_CONFIGURE_ARGS"
- mkl_write_mk ""
-
- # This variable is used by Makefile.base to avoid multiple inclusions.
- mkl_write_mk "MKL_MAKEFILE_CONFIG=y"
-
- # Export colors to Makefile.config
- mkl_write_mk "MKL_RED=\t${MKL_RED}"
- mkl_write_mk "MKL_GREEN=\t${MKL_GREEN}"
- mkl_write_mk "MKL_YELLOW=\t${MKL_YELLOW}"
- mkl_write_mk "MKL_BLUE=\t${MKL_BLUE}"
- mkl_write_mk "MKL_CLR_RESET=\t${MKL_CLR_RESET}"
-
- local n=
- for n in $MKL_MKVARS ; do
- # Some special variables should be prefixable by the caller, so
- # define them in the makefile as appends.
- local op="="
- case $n in
- CFLAGS|CPPFLAGS|CXXFLAGS|LDFLAGS|LIBS)
- op="+="
- ;;
- esac
- mkl_write_mk "$n$op\t${!n}"
- done
- mkl_write_mk "# End of config variables"
-
- MKL_OUTMK_FINAL=Makefile.config
- mv $MKL_OUTMK $MKL_OUTMK_FINAL
-
- echo "Generated $MKL_OUTMK_FINAL"
-
- # Generate config.h
- mkl_write_h "// Automatically generated by $0 $*"
- mkl_write_h "#pragma once"
- for n in $MKL_DEFINES ; do
- mkl_write_h "${!n}"
- done
-
- MKL_OUTH_FINAL=config.h
- mv $MKL_OUTH $MKL_OUTH_FINAL
-
- echo "Generated $MKL_OUTH_FINAL"
-}
-
-# Remove file noisily, if it exists
-function mkl_rm {
- if [[ -f $fname ]]; then
- echo "Removing $fname"
- rm -f "$fname"
- fi
-}
-
-# Remove files generated by configure
-function mkl_clean {
- for fname in Makefile.config config.h config.cache config.log ; do
- mkl_rm "$fname"
- done
-
- local mf=
- for mf in $MKL_CLEANERS ; do
- MKL_MODULE=${mf%:*}
- local func=${mf#*:}
- $func || exit 1
- done
-
-}
-
-
-# Print summary of succesful configure run
-function mkl_summary {
-
- echo "
-Configuration summary:"
- local n=
- for n in $MKL_MKVARS ; do
- # Skip the boring booleans
- if [[ $n == WITH_* || $n == WITHOUT_* || $n == HAVE_* || $n == def_* ]]; then
- continue
- fi
- printf " %-24s %s\n" "$n" "${!n}"
- done
-}
-
-
-
-# Write to mk file
-# Argument:
-# string ..
-function mkl_write_mk {
- echo -e "$*" >> $MKL_OUTMK
-}
-
-# Write to header file
-# Argument:
-# string ..
-function mkl_write_h {
- echo -e "$*" >> $MKL_OUTH
-}
-
-
-
-###########################################################################
-#
-#
-# Logging and debugging
-#
-#
-###########################################################################
-
-# Debug print
-# Only visible on terminal if MKL_DEBUG is set.
-# Always written to config.log
-# Argument:
-# string ..
-function mkl_dbg {
- if [[ ! -z $MKL_DEBUG ]]; then
- echo -e "${MKL_BLUE}DBG:$$: $*${MKL_CLR_RESET}" 1>&2
- fi
- echo "DBG: $*" >> $MKL_OUTDBG
-}
-
-# Error print (with color)
-# Always printed to terminal and config.log
-# Argument:
-# string ..
-function mkl_err {
- echo -e "${MKL_RED}$*${MKL_CLR_RESET}" 1>&2
- echo "$*" >> $MKL_OUTDBG
-}
-
-# Same as mkl_err but without coloring
-# Argument:
-# string ..
-function mkl_err0 {
- echo -e "$*" 1>&2
- echo "$*" >> $MKL_OUTDBG
-}
-
-# Standard print
-# Always printed to terminal and config.log
-# Argument:
-# string ..
-function mkl_info {
- echo -e "$*" 1>&2
- echo -e "$*" >> $MKL_OUTDBG
-}
-
-
-
-
-
-
-
-###########################################################################
-#
-#
-# Misc helpers
-#
-#
-###########################################################################
-
-# Returns the absolute path (but not necesarily canonical) of the first argument
-function mkl_abspath {
- echo $1 | sed -e "s|^\([^/]\)|$PWD/\1|"
-}
-
-# Returns true (0) if function $1 exists, else false (1)
-function mkl_func_exists {
- declare -f "$1" > /dev/null
- return $?
-}
-
-# Rename function.
-# Returns 0 on success or 1 if old function (origname) was not defined.
-# Arguments:
-# origname
-# newname
-function mkl_func_rename {
- if ! mkl_func_exists $1 ; then
- return 1
- fi
- local orig=$(declare -f $1)
- local new="$2${orig#$1}"
- eval "$new"
- unset -f "$1"
- return 0
-}
-
-
-# Push module function for later call by mklove.
-# The function is renamed to an internal name.
-# Arguments:
-# list variable name
-# module name
-# function name
-function mkl_func_push {
- local newfunc="__mkl__f_${2}_$(( MKL_IDNEXT++ ))"
- if mkl_func_rename "$3" "$newfunc" ; then
- mkl_var_append "$1" "$2:$newfunc"
- fi
-}
-
-
-
-# Returns value, or the default string if value is empty.
-# Arguments:
-# value
-# default
-function mkl_def {
- if [[ ! -z $1 ]]; then
- echo $1
- else
- echo $2
- fi
-}
-
-
-# Render a string (e.g., evaluate its $varrefs)
-# Arguments:
-# string
-function mkl_render {
- if [[ $* == *\$* ]]; then
- eval "echo $*"
- else
- echo "$*"
- fi
-}
-
-# Escape a string so that it becomes suitable for being an env variable.
-# This is a destructive operation and the original string cannot be restored.
-function mkl_env_esc {
- echo $* | LC_ALL=C sed -e 's/[^a-zA-Z0-9_]/_/g'
-}
-
-# Convert arguments to upper case
-function mkl_upper {
- echo "$*" | tr '[:lower:]' '[:upper:]'
-}
-
-# Convert arguments to lower case
-function mkl_lower {
- echo "$*" | tr '[:upper:]' '[:lower:]'
-}
-
-
-# Checks if element is in list
-# Arguments:
-# list
-# element
-function mkl_in_list {
- local n
- for n in $1 ; do
- [[ $n == $2 ]] && return 0
- done
- return 1
-}
-
-
-
-
-###########################################################################
-#
-#
-# Cache functionality
-#
-#
-###########################################################################
-
-
-# Write cache file
-function mkl_cache_write {
- [[ ! -z "$MKL_NOCACHE" ]] && return 0
- echo "# mklove configure cache file generated at $(date)" > config.cache
- for n in $MKL_CACHEVARS ; do
- echo "$n=${!n}" >> config.cache
- done
- echo "Generated config.cache"
-}
-
-
-# Read cache file
-function mkl_cache_read {
- [[ ! -z "$MKL_NOCACHE" ]] && return 0
- [ -f config.cache ] || return 1
-
- echo "using cache file config.cache"
-
- local ORIG_IFS=$IFS
- IFS="$IFS="
- while read -r n v ; do
- [[ -z $n || $n = \#* || -z $v ]] && continue
- mkl_var_set $n $v cache
- done < config.cache
- IFS=$ORIG_IFS
-}
-
-
-###########################################################################
-#
-#
-# Config name meta data
-#
-#
-###########################################################################
-
-# Set metadata for config name
-# This metadata is used by mkl in various situations
-# Arguments:
-# config name
-# metadata key
-# metadata value (appended)
-function mkl_meta_set {
- local metaname="mkl__$1__$2"
- eval "$metaname=\"\$$metaname $3\""
-}
-
-# Returns metadata for config name
-# Arguments:
-# config name
-# metadata key
-# default (optional)
-function mkl_meta_get {
- local metaname="mkl__$1__$2"
- if [[ ! -z ${!metaname} ]]; then
- echo ${!metaname}
- else
- echo "$3"
- fi
-}
-
-# Checks if metadata exists
-# Arguments:
-# config name
-# metadata key
-function mkl_meta_exists {
- local metaname="mkl__$1__$2"
- if [[ ! -z ${!metaname} ]]; then
- return 0
- else
- return 1
- fi
-}
-
-
-
-
-
-###########################################################################
-#
-#
-# Check framework
-#
-#
-###########################################################################
-
-
-# Print that a check is beginning to run
-# Returns 0 if a cached result was used (do not continue with your tests),
-# else 1.
-#
-# If the check should not be cachable then specify argument 3 as "no-cache",
-# this is useful when a check not only checks but actually sets config
-# variables itself (which is not recommended, but desired sometimes).
-#
-# Arguments:
-# [ --verb "verb.." ] (replace "checking for")
-# config name
-# define name
-# action (fail,cont,disable or no-cache)
-# [ display name ]
-function mkl_check_begin {
- local verb="checking for"
- if [[ $1 == "--verb" ]]; then
- verb="$2"
- shift
- shift
- fi
-
- local name=$(mkl_meta_get $1 name "$4")
- [[ -z $name ]] && name="x:$1"
-
- echo -n "$verb $name..."
- if [[ $3 != "no-cache" ]]; then
- local status=$(mkl_var_get "MKL_STATUS_$1")
- # Check cache (from previous run or this one).
- # Only used cached value if the cached check succeeded:
- # it is more likely that a failed check has been fixed than the other
- # way around.
- if [[ ! -z $status && ( $status = "ok" ) ]]; then
- mkl_check_done "$1" "$2" "$3" $status "cached"
- return 0
- fi
- fi
- return 1
-}
-
-# Print that a check is done
-# Arguments:
-# config name
-# define name
-# action
-# status (ok|failed)
-# extra-info (optional)
-function mkl_check_done {
- # Clean up configname to be a safe varname
- local cname=${1//-/_}
- mkl_var_set "MKL_STATUS_$cname" "$4" cache
-
- local extra=""
- if [[ $4 = "failed" ]]; then
- local clr=$MKL_YELLOW
- extra=" ($3)"
- case "$3" in
- fail)
- clr=$MKL_RED
- ;;
- cont)
- extra=""
- ;;
- esac
- echo -e " $clr$4$MKL_CLR_RESET${extra}"
- else
- [[ ! -z $2 ]] && mkl_define_set "$cname" "$2" "1"
- [[ ! -z $2 ]] && mkl_mkvar_set "$cname" "$2" "y"
- [ ! -z "$5" ] && extra=" ($5)"
- echo -e " $MKL_GREEN$4${MKL_CLR_RESET}$extra"
- fi
-}
-
-
-# Perform configure check by compiling source snippet
-# Arguments:
-# [--ldflags="..." ] (appended after "compiler arguments" below)
-# config name
-# define name
-# action (fail|disable)
-# compiler (CC|CXX)
-# compiler arguments (optional "", example: "-lzookeeper")
-# source snippet
-function mkl_compile_check {
- local ldf=
- if [[ $1 == --ldflags=* ]]; then
- ldf=${1#*=}
- shift
- fi
- mkl_check_begin "$1" "$2" "$3" "$1 (by compile)" && return $?
-
- local cflags=
-
- if [[ $4 = "CXX" ]]; then
- local ext=cpp
- cflags="$(mkl_mkvar_get CXXFLAGS)"
- else
- local ext=c
- cflags="$(mkl_mkvar_get CFLAGS)"
- fi
-
- local srcfile=$(mktemp _mkltmpXXXXXX)
- mv "$srcfile" "${srcfile}.$ext"
- srcfile="$srcfile.$ext"
- echo "$6" > $srcfile
- echo "
-int main () { return 0; }
-" >> $srcfile
-
- local cmd="${!4} $cflags $(mkl_mkvar_get CPPFLAGS) -Wall -Werror $srcfile -o ${srcfile}.o $ldf $(mkl_mkvar_get LDFLAGS) $5";
- mkl_dbg "Compile check $1 ($2): $cmd"
-
- local output
- output=$($cmd 2>&1)
-
- if [[ $? != 0 ]] ; then
- mkl_dbg "compile check for $1 ($2) failed: $cmd: $output"
- mkl_check_failed "$1" "$2" "$3" "compile check failed:
-CC: $4
-flags: $5
-$cmd:
-$output
-source: $6"
- local ret=1
- else
- mkl_check_done "$1" "$2" "$3" "ok"
- local ret=0
- fi
-
- # OSX XCode toolchain creates dSYM directories when -g is set,
- # delete them specifically.
- rm -rf "$srcfile" "${srcfile}.o" "$srcfile*dSYM"
-
- return $ret
-}
-
-
-# Try to link with a library.
-# Arguments:
-# config name
-# define name
-# action (fail|disable)
-# linker flags (e.g. "-lpthreads")
-function mkl_link_check {
- mkl_check_begin "$1" "$2" "$3" "$1 (by linking)" && return $?
-
- local srcfile=$(mktemp _mktmpXXXXXX)
- echo "int main () { return 0; }" > $srcfile
-
- local cmd="${CC} $(mkl_mkvar_get LDFLAGS) -c $srcfile -o ${srcfile}.o $4";
- mkl_dbg "Link check $1 ($2): $cmd"
-
- local output
- output=$($cmd 2>&1)
-
- if [[ $? != 0 ]] ; then
- mkl_dbg "link check for $1 ($2) failed: $output"
- mkl_check_failed "$1" "$2" "$3" "compile check failed:
-$output"
- local ret=1
- else
- mkl_check_done "$1" "$2" "$3" "ok" "$4"
- local ret=0
- fi
-
- rm -f $srcfile*
- return $ret
-}
-
-
-
-# Tries to figure out if we can use a static library or not.
-# Arguments:
-# library name (e.g. -lrdkafka)
-# compiler flags (optional "", e.g: "-lyajl")
-# Returns/outputs:
-# New list of compiler flags
-function mkl_lib_check_static {
- local libname=$1
- local libs=$2
- local arfile_var=STATIC_LIB_${libname#-l}
-
- mkl_dbg "Check $libname for static library (libs $libs, arfile variable $arfile_var=${!arfile_var})"
-
- # If STATIC_LIB_<libname_without_-l> specifies an existing .a file we
- # use that instead.
- if [[ -f ${!arfile_var} ]]; then
- libs=$(echo $libs | sed -e "s|$libname|${!arfile_var}|g")
- elif [[ $HAS_LDFLAGS_STATIC == y ]]; then
- libs=$(echo $libs | sed -e "s|$libname|${LDFLAGS_STATIC} $libname ${LDFLAGS_DYNAMIC}|g")
- else
- mkl_dbg "$libname: Neither $arfile_var specified or static linker flags supported: static linking probably won't work"
- fi
-
- echo $libs
-}
-
-
-# Checks that the specified lib is available through a number of methods.
-# compiler flags are automatically appended to "LIBS" mkvar on success.
-#
-# If STATIC_LIB_<libname_without_-l> is set to the path of an <libname>.a file
-# it will be used instead of -l<libname>.
-#
-# Arguments:
-# [--static=<lib>] (allows static linking (--enable-static) for the
-# library provided, e.g.: --static=-lrdkafka "librdkafka"..)
-# [--libname=<lib>] (library name if different from config name, such as
-# when the libname includes a dash)
-# config name (library name (for pkg-config))
-# define name
-# action (fail|disable|cont)
-# compiler (CC|CXX)
-# compiler flags (optional "", e.g: "-lyajl")
-# source snippet
-function mkl_lib_check {
-
- local is_static=0
- local staticopt=
- if [[ $1 == --static* ]]; then
- staticopt=$1
- shift
- fi
-
- local libnameopt=
- local libname=$1
- if [[ $1 == --libname* ]]; then
- libnameopt=$1
- libname="${libnameopt#*=}"
- shift
- fi
-
- # pkg-config result (0=ok)
- local pkg_conf_failed=1
- if [[ $WITH_PKGCONFIG == "y" ]]; then
- # Let pkg-config populate CFLAGS, et.al.
- mkl_pkg_config_check $staticopt $libnameopt "$1" "" cont
- pkg_conf_failed=$?
- fi
-
- local libs=""
- if [[ $pkg_conf_failed ]]; then
- libs="$5"
- if [[ $WITH_STATIC_LINKING == y && ! -z $staticopt ]]; then
- libs=$(mkl_lib_check_static "${staticopt#*=}" "$libs")
- is_static=1
- fi
- fi
-
- if ! mkl_compile_check "$1" "$2" "$3" "$4" "$libs" "$6"; then
- return 1
- fi
-
- if [[ $pkg_conf_failed == 1 ]]; then
- if [[ $is_static == 1 ]]; then
- mkl_mkvar_prepend "$1" LIBS "$libs"
- else
- mkl_mkvar_append "$1" LIBS "$libs"
- fi
- fi
-
- return 0
-}
-
-
-# Check for library with pkg-config
-# Automatically sets CFLAGS and LIBS from pkg-config information.
-# Arguments:
-# [--static=<lib>] (allows static linking (--enable-static) for the
-# library provided, e.g.: --static=-lrdkafka "librdkafka"..)
-# [--libname=<lib>] (library name if different from config name, such as
-# when the libname includes a dash)
-# config name
-# define name
-# action (fail|disable|ignore)
-function mkl_pkg_config_check {
-
- local staticopt=
- if [[ $1 == --static* ]]; then
- staticopt=$1
- shift
- fi
-
- local libname=$1
- if [[ $1 == --libname* ]]; then
- libname="${libnameopt#*=}"
- shift
- fi
-
- local cname="${1}_PKGCONFIG"
- mkl_check_begin "$cname" "$2" "no-cache" "$1 (by pkg-config)" && return $?
-
- local cflags=
- local cmd="${PKG_CONFIG} --short-errors --cflags $libname"
- mkl_dbg "pkg-config check $libname ($2): $cmd"
-
- cflags=$($cmd 2>&1)
- if [[ $? != 0 ]]; then
- mkl_dbg "'$cmd' failed: $cflags"
- mkl_check_failed "$cname" "$2" "$3" "'$cmd' failed:
-$cflags"
- return 1
- fi
-
- local libs=
- libs=$(${PKG_CONFIG} --short-errors --libs $libname 2>&1)
- if [[ $? != 0 ]]; then
- mkl_dbg "${PKG_CONFIG} --libs $libname failed: $libs"
- mkl_check_failed "$cname" "$2" "$3" "pkg-config --libs failed"
- return 1
- fi
-
- mkl_mkvar_append $1 "CFLAGS" "$cflags"
-
- if [[ $WITH_STATIC_LINKING == y && ! -z $staticopt ]]; then
- libs=$(mkl_lib_check_static "${staticopt#*=}" "$libs")
- mkl_mkvar_prepend "$1" LIBS "$libs"
- else
- mkl_mkvar_append "$1" LIBS "$libs"
- fi
-
- mkl_check_done "$1" "$2" "$3" "ok"
-
- return 0
-}
-
-
-# Check that a command runs and exits succesfully.
-# Arguments:
-# config name
-# define name (optional, can be empty)
-# action
-# command
-function mkl_command_check {
- mkl_check_begin "$1" "$2" "$3" "$1 (by command)" && return $?
-
- local out=
- out=$($4 2>&1)
- if [[ $? != 0 ]]; then
- mkl_dbg "$1: $2: $4 failed: $out"
- mkl_check_failed "$1" "$2" "$3" "command '$4' failed:
-$out"
- return 1
- fi
-
- mkl_check_done "$1" "$2" "$3" "ok"
-
- return 0
-}
-
-
-# Check that a program is executable, but will not execute it.
-# Arguments:
-# config name
-# define name (optional, can be empty)
-# action
-# program name (e.g, objdump)
-function mkl_prog_check {
- mkl_check_begin --verb "checking executable" "$1" "$2" "$3" "$1" && return $?
-
- local out=
- out=$(command -v "$4" 2>&1)
- if [[ $? != 0 ]]; then
- mkl_dbg "$1: $2: $4 is not executable: $out"
- mkl_check_failed "$1" "$2" "$3" "$4 is not executable"
- return 1
- fi
-
- mkl_check_done "$1" "$2" "$3" "ok"
-
- return 0
-}
-
-
-
-
-# Checks that the check for the given config name passed.
-# This does not behave like the other checks, if the given config name passed
-# its test then nothing is printed. Else the configure will fail.
-# Arguments:
-# checked config name
-function mkl_config_check {
- local status=$(mkl_var_get "MKL_STATUS_$1")
- [[ $status = "ok" ]] && return 0
- mkl_fail $1 "" "fail" "$MKL_MODULE requires $1"
- return 1
-}
-
-
-# Checks that all provided config names are set.
-# Arguments:
-# config name
-# define name
-# action
-# check_config_name1
-# check_config_name2..
-function mkl_config_check_all {
- local cname=
- local res="ok"
- echo start this now for $1
- for cname in ${@:4}; do
- local st=$(mkl_var_get "MKL_STATUS_$cname")
- [[ $status = "ok" ]] && continue
- mkl_fail $1 $2 $3 "depends on $cname"
- res="failed"
- done
-
- echo "try res $res"
- mkl_check_done "$1" "$2" "$3" $res
-}
-
-
-# Check environment variable
-# Arguments:
-# config name
-# define name
-# action
-# environment variable
-function mkl_env_check {
- mkl_check_begin "$1" "$2" "$3" "$1 (by env $4)" && return $?
-
- if [[ -z ${!4} ]]; then
- mkl_check_failed "$1" "$2" "$3" "environment variable $4 not set"
- return 1
- fi
-
- mkl_check_done "$1" "$2" "$3" "ok" "${!4}"
-
- return 0
-}
-
-
-# Run all checks
-function mkl_checks_run {
- # Set up common variables
- mkl_allvar_set "" MKL_APP_NAME $(mkl_meta_get description name)
- mkl_allvar_set "" MKL_APP_DESC_ONELINE "$(mkl_meta_get description oneline)"
-
- # Call checks functions in dependency order
- local mf
- for mf in $MKL_CHECKS ; do
- MKL_MODULE=${mf%:*}
- local func=${mf#*:}
-
- if mkl_func_exists $func ; then
- $func
- else
- mkl_err "Check function $func from $MKL_MODULE disappeared ($mf)"
- fi
- unset MKL_MODULE
- done
-}
-
-
-# Check for color support in terminal.
-# If the terminal supports colors, the function will alter
-# MKL_RED
-# MKL_GREEN
-# MKL_YELLOW
-# MKL_BLUE
-# MKL_CLR_RESET
-function mkl_check_terminal_color_support {
- local use_color=false
- local has_tput=false
-
- if [[ -z ${TERM} ]]; then
- # tput and dircolors require $TERM
- mkl_dbg "\$TERM is not set! Cannot check for color support in terminal."
- return 1
- elif hash tput 2>/dev/null; then
- has_tput=true
- [[ $(tput colors 2>/dev/null) -ge 8 ]] && use_color=true
- mkl_dbg "tput reports color support: ${use_color}"
- elif hash dircolors 2>/dev/null; then
- # Enable color support only on colorful terminals.
- # dircolors --print-database uses its own built-in database
- # instead of using /etc/DIR_COLORS. Try to use the external file
- # first to take advantage of user additions.
- local safe_term=${TERM//[^[:alnum:]]/?}
- local match_lhs=""
- [[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
- [[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
- [[ -z ${match_lhs} ]] && match_lhs=$(dircolors --print-database)
- [[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
- mkl_dbg "dircolors reports color support: ${use_color}"
- fi
-
- if ${use_color}; then
- if ${has_tput}; then
- # In theory, user could have set different escape sequences
- # Because tput is available we can use it to query the right values ...
- mkl_dbg "Using color escape sequences from tput"
- MKL_RED=$(tput setaf 1)
- MKL_GREEN=$(tput setaf 2)
- MKL_YELLOW=$(tput setaf 3)
- MKL_BLUE=$(tput setaf 4)
- MKL_CLR_RESET=$(tput sgr0)
- else
- mkl_dbg "Using hard-code ANSI color escape sequences"
- MKL_RED="\033[031m"
- MKL_GREEN="\033[032m"
- MKL_YELLOW="\033[033m"
- MKL_BLUE="\033[034m"
- MKL_CLR_RESET="\033[0m"
- fi
- else
- mkl_dbg "Did not detect color support in \"$TERM\" terminal!"
- fi
-
- return 0
-}
-
-
-
-
-###########################################################################
-#
-#
-# Module functionality
-#
-#
-###########################################################################
-
-# Downloads module from repository.
-# Arguments:
-# module name
-# Returns:
-# module file name
-function mkl_module_download {
- local modname="$1"
- local url="$MKL_REPO_URL/modules/configure.$modname"
- local tmpfile=""
-
- fname="${MKLOVE_DIR}/modules/configure.$modname"
-
- if [[ $url != http*://* ]]; then
- # Local path, just copy file.
- if [[ ! -f $url ]]; then
- mkl_err "Module $modname not found at $url"
- return 1
- fi
-
- if ! cp "$url" "$fname" ; then
- mkl_err "Failed to copy $url to $fname"
- return 1
- fi
-
- echo "$fname"
- return 0
- fi
-
- # Download
- mkl_info "${MKL_BLUE}downloading missing module $modname from $url${MKL_CLR_RESET}"
-
- tmpfile=$(mktemp _mkltmpXXXXXX)
- local out=
- out=$(wget -nv -O "$tmpfile" "$url" 2>&1)
-
- if [[ $? -ne 0 ]]; then
- rm -f "$tmpfile"
- mkl_err "Failed to download $modname:"
- mkl_err0 $out
- return 1
- fi
-
- # Move downloaded file into place replacing the old file.
- mv "$tmpfile" "$fname" || return 1
-
- # "Return" filename
- echo "$fname"
-
- return 0
-}
-
-
-# Load module by name or filename
-# Arguments:
-# "require"|"try"
-# filename
-# [ module arguments ]
-function mkl_module_load {
- local try=$1
- shift
- local fname=$1
- shift
- local modname=${fname#*configure.}
- local bypath=1
-
- # Check if already loaded
- if mkl_in_list "$MKL_MODULES" "$modname"; then
- return 0
- fi
-
- if [[ $fname = $modname ]]; then
- # Module specified by name, find the file.
- bypath=0
- for fname in configure.$modname \
- ${MKLOVE_DIR}/modules/configure.$modname ; do
- [[ -s $fname ]] && break
- done
- fi
-
- # Calling module
- local cmod=$MKL_MODULE
- [[ -z $cmod ]] && cmod="base"
-
- if [[ ! -s $fname ]]; then
- # Attempt to download module, if permitted
- if [[ $MKL_NO_DOWNLOAD != 0 || $bypath == 1 ]]; then
- mkl_err "Module $modname not found at $fname (required by $cmod) and downloads disabled"
- if [[ $try = "require" ]]; then
- mkl_fail "$modname" "none" "fail" \
- "Module $modname not found (required by $cmod) and downloads disabled"
- fi
- return 1
- fi
-
- fname=$(mkl_module_download "$modname")
- if [[ $? -ne 0 ]]; then
- mkl_err "Module $modname not found (required by $cmod)"
- if [[ $try = "require" ]]; then
- mkl_fail "$modname" "none" "fail" \
- "Module $modname not found (required by $cmod)"
- return 1
- fi
- fi
-
- # Now downloaded, try loading the module again.
- mkl_module_load $try "$fname" "$@"
- return $?
- fi
-
- # Set current module
- local save_MKL_MODULE=$MKL_MODULE
- MKL_MODULE=$modname
-
- mkl_dbg "Loading module $modname (required by $cmod) from $fname"
-
- # Source module file (positional arguments are available to module)
- source $fname
-
- # Restore current module (might be recursive)
- MKL_MODULE=$save_MKL_MODULE
-
- # Add module to list of modules
- mkl_var_append MKL_MODULES $modname
-
- # Rename module's special functions so we can call them separetely later.
- mkl_func_rename "options" "${modname}_options"
- mkl_func_push MKL_CHECKS "$modname" "checks"
- mkl_func_push MKL_GENERATORS "$modname" "generate"
- mkl_func_push MKL_CLEANERS "$modname" "clean"
-}
-
-
-# Require and load module
-# Must only be called from module file outside any function.
-# Arguments:
-# [ --try ] Dont fail if module doesn't exist
-# module1
-# [ "must" "pass" ]
-# [ module arguments ... ]
-function mkl_require {
- local try="require"
- if [[ $1 = "--try" ]]; then
- local try="try"
- shift
- fi
-
- local mod=$1
- shift
- local override_action=
-
- # Check for cyclic dependencies
- if mkl_in_list "$MKL_LOAD_STACK" "$mod"; then
- mkl_err "Cyclic dependency detected while loading $mod module:"
- local cmod=
- local lmod=$mod
- for cmod in $MKL_LOAD_STACK ; do
- mkl_err " $lmod required by $cmod"
- lmod=$cmod
- done
- mkl_fail base "" fail "Cyclic dependency detected while loading module $mod"
- return 1
- fi
-
- mkl_var_prepend MKL_LOAD_STACK "$mod"
-
-
- if [[ "$1 $2" == "must pass" ]]; then
- shift
- shift
- override_action="fail"
- fi
-
- if [[ ! -z $override_action ]]; then
- mkl_meta_set "MOD__$mod" "override_action" "$override_action"
- fi
-
-
- mkl_module_load $try $mod "$@"
- local ret=$?
-
- mkl_var_shift MKL_LOAD_STACK
-
- return $ret
-}
-
-
-
-###########################################################################
-#
-#
-# Usage options
-#
-#
-###########################################################################
-
-
-MKL_USAGE="Usage: ./configure [OPTIONS...]
-
- mklove configure script - mklove, not autoconf
- Copyright (c) 2014-2015 Magnus Edenhill - https://github.com/edenhill/mklove
-"
-
-function mkl_usage {
- echo "$MKL_USAGE"
- local name=$(mkl_meta_get description name)
-
- if [[ ! -z ${name} ]]; then
- echo " $name - $(mkl_meta_get description oneline)
- $(mkl_meta_get description copyright)
-"
- fi
-
- local og
- for og in $MKL_USAGE_GROUPS ; do
- og="MKL_USAGE_GROUP__$og"
- echo "${!og}"
- done
-
- echo "Honoured environment variables:
- CC, CPP, CXX, CFLAGS, CPPFLAGS, CXXFLAGS, LDFLAGS, LIBS,
- LD, NM, OBJDUMP, STRIP, PKG_CONFIG, PKG_CONFIG_PATH,
- STATIC_LIB_<libname>=.../libname.a
-
-"
-
-}
-
-
-
-# Add usage option informative text
-# Arguments:
-# text
-function mkl_usage_info {
- MKL_USAGE="$MKL_USAGE
-$1"
-}
-
-
-# Add option to usage output
-# Arguments:
-# option group ("Standard", "Cross-Compilation", etc..)
-# variable name
-# option ("--foo=feh")
-# help
-# default (optional)
-# assignvalue (optional, default:"y")
-# function block (optional)
-function mkl_option {
- local optgroup=$1
- local varname=$2
-
- # Fixed width between option name and help in usage output
- local pad=" "
- if [[ ${#3} -lt ${#pad} ]]; then
- pad=${pad:0:$(expr ${#pad} - ${#3})}
- else
- pad=""
- fi
-
- # Add to usage output
- local optgroup_safe=$(mkl_env_esc $optgroup)
- if ! mkl_in_list "$MKL_USAGE_GROUPS" "$optgroup_safe" ; then
- mkl_env_append MKL_USAGE_GROUPS "$optgroup_safe"
- mkl_env_set "MKL_USAGE_GROUP__$optgroup_safe" "$optgroup options:
-"
- fi
-
- local defstr=""
- [[ ! -z $5 ]] && defstr=" [$5]"
- mkl_env_append "MKL_USAGE_GROUP__$optgroup_safe" " $3 $pad $4$defstr
-"
-
- local optname="${3#--}"
- local safeopt=
- local optval=""
- if [[ $3 == *=* ]]; then
- optname="${optname%=*}"
- optval="${3#*=}"
- fi
-
- safeopt=$(mkl_env_esc $optname)
-
- mkl_meta_set "MKL_OPT_ARGS" "$safeopt" "$optval"
-
- #
- # Optional variable scoping by prefix: "env:", "mk:", "def:"
- #
- local setallvar="mkl_allvar_set ''"
- local setmkvar="mkl_mkvar_set ''"
-
- if [[ $varname = env:* ]]; then
- # Set environment variable (during configure runtime only)
- varname=${varname#*:}
- setallvar=mkl_env_set
- setmkvar=mkl_env_set
- elif [[ $varname = mk:* ]]; then
- # Set Makefile.config variable
- varname=${varname#*:}
- setallvar="mkl_mkvar_append ''"
- setmkvar="mkl_mkvar_append ''"
- elif [[ $varname = def:* ]]; then
- # Set config.h define
- varname=${varname#*:}
- setallvar="mkl_define_set ''"
- setmkvar="mkl_define_set ''"
- fi
-
-
- if [[ ! -z $7 ]]; then
- # Function block specified.
- eval "function opt_$safeopt { $7 }"
- else
- # Add default implementation of function simply setting the value.
- # Application may override this by redefining the function after calling
- # mkl_option.
- if [[ $optval = "PATH" ]]; then
- # PATH argument: make it an absolute path.
- # Only set the make variable (not config.h)
- eval "function opt_$safeopt { $setmkvar $varname \"\$(mkl_abspath \$(mkl_render \$1))\"; }"
- else
- # Standard argument: simply set the value
- if [[ -z "$6" ]]; then
- eval "function opt_$safeopt { $setallvar $varname \"\$1\"; }"
- else
- eval "function opt_$safeopt { $setallvar $varname \"$6\"; }"
- fi
- fi
- fi
-
- # If default value is provided and does not start with "$" (variable ref)
- # then set it right away.
- # $ variable refs are set after all checks have run during the
- # generating step.
- if [[ ${#5} != 0 ]] ; then
- if [[ $5 = *\$* ]]; then
- mkl_var_append "MKL_LATE_VARS" "opt_$safeopt:$5"
- else
- opt_$safeopt $5
- fi
- fi
-
- if [[ ! -z $varname ]]; then
- # Add variable to list
- MKL_CONFVARS="$MKL_CONFVARS $varname"
- fi
-
-}
-
-
-
-# Adds a toggle (--enable-X, --disable-X) option.
-# Arguments:
-# option group ("Standard", ..)
-# variable name (WITH_FOO)
-# option (--enable-foo)
-# help ("foo.." ("Enable" and "Disable" will be prepended))
-# default (y or n)
-
-function mkl_toggle_option {
-
- # Add option argument
- mkl_option "$1" "$2" "$3" "$4" "$5"
-
- # Add corresponding "--disable-foo" option for "--enable-foo".
- local disname="${3/--enable/--disable}"
- local dishelp="${4/Enable/Disable}"
- mkl_option "$1" "$2" "$disname" "$dishelp" "" "n"
-}
-
-# Adds a toggle (--enable-X, --disable-X) option with builtin checker.
-# This is the library version.
-# Arguments:
-# option group ("Standard", ..)
-# config name (foo, must be same as pkg-config name)
-# variable name (WITH_FOO)
-# action (fail or disable)
-# option (--enable-foo)
-# help (defaults to "Enable <config name>")
-# linker flags (-lfoo)
-# default (y or n)
-
-function mkl_toggle_option_lib {
-
- local help="$6"
- [[ -z "$help" ]] && help="Enable $2"
-
- # Add option argument
- mkl_option "$1" "$3" "$5" "$help" "$8"
-
- # Add corresponding "--disable-foo" option for "--enable-foo".
- local disname="${5/--enable/--disable}"
- local dishelp="${help/Enable/Disable}"
- mkl_option "$1" "$3" "$disname" "$dishelp" "" "n"
-
- # Create checks
- eval "function _tmp_func { mkl_lib_check \"$2\" \"$3\" \"$4\" CC \"$7\"; }"
- mkl_func_push MKL_CHECKS "$MKL_MODULE" _tmp_func
-}
-
-
-
-
-
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/7528d23e/thirdparty/librdkafka-0.11.1/mklove/modules/configure.builtin
----------------------------------------------------------------------
diff --git a/thirdparty/librdkafka-0.11.1/mklove/modules/configure.builtin b/thirdparty/librdkafka-0.11.1/mklove/modules/configure.builtin
deleted file mode 100644
index 546cbb2..0000000
--- a/thirdparty/librdkafka-0.11.1/mklove/modules/configure.builtin
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/bash
-#
-# mklove builtin checks and options
-# Sets:
-# prefix, etc..
-
-
-mkl_option "Standard" prefix "--prefix=PATH" \
- "Install arch-independent files in PATH" "/usr/local"
-mkl_option "Standard" exec_prefix "--exec-prefix=PATH" \
- "Install arch-dependent files in PATH" "\$prefix"
-mkl_option "Standard" bindir "--bindir=PATH" "User executables" "\$exec_prefix/bin"
-mkl_option "Standard" sbindir "--sbindir=PATH" "System admin executables" \
- "\$exec_prefix/sbin"
-mkl_option "Standard" libexecdir "--libexecdir=PATH" "Program executables" \
- "\$exec_prefix/libexec"
-mkl_option "Standard" datadir "--datadir=PATH" "Read-only arch-independent data" \
- "\$prefix/share"
-mkl_option "Standard" sysconfdir "--sysconfdir=PATH" "Configuration data" \
- "\$prefix/etc"
-mkl_option "Standard" sharedstatedir "--sharedstatedir=PATH" \
- "Modifiable arch-independent data" "\$prefix/com"
-mkl_option "Standard" localstatedir "--localstatedir=PATH" \
- "Modifiable local state data" "\$prefix/var"
-mkl_option "Standard" libdir "--libdir=PATH" "Libraries" "\$exec_prefix/lib"
-mkl_option "Standard" includedir "--includedir=PATH" "C/C++ header files" \
- "\$prefix/include"
-mkl_option "Standard" infodir "--infodir=PATH" "Info documentation" "\$prefix/info"
-mkl_option "Standard" mandir "--mandir=PATH" "Manual pages" "\$prefix/man"
-
-mkl_option "Configure tool" "" "--list-modules" "List loaded mklove modules"
-mkl_option "Configure tool" "" "--list-checks" "List checks"
-mkl_option "Configure tool" env:MKL_FAILFATAL "--fail-fatal" "All failures are fatal"
-mkl_option "Configure tool" env:MKL_NOCACHE "--no-cache" "Dont use or generate config.cache"
-mkl_option "Configure tool" env:MKL_DEBUG "--debug" "Enable configure debugging"
-mkl_option "Configure tool" env:MKL_CLEAN "--clean" "Remove generated configure files"
-mkl_option "Configure tool" "" "--reconfigure" "Rerun configure with same arguments as last run"
-mkl_option "Configure tool" env:MKL_NO_DOWNLOAD "--no-download" "Disable downloads of required mklove modules"
-mkl_option "Configure tool" env:MKL_UPDATE_MODS "--update-modules" "Update modules from global repository"
-mkl_option "Configure tool" env:MKL_REPO_URL "--repo-url=URL_OR_PATH" "Override mklove modules repo URL" "$MKL_REPO_URL"
-mkl_option "Configure tool" "" "--help" "Show configure usage"
-
-
-mkl_toggle_option "Compatibility" "mk:MKL_MAINT_MODE" "--enable-maintainer-mode" "Maintainer mode (no-op)"
-
-mkl_option "Configure tool" "mk:PROGRAM_PREFIX" "--program-prefix=PFX" "Program prefix"
-
-mkl_option "Compatibility" "mk:DISABL_DEP_TRACK" "--disable-dependency-tracking" "Disable dependency tracking (no-op)"
-mkl_option "Compatibility" "mk:DISABL_SILENT_RULES" "--disable-silent-rules" "Verbose build output (no-op)"
-
-
-function checks {
-
- if [[ ! -z $libdir ]]; then
- mkl_mkvar_append "libdir" LDFLAGS "-L${libdir}"
- fi
-
- if [[ ! -z $includedir ]]; then
- mkl_mkvar_append "includedir" CPPFLAGS "-I${includedir}"
- fi
-
-}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/7528d23e/thirdparty/librdkafka-0.11.1/mklove/modules/configure.cc
----------------------------------------------------------------------
diff --git a/thirdparty/librdkafka-0.11.1/mklove/modules/configure.cc b/thirdparty/librdkafka-0.11.1/mklove/modules/configure.cc
deleted file mode 100644
index 79ce7fb..0000000
--- a/thirdparty/librdkafka-0.11.1/mklove/modules/configure.cc
+++ /dev/null
@@ -1,178 +0,0 @@
-#!/bin/bash
-#
-# Compiler detection
-# Sets:
-# CC, CXX, CFLAGS, CPPFLAGS, LDFLAGS, ARFLAGS, PKG_CONFIG, INSTALL, MBITS
-
-
-mkl_require host
-
-function checks {
-
- # C compiler
- mkl_meta_set "ccenv" "name" "C compiler from CC env"
- if ! mkl_command_check "ccenv" "WITH_CC" cont "$CC --version"; then
- if mkl_command_check "gcc" "WITH_GCC" cont "gcc --version"; then
- CC=gcc
- elif mkl_command_check "clang" "WITH_CLANG" cont "clang --version"; then
- CC=clang
- elif mkl_command_check "cc" "WITH_CC" fail "cc --version"; then
- CC=cc
- fi
- fi
- export CC="${CC}"
- mkl_mkvar_set CC CC "$CC"
-
- if [[ $MKL_CC_WANT_CXX == 1 ]]; then
- # C++ compiler
- mkl_meta_set "cxxenv" "name" "C++ compiler from CXX env"
- if ! mkl_command_check "cxxenv" "WITH_CXX" cont "$CXX --version" ; then
- mkl_meta_set "gxx" "name" "C++ compiler (g++)"
- mkl_meta_set "clangxx" "name" "C++ compiler (clang++)"
- mkl_meta_set "cxx" "name" "C++ compiler (c++)"
- if mkl_command_check "gxx" "WITH_GXX" cont "g++ --version"; then
- CXX=g++
- elif mkl_command_check "clangxx" "WITH_CLANGXX" cont "clang++ --version"; then
- CXX=clang++
- elif mkl_command_check "cxx" "WITH_CXX" fail "c++ --version"; then
- CXX=c++
- fi
- fi
- export CXX="${CXX}"
- mkl_mkvar_set "CXX" CXX $CXX
- fi
-
- # Handle machine bits, if specified.
- if [[ ! -z "$MBITS" ]]; then
- mkl_meta_set mbits_m name "mbits compiler flag (-m$MBITS)"
- if mkl_compile_check mbits_m "" fail CC "-m$MBITS"; then
- mkl_mkvar_append CPPFLAGS CPPFLAGS "-m$MBITS"
- mkl_mkvar_append LDFLAGS LDFLAGS "-m$MBITS"
- fi
- if [[ -z "$ARFLAGS" && $MBITS == 64 && $MKL_DISTRO == "SunOS" ]]; then
- # Turn on 64-bit archives on SunOS
- mkl_mkvar_append ARFLAGS ARFLAGS "S"
- fi
- fi
-
- # Provide prefix and checks for various other build tools.
- local t=
- for t in LD:ld NM:nm OBJDUMP:objdump STRIP:strip ; do
- local tenv=${t%:*}
- t=${t#*:}
- local tval="${!tenv}"
-
- [[ -z $tval ]] && tval="$t"
-
- if mkl_prog_check "$t" "" disable "$tval" ; then
- if [[ $tval != ${!tenv} ]]; then
- export "$tenv"="$tval"
- fi
- mkl_mkvar_set $tenv $tenv "$tval"
- fi
- done
-
- # Compiler and linker flags
- [[ ! -z $CFLAGS ]] && mkl_mkvar_set "CFLAGS" "CFLAGS" "$CFLAGS"
- [[ ! -z $CPPFLAGS ]] && mkl_mkvar_set "CPPFLAGS" "CPPFLAGS" "$CPPFLAGS"
- [[ ! -z $CXXFLAGS ]] && mkl_mkvar_set "CXXFLAGS" "CXXFLAGS" "$CXXFLAGS"
- [[ ! -z $LDFLAGS ]] && mkl_mkvar_set "LDFLAGS" "LDFLAGS" "$LDFLAGS"
- [[ ! -z $ARFLAGS ]] && mkl_mkvar_set "ARFLAGS" "ARFLAGS" "$ARFLAGS"
-
- if [[ $MKL_NO_DEBUG_SYMBOLS != "y" ]]; then
- # Add debug symbol flag (-g)
- # OSX 10.9 requires -gstrict-dwarf for some reason.
- mkl_meta_set cc_g_dwarf name "debug symbols compiler flag (-g...)"
- if [[ $MKL_DISTRO == "osx" ]]; then
- if mkl_compile_check cc_g_dwarf "" cont CC "-gstrict-dwarf"; then
- mkl_mkvar_append CPPFLAGS CPPFLAGS "-gstrict-dwarf"
- else
- mkl_mkvar_append CPPFLAGS CPPFLAGS "-g"
- fi
- else
- mkl_mkvar_append CPPFLAGS CPPFLAGS "-g"
- fi
- fi
-
-
- # pkg-config
- if [ -z "$PKG_CONFIG" ]; then
- PKG_CONFIG=pkg-config
- fi
-
- if mkl_command_check "pkgconfig" "WITH_PKGCONFIG" cont "$PKG_CONFIG --version"; then
- export PKG_CONFIG
- fi
- mkl_mkvar_set "pkgconfig" PKG_CONFIG $PKG_CONFIG
-
- [[ ! -z "$PKG_CONFIG_PATH" ]] && mkl_env_append PKG_CONFIG_PATH "$PKG_CONFIG_PATH"
-
- # install
- if [ -z "$INSTALL" ]; then
- if [[ $MKL_DISTRO == "SunOS" ]]; then
- mkl_meta_set ginstall name "GNU install"
- if mkl_command_check ginstall "" ignore "ginstall --version"; then
- INSTALL=ginstall
- else
- INSTALL=install
- fi
- else
- INSTALL=install
- fi
- fi
-
- if mkl_command_check "install" "WITH_INSTALL" cont "$INSTALL --version"; then
- export INSTALL
- fi
- mkl_mkvar_set "install" INSTALL $INSTALL
-
-
- # Enable profiling if desired
- if [[ $WITH_PROFILING == y ]]; then
- mkl_allvar_set "" "WITH_PROFILING" "y"
- mkl_mkvar_append CPPFLAGS CPPFLAGS "-pg"
- mkl_mkvar_append LDFLAGS LDFLAGS "-pg"
- fi
-
- # Optimization
- if [[ $WITHOUT_OPTIMIZATION == n ]]; then
- mkl_mkvar_append CPPFLAGS CPPFLAGS "-O2"
- else
- mkl_mkvar_append CPPFLAGS CPPFLAGS "-O0"
- fi
-
- # Static linking
- if [[ $WITH_STATIC_LINKING == y ]]; then
- # LDFLAGS_STATIC is the LDFLAGS needed to enable static linking
- # of sub-sequent libraries, while
- # LDFLAGS_DYNAMIC is the LDFLAGS needed to enable dynamic linking.
- if [[ $MKL_DISTRO != "osx" ]]; then
- mkl_mkvar_set staticlinking LDFLAGS_STATIC "-Wl,-Bstatic"
- mkl_mkvar_set staticlinking LDFLAGS_DYNAMIC "-Wl,-Bdynamic"
- mkl_mkvar_set staticlinking HAS_LDFLAGS_STATIC y
- else
- # OSX linker can't enable/disable static linking so we'll
- # need to find the .a through STATIC_LIB_libname env var
- mkl_mkvar_set staticlinking HAS_LDFLAGS_STATIC n
- fi
- fi
-}
-
-
-mkl_option "Compiler" "env:CC" "--cc=CC" "Build using C compiler CC" "\$CC"
-mkl_option "Compiler" "env:CXX" "--cxx=CXX" "Build using C++ compiler CXX" "\$CXX"
-mkl_option "Compiler" "ARCH" "--arch=ARCH" "Build for architecture" "$(uname -m)"
-mkl_option "Compiler" "CPU" "--cpu=CPU" "Build and optimize for specific CPU" "generic"
-mkl_option "Compiler" "MBITS" "--mbits=BITS" "Machine bits (32 or 64)" ""
-
-for n in CFLAGS CPPFLAGS CXXFLAGS LDFLAGS ARFLAGS; do
- mkl_option "Compiler" "mk:$n" "--$n=$n" "Add $n flags"
-done
-
-mkl_option "Compiler" "env:PKG_CONFIG_PATH" "--pkg-config-path" "Extra paths for pkg-config"
-
-mkl_option "Compiler" "WITH_PROFILING" "--enable-profiling" "Enable profiling"
-mkl_option "Compiler" "WITH_STATIC_LINKING" "--enable-static" "Enable static linking"
-mkl_option "Compiler" "WITHOUT_OPTIMIZATION" "--disable-optimization" "Disable optimization flag to compiler" "n"
-mkl_option "Compiler" "env:MKL_NO_DEBUG_SYMBOLS" "--disable-debug-symbols" "Disable debugging symbols" "n"
-mkl_option "Compiler" "env:MKL_WANT_WERROR" "--enable-werror" "Enable compiler warnings as errors" "n"