2 |
dnl |
dnl |
3 |
dnl Copyright (c) by Jaroslav Kysela <perex@suse.cz> |
dnl Copyright (c) by Jaroslav Kysela <perex@suse.cz> |
4 |
|
|
5 |
AC_INIT(acore/sound.c) |
AC_INIT(acore/sound.patch) |
6 |
AC_PREFIX_DEFAULT(/usr) |
AC_PREFIX_DEFAULT(/usr) |
7 |
CONFIG_SND_VERSION="0.9.3c" |
CONFIG_SND_VERSION="0.9.4" |
8 |
|
|
9 |
dnl Checks for programs. |
dnl Checks for programs. |
10 |
AC_PROG_CC |
AC_PROG_CC |
191 |
kernel_compiler="", |
kernel_compiler="", |
192 |
kernel_compiler="")]) |
kernel_compiler="")]) |
193 |
CFLAGS="$ac_save_CFLAGS" |
CFLAGS="$ac_save_CFLAGS" |
194 |
|
my_compiler=`$CROSS_COMPILE$CC --version | head -n 1` |
195 |
|
dnl |
196 |
|
dnl Test section, uncomment any of these double lines to verify the bellow code: |
197 |
|
dnl |
198 |
|
dnl |
199 |
|
dnl kernel_compiler="gcc 3.2" |
200 |
|
dnl my_compiler="gcc (GCC) 3.2" |
201 |
|
dnl |
202 |
|
dnl kernel_compiler="gcc 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk)" |
203 |
|
dnl my_compiler="gcc-3.2.2 (GCC) 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk)" |
204 |
|
dnl |
205 |
|
dnl kernel_compiler="gcc egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)" |
206 |
|
dnl my_compiler="egcs-2.91.66" |
207 |
|
dnl |
208 |
|
dnl kernel_compiler="gcc 2.95.3 20010315 (release)" |
209 |
|
dnl my_compiler="2.95.3" |
210 |
|
dnl |
211 |
kernel_compiler_type=`echo $kernel_compiler | cut -d ' ' -f 1` |
kernel_compiler_type=`echo $kernel_compiler | cut -d ' ' -f 1` |
212 |
kernel_compiler_version=`echo $kernel_compiler | cut -d ' ' -f 2` |
kernel_compiler_version=`echo $kernel_compiler | cut -d ' ' -f 2` |
213 |
my_compiler=`$CROSS_COMPILE$CC --version | head -n 1` |
if test "${kernel_compiler_version:0:5}" = "egcs-"; then |
214 |
my_compiler_type=`echo $my_compiler | cut -d ' ' -f 1` |
kernel_compiler_type="egcs" |
215 |
my_compiler_version=`echo $my_compiler | cut -d ' ' -f 3` |
kernel_compiler_version=`echo ${kernel_compiler_version:5} | cut -d ' ' -f 1` |
216 |
if test -z "$my_compiler_version" -o "$my_compiler_type" = "$my_compiler_version" ; then |
fi |
217 |
my_compiler_version="$my_compiler_type" |
if test "${my_compiler:0:4}" = "gcc-"; then |
218 |
|
my_compiler_type="gcc" |
219 |
|
my_compiler_version=`echo ${my_compiler:4} | cut -d ' ' -f 1` |
220 |
|
else |
221 |
|
if test "${my_compiler:0:5}" = "egcs-"; then |
222 |
|
my_compiler_type="egcs" |
223 |
|
my_compiler_version=`echo ${my_compiler:5} | cut -d ' ' -f 1` |
224 |
|
else |
225 |
|
my_compiler_type=`echo $my_compiler | cut -d ' ' -f 1` |
226 |
|
my_compiler_version=`echo $my_compiler | cut -d ' ' -f 3` |
227 |
|
fi |
228 |
|
fi |
229 |
|
if test "$my_compiler_type" = "$my_compiler_version"; then |
230 |
my_compiler_type="gcc" |
my_compiler_type="gcc" |
|
my_compiler="gcc $my_compiler" |
|
231 |
fi |
fi |
232 |
AC_MSG_RESULT(Kernel compiler: $kernel_compiler Used compiler: $my_compiler); |
AC_MSG_RESULT(Kernel compiler: $kernel_compiler Used compiler: $my_compiler); |
233 |
if test -z "$kernel_compiler"; then |
if test -z "$kernel_compiler"; then |
240 |
else |
else |
241 |
if test "$my_compiler_type" != "$kernel_compiler_type"; then |
if test "$my_compiler_type" != "$kernel_compiler_type"; then |
242 |
echo "Fatal error: Compiler type does not match" |
echo "Fatal error: Compiler type does not match" |
243 |
|
echo "Decoded kernel compiler: type=$kernel_compiler_type version=$kernel_compiler_version" |
244 |
|
echo "Decoded used compiler: type=$my_compiler_type version=$my_compiler_version" |
245 |
|
echo "Please, send ./configure output to <alsa-devel@alsa-project.org>" |
246 |
exit 1 |
exit 1 |
247 |
fi |
fi |
248 |
if test "$my_compiler_type" = "gcc" ; then |
if test "$my_compiler_type" = "gcc" ; then |
251 |
if test $kernel_major -eq 2 -a $my_major -eq 3 ; then |
if test $kernel_major -eq 2 -a $my_major -eq 3 ; then |
252 |
echo "Fatal error: Kernel is compiled with GCC 2.x and you are trying to use GCC 3.x." |
echo "Fatal error: Kernel is compiled with GCC 2.x and you are trying to use GCC 3.x." |
253 |
echo " These two version of GCC are incompatible for binary code." |
echo " These two version of GCC are incompatible for binary code." |
254 |
|
exit 1 |
255 |
fi |
fi |
256 |
if test $kernel_major -eq 3 -a $my_major -eq 2 ; then |
if test $kernel_major -eq 3 -a $my_major -eq 2 ; then |
257 |
echo "Fatal error: Kernel is compiled with GCC 3.x and you are trying to use GCC 2.x." |
echo "Fatal error: Kernel is compiled with GCC 3.x and you are trying to use GCC 2.x." |
258 |
echo " These two version of GCC are incompatible for binary code." |
echo " These two version of GCC are incompatible for binary code." |
259 |
|
exit 1 |
260 |
fi |
fi |
261 |
fi |
fi |
262 |
fi |
fi |
280 |
fi |
fi |
281 |
]) |
]) |
282 |
|
|
283 |
|
AC_DEFUN(CHECK_AND_REPLACE_KERNEL_HEADER, [ |
284 |
|
AC_MSG_CHECKING(for kernel $1) |
285 |
|
if test -f "$CONFIG_SND_KERNELDIR/include/$1"; then |
286 |
|
AC_MSG_RESULT("yes") |
287 |
|
if test -f include/$1; then |
288 |
|
echo "Removing a dummy $1." |
289 |
|
rm -f include/$1 |
290 |
|
fi |
291 |
|
else |
292 |
|
AC_MSG_RESULT("no") |
293 |
|
if test ! -f include/$1; then |
294 |
|
echo "Creating a dummy <$1> which points to <$2>..." |
295 |
|
mkdir -p include/linux |
296 |
|
echo "#include <$2>" > include/$1 |
297 |
|
fi |
298 |
|
fi |
299 |
|
]) |
300 |
|
|
301 |
dnl Check kernel configurations |
dnl Check kernel configurations |
302 |
AC_DEFUN(CHECK_KERNEL_CONFIG, [ |
AC_DEFUN(CHECK_KERNEL_CONFIG, [ |
303 |
boolvar=$1 |
boolvar=$1 |
345 |
fi |
fi |
346 |
fi |
fi |
347 |
CHECK_KERNEL_HEADER(asm/hw_irq.h) |
CHECK_KERNEL_HEADER(asm/hw_irq.h) |
348 |
|
CHECK_AND_REPLACE_KERNEL_HEADER(linux/jiffies.h, linux/sched.h) |
349 |
|
dnl PPC headers (for 2.2 kernels) |
350 |
|
CHECK_AND_REPLACE_KERNEL_HEADER(linux/adb.h, asm/adb.h) |
351 |
|
CHECK_AND_REPLACE_KERNEL_HEADER(linux/cuda.h, asm/cuda.h) |
352 |
|
CHECK_AND_REPLACE_KERNEL_HEADER(linux/pmu.h, asm/pmu.h) |
353 |
|
|
354 |
dnl Check for modversions... |
dnl Check for modversions... |
355 |
CHECK_KERNEL_CONFIG(CONFIG_MODVERSIONS, [kernel module symbol versions]) |
CHECK_KERNEL_CONFIG(CONFIG_MODVERSIONS, [kernel module symbol versions]) |
865 |
AC_DEFINE(CONFIG_PNP) |
AC_DEFINE(CONFIG_PNP) |
866 |
fi |
fi |
867 |
|
|
868 |
|
dnl Check for strlcpy... |
869 |
|
AC_MSG_CHECKING(for strlcpy) |
870 |
|
strlcpy="0" |
871 |
|
ac_save_CFLAGS="$CFLAGS" |
872 |
|
CFLAGS="-Wall -Werror $CFLAGS -I$CONFIG_SND_KERNELDIR/include" |
873 |
|
AC_TRY_COMPILE([ |
874 |
|
#define __KERNEL__ |
875 |
|
#include "$CONFIG_SND_KERNELDIR/include/linux/config.h" |
876 |
|
#include "$CONFIG_SND_KERNELDIR/include/linux/kernel.h" |
877 |
|
],[ |
878 |
|
char buf[128]; |
879 |
|
strlcpy(buf, "abcd", sizeof(buf)); |
880 |
|
], |
881 |
|
AC_MSG_RESULT("yes");strlcpy="1", |
882 |
|
AC_MSG_RESULT("no");strlcpy="0", |
883 |
|
AC_MSG_RESULT("unknown");strlcpy="0" |
884 |
|
) |
885 |
|
CFLAGS=$ac_save_CFLAGS |
886 |
|
CONFIG_HAVE_STRLCPY=$strlcpy |
887 |
|
dnl AC_SUBST(CONFIG_HAVE_STRLCPY) |
888 |
|
if test "$CONFIG_HAVE_STRLCPY" = "1"; then |
889 |
|
AC_DEFINE(CONFIG_HAVE_STRLCPY) |
890 |
|
fi |
891 |
|
|
892 |
|
dnl Check for snprintf... |
893 |
|
AC_MSG_CHECKING(for snprintf) |
894 |
|
snprintf="0" |
895 |
|
ac_save_CFLAGS="$CFLAGS" |
896 |
|
CFLAGS="-Wall -Werror $CFLAGS -I$CONFIG_SND_KERNELDIR/include" |
897 |
|
AC_TRY_COMPILE([ |
898 |
|
#define __KERNEL__ |
899 |
|
#include "$CONFIG_SND_KERNELDIR/include/linux/config.h" |
900 |
|
#include "$CONFIG_SND_KERNELDIR/include/linux/kernel.h" |
901 |
|
],[ |
902 |
|
char buf[128]; |
903 |
|
snprintf(buf, sizeof(buf), "abcd"); |
904 |
|
], |
905 |
|
AC_MSG_RESULT("yes");snprintf="1", |
906 |
|
AC_MSG_RESULT("no");snprintf="0", |
907 |
|
AC_MSG_RESULT("unknown");snprintf="0" |
908 |
|
) |
909 |
|
CFLAGS=$ac_save_CFLAGS |
910 |
|
CONFIG_HAVE_SNPRINTF=$snprintf |
911 |
|
dnl AC_SUBST(CONFIG_HAVE_SNPRINTF) |
912 |
|
if test "$CONFIG_HAVE_SNPRINTF" = "1"; then |
913 |
|
AC_DEFINE(CONFIG_HAVE_SNPRINTF) |
914 |
|
fi |
915 |
|
|
916 |
|
dnl Check for vmalloc_to_page... |
917 |
|
AC_MSG_CHECKING(for vmalloc_to_page) |
918 |
|
vmalloc_to_page="0" |
919 |
|
ac_save_CFLAGS="$CFLAGS" |
920 |
|
CFLAGS="$CFLAGS -I$CONFIG_SND_KERNELDIR/include" |
921 |
|
AC_TRY_COMPILE([ |
922 |
|
#define __KERNEL__ |
923 |
|
#include "$CONFIG_SND_KERNELDIR/include/linux/config.h" |
924 |
|
#include "$CONFIG_SND_KERNELDIR/include/linux/time.h" |
925 |
|
#include "$CONFIG_SND_KERNELDIR/include/linux/slab.h" |
926 |
|
],[ |
927 |
|
struct page * (*func)(void*); |
928 |
|
func = vmalloc_to_page; |
929 |
|
], |
930 |
|
AC_MSG_RESULT("yes");vmalloc_to_page="1", |
931 |
|
AC_MSG_RESULT("no");vmalloc_to_page="0", |
932 |
|
AC_MSG_RESULT("unknown");vmalloc_to_page="0" |
933 |
|
) |
934 |
|
CFLAGS=$ac_save_CFLAGS |
935 |
|
CONFIG_HAVE_VMALLOC_TO_PAGE=$vmalloc_to_page |
936 |
|
dnl AC_SUBST(CONFIG_HAVE_VMALLOC_TO_PAGE) |
937 |
|
if test "$CONFIG_HAVE_VMALLOC_TO_PAGE" = "1"; then |
938 |
|
AC_DEFINE(CONFIG_HAVE_VMALLOC_TO_PAGE) |
939 |
|
fi |
940 |
|
|
941 |
|
dnl Check for old kmod... |
942 |
|
AC_MSG_CHECKING(for old kmod) |
943 |
|
old_kmod="0" |
944 |
|
ac_save_CFLAGS="$CFLAGS" |
945 |
|
CFLAGS="$CFLAGS -Wall -I$CONFIG_SND_KERNELDIR/include" |
946 |
|
AC_TRY_COMPILE([ |
947 |
|
#define __KERNEL__ |
948 |
|
#include "$CONFIG_SND_KERNELDIR/include/linux/config.h" |
949 |
|
#include "$CONFIG_SND_KERNELDIR/include/linux/module.h" |
950 |
|
],[ |
951 |
|
kmod("abcd", "def", "ixj"); |
952 |
|
], |
953 |
|
AC_MSG_RESULT("yes");old_kmod="1", |
954 |
|
AC_MSG_RESULT("no");old_kmod="0", |
955 |
|
AC_MSG_RESULT("unknown");old_kmod="0" |
956 |
|
) |
957 |
|
CFLAGS=$ac_save_CFLAGS |
958 |
|
CONFIG_HAVE_OLD_REQUEST_MODULE=$old_kmod |
959 |
|
dnl AC_SUBST(CONFIG_HAVE_OLD_REQUEST_MODULE) |
960 |
|
if test "$CONFIG_HAVE_OLD_REQUEST_MODULE" = "1"; then |
961 |
|
AC_DEFINE(CONFIG_HAVE_OLD_REQUEST_MODULE) |
962 |
|
fi |
963 |
|
|
964 |
dnl check only on 2.2 kernel.. |
dnl check only on 2.2 kernel.. |
965 |
if test $kpatchlevel -le 2; then |
if test $kpatchlevel -le 2; then |
966 |
|
|
971 |
CFLAGS="$CFLAGS -I$CONFIG_SND_KERNELDIR/include" |
CFLAGS="$CFLAGS -I$CONFIG_SND_KERNELDIR/include" |
972 |
AC_TRY_COMPILE([ |
AC_TRY_COMPILE([ |
973 |
#define __KERNEL__ |
#define __KERNEL__ |
974 |
|
#include "$CONFIG_SND_KERNELDIR/include/linux/config.h" |
975 |
#ifdef __alpha__ /* it's required (at least for 2.2.18) */ |
#ifdef __alpha__ /* it's required (at least for 2.2.18) */ |
976 |
#include <asm/current.h> |
#include "$CONFIG_SND_KERNELDIR/include/asm/current.h" |
977 |
#endif |
#endif |
978 |
#include <linux/fs.h> |
#include "$CONFIG_SND_KERNELDIR/include/linux/fs.h" |
979 |
],[ |
],[ |
980 |
struct fasync_struct *fa; |
struct fasync_struct *fa; |
981 |
int sig; |
int sig; |
999 |
CFLAGS="$CFLAGS -I$CONFIG_SND_KERNELDIR/include" |
CFLAGS="$CFLAGS -I$CONFIG_SND_KERNELDIR/include" |
1000 |
AC_TRY_COMPILE([ |
AC_TRY_COMPILE([ |
1001 |
#define __KERNEL__ |
#define __KERNEL__ |
1002 |
#include <asm/types.h> |
#include "$CONFIG_SND_KERNELDIR/include/linux/config.h" |
1003 |
|
#include "$CONFIG_SND_KERNELDIR/include/asm/types.h" |
1004 |
],[ |
],[ |
1005 |
dma_addr_t addr; |
dma_addr_t addr; |
1006 |
], |
], |
1022 |
CFLAGS="$CFLAGS -I$CONFIG_SND_KERNELDIR/include" |
CFLAGS="$CFLAGS -I$CONFIG_SND_KERNELDIR/include" |
1023 |
AC_TRY_COMPILE([ |
AC_TRY_COMPILE([ |
1024 |
#define __KERNEL__ |
#define __KERNEL__ |
1025 |
#include <asm/semaphore.h> |
#include "$CONFIG_SND_KERNELDIR/include/linux/config.h" |
1026 |
|
#include "$CONFIG_SND_KERNELDIR/include/asm/semaphore.h" |
1027 |
],[ |
],[ |
1028 |
#ifndef init_MUTEX |
#ifndef init_MUTEX |
1029 |
#error not defined |
#error not defined |
1070 |
fi |
fi |
1071 |
fi |
fi |
1072 |
|
|
|
dnl Check for vmalloc_to_page... |
|
|
AC_MSG_CHECKING(for vmalloc_to_page) |
|
|
vmalloc_to_page="0" |
|
|
ac_save_CFLAGS="$CFLAGS" |
|
|
CFLAGS="$CFLAGS -I$CONFIG_SND_KERNELDIR/include" |
|
|
AC_TRY_COMPILE([ |
|
|
#define __KERNEL__ |
|
|
#include <linux/config.h> |
|
|
#include <linux/time.h> |
|
|
#include <linux/slab.h> |
|
|
],[ |
|
|
struct page * (*func)(void*); |
|
|
func = vmalloc_to_page; |
|
|
], |
|
|
AC_MSG_RESULT("yes");vmalloc_to_page="1", |
|
|
AC_MSG_RESULT("no");vmalloc_to_page="0", |
|
|
AC_MSG_RESULT("unknown");vmalloc_to_page="0" |
|
|
) |
|
|
CFLAGS=$ac_save_CFLAGS |
|
|
CONFIG_HAVE_VMALLOC_TO_PAGE=$vmalloc_to_page |
|
|
dnl AC_SUBST(CONFIG_HAVE_VMALLOC_TO_PAGE) |
|
|
if test "$CONFIG_HAVE_VMALLOC_TO_PAGE" = "1"; then |
|
|
AC_DEFINE(CONFIG_HAVE_VMALLOC_TO_PAGE) |
|
|
fi |
|
|
|
|
1073 |
dnl Check for version... |
dnl Check for version... |
1074 |
AC_MSG_CHECKING(for driver version) |
AC_MSG_CHECKING(for driver version) |
1075 |
AC_DEFINE_UNQUOTED(CONFIG_SND_VERSION, "$CONFIG_SND_VERSION") |
AC_DEFINE_UNQUOTED(CONFIG_SND_VERSION, "$CONFIG_SND_VERSION") |
1130 |
int main(void) { exit(1); } |
int main(void) { exit(1); } |
1131 |
#else |
#else |
1132 |
#define __KERNEL__ |
#define __KERNEL__ |
1133 |
#include <linux/version.h> |
#include "$CONFIG_SND_KERNELDIR/include/linux/version.h" |
1134 |
|
#include "$CONFIG_SND_KERNELDIR/include/linux/config.h" |
1135 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 12) /* FIXME: which 2.2.x kernel? */ |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 12) /* FIXME: which 2.2.x kernel? */ |
1136 |
#include <linux/rtc.h> |
#include "$CONFIG_SND_KERNELDIR/include/linux/rtc.h" |
1137 |
#else |
#else |
1138 |
#include <linux/mc146818rtc.h> |
#include "$CONFIG_SND_KERNELDIR/include/linux/mc146818rtc.h" |
1139 |
#endif |
#endif |
1140 |
int main(void) |
int main(void) |
1141 |
{ |
{ |