summaryrefslogtreecommitdiff
path: root/configure.ac
blob: fadf32804e7fbd11e157082c5335f9cee72aca02 (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
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
AC_INIT([camsync], m4_esyscmd([cat version.h | cut -d'"' -f2 | xargs echo -n]))dnl"

AC_CONFIG_SRCDIR([src/lv2.cc])
AM_INIT_AUTOMAKE

AC_PROG_CXX
AM_PROG_CC_C_O

LT_INIT

AC_CONFIG_HEADERS(config.h)

need_jack=no

dnl ===========================
dnl Compile with C++11 support.
dnl ===========================
AC_LANG_PUSH([C++])
TMP_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=-std=c++11
AC_MSG_CHECKING([whether CXX supports -std=c++11])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
	[AC_MSG_RESULT([yes])],
	[
	 AC_MSG_RESULT([no])
	 CXXFLAGS=-std=c++0x
	 AC_MSG_CHECKING([whether CXX supports -std=c++0x])
	 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
	 	[AC_MSG_RESULT([yes])],
	 	[
	 	 AC_MSG_RESULT([no])
	 	 AC_MSG_ERROR([Compiler does not support c++11])
	 	]
	 )
]
)
CXXFLAGS="$TMP_CXXFLAGS $CXXFLAGS"
AC_LANG_POP([C++])

dnl ======================
dnl Init pkg-config
dnl ======================
PKG_PROG_PKG_CONFIG(0.23)

HUGIN_PARM="-DDISABLE_HUGIN"
AC_ARG_WITH([debug],
	AS_HELP_STRING([--with-debug], [Build with debug support]))

AS_IF([test "x$with_debug" == "xyes"],
      [AC_MSG_WARN([*** Building with debug support!])
	     CXXFLAGS="$CXXFLAGS -Wall -Werror -g"
	     HUGIN_PARM=""]
)

dnl ===========================
dnl Check for GUI backend
dnl ===========================
AC_CANONICAL_HOST
AC_ARG_ENABLE([gui],
	AS_HELP_STRING([--enable-gui[=backend]], [Use specified gui backend. Can be win32, x11, pugl or auto [default=auto]]),,
        [enable_gui="auto"])

AS_IF([test "x$enable_gui" = "xyes"], [enable_gui="auto"])

AS_IF([test "x$enable_gui" = "xauto"],
      [AC_MSG_RESULT([Auto setting gui based on host: $host_os])
	     AS_CASE([$host_os],
		      [darwin*], [enable_gui=""],
		      [linux*|*BSD*], [enable_gui="x11"],
		      [mingw*|windows*|winnt|cygwin], [enable_gui="win32"],

		      AC_MSG_ERROR([Your platform is not currently supported])
	     )]
)

AS_IF(
  [test "x$enable_gui" = "xx11"],
  [AC_MSG_RESULT([Setting gui backend to X11])
  dnl ======================
  dnl Check for Xlib
  dnl ======================
  PKG_CHECK_MODULES(X11, x11 >= 1.0)

  GUI_CFLAGS="-DX11 $X11_CFLAGS"
  GUI_LIBS="$X11_LIBS"],

  [test "x$enable_gui" = "xwin32"],
  [AC_MSG_RESULT([Setting gui backend to Win32])
  GUI_CFLAGS="-DWIN32"
  GUI_LIBS="-lgdi32 -lsetupapi -lws2_32"],

  [test "x$enable_gui" = "xpugl"],
  [AC_MSG_RESULT([Setting gui backend to Pugl])
  GUI_CFLAGS="-DPUGL -I../../pugl"
  GUI_LIBS="-lGLU -lGL -lglut"],

  AC_MSG_ERROR([*** No GUI backend has been selected ***])
)

AC_SUBST(GUI_CFLAGS)
AC_SUBST(GUI_LIBS)

AM_CONDITIONAL([ENABLE_PUGL], [test "x$enable_gui" = "xpugl"])

# dnl ======================
# dnl Compile unit tests
# dnl ======================
# AC_ARG_WITH([test],
# 	AS_HELP_STRING([--with-test], [Build unit tests]))
#
# AS_IF([test x$with_test == xyes],
#       [AC_MSG_WARN([*** Building unittests!])
#        AM_PATH_CPPUNIT(1.9.6)]
# )

dnl ======================
dnl Compile LV2 plugin
dnl ======================
AC_ARG_ENABLE([lv2],
	AS_HELP_STRING([--enable-lv2], [Compile the LV2 plugin [default=no]]),,
        [enable_lv2="no"])

AS_IF(
  [test "x$enable_lv2" = "xyes"],
  [enable_lv2=yes
  dnl ======================
  dnl Check for lv2core
  dnl ======================
  PKG_CHECK_MODULES(LV2, lv2 >= 1.0)],

  [AC_MSG_RESULT([*** LV2 plugin will not be compiled ***])
   enable_lv2=no]
)

AM_CONDITIONAL([ENABLE_LV2], [test "x$enable_lv2" = "xyes"])

# dnl ======================
# dnl Compile VST plugin
# dnl ======================
# AC_ARG_WITH([vst_sources],
# 	AS_HELP_STRING([--with-vst-sources], [Point this to the vstsdk24 directory]))
# AC_ARG_ENABLE([vst],
# 	AS_HELP_STRING([--enable-vst], [Compile the VST plugin [default=no]]),,
#         [enable_vst="no"])
#
# AS_IF(
#   [test "x$enable_vst" = "xyes"],
#   [enable_vst=yes
#   VST_CPPFLAGS="-I$with_vst_sources -D__int64='long long int'"
#   VST_SOURCE_PATH="$with_vst_sources"
#   AC_SUBST(VST_SOURCE_PATH)
#   AC_SUBST(VST_CPPFLAGS)
#   AC_CONFIG_FILES(vst/Makefile.mingw32)],
#
#   [AC_MSG_RESULT([*** VST plugin will not be compiled ***])
#    enable_vst=no]
# )
#
# AM_CONDITIONAL([ENABLE_VST], [test "x$enable_vst" = "xyes"])


dnl ======================
dnl Compile AU plugin
dnl ======================
#AC_ARG_ENABLE([au],
#[  --enable-au   Compile the audio units plugin [default=no]],,
#        [enable_au="no"])
#if test "x$enable_au" = "xyes"; then
#	 enable_au=yes
#else
#	 AC_MSG_RESULT([*** Audio Units plugin will not be compiled ***])
#   enable_au=no
#fi
#AM_CONDITIONAL([ENABLE_AU], [test "x$enable_au" = "xyes"])

dnl ======================
dnl Check for sndfile
dnl ======================
PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.20)

#dnl ======================
#dnl Check for zlib
#dnl ======================
PKG_CHECK_MODULES(ZLIB, zlib >= 1.2.3)

dnl ======================
dnl Check for the pthread library
dnl ======================
tmp_CXXFLAGS="$CXXFLAGS"
tmp_CPPFLAGS="$CPPFLAGS"
tmp_CFLAGS="$CFLAGS"
tmp_LDFLAGS="$LDFLAGS"
tmp_LIBS="$LIBS"
CXXFLAGS=""
CPPFLAGS=""
CFLAGS=""
LDFLAGS=""
LIBS=""
AC_CHECK_HEADER(pthread.h, , AC_MSG_ERROR([*** pthread header file not found!]))
AC_CHECK_LIB(pthread,  pthread_mutex_init, , AC_MSG_ERROR([*** pthread library not found!]))
PTHREAD_CFLAGS="$CXXFLAGS $CPPFLAGS $CFLAGS"
PTHREAD_LIBS="$LDFLAGS $LIBS"
CXXFLAGS="$tmp_CXXFLAGS"
CPPFLAGS="$tmp_CPPFLAGS"
CFLAGS="$tmp_CFLAGS"
LDFLAGS="$tmp_LDFLAGS"
LIBS="$tmp_LIBS"
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_LIBS)

dnl ======================
dnl Check for eXpat library
dnl ======================
tmp_CXXFLAGS="$CXXFLAGS"
tmp_CPPFLAGS="$CPPFLAGS"
tmp_CFLAGS="$CFLAGS"
tmp_LDFLAGS="$LDFLAGS"
tmp_LIBS="$LIBS"
CXXFLAGS=""
CPPFLAGS=""
CFLAGS="$EXPAT_CFLAGS"
LDFLAGS="$EXPAT_LDFLAGS"
LIBS=""
AC_CHECK_HEADER(expat.h, , AC_MSG_ERROR([*** eXpat header file not found!]))
AC_CHECK_LIB(expat, XML_ParserCreate, , AC_MSG_ERROR([*** eXpat library not found!]))
EXPAT_CFLAGS="$CXXFLAGS $CPPFLAGS $CFLAGS"
EXPAT_LIBS="$LDFLAGS $LIBS"
CXXFLAGS="$tmp_CXXFLAGS"
CPPFLAGS="$tmp_CPPFLAGS"
CFLAGS="$tmp_CFLAGS"
LDFLAGS="$tmp_LDFLAGS"
LIBS="$tmp_LIBS"
AC_SUBST(EXPAT_CFLAGS)
AC_SUBST(EXPAT_LIBS)

AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(CXXFLAGS)
AC_SUBST(LDFLAGS)

AC_CONFIG_FILES(
	Makefile
	tools/Makefile
	src/Makefile
	plugingui/Makefile)

AC_OUTPUT()