forked from grrrr/flext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
224 lines (191 loc) · 5.7 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
#
# autoconf template
# modified by Thomas Grill
#
# flext API version (current:release:age)
# API_VERSION=0:0:0
AC_INIT([flext],[0.6.0],[gr@grrrr.org])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_MACRO_DIRS([m4])
# TODO: this should definitely be changed to work with any version of CYGWIN_NT or MINGW32_NT
if ( test $(uname -s) == CYGWIN_NT-5.0 ) || ( test $(uname -s) == CYGWIN_NT-5.1 ) || ( test $(uname -s) == MINGW32_NT-5.1 ); then
set win = 1
fi
# configure options
AC_ARG_ENABLE(system,
AC_HELP_STRING(--enable-system,[realtime system [default=pd]]),
[SYSTEM=$enableval],
[SYSTEM=pd]
)
AC_ARG_WITH(sdkdir,
AC_HELP_STRING(--with-sdkdir,[path to pd or max headers]),
[sdkdir=$withval],
AC_MSG_ERROR(path to system SDK headers required $withval)
)
AC_ARG_WITH(pdbindir,
AC_HELP_STRING(--with-pdbindir,[path to pd bin dir]),
[
if test $win; then
# LATER: shouldn't we use AC_CHECK_LIB([pd]) ?
AC_CHECK_FILE([$withval/pd.dll],,AC_MSG_ERROR([Cannot find $withval/pd.dll]))
fi
LIBDIRS="$LIBDIRS $withval"
],
[
if test $win; then
AC_MSG_ERROR(path to pd bin dir required)
fi
]
)
if test $SYSTEM == max; then
AC_DEFINE(FLEXT_SYS,1)
# check for MaxAPI.h in pd folder
AC_CHECK_FILE([$sdkdir/max-includes/MaxAPI.h],,AC_MSG_ERROR([Cannot find $sdkdir/max-includes/MaxAPI.h]))
AC_CHECK_FILE([$sdkdir/max-includes/MaxAudioAPI.h],,AC_MSG_ERROR([Cannot find $sdkdir/max-includes/MaxAudioAPI.h]))
INCLUDEDIRS="$INCLUDEDIRS $sdkdir/max-includes $sdkdir/msp-includes"
elif test $SYSTEM == pd; then
# if test $win; then
# fi
AC_DEFINE(FLEXT_SYS,2)
# check for g_canvas.h in pd folder
AC_CHECK_FILE([$sdkdir/g_canvas.h],,AC_MSG_ERROR([Cannot find $sdkdir/g_canvas.h]))
INCLUDEDIRS="$INCLUDEDIRS $sdkdir"
if test $win; then
libs="$libs pd"
AC_DEFINE(NT)
fi
else
AC_MSG_ERROR([system must be pd or max])
fi
AC_ARG_WITH(atomic_ops,
AC_HELP_STRING(--with-atomic_ops,[path to atomic_ops library (needed for gcc version < 4.1 on non-i386 cpus)]),
[
AC_CHECK_FILE([$withval/atomic_ops.h],,AC_MSG_ERROR([Cannot find $withval/atomic_ops.h]))
INCLUDEDIRS="$INCLUDEDIRS $withval"
AC_DEFINE(USE_ATOMIC_OPS)
]
)
AC_ARG_WITH(stkdir,
AC_HELP_STRING(--with-stkdir,[path to STK headers]),
[
AC_CHECK_FILE([$withval/Stk.h],,AC_MSG_ERROR([Cannot find $withval/Stk.h]))
stkdir=$withval
INCLUDEDIRS="$INCLUDEDIRS $withval"
]
)
AM_CONDITIONAL([STK],[test "$stkdir"])
AC_ARG_WITH(sndobjdir,
AC_HELP_STRING(--with-sndobjdir,[path to SndObj headers]),
[
AC_CHECK_FILE([$withval/SndObj.h],,AC_MSG_ERROR([Cannot find $withval/SndObj.h]))
sndobjdir=$withval
INCLUDEDIRS="$INCLUDEDIRS $withval"
]
)
AM_CONDITIONAL([SNDOBJ],[test "$sndobjdir"])
# if CFLAGS aren't set by the user, set them to an empty string
# otherwise AC_PROG_CC sets them to "-O2 -g"
test ".$CFLAGS" = "." && CFLAGS=" "
test ".$CXXFLAGS" = "." && CXXFLAGS=" "
# needed for libtool to build win32 dlls
AC_LIBTOOL_WIN32_DLL
AM_ENABLE_STATIC
AM_ENABLE_SHARED
# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_LANG(C++)
# Checks for libraries.
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_STRUCT_TM
# Checks for library functions.
# system specific
if test $(uname -s) == Linux; then
true
elif test $(uname -s) == Darwin; then
FRAMEWORKS="$FRAMEWORKS ApplicationServices Accelerate"
LD_FLAGS="$LD_FLAGS -flat_namespace -undefined dynamic_lookup"
elif test $win; then
C_FLAGS="$C_FLAGS -mms-bitfields -mno-cygwin"
LD_FLAGS="$LD_FLAGS -mno-cygwin"
fi
# set compilation flags
OPT_FLAGS="$C_FLAGS -O2"
DBG_FLAGS="$C_FLAGS -DFLEXT_DEBUG -g"
FLEXT_EXT_CFLAGS=""
AC_ARG_ENABLE(optimize,
AC_HELP_STRING(--enable-optimize,[enables optimized architecture specific builds for pentium4, pentium3, G4, G5, etc.]),
[
# tune to a specific CPU
OPT_FLAGS="$OPT_FLAGS -mtune=$enableval"
case $enableval in
pentium | pentium2 | athlon | pentium-mmx)
OPT_FLAGS="$OPT_FLAGS -march=$enableval";;
pentium3 | pentium3m | pentium4 | pentium4m | pentium-m | prescott | nocona | athlon-xp | athlon-mp | athlon64 | opteron)
OPT_FLAGS="$OPT_FLAGS -march=$enableval -mfpmath=sse";
AC_DEFINE(FLEXT_USE_SIMD);;
G3)
# set specific architecture (like march)
OPT_FLAGS="$OPT_FLAGS -mcpu=$enableval";;
G5 | G4)
# set specific architecture (like march)
OPT_FLAGS="$OPT_FLAGS -mcpu=$enableval -faltivec";
AC_DEFINE(FLEXT_USE_SIMD);;
*)
;;
esac
]
)
AC_ARG_ENABLE([cmem],
AC_HELP_STRING(--enable-cmem,[enables C-style memory allocation (as opposed to overloading 'new' and 'delete')]),
AS_CASE([$enableval], [yes], [
AC_DEFINE(FLEXT_USE_CMEM)
FLEXT_EXT_CFLAGS="$FLEXT_EXT_CFLAGS -DFLEXT_USE_CMEM"]))
AC_SUBST(SYSTEM)
AC_SUBST(INCLUDEDIRS)
AC_SUBST(LIBDIRS)
AC_SUBST(OPT_FLAGS)
AC_SUBST(DBG_FLAGS)
AC_SUBST(LD_FLAGS)
# AC_SUBST(API_VERSION)
AC_SUBST(libs)
AC_SUBST(stkdir)
AC_SUBST(sndobjdir)
AC_SUBST(FRAMEWORKS)
AC_SUBST(FLEXT_EXT_CFLAGS)
AC_OUTPUT([
Makefile
source/Makefile
tutorial/simple1/Makefile
$SYSTEM-flext.pc
])
# tutorial/Makefile
# tutorial/adv1/Makefile
# tutorial/adv2/Makefile
# tutorial/adv3/Makefile
# tutorial/attr1/Makefile
# tutorial/attr2/Makefile
# tutorial/attr3/Makefile
# tutorial/bind1/Makefile
# tutorial/buffer1/Makefile
# tutorial/lib1/Makefile
# tutorial/signal1/Makefile
# tutorial/signal2/Makefile
# tutorial/simple1/Makefile
# tutorial/simple2/Makefile
# tutorial/simple3/Makefile
# tutorial/sndobj1/Makefile
# tutorial/stk1/Makefile
# tutorial/stk2/Makefile
# tutorial/thread1/Makefile
# tutorial/thread2/Makefile
# tutorial/timer1/Makefile
# tutorial/pd/Makefile
# tutorial/maxmsp/Makefile