00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "stdio.h"
00032 #include "stdlib.h"
00033 #include "string.h"
00034
00035 typedef struct {
00036 const char *name;
00037 const char *value;
00038 } cf_parameter;
00039
00040 const cf_parameter cf_parameter_list[] = {
00041 { "CONFDIR", CONFDIR },
00042 { "DATADIR", DATADIR },
00043 { "LIBDIR", LIBDIR },
00044 { "LOCALDIR", LOCALDIR },
00045 { "PLUGIN_SUFFIX", PLUGIN_SUFFIX },
00046 };
00047
00048 const int cf_parameter_list_size = sizeof(cf_parameter_list)/sizeof(cf_parameter);
00049
00050 int main(int argc, char **argv) {
00051 int i;
00052
00053 if (argc == 2) {
00054 if (!strcmp(argv[1], "--parameter-list")) {
00055 printf("parameter maybe one of:\n");
00056 printf("\tPLUGININSTALLDIR\n");
00057 for (i = 0; i < cf_parameter_list_size; i++)
00058 printf("\t%s\n", cf_parameter_list[i].name);
00059 return 0;
00060 }
00061
00062
00063 if (!strcmp(argv[1], "PLUGININSTALLDIR")) {
00064 printf("%s/plugins/\n", LIBDIR);
00065 return 0;
00066 }
00067 if (!strcmp(argv[1], "--Dflags")) {
00068 for (i = 0; i < cf_parameter_list_size; i++)
00069 printf("-D%s=\\\"%s\\\" ", cf_parameter_list[i].name, cf_parameter_list[i].value);
00070
00071
00072 printf("\n");
00073 return 0;
00074 }
00075 for (i = 0; i < cf_parameter_list_size; i++) {
00076 if (!strcmp(argv[1], cf_parameter_list[i].name)) {
00077 printf("%s\n", cf_parameter_list[i].value);
00078 return 0;
00079 }
00080 }
00081 }
00082
00083 printf("usage: crossfire-config --Dflags");
00084 printf(" (gives complete Dflags line for compiler invocation)\n");
00085 printf("usage: crossfire-config --parameter-list");
00086 printf(" (show the list of available parameters)\n");
00087 printf("usage: crossfire-config <parameter name>");
00088 printf(" (extract a compilation parameter)\n");
00089 return -1;
00090 }