-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
240 lines (202 loc) · 7.68 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
AC_PREREQ(2.60)
m4_define(PA_MAJOR, [6])
m4_define(PA_MINOR, [0])
m4_define(NEMO_MICRO, [4])
AC_INIT([pulseaudio-module-cmtspeech-n9xx], [PA_MAJOR.PA_MINOR.NEMO_MICRO], [[email protected]])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE([foreign -Wall silent-rules])
AC_CONFIG_MACRO_DIR(m4)
AM_SILENT_RULES([yes])
if type -p stow > /dev/null && test -d /usr/local/stow ; then
AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
fi
AC_PROG_CC
AC_PROG_CC_C99
AM_PROG_CC_C_O
AC_PROG_GCC_TRADITIONAL
AC_SUBST(PA_MAJORMINOR, PA_MAJOR.PA_MINOR)
DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wno-long-long -Winline -Wvla -Wno-overlength-strings -Wunsafe-loop-optimizations -Wundef -Wformat=2 -Wlogical-op -Wsign-compare -Wpacked -Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -Wold-style-definition -Wpointer-arith -Winit-self -Wfloat-equal -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-unused-parameter -ffast-math -Wp,-D_FORTIFY_SOURCE=2 -fno-common -fdiagnostics-show-option" # PulseAudio 0.9.15 usess same + -Wcast-align -Wdeclaration-after-statement
for flag in $DESIRED_FLAGS ; do
CC_CHECK_CFLAGS([$flag], [CFLAGS="$CFLAGS $flag"])
done
# FIXME: we should push that as .m4 macro installed by pulseaudio-dev package
# Native atomic operation support
AC_ARG_ENABLE([atomic-arm-linux-helpers],
AS_HELP_STRING([--disable-atomic-arm-linux-helpers],[use inline asm or libatomic_ops instead]),
[
case "${enableval}" in
yes) atomic_arm_linux_helpers=yes ;;
no) atomic_arm_linux_helpers=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --disable-atomic-arm-linux-helpers) ;;
esac
],
[atomic_arm_linux_helpers=auto])
AC_ARG_ENABLE([atomic-arm-memory-barrier],
AS_HELP_STRING([--enable-atomic-arm-memory-barrier],[only really needed in SMP arm systems]),
[
case "${enableval}" in
yes) AC_DEFINE_UNQUOTED(ATOMIC_ARM_MEMORY_BARRIER_ENABLED, 1, [Enable memory barriers]) ;;
no) ;;
*) AC_MSG_ERROR(bad value ${enableval} for --disable-atomic-arm-linux-helpers) ;;
esac
],)
AC_CANONICAL_HOST
AC_DEFINE_UNQUOTED([CANONICAL_HOST], "$host", [Canonical host string.])
AC_MSG_CHECKING([target operating system])
case $host in
*-*-linux*)
AC_MSG_RESULT([linux])
pulse_target_os=linux
;;
*)
AC_MSG_RESULT([unknown])
pulse_target_os=unknown
;;
esac
# If everything else fails use libatomic_ops
need_libatomic_ops=yes
AC_MSG_CHECKING([whether $CC knows __sync_bool_compare_and_swap()])
AC_LANG_CONFTEST([int main() { int a = 4; __sync_bool_compare_and_swap(&a, 4, 5); }])
$CC conftest.c $CFLAGS -o conftest > /dev/null 2> /dev/null
ret=$?
rm -f conftest.o conftest
if test $ret -eq 0 ; then
AC_DEFINE([HAVE_ATOMIC_BUILTINS], 1, [Have __sync_bool_compare_and_swap() and friends.])
AC_MSG_RESULT([yes])
need_libatomic_ops=no
else
AC_MSG_RESULT([no])
# HW specific atomic ops stuff
AC_MSG_CHECKING([architecture for native atomic operations])
case $host_cpu in
arm*)
AC_MSG_RESULT([arm])
AC_MSG_CHECKING([compiler support for arm inline asm atomic operations])
AC_LANG_CONFTEST([[int main()
{
volatile int a=0;
int o=0, n=1, r;
asm volatile ("ldrex %0, [%1]\n"
"subs %0, %0, %2\n"
"strexeq %0, %3, [%1]\n"
: "=&r" (r)
: "r" (&a), "Ir" (o), "r" (n)
: "cc");
return (a==1 ? 0 : -1);
}]])
$CC conftest.c $CFLAGS -o conftest > /dev/null 2>&1
ret=$?
rm -f conftest.o conftest
if test $ret -eq 0 ; then
AC_DEFINE([ATOMIC_ARM_INLINE_ASM], 1, [Have ARMv6 instructions.])
AC_MSG_RESULT([yes])
need_libatomic_ops=no
else
# We really want inline asm atomic operations!!
echo "ERROR No ARMv6 instructions available check your compiler!!!"
exit 1
AC_MSG_CHECKING([whether we can use Linux kernel helpers])
# The Linux kernel helper functions have been there since 2.6.16. However
# compile time checking for kernel version in cross compile environment
# (which is usually the case for arm cpu) is tricky (or impossible).
if test "x$pulse_target_os" = "xlinux" && test "x$atomic_arm_linux_helpers" != "xno"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(ATOMIC_ARM_LINUX_HELPERS, 1, [special arm linux implementation])
need_libatomic_ops=no
else
AC_MSG_RESULT([no])
fi
fi
;;
*)
AC_MSG_RESULT([unknown])
;;
esac
fi
AC_MSG_CHECKING([whether we need libatomic_ops])
if test "x$need_libatomic_ops" = "xyes"; then
AC_MSG_RESULT([yes])
AC_CHECK_HEADERS([atomic_ops.h], [], [
AC_MSG_ERROR([*** libatomic-ops headers not found])
])
# Win32 does not need the lib and breaks horribly if we try to include it
if test "x$os_is_win32" != "x1" ; then
LIBS="$LIBS -latomic_ops"
fi
else
AC_MSG_RESULT([no])
fi
CC_CHECK_TLS
AC_CACHE_CHECK([whether $CC knows _Bool],
pulseaudio_cv__Bool,
[AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([], [[_Bool b;]]),
[pulseaudio_cv__Bool=yes],
[pulseaudio_cv__Bool=no])
])
AS_IF([test "$pulseaudio_cv__Bool" = "yes"], [
AC_DEFINE([HAVE_STD_BOOL], 1, [Have _Bool.])
])
#### libtool stuff (FIXME: when sbox will have 2.2 )####
#LT_PREREQ(2.2)
#LT_INIT([dlopen win32-dll disable-static])
AC_PROG_LIBTOOL
PKG_CHECK_MODULES([PULSEAUDIO], [libpulse >= 4.0 pulsecore >= 4.0 ])
AC_SUBST(PULSEAUDIO_CFLAGS)
AC_SUBST(PULSEAUDIO_LIBS)
pulseaudiodir=`pkg-config --variable=prefix pulsecore`
PKG_CHECK_MODULES([MODULE_COMMON], [libmeego-common >= 4.0.2])
AC_SUBST(MODULE_COMMON_CFLAGS)
AC_SUBST(MODULE_COMMON_LIBS)
PKG_CHECK_MODULES([DBUS], [dbus-1 >= 1.2])
AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)
AC_ARG_WITH([module-dir],
AS_HELP_STRING([--with-module-dir],[Directory where to install the modules to (defaults to ${pulseaudiodir}/lib/pulse-${PA_MAJORMINOR}/modules/]),
[modlibexecdir=$withval], [modlibexecdir="${pulseaudiodir}/lib/pulse-${PA_MAJORMINOR}/modules"])
AC_SUBST(modlibexecdir)
############################################
# Cmtspeech
AC_CHECK_HEADER([cmtspeech.h],
,
[ AC_MSG_ERROR([*** libcmtspeechdata-devel headers not found ***]) ])
############################################
# x86
AC_MSG_CHECKING([Use x86 libraries])
case $host_cpu in
arm*) x86=no; AC_MSG_RESULT([no]) ;;
*) x86=yes; AC_MSG_RESULT([yes]) ;;
esac
AM_CONDITIONAL([X86], [test "x$x86" = xyes])
ENABLE_X86=no
if test "x$x86" = xyes ; then
AC_DEFINE([X86], 1, [x86 libraries used.])
ENABLE_X86=yes
fi
AC_MSG_CHECKING([If we are using hardfp tool chain])
case `echo | gcc -v -xc -o - - 2>&1 | grep COLLECT_GCC_OPTIONS | tail -1` in
*float-abi=hard*) hardfp=yes; AC_MSG_RESULT([yes]) ;;
*) hardfp=no; AC_MSG_RESULT([no]) ;;
esac
AM_CONDITIONAL([ARM_HARDFP], [test "x$hardfp" = xyes])
ENABLE_ARM_HARDFP=no
if test "x$hardfp" = xyes ; then
AC_DEFINE([ARM_HARDFP], 1, [ARM Hard FP toolchain used.])
ENABLE_ARM_HARDFP=yes
fi
AC_CONFIG_FILES([
Makefile
src/Makefile
src/cmtspeech/Makefile
])
AC_OUTPUT
echo "
---{ $PACKAGE_NAME $VERSION }---
compiler: ${CC}
CFLAGS: ${CFLAGS}
prefix: ${prefix}
PulseAudio prefix: ${pulseaudiodir}
modules directory: ${modlibexecdir}
Enable x86 libraries ${ENABLE_X86}
"