/
configure.ac
137 lines (118 loc) · 3.76 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
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.63)
AC_INIT([libmodplug], [0.8.9.0])
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_MAINTAINER_MODE([enable])
dnl Checks for programs.
dnl I am disabling static libraries here because otherwise libtool insists on
dnl compiling everything twice -- once with and once without -fPIC. Pisses me
dnl off. Just do everything with -fPIC, damnit! Compiling everything twice
dnl probably wastes more cycles than not using -fPIC saves.
AC_DISABLE_STATIC
AC_DISABLE_STATIC([])
AC_PROG_CC
AC_PROG_CXX
AC_LANG([C++])
AC_C_BIGENDIAN
#AC_LIBTOOL_WIN32_DLL
#AC_PROG_LIBTOOL
LT_INIT([win32-dll])
AC_HEADER_STDC
AC_CHECK_HEADERS([inttypes.h stdint.h malloc.h])
AC_CHECK_FUNCS(sinf)
CXXFLAGS="$CXXFLAGS -fno-exceptions -Wall -ffast-math -fno-common -D_REENTRANT"
AC_CANONICAL_HOST
case "$host" in
*mingw* | *cygwin*)
LT_LDFLAGS="-no-undefined"
;;
*)
LT_LDFLAGS=""
;;
esac
AC_SUBST(LT_LDFLAGS)
# require 10.5+ for osx/x86_64 builds
case "$host" in
x86_64-*-darwin*)
CXXFLAGS="$CXXFLAGS -mmacosx-version-min=10.5"
LDFLAGS="$LDFLAGS -mmacosx-version-min=10.5" ;;
esac
# symbol visibility
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -fvisibility=hidden -Werror"
AC_CACHE_CHECK([if compiler supports visibility attributes],[libmodplug_cv_gcc_visibility],
AC_TRY_COMPILE([void foo(void);
__attribute__((visibility("default"))) void foo(void) {}],
[],
[libmodplug_cv_gcc_visibility=yes],
[libmodplug_cv_gcc_visibility=no])
)
# we want symbol -fvisibility for elf targets, however it works
# with darwin/macho too. other than that, windows, dos and os2
# do not need it: for any such targets, the -Werror switch is
# supposed to fail the above check. (I'm adding the manual test
# below nonetheless, just in case.)
case $host_os in
mingw*|cygwin*|emx*|*djgpp)
libmodplug_cv_gcc_visibility=no
;;
esac
CXXFLAGS="$ac_save_CXXFLAGS"
if test $libmodplug_cv_gcc_visibility = yes ;then
CXXFLAGS="$CXXFLAGS -DSYM_VISIBILITY -fvisibility=hidden"
fi
case ${target_os} in
*sun* | *solaris*)
CXXFLAGS="$CXXFLAGS -fpermissive"
;;
esac
AC_ARG_ENABLE([cxx_interface],
[AS_HELP_STRING([--enable-cxx-interface],
[export C++ interface from library [[default=yes]]])],,
[enable_cxx_interface=yes])
if test x$enable_cxx_interface != xyes; then
AC_DEFINE(NO_CXX_EXPORTS, 1, [Do not export the C++ interface.])
fi
AM_CONDITIONAL(EXPORT_CXX, test x$enable_cxx_interface = xyes)
AC_ARG_ENABLE([midi],
[AS_HELP_STRING([--enable-midi],
[compile with midi formats support [[default=no]]])],,
[enable_midi=no])
if test x$enable_midi = xyes; then
AC_DEFINE(MIDIFMT_SUPPORT, 1, [Enable midi formats support.])
fi
AC_ARG_ENABLE([wav],
[AS_HELP_STRING([--enable-wav],
[compile with wav formats support [[default=no]]])],,
[enable_wav=no])
if test x$enable_wav = xyes; then
AC_DEFINE(WAV_SUPPORT, 1, [Enable wav formats support.])
fi
AC_ARG_ENABLE([mmcmp],
[AS_HELP_STRING([--enable-mmcmp],
[compile with mmcmp and pp20 decompression support [[default=no]]])],,
[enable_mmcmp=no])
if test x$enable_mmcmp = xyes; then
AC_DEFINE(MMCMP_SUPPORT, 1, [Enable mmcmp and pp20 decompression support.])
fi
# portable types. requires autoconf 2.60
# `configure' will check if these are defined in system headers.
# if not, it will auto-detect and define them in `config.h'
AC_TYPE_INT8_T
AC_TYPE_UINT8_T
AC_TYPE_INT16_T
AC_TYPE_UINT16_T
AC_TYPE_INT32_T
AC_TYPE_UINT32_T
AC_TYPE_INT64_T
AC_TYPE_UINT64_T
MODPLUG_LIBRARY_VERSION=1:0:0
AC_SUBST(MODPLUG_LIBRARY_VERSION)
AC_CONFIG_FILES([Makefile
src/Makefile
libmodplug.pc])
AC_OUTPUT