configure.ac 5.21 KB
Newer Older
thomas's avatar
thomas committed
1
2
3
4
5
6
7
8
9
10
11
#
# autoconf template
# modified by Thomas Grill
#

# flext API version (current:release:age)
# API_VERSION=0:0:0

AC_INIT([flext],[0.5.1],[gr@grrrr.org])
AM_INIT_AUTOMAKE

12
13
14
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
thomas's avatar
thomas committed
15
16
17

# configure options
AC_ARG_ENABLE(system,
18
	AC_HELP_STRING(--enable-system,[realtime system [default=pd]]),
thomas's avatar
thomas committed
19
20
21
22
    [SYSTEM=$enableval],
    [SYSTEM=pd]
)

23
24
25
AC_ARG_WITH(sdkdir,
	AC_HELP_STRING(--with-sdkdir,[path to pd or max headers]),
    [sdkdir=$withval],
thomas's avatar
thomas committed
26
	AC_MSG_ERROR(path to system SDK headers required $withval)
thomas's avatar
thomas committed
27
28
)

29
30
31
AC_ARG_WITH(pdbindir,
	AC_HELP_STRING(--with-pdbindir,[path to pd bin dir]),
	[
thomas's avatar
thomas committed
32
33
34
35
		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
36
37
		LIBDIRS="$LIBDIRS $withval"
	],
thomas's avatar
thomas committed
38
39
40
41
42
	[
		if test $win; then
			AC_MSG_ERROR(path to pd bin dir required)
		fi
	]
43
44
)

thomas's avatar
thomas committed
45
46
47
if test $SYSTEM == max; then
	AC_DEFINE(FLEXT_SYS,1)
# check for MaxAPI.h in pd folder
48
49
50
	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"
thomas's avatar
thomas committed
51
52

elif test $SYSTEM == pd; then
53
54
55
#	if test $win; then
#	fi

thomas's avatar
thomas committed
56
57
	AC_DEFINE(FLEXT_SYS,2)
# check for g_canvas.h in pd folder
58
59
	AC_CHECK_FILE([$sdkdir/g_canvas.h],,AC_MSG_ERROR([Cannot find $sdkdir/g_canvas.h]))
	INCLUDEDIRS="$INCLUDEDIRS $sdkdir"
thomas's avatar
thomas committed
60

61
	if test $win; then
thomas's avatar
thomas committed
62
		libs="$libs pd"
63
64
		AC_DEFINE(NT)
	fi
thomas's avatar
thomas committed
65
66
67
68
69
else
	AC_MSG_ERROR([system must be pd or max])
fi

AC_ARG_WITH(atomic_ops,
70
	AC_HELP_STRING(--with-atomic_ops,[path to atomic_ops library (needed for gcc version < 4.1 on non-i386 cpus)]),
thomas's avatar
thomas committed
71
72
	[
	    AC_CHECK_FILE([$withval/atomic_ops.h],,AC_MSG_ERROR([Cannot find $withval/atomic_ops.h]))	
73
		INCLUDEDIRS="$INCLUDEDIRS $withval"
thomas's avatar
thomas committed
74
75
76
77
78
        AC_DEFINE(USE_ATOMIC_OPS)
	]
)

AC_ARG_WITH(stkdir,
79
	AC_HELP_STRING(--with-stk,[path to STK headers]),
thomas's avatar
thomas committed
80
81
82
	[
	    AC_CHECK_FILE([$withval/Stk.h],,AC_MSG_ERROR([Cannot find $withval/Stk.h]))	
		stkdir=$withval
83
		INCLUDEDIRS="$INCLUDEDIRS $withval"
thomas's avatar
thomas committed
84
85
86
87
88
89
	]
)

AM_CONDITIONAL([STK],[test "$stkdir"])

AC_ARG_WITH(sndobjdir,
90
	AC_HELP_STRING(--with-sndobj,[path to SndObj headers]),
thomas's avatar
thomas committed
91
92
93
	[
		AC_CHECK_FILE([$withval/SndObj.h],,AC_MSG_ERROR([Cannot find $withval/SndObj.h]))
		sndobjdir=$withval
94
		INCLUDEDIRS="$INCLDUEDIRS $withval"
thomas's avatar
thomas committed
95
96
97
98
99
100
101
102
103
104
	]
)

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=" "

105
106
107
108
109
110
# needed for libtool to build win32 dlls
AC_LIBTOOL_WIN32_DLL

AM_ENABLE_STATIC
AM_ENABLE_SHARED

thomas's avatar
thomas committed
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
# 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
136
	FRAMEWORKS="$FRAMEWORKS ApplicationServices vecLib"
137
	LD_FLAGS="$LD_FLAGS -flat_namespace -undefined dynamic_lookup"
138
139
140
elif test $win; then
	C_FLAGS="$C_FLAGS -mms-bitfields -mno-cygwin"
	LD_FLAGS="$LD_FLAGS -mno-cygwin"
thomas's avatar
thomas committed
141
142
143
144
145
fi


# set compilation flags

146
147
OPT_FLAGS="$C_FLAGS -O2"
DBG_FLAGS="$C_FLAGS -DFLEXT_DEBUG -g"
thomas's avatar
thomas committed
148
149

AC_ARG_ENABLE(optimize, 
150
	AC_HELP_STRING(--enable-optimize,[enables optimized architecture specific builds for pentium4, pentium3, G4, G5, etc.]),
thomas's avatar
thomas committed
151
    [
thomas's avatar
thomas committed
152
        # tune to a specific CPU
153
		OPT_FLAGS="$OPT_FLAGS -mtune=$enableval"
thomas's avatar
thomas committed
154
155
		case $enableval in
			pentium | pentium2 | athlon | pentium-mmx)
156
				OPT_FLAGS="$OPT_FLAGS -march=$enableval";;
thomas's avatar
thomas committed
157
			pentium3 | pentium3m | pentium4 | pentium4m | pentium-m | prescott | nocona | athlon-xp | athlon-mp | athlon64 | opteron) 
158
				OPT_FLAGS="$OPT_FLAGS -march=$enableval -mfpmath=sse";
thomas's avatar
thomas committed
159
160
				AC_DEFINE(FLEXT_USE_SIMD);;
			G3)
thomas's avatar
thomas committed
161
                # set specific architecture (like march)
162
				OPT_FLAGS="$OPT_FLAGS -mcpu=$enableval";;
thomas's avatar
thomas committed
163
			G5 | G4)
thomas's avatar
thomas committed
164
                # set specific architecture (like march)
165
				OPT_FLAGS="$OPT_FLAGS -mcpu=$enableval -faltivec";
thomas's avatar
thomas committed
166
167
168
169
170
171
172
173
174
				AC_DEFINE(FLEXT_USE_SIMD);;
			*)
				;;
		esac
	]
)


AC_SUBST(SYSTEM)
175
176
AC_SUBST(INCLUDEDIRS)
AC_SUBST(LIBDIRS)
thomas's avatar
thomas committed
177
178
AC_SUBST(OPT_FLAGS)
AC_SUBST(DBG_FLAGS)
179
AC_SUBST(LD_FLAGS)
thomas's avatar
thomas committed
180
# AC_SUBST(API_VERSION)
181
AC_SUBST(libs)
thomas's avatar
thomas committed
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
AC_SUBST(stkdir)
AC_SUBST(sndobjdir)
AC_SUBST(FRAMEWORKS)

AC_OUTPUT([
			Makefile
			source/Makefile
])

#			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