"Fossies" - the Fresh Open Source Software Archive

Member "mariadb-connector-c-3.0.8-src/mariadb_config/mariadb_config.c.in" (18 Dec 2018, 2536 Bytes) of package /linux/misc/mariadb-connector-c-3.0.8-src.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "mariadb_config.c.in": 3.0.3-src_vs_3.0.4-src.

    1 #include <getopt.h>
    2 #include <stdio.h>
    3 #include <stdlib.h>
    4 #include <mariadb_version.h>
    5 
    6 static char *mariadb_progname;
    7 
    8 #define INCLUDE "-I@CMAKE_INSTALL_PREFIX@/@INSTALL_INCLUDEDIR@ -I@CMAKE_INSTALL_PREFIX@/@INSTALL_INCLUDEDIR@/mysql"
    9 #define LIBS    "-L@CMAKE_INSTALL_PREFIX@/@INSTALL_LIBDIR@/ -lmariadb @extra_dynamic_LDFLAGS@"
   10 #define LIBS_SYS "@extra_dynamic_LDFLAGS@"
   11 #define CFLAGS  INCLUDE
   12 #define VERSION "@MARIADB_CLIENT_VERSION@"
   13 #define CC_VERSION "@CPACK_PACKAGE_VERSION@"
   14 #define PLUGIN_DIR "@CMAKE_INSTALL_PREFIX@/@INSTALL_PLUGINDIR@"
   15 #define SOCKET  "@MARIADB_UNIX_ADDR@"
   16 #define PORT "@MARIADB_PORT@"
   17 #define TLS_LIBRARY_VERSION "@TLS_LIBRARY_VERSION@"
   18 
   19 static struct option long_options[]=
   20 {
   21   {"cflags", no_argument, 0, 'a'},
   22   {"help", no_argument, 0, 'b'},
   23   {"include", no_argument, 0, 'c'},
   24   {"libs", no_argument, 0, 'd'},
   25   {"libs_r", no_argument, 0, 'e'},
   26   {"libs_sys", no_argument, 0, 'l'},
   27   {"version", no_argument, 0, 'f'},
   28   {"cc_version", no_argument, 0, 'g'},
   29   {"socket", no_argument, 0, 'h'},
   30   {"port", no_argument, 0, 'i'},
   31   {"plugindir", no_argument, 0, 'j'},
   32   {"tlsinfo", no_argument, 0, 'k'},
   33   {NULL, 0, 0, 0}
   34 };
   35 
   36 static const char *values[]=
   37 {
   38   CFLAGS,
   39   NULL,
   40   INCLUDE,
   41   LIBS,
   42   LIBS,
   43   LIBS_SYS,
   44   VERSION,
   45   CC_VERSION,
   46   SOCKET,
   47   PORT,
   48   PLUGIN_DIR,
   49   TLS_LIBRARY_VERSION
   50 };
   51 
   52 void usage(void)
   53 {
   54   int i=0;
   55   puts("Copyright 2011-2015 MariaDB Corporation AB");
   56   puts("Get compiler flags for using the MariaDB Connector/C.");
   57   printf("Usage: %s [OPTIONS]\n", mariadb_progname);
   58   while (long_options[i].name)
   59   {
   60     if (values[i])
   61       printf("  --%-12s  [%s]\n", long_options[i].name, values[i]);
   62     i++;
   63   }
   64 }
   65 
   66 
   67 int main(int argc, char **argv)
   68 {
   69   int c;
   70   mariadb_progname= argv[0];
   71 
   72   if (argc <= 1)
   73   {
   74     usage();
   75     exit(0);
   76   }
   77 
   78   while(1)
   79   {
   80     int option_index= 0;
   81     c= getopt_long(argc, argv, "abcdefghij", long_options, &option_index);
   82 
   83     switch(c) {
   84     case 'a':
   85       puts(CFLAGS);
   86       break;
   87     case 'b':
   88       usage();
   89       break;
   90     case 'c':
   91       puts(INCLUDE);
   92       break;
   93     case 'd':
   94     case 'e':
   95       puts(LIBS);
   96       break;
   97     case 'f':
   98       puts(VERSION);
   99       break;
  100     case 'g':
  101       puts(CC_VERSION);
  102       break;
  103     case 'h':
  104       puts(SOCKET);
  105       break;
  106     case 'i':
  107       puts(PORT);
  108       break;
  109     case 'j':
  110       puts(PLUGIN_DIR);
  111       break;
  112     case 'k':
  113       puts(TLS_LIBRARY_VERSION);
  114       break;
  115     case 'l':
  116       puts(LIBS_SYS);
  117       break;
  118     default:
  119       exit((c != -1));
  120     }
  121   }
  122 
  123   exit(0);
  124 }
  125