aboutsummaryrefslogtreecommitdiff
path: root/pd/portaudio/configure.in
blob: edb0fe11442bf77d37523cf6dad503a27cbdc899 (plain)
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
dnl
dnl portaudio V19 configure.in script
dnl
dnl Dominic Mazzoni
dnl

dnl Require autoconf >= 2.13
AC_PREREQ(2.13)

dnl Init autoconf and make sure configure is being called
dnl from the right directory
AC_INIT([pa_common/portaudio.h])

dnl Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PATH_PROG(AR, ar, no)
if [[ $AR = "no" ]] ; then
    AC_MSG_ERROR("Could not find ar - needed to create a library");
fi

dnl This must be one of the first tests we do or it will fail...
AC_C_BIGENDIAN

dnl extra variables
AC_SUBST(OTHER_OBJS)
AC_SUBST(PADLL)
AC_SUBST(SHARED_FLAGS)
AC_SUBST(DLL_LIBS)

dnl checks for various host APIs and arguments to configure that
dnl turn them on or off

AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no)

PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no)

AC_ARG_WITH(alsa, 
            [  --with-alsa (default=auto)],
            with_alsa=$withval, with_alsa="yes")

AC_ARG_WITH(jack, 
            [  --with-jack (default=auto)],
            with_jack=$withval, with_jack="yes")

AC_ARG_WITH(oss, 
            [  --with-oss (default=yes)],
            with_oss=$withval, with_oss="yes")

CFLAGS="-g -O2 -Wall"

if [[ $ac_cv_c_bigendian = "yes" ]] ; then
   CFLAGS="$CFLAGS -DPA_BIG_ENDIAN"
else
   CFLAGS="$CFLAGS -DPA_LITTLE_ENDIAN"
fi

case "${host_os}" in
  darwin* )
	dnl Mac OS X configuration

	OTHER_OBJS="pa_mac_core/pa_mac_core.o";
	LIBS="-framework AudioUnit -framework AudioToolbox -framework CoreAudio";
	PADLL="libportaudio.dylib";
	SHARED_FLAGS="-framework AudioUnit -framework AudioToolbox";
	SHARED_FLAGS="$SHARED_FLAGS -framework CoreAudio -dynamiclib";
	;;

  mingw* )
	dnl MingW configuration

	OTHER_OBJS="pa_win_wmme/pa_win_wmme.o";
	LIBS="-lwinmm -lm";
	PADLL="portaudio.dll";
	SHARED_FLAGS="-shared -mthreads";
	DLL_LIBS="-lwinmm";
	;;

  cygwin* )
	dnl Cygwin configuration

	OTHER_OBJS="pa_win_wmme/pa_win_wmme.o";
	LIBS="-lwinmm -lm";
	PADLL="portaudio.dll";
	SHARED_FLAGS="-shared -mthreads";
	DLL_LIBS="-lwinmm";
	;;

  *)
	dnl Unix OSS configuration

   AC_CHECK_LIB(pthread, pthread_create,
                ,
                AC_MSG_ERROR([libpthread not found!]))

	if [[ $have_alsa = "yes" ] && [ $with_alsa != "no" ]] ; then
                LIBS="$LIBS -lasound"
		OTHER_OBJS="$OTHER_OBJS pa_linux_alsa/pa_linux_alsa.o"
		OTHER_OBJS="$OTHER_OBJS pa_linux_alsa/callback_thread.o"
		OTHER_OBJS="$OTHER_OBJS pa_linux_alsa/blocking_calls.o"
                AC_DEFINE(PA_USE_ALSA)
	fi

	if [[ $have_jack = "yes" ] && [ $with_jack != "no" ]] ; then
   	LIBS="$LIBS $JACK_LIBS"
		CFLAGS="$CFLAGS $JACK_CFLAGS"
		OTHER_OBJS="$OTHER_OBJS pa_jack/pa_jack.o"
                AC_DEFINE(PA_USE_JACK)
	fi

	if [[ $with_oss != "no" ]] ; then
		OTHER_OBJS="$OTHER_OBJS pa_unix_oss/pa_unix_oss.o"
		AC_DEFINE(PA_USE_OSS)
	fi
	LIBS="$LIBS -lm -lpthread";
	PADLL="libportaudio.so";
	SHARED_FLAGS="-shared";

        OTHER_OBJS="$OTHER_OBJS pa_unix/pa_unix_hostapis.o pa_unix/pa_unix_util.o"
esac

AC_OUTPUT([Makefile])