mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-09 01:07:16 +01:00
113 lines
2.2 KiB
C
113 lines
2.2 KiB
C
|
#include <getopt.h>
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
#define INCLUDE "-I@PREFIX_INSTALL_DIR@/@INCLUDE_INSTALL_DIR@/@SUFFIX_INSTALL_DIR@ -I@PREFIX_INSTALL_DIR@/@INCLUDE_INSTALL_DIR@/@SUFFIX_INSTALL_DIR@/mysql"
|
||
|
#define LIBS "-L@PREFIX_INSTALL_DIR@/@LIB_INSTALL_DIR@/@LIBSUFFIX_INSTALL_DIR@ -lmariadb" \
|
||
|
"@extra_dynamic_LDFLAGS@"
|
||
|
#define CFLAGS INCLUDE " @CMAKE_C_FLAGS@"
|
||
|
#define VERSION "@MYSQL_CLIENT_VERSION@"
|
||
|
#define CC_VERSION "@CPACK_PACKAGE_VERSION@"
|
||
|
#define PLUGIN_DIR "@PREFIX_INSTALL_DIR@/@SUFFIX_INSTALL_DIR@/@PLUGIN_INSTALL_DIR@"
|
||
|
#define SOCKET "@MYSQL_UNIX_ADDR@"
|
||
|
#define PORT "@MYSQL_PORT@"
|
||
|
|
||
|
static struct option long_options[]=
|
||
|
{
|
||
|
{"cflags", no_argument, 0, 'a'},
|
||
|
{"help", no_argument, 0, 'b'},
|
||
|
{"include", no_argument, 0, 'c'},
|
||
|
{"libs", no_argument, 0, 'd'},
|
||
|
{"libs_r", no_argument, 0, 'e'},
|
||
|
{"version", no_argument, 0, 'f'},
|
||
|
{"cc_version", no_argument, 0, 'g'},
|
||
|
{"socket", no_argument, 0, 'h'},
|
||
|
{"port", no_argument, 0, 'i'},
|
||
|
{"plugindir", no_argument, 0, 'j'},
|
||
|
{NULL, 0, 0, 0}
|
||
|
};
|
||
|
|
||
|
static char *values[]=
|
||
|
{
|
||
|
CFLAGS,
|
||
|
NULL,
|
||
|
INCLUDE,
|
||
|
LIBS,
|
||
|
LIBS,
|
||
|
VERSION,
|
||
|
CC_VERSION,
|
||
|
SOCKET,
|
||
|
PORT,
|
||
|
PLUGIN_DIR
|
||
|
};
|
||
|
|
||
|
const char *my_progname;
|
||
|
|
||
|
void usage(void)
|
||
|
{
|
||
|
int i=0;
|
||
|
puts("Copyright 2011-2015 MariaDB Corporation AB");
|
||
|
puts("Get compiler flags for using the MariaDB Connector/C.");
|
||
|
printf("Usage: %s [OPTIONS]\n", my_progname);
|
||
|
while (long_options[i].name)
|
||
|
{
|
||
|
if (values[i])
|
||
|
printf(" --%-12s [%s]\n", long_options[i].name, values[i]);
|
||
|
i++;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
int main(int argc, char **argv)
|
||
|
{
|
||
|
int c;
|
||
|
my_progname= argv[0];
|
||
|
|
||
|
if (argc <= 1)
|
||
|
{
|
||
|
usage();
|
||
|
exit(1);
|
||
|
}
|
||
|
|
||
|
while(1)
|
||
|
{
|
||
|
int option_index= 0;
|
||
|
c= getopt_long(argc, argv, "abcdefghij", long_options, &option_index);
|
||
|
|
||
|
switch(c) {
|
||
|
case 'a':
|
||
|
puts(CFLAGS);
|
||
|
break;
|
||
|
case 'b':
|
||
|
usage();
|
||
|
break;
|
||
|
case 'c':
|
||
|
puts(INCLUDE);
|
||
|
break;
|
||
|
case 'd':
|
||
|
case 'e':
|
||
|
puts(LIBS);
|
||
|
break;
|
||
|
case 'f':
|
||
|
puts(VERSION);
|
||
|
break;
|
||
|
case 'g':
|
||
|
puts(CC_VERSION);
|
||
|
break;
|
||
|
case 'h':
|
||
|
puts(SOCKET);
|
||
|
break;
|
||
|
case 'i':
|
||
|
puts(PORT);
|
||
|
break;
|
||
|
case 'j':
|
||
|
puts(PLUGIN_DIR);
|
||
|
break;
|
||
|
default:
|
||
|
exit(0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
exit(0);
|
||
|
}
|
||
|
|