File: acinclude.m4

package info (click to toggle)
ecasound 2.9.1-7
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 5,652 kB
  • ctags: 6,128
  • sloc: cpp: 39,403; sh: 10,512; ansic: 2,040; lisp: 1,918; makefile: 909; python: 611; ruby: 202
file content (222 lines) | stat: -rw-r--r-- 5,491 bytes parent folder | download | duplicates (4)
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
dnl ---
dnl acinclude.m4 for ecasound
dnl ---

## ------------------------------------------------------------------------
## Check for JACK support
##
## defines: ECA_AM_COMPILE_JACK, ECA_S_JACK_LIBS, ECA_S_JACK_INCLUDES,
##          ECA_COMPILE_JACK, ECA_JACK_TRANSPORT_API, ECA_JACK_FEATSET
## ------------------------------------------------------------------------

AC_DEFUN([AC_CHECK_JACK],
[
AC_CHECK_HEADER(jack/jack.h,jack_support=yes,jack_support=no)

AC_ARG_WITH(jack,
  [  --with-jack=DIR	  Compile against JACK installed in DIR],
  [
    ECA_S_JACK_LIBS="-L${withval}/lib"
    ECA_S_JACK_INCLUDES="-I${withval}/include"
    jack_support=yes
  ])

AC_ARG_ENABLE(jack,
  [  --enable-jack		  Enable JACK support (default=yes, if found)],
  [
    case "$enableval" in
      y | yes)
        AC_MSG_RESULT(yes)
	jack_support=yes
      ;;

      n | no)
        AC_MSG_RESULT(no)
	jack_support=no
      ;;
        
      *)
        AC_MSG_ERROR([Invalid parameter value for --enable-jack: $enableval])
      ;;
    esac
 ])

AM_CONDITIONAL(ECA_AM_COMPILE_JACK, test x$jack_support = xyes)

if test x$jack_support = xyes; then
    AC_DEFINE([ECA_COMPILE_JACK], 1, [enable JACK support])
    ECA_S_JACK_LIBS="${ECA_S_JACK_LIBS} -ljack"
    case "$host" in
	*darwin*)
	    AM_LDFLAGS="$AM_LDFLAGS -framework CoreAudio"
	    ;;
    esac
fi                                     

AC_LANG_C
old_cppflags=$CPPFLAGS
old_ldflags=$LDFLAGS
old_INCLUDES=$INCLUDES
CPPFLAGS="$CPPFLAGS $ECA_S_JACK_INCLUDES"
LDFLAGS="$LDFLAGS $ECA_S_JACK_LIBS"

AC_TRY_LINK(
[ #include <jack/transport.h> ],
[
	jack_position_t t;
	int *a = (void*)&jack_transport_query;
	int *b = (void*)&jack_transport_start;
	int *c = (void*)&jack_transport_stop;
	int *d = (void*)&jack_transport_locate;
	t.frame = 0;
	t.valid = 0;
	return 0;
],
[ ECA_JACK_TRANSPORT_API="3" ],
[ ECA_JACK_TRANSPORT_API="0" ]
)

# note: check for the new latency API added to JACK 0.120.1

AC_TRY_LINK(
[ #include <jack/jack.h> ],
[
	jack_latency_range_t t;
	t.min = 0;
	t.max = 0;
	return 0;
],
[ ECA_JACK_FEATSET="1" ],
[ ECA_JACK_FEATSET="0" ]
)

CPPFLAGS="$old_cppflags"
LDFLAGS="$old_ldflags"
INCLUDES="$old_INCLUDES"

echo "Using JACK transport API version:" ${ECA_JACK_TRANSPORT_API}
AC_DEFINE_UNQUOTED([ECA_JACK_TRANSPORT_API], ${ECA_JACK_TRANSPORT_API}, [version of JACK transport API to use])
echo "Using JACK feature set (ecasound specific):" ${ECA_JACK_FEATSET}
AC_DEFINE_UNQUOTED([ECA_JACK_FEATSET], ${ECA_JACK_FEATSET}, [ecasound specific versioning of JACK interface features ])

AC_SUBST(ECA_S_JACK_LIBS)
AC_SUBST(ECA_S_JACK_INCLUDES)
])

