source: roaraudio/plugins/ao/configure @ 1732:f2e00166a8e3

Last change on this file since 1732:f2e00166a8e3 was 1729:49fc00705baf, checked in by phi, 15 years ago

use pkg-config for libao plugin

  • Property exe set to *
File size: 2.0 KB
Line 
1#!/bin/sh
2
3INSTALL_DIR=/usr/lib/ao/plugins-2/
4
5HAVE_ROAR=false
6
7while [ "$1" != '' ]
8do
9 case "$1" in
10  --install-dir|--inst-dir)
11   INSTALL_DIR="$2"
12   shift;
13  ;;
14  --pkg-config)
15   PKG_CONFIG="$2"
16   shift;
17  ;;
18  --force-have-roar)
19   HAVE_ROAR=true
20  ;;
21  --help|-h)
22    cat << EOF
23Usage: ./configure [OPTIONS]...
24
25Options:
26  --help               - Show this help
27  --inst-dir DIR       - Install dir
28  --force-have-roar    - Force to assume libroar is ok
29  --pkg-config PKGCONF - Set filename for pkg-config
30EOF
31    exit 0
32   ;;
33  *)
34    echo 'Unknown option. Try ./configure --help'
35    exit 2
36 esac
37 shift;
38done
39
40on_error () {
41 rm -f Makefile.conf
42 exit 1;
43}
44
45echo -n 'testing for C compiler... '
46CC=$(which gcc cc 2> /dev/null | head -n 1)
47if [ -x "$CC" ]
48then
49 echo $CC
50else
51 echo no.
52 on_error;
53fi
54
55echo -n "checking for pkg-config... "
56if [ "$PKG_CONFIG" = '' ]
57then
58 PKG_CONFIG=$(which pkg-config false 2> /dev/null | grep ^/ | head -n 1)
59 if $PKG_CONFIG --help > /dev/null 2> /dev/null
60 then
61  echo $PKG_CONFIG
62 else
63  PKG_CONFIG=''
64  echo no
65  on_error;
66 fi
67else
68  echo $PKG_CONFIG '(forced)'
69fi
70
71echo -n 'testing for libao... '
72cat > tests.c << EOF
73#include <ao/ao.h>
74#include <ao/plugin.h>
75int main (void) { return 0; }
76EOF
77
78if [ "$PKG_CONFIG" = '' ]
79then
80 AO_LIBS=''
81 AO_CFLAGS=''
82else
83 AO_LIBS=`pkg-config --libs ao`
84 AO_CFLAGS=`pkg-config --cflags ao`
85fi
86if [ "$AO_LIBS" = '' -a "$AO_CFLAGS" = '' ]
87then
88 AO_LIBS='-lao'
89 AO_CFLAGS=''
90fi
91
92$CC $AO_LIBS $AO_CFLAGS -o tests tests.c 2> /dev/null
93./tests 2> /dev/null
94
95if [ "$?" = '0' ]
96then
97 echo yes
98else
99 echo no.
100 on_error
101fi
102
103echo -n 'testing for libroar... '
104if $HAVE_ROAR
105then
106 echo 'yes (forced)'
107else
108 cat > tests.c << EOF
109#include <roaraudio.h>
110int main (void) { return 0; }
111EOF
112
113 $CC -o tests tests.c -lroar 2> /dev/null
114 ./tests 2> /dev/null
115
116 if [ "$?" = '0' ]
117 then
118  echo yes
119 else
120  echo no.
121  on_error
122 fi
123fi
124rm -f tests tests.c
125
126echo creating Makefile.conf...
127{
128 echo "CC=$CC"
129 echo "INSTALL_DIR=$INSTALL_DIR"
130 echo
131 echo "AO_CFLAGS=$AO_CFLAGS"
132 echo "AO_LIBS=$AO_LIBS"
133} > Makefile.conf
134
135#ll
Note: See TracBrowser for help on using the repository browser.