| 1 | #!/bin/bash |
| 2 | # |
| 3 | |
| 4 | function usage { |
| 5 | echo "usage: faust-config <OPTION>..." |
| 6 | echo |
| 7 | echo "Get various configuration information needed to compile programs which use" |
| 8 | echo "Faust. Typically called from 'configure' scripts. Examples:" |
| 9 | echo " faust-config --cflags" |
| 10 | echo |
| 11 | echo "Options:" |
| 12 | echo " --version Print Faust version." |
| 13 | echo " --cflags C compiler flags for files that include Faust headers." |
| 14 | echo " --ldflags Print Linker flags." |
| 15 | echo " --system-libs System Libraries needed to link against LLVM components." |
| 16 | } |
| 17 | |
| 18 | function get { |
| 19 | case $1 in |
| 20 | --version) |
| 21 | faust --version |
| 22 | ;; |
| 23 | |
| 24 | --cflags) |
| 25 | OUT="$OUT -I$(faust --includedir)" |
| 26 | ;; |
| 27 | |
| 28 | --ldflags) |
| 29 | OUT="$OUT -L$(faust --libdir)" |
| 30 | ;; |
| 31 | |
| 32 | --system-libs) |
| 33 | OUT="$OUT $SYSTEMLIBS" |
| 34 | ;; |
| 35 | *) |
| 36 | usage |
| 37 | ;; |
| 38 | esac |
| 39 | } |
| 40 | |
| 41 | SYSTEMLIBS="-lm -lz -lcurses -lxml2" |
| 42 | |
| 43 | if [ "$#" -eq 0 ] |
| 44 | then |
| 45 | usage |
| 46 | exit 1 |
| 47 | fi |
| 48 | |
| 49 | |
| 50 | while [ $1 ] |
| 51 | do |
| 52 | get $1 |
| 53 | shift |
| 54 | done |
| 55 | |
| 56 | echo $OUT |
| 57 | |
| 58 | exit 0 |
| 59 | |
| 60 | |
| 61 |