## ------------------------------------------------------------------------
## Check for LFS (now deprecated, v3 is only a stub that doesn't
## peform any checks)
## 
## version: 3
##
## refs:
##  - http://www.gnu.org/software/libtool/manual/libc/Feature-Test-Macros.html
##  - http://www.suse.de/~aj/linux_lfs.html
##  - http://en.wikipedia.org/wiki/Large_file_support
##
## modifies: AM_CXXFLAGS, AM_CFLAGS
## defines: enable_largefile
## ------------------------------------------------------------------------
##

AC_DEFUN([AC_CHECK_LARGEFILE],
[
  echo "checking for largefile support (>2GB files)..."

  dnl note: this is only for backwards compatibility
  AC_ARG_WITH(largefile,
    [  --with-largefile        deprecated option, now used by default], [])

  AC_SYS_LARGEFILE
  if test x$ac_cv_sys_file_offset_bits = x64 ; then
    dnl note: Just to be sure that the define is there even
    dnl       if config.h is not included in right order w.r.t.
    dnl       the system headers.
    AM_CXXFLAGS="$AM_CXXFLAGS -D_FILE_OFFSET_BITS=64"
    AM_CFLAGS="$AM_CFLAGS -D_FILE_OFFSET_BITS=64"

    enable_largefile=yes
  fi

  dnl old checks
  dnl ----------
  dnl  [ if test "x$withval" = "xyes" ; then
  dnl      enable_largefile="yes"
  dnl    fi 
  dnl  ]
  dnl if test "x$enable_largefile" = "xyes"; then
  dnl   dnl AC_DEFINE(_FILE_OFFSET_BITS, 64)
  dnl   dnl AC_DEFINE(_LARGEFILE_SOURCE)
  dnl   AM_CXXFLAGS="$AM_CXXFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
  dnl   AM_CFLAGS="$AM_CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
  dnl   AC_MSG_RESULT(yes.)
  dnl else
  dnl   AC_MSG_RESULT(no.)
  dnl fi

])

## ------------------------------------------------------------------------
## Check whether namespaces are supported.
##
## version: 3
##
## defines: ECA_USE_CXX_STD_NAMESPACE
## ------------------------------------------------------------------------
##
AC_DEFUN([AC_CHECK_CXX_NAMESPACE_SUPPORT],
[
AC_MSG_CHECKING(if C++ compiler supports namespaces)
AC_LANG_CPLUSPLUS
old_cxx_flags=$CXXFLAGS
CXXFLAGS="-fno-exceptions $CXXFLAGS" # hack around gcc3.x feature
AC_TRY_RUN(
[
#include <string>
#include <vector>

using std::string;

int main(void)
{	
	string s ("foo");
 	std::vector<string> v;
	return(0);
}
],
[ 	
	AC_MSG_RESULT(yes.)
	AC_DEFINE([ECA_USE_CXX_STD_NAMESPACE], 1, [use C++ std namespace])
],
[
	AC_MSG_RESULT(no.)
	AC_MSG_WARN([C++ compiler has problems with namespaces. Build process can fail because of this.])
]
,
[
	AC_MSG_RESULT(no.)
]
)
CXXFLAGS=$old_cxx_flags
])

## ------------------------------------------------------------------------
## Find a file (or one of more files in a list of dirs)
##
## version: 1
## ------------------------------------------------------------------------
##
AC_DEFUN([AC_FIND_FILE],
[
$3=NO
for i in $2;
do
  for j in $1;
  do
    if test -r "$i/$j"; then
      $3=$i
      break 2
    fi
  done
done
])