aboutsummaryrefslogtreecommitdiffhomepage
path: root/configure.ac
blob: 0e4b994c3d9c6dd3f2177f58728e26abae424087 (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
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
dnl ------------------------------------------------
dnl Initialization and Versioning
dnl ------------------------------------------------

AC_INIT(libcubeb,[0.1git])

AC_CANONICAL_HOST
AC_CANONICAL_TARGET

AC_CONFIG_MACRO_DIR([m4])

AM_CONFIG_HEADER([config.h])
AC_CONFIG_SRCDIR([src/cubeb_pulse.c])
AM_INIT_AUTOMAKE

m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

dnl Library versioning
dnl CURRENT, REVISION, AGE
dnl - library source changed -> increment REVISION
dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
dnl - interfaces added -> increment AGE
dnl - interfaces removed -> AGE = 0

CUBEB_CURRENT=0
CUBEB_REVISION=0
CUBEB_AGE=1
AC_SUBST(CUBEB_CURRENT)
AC_SUBST(CUBEB_REVISION)
AC_SUBST(CUBEB_AGE)


dnl --------------------------------------------------  
dnl Check for programs
dnl --------------------------------------------------  

dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2"
dnl if $CFLAGS is blank
cflags_save="$CFLAGS"
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
CFLAGS="$cflags_save"

AM_PROG_CC_C_O
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL

dnl Choose the target platform audio API
AC_CHECK_HEADERS([alsa/asoundlib.h pulse/pulseaudio.h \
                  AudioUnit/AudioUnit.h \
                  windows.h dsound.h sndio.h SLES/OpenSLES.h])
platform_api="none"
platform_lib="none"
if test "x$ac_cv_header_pulse_pulseaudio_h" = "xyes"; then
  platform_api="pulse"
  platform_lib="-lpulse"
elif test "x$ac_cv_header_alsa_asoundlib_h" = "xyes"; then
  platform_api="alsa"
  platform_lib="-lasound"
elif test "x$ac_cv_header_AudioUnit_AudioUnit_h" = "xyes"; then
  platform_api="coreaudio"
  platform_lib="-framework CoreServices -framework AudioUnit"
elif test "x$ac_cv_header_sndio_h" = "xyes"; then
  platform_api="sndio"
  platform_lib="-lsndio -lm"
elif test "x$ac_cv_header_SLES_OpenSLES_h" = "xyes"; then
  platform_api="opensl"
  platform_lib=""
elif test "x$ac_cv_header_windows_h" = "xyes"; then
#  if test "x$ac_cv_header_dsound_h" = "xyes"; then
#    platform_api="dsound"
#  else
    platform_api="wave"
    platform_lib="-lwinmm"
#  fi
fi
AM_CONDITIONAL([PULSE], [test ${platform_api} = "pulse"])
AM_CONDITIONAL([ALSA], [test ${platform_api} = "alsa"])
AM_CONDITIONAL([COREAUDIO], [test ${platform_api} = "coreaudio"])
AM_CONDITIONAL([DSOUND], [test ${platform_api} = "dsound"])
AM_CONDITIONAL([WAVE], [test ${platform_api} = "wave"])
AM_CONDITIONAL([SNDIO], [test ${platform_api} = "sndio"])
AM_CONDITIONAL([OPENSL], [test ${platform_api} = "opensl"])

dnl Check for doxygen
AC_ARG_ENABLE([doc],
	AS_HELP_STRING([--enable-doc], [Build API documentation]),
	[ac_enable_doc=$enableval], [ac_enable_doc=auto])

if test "x$ac_enable_doc" != "xno"; then
	AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)

	if test "x$HAVE_DOXYGEN" = "xfalse" -a "x$ac_enable_doc" = "xyes"; then
		AC_MSG_ERROR([*** API documentation explicitly requested but Doxygen not found])
	fi
else
	HAVE_DOXYGEN=false
fi
AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN)
if test $HAVE_DOXYGEN = "false"; then
        AC_MSG_WARN([*** doxygen not found, API documentation will not be built])
fi

# Generate portable stdint.h replacement
AX_CREATE_STDINT_H(include/cubeb/cubeb-stdint.h)

# Test whenever ld supports -version-script
AC_PROG_LD
AC_PROG_LD_GNU
AC_MSG_CHECKING([how to control symbol export])

dnl --------------------------------------------------
dnl Do substitutions
dnl --------------------------------------------------

AC_SUBST(DEBUG)
AC_SUBST(PROFILE)
AC_SUBST(platform_lib)

AC_OUTPUT([
  Makefile 
  docs/Makefile
  docs/Doxyfile
  cubeb.pc
  cubeb-uninstalled.pc
])

AS_AC_EXPAND(LIBDIR, ${libdir})
AS_AC_EXPAND(INCLUDEDIR, ${includedir})
AS_AC_EXPAND(BINDIR, ${bindir})
AS_AC_EXPAND(DOCDIR, ${docdir})

if test $HAVE_DOXYGEN = "false"; then
  doc_build="no"
else
  doc_build="yes"
fi

AC_MSG_RESULT([
------------------------------------------------------------------------
  $PACKAGE $VERSION:  Automatic configuration OK.

  General configuration:

    Platform API target: ........ ${platform_api}
    API Documentation: .......... ${doc_build}

  Installation paths:

    libcubeb: .................... ${LIBDIR}
    C header files: .............. ${INCLUDEDIR}/cubeb
    Documentation: ............... ${DOCDIR}

  Building:

    Type 'make' to compile $PACKAGE.

    Type 'make install' to install $PACKAGE.

  Example programs will be built but not installed.
------------------------------------------------------------------------
])