aboutsummaryrefslogtreecommitdiff
path: root/chaos/configure.ac
blob: 67bf0568d4a8d7f33c06ecd23685c3604ae282b9 (plain)
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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(chaos~, 0.01, TimBlechmann@gmx.de, chaos~)
AM_INIT_AUTOMAKE

dnl Checks for programs.
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_CXX

dnl Checks for libraries.
AC_CHECK_LIB(m, sin)

dnl Checks for header files.
AC_HEADER_STDC

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_HEADER_TIME


dnl Checks for command line arguments
AC_ARG_WITH(flextdir,
	[  --with-flextdir         path to flext headers],
    [
		flextdir=$withval
		INCLUDEDIR="-I$withval $INCLUDEDIR"
	],
	[echo "path to flext headers required" && exit 1])

AC_CHECK_FILE("$flextdir/flext.h",,
	[echo "$flextdir/flext.h not found" && exit 1])


AC_ARG_ENABLE(system,
	[  --enable-system         system (default: pd)],
	[
	if test "enableval" == "max"; then
		AC_DEFINE(FLEXT_SYS,1)
	else
		AC_DEFINE(FLEXT_SYS,2)
	fi
	system = $enabeval
	],
	AC_DEFINE(FLEXT_SYS,2)
	)


AC_ARG_WITH(sysdir,
	[  --with-sysdir           path pd / max installation],
	[
		SYSDIR=$withval
		INCLUDEDIR="-I$withval $INCLUDEDIR"
	],	
	[echo "path to pd / max installation required" && exit 1])


AC_ARG_ENABLE(static,
	[  --enable-static         static linking with libflext],
			LDFLAGS="-Bstatic $LDFLAGS"
		,
	    [
			AC_DEFINE(FLEXT_SHARED)
			AC_DEFINE(FLEXT_THREADS)
			LDFLAGS="-Bdynamic $LDFLAGS"
		]
		)

AC_ARG_ENABLE(debug,
	[  --enable-debug          link with libflext_d library for debugging],
   	[
		LDFLAGS="-lflext_d $LDFLAGS"
		CXXFLAGS="-g"
	],
	[
		LDFLAGS="-lflext $LDFLAGS"
		CXXFLAGS="-O3"
	])

dnl mtune will break gcc 3.3.x
AC_ARG_ENABLE(optimize, [  --enable-optimize       enables optimized builds for: pentium4, pentium3, G4, G5],
    [
	case $enableval in
	pentium3 | pentium3m)
		OPT_FLAGS = "-mtune=$enableval -march=$enableval -mmmx -msse -mfpmath=sse";;
	pentium2 | athlon | pentium-mmx)
		OPT_FLAGS="-mtune=$enableval -march=$enableval -mmmx";;
	pentium)
	 	OPT_FLAGS="-mtune=$enableval -march=$enableval";;
	pentium4 | pentium4m | pentium-m | prescott | nocona | athlon-xp | athlon-mp | athlon64 | opteron) 
		OPT_FLAGS="-mtune=$enableval -march=$enableval -mmmx -msse -msse2 -mfpmath=sse";;
	G5 | G4)
		OPT_FLAGS="-mtune=$enableval -march=$enableval -maltivec -faltivec -malign-natural";;
	G3)
		OPT_FLAGS="-mtune=$enableval -march=$enableval -malign-natural";;
	*)
		;;
	esac
	])

dnl select build
if test `uname -s` == "Linux"; then 
	dnl no max/msp for linux
	OBJEXT=o
	EXTENSION=pd_linux
fi

if test `uname -s` == "Darwin"; then 
	dnl just a guess
	if test "$system" = "max"; then
		echo "build system doesn't support max, yet" && exit 1;
	else
		LDFLAGS="-bundle -bundle_loader $LDFLAGS"
		FRAMEWORKS=
		EXTENSION=pd_darwin
		LIBS="gcc $LIBS"
	fi
	OBJEXT=o
fi

if test `uname -s` == "Cygwin"; then 
	dnl just a guess
	if test "$system" = "max"; then
		echo "build system doesn't support max, yet" && exit 1;
	else
		EXTENSION=dll
		LIBS="gcc $LIBS bin/pd bin/pthreadVC.dll"
		LDFLAGS="-L$SYSDIR"
	fi
fi	


AC_SUBST(EXTENSION)
AC_SUBST(INCLUDEDIR)
AC_SUBST(CXXFLAGS)
AC_SUBST(OPT_FLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(DEFS)
AC_SUBST(LIBS)
AC_SUBST(OBJEXT)
AC_SUBST(FRAMEWORKS)
AC_SUBST(SYSDIR)
AC_OUTPUT([Makefile
		  src/Makefile])