forked from dbry/WavPack
-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
225 lines (182 loc) · 6.79 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
# wavpack 5.3.2 configure.ac
AC_INIT(wavpack, 5.3.2, [email protected])
AC_CONFIG_SRCDIR([src/pack.c])
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
LIBWAVPACK_MAJOR=5
LIBWAVPACK_MINOR=3
LIBWAVPACK_MICRO=2
LIBWAVPACK_VERSION_STRING=$LIBWAVPACK_MAJOR.$LIBWAVPACK_MINOR.$LIBWAVPACK_MICRO
AC_DEFINE_UNQUOTED(LIBWAVPACK_MAJOR, $LIBWAVPACK_MAJOR, [libwavpack major version])
AC_DEFINE_UNQUOTED(LIBWAVPACK_MINOR, $LIBWAVPACK_MINOR, [libwavpack minor version])
AC_DEFINE_UNQUOTED(LIBWAVPACK_MICRO, $LIBWAVPACK_MICRO, [libwavpack micro version])
AC_DEFINE_UNQUOTED(LIBWAVPACK_VERSION_STRING, "$LIBWAVPACK_VERSION_STRING", [libwavpack version string])
# set libtool versioning
# +1 : 0 : +1 == new interface that does not break old one.
# +1 : 0 : 0 == changed/removed an interface. Breaks old apps.
# ? : +1 : ? == internal changes that doesn't break anything.
# CURRENT : REVISION : AGE
LT_CURRENT=3
LT_REVISION=2
LT_AGE=2
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
# Check for os version
VERSION_OS=$(uname -s)
AC_DEFINE_UNQUOTED(VERSION_OS, "$VERSION_OS", [os version])
# Check host so we can infer target CPU (and assembly optimizations)
AC_CANONICAL_HOST
# Check for processor characteristics
AC_C_BIGENDIAN(AC_DEFINE([HIGHFIRST], [1], [big-endian machine]))
# Checks for programs.
AC_PROG_CC
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AM_PROG_CC_C_O
AM_PROG_AS
AC_HEADER_STDC
# Checks for libraries.
AC_CHECK_LIBM
AC_SUBST(LIBM)
# Check for large files support
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO
# Check if cross-compiling on mingw
AC_MINGW32
AC_ARG_ENABLE([libcrypto],
AS_HELP_STRING([--enable-libcrypto], [use libcrypto MD5 if available (breaks Mac build)]))
AC_ARG_ENABLE([apps],
AS_HELP_STRING([--disable-apps], [build only libwavpack (removes ICONV dependency)]))
AM_CONDITIONAL([ENABLE_APPS], [test "x$enable_apps" != "xno"])
if test "x$enable_apps" != "xno" ; then
if test "x$MINGW32" != "xyes" ; then
# Check for iconv
AC_ARG_WITH(iconv, [[ --with-iconv[=DIR] add ICONV support [yes]]])
if test "$with_iconv" = "no" ; then
AC_MSG_ERROR([[iconv is required for apps, use --disable-apps to build only libwavpack]])
else
if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
ICONV_CFLAGS="${CPPFLAGS} -I$with_iconv/include"
ICONV_LIBS="-L$with_iconv/lib"
fi
AC_CHECK_HEADER(iconv.h,
AC_MSG_CHECKING(for iconv)
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],[
iconv_t cd = iconv_open ("","");
iconv (cd, NULL, NULL, NULL, NULL);],[
AC_MSG_RESULT(yes)
WITH_ICONV=1],[
AC_MSG_RESULT(no)
AC_MSG_CHECKING(for iconv in -liconv)
old_cflags="${CFLAGS}"
old_ldflags="${LDFLAGS}"
old_libs="${LIBS}"
CFLAGS="${ICONV_CFLAGS} ${CFLAGS}"
LDFLAGS="${LDFLAGS} ${ICONV_LIBS}"
LIBS="${LIBS} -liconv"
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],[
iconv_t cd = iconv_open ("","");
iconv (cd, NULL, NULL, NULL, NULL);],[
AC_MSG_RESULT(yes)
WITH_ICONV=1
ICONV_LIBS="${ICONV_LIBS} -liconv"
ICONV="-liconv"],[
AC_MSG_ERROR([[Can't find iconv libraries.]])])
CFLAGS=$old_cflags
LDFLAGS=$old_ldflags
LIBS=$old_libs
]),
AC_MSG_ERROR([[Can't find iconv headers.]]))
fi
AC_SUBST(ICONV_LIBS)
AC_SUBST(ICONV)
fi
AS_IF([test "x$enable_libcrypto" = "xyes"],
[AC_CHECK_LIB([crypto],[MD5_Init])])
fi
AC_MSG_CHECKING([if we are building for a Windows host])
AS_CASE([$host_os],
[*mingw*], [windows_host=yes],
[windows_host=no])
AC_MSG_RESULT([$windows_host])
AM_CONDITIONAL([WINDOWS_HOST], [test "x$windows_host" = "xyes"])
AC_ARG_ENABLE([legacy],
AS_HELP_STRING([--enable-legacy], [decode legacy (< 4.0) WavPack files]))
AS_IF([test "x$enable_legacy" = "xyes"],
[AC_DEFINE([ENABLE_LEGACY])])
AM_CONDITIONAL([ENABLE_LEGACY], [test "x$enable_legacy" == "xyes"])
AC_ARG_ENABLE([dsd],
AS_HELP_STRING([--disable-dsd], [disable support for WavPack DSD files]))
AS_IF([test "x$enable_dsd" != "xno"],
[AC_DEFINE([ENABLE_DSD])])
AM_CONDITIONAL([ENABLE_DSD], [test "x$enable_dsd" != "xno"])
AC_ARG_ENABLE([rpath],
AS_HELP_STRING([--enable-rpath], [hardcode library path in executables]))
AM_CONDITIONAL([ENABLE_RPATH], [test "x$enable_rpath" == "xyes"])
AC_ARG_ENABLE([tests],
AS_HELP_STRING([--enable-tests], [build libwavpack test program (requires Pthreads)]))
AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" == "xyes"])
AC_ARG_ENABLE([asm],
[AS_HELP_STRING([--disable-asm], [disable assembly optimizations])],,
[enable_asm=check])
asm_selected=none
AS_IF([test "x$enable_asm" != "xno"],[
AC_MSG_CHECKING(if assembly optimizations are available)
AS_CASE([$host_cpu],
[i386|i486|i586|i686|i786], [AC_DEFINE([OPT_ASM_X86]) asm_selected=x86],
[x86_64], [AC_DEFINE([OPT_ASM_X64]) asm_selected=x64],
[arm*], [AC_DEFINE([OPT_ASM_ARM]) asm_selected=arm],
[AS_IF([test "x$enable_asm" = "xyes"],[AC_MSG_ERROR(no assembly code for CPU $host_cpu)])]
)
AC_MSG_RESULT($asm_selected)
])
AM_CONDITIONAL([ENABLE_X86ASM], [test "x$asm_selected" = "xx86"])
AM_CONDITIONAL([ENABLE_X64ASM], [test "x$asm_selected" = "xx64"])
AM_CONDITIONAL([ENABLE_ARMASM], [test "x$asm_selected" = "xarm"])
dnl Check for __builtin_clz
AC_CACHE_CHECK([for __builtin_clz], ac_cv_have___builtin_clz,
AC_LINK_IFELSE([AC_LANG_PROGRAM(,[[return __builtin_clz(1)]])],
[ac_cv_have___builtin_clz="yes"], [ac_cv_have___builtin_clz="no"]))
if test "$ac_cv_have___builtin_clz" = "yes"
then
AC_DEFINE([HAVE___BUILTIN_CLZ])
fi
dnl Check for __builtin_ctz
AC_CACHE_CHECK([for __builtin_ctz], ac_cv_have___builtin_ctz,
AC_LINK_IFELSE([AC_LANG_PROGRAM(,[[return __builtin_ctz(1)]])],
[ac_cv_have___builtin_ctz="yes"], [ac_cv_have___builtin_ctz="no"]))
if test "$ac_cv_have___builtin_ctz" = "yes"
then
AC_DEFINE([HAVE___BUILTIN_CTZ])
fi
AC_ARG_ENABLE(man,
[AC_HELP_STRING([--enable-man],
[regenerate man pages from Docbook [default=no]])],enable_man=$enableval,
enable_man=no)
if test "${enable_man}" != no; then
dnl
dnl Check for xsltproc
dnl
AC_PATH_PROG([XSLTPROC], [xsltproc])
if test -z "$XSLTPROC"; then
enable_man=no
fi
dnl check for DocBook DTD and stylesheets in the local catalog.
JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
[DocBook XML DTD V4.1.2],,enable_man=no)
JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
[DocBook XSL Stylesheets],,enable_man=no)
fi
AM_CONDITIONAL(ENABLE_MAN, test x$enable_man != xno)
AC_CONFIG_FILES(
Makefile
wavpack.pc
src/Makefile
include/Makefile
cli/Makefile
man/Makefile)
AC_OUTPUT