source: roaraudio/roarclients/roar-config.c @ 2062:ccb0a81398e3

Last change on this file since 2062:ccb0a81398e3 was 2025:58267001583a, checked in by phi, 15 years ago

added support for multibe libs

File size: 2.2 KB
Line 
1//roar-config.c:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008
5 *
6 *  This file is part of roarclients a part of RoarAudio,
7 *  a cross-platform sound system for both, home and professional use.
8 *  See README for details.
9 *
10 *  This file is free software; you can redistribute it and/or modify
11 *  it under the terms of the GNU General Public License version 3
12 *  as published by the Free Software Foundation.
13 *
14 *  RoarAudio is distributed in the hope that it will be useful,
15 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 *  GNU General Public License for more details.
18 *
19 *  You should have received a copy of the GNU General Public License
20 *  along with this software; see the file COPYING.  If not, write to
21 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 */
24
25#include <roaraudio.h>
26
27struct {
28 char * name;
29 char * cflags;
30 char * libs;
31} flags[] = {
32 {"roar",      ROAR_CFLAGS, ROAR_LIBS      }, // NOTE: libroar *MUST* be the first entry
33 {"roardsp",   ROAR_CFLAGS, ROAR_LIBS_DSP  },
34 {"roarmidi",  ROAR_CFLAGS, ROAR_LIBS_MIDI },
35 {"roarlight", ROAR_CFLAGS, ROAR_LIBS_LIGHT},
36 {NULL, NULL, NULL}
37}, * flags_ptr = NULL;
38
39int main (int argc, char * argv[]) {
40 int i, h;
41 int cflags = 0;
42 int libs   = 0;
43 char buf[1024] = {0};
44
45 if ( argc == 1 ) {
46  printf("Usage: roar-config [--version] [--libs] [--cflags] [lib]\n");
47  return 0;
48 }
49
50 for (i = 1; i < argc; i++) {
51  if ( !strcmp(argv[i], "--version") ) {
52   printf("unknown\n");
53  } else if ( !strcmp(argv[i], "--libs") ) {
54   libs   = 1;
55  } else if ( !strcmp(argv[i], "--cflags") ) {
56   cflags = 1;
57  } else if ( flags_ptr == NULL ) {
58   for (h = 0; flags[h].name != NULL; h++) {
59    if ( !strcasecmp(argv[i], flags[h].name) )
60     flags_ptr = &(flags[h]);
61   }
62
63   if ( flags_ptr == NULL ) {
64    ROAR_ERR("Unknown lib: %s", argv[i]);
65    return 2;
66   }
67  } else {
68   fprintf(stderr, "Unknown option: %s\n", argv[i]);
69   return 1;
70  }
71 }
72
73 if ( flags_ptr == NULL )
74  flags_ptr = &(flags[0]);
75
76 if ( cflags )
77  strcat(buf, flags_ptr->cflags);
78
79 if ( libs )
80  strcat(buf, flags_ptr->libs);
81
82 puts(buf);
83
84 return 0;
85}
86
87//ll
Note: See TracBrowser for help on using the repository browser.