aboutsummaryrefslogtreecommitdiff
path: root/flite/configure.in
blob: c53c07462f2122324cbf6a026e1148ed624e6bc5 (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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
dnl Process this file with autoconf to produce a configure script.
dnl -- adapted from 'configure.in' in ggee distribution by Guenter Geiger
AC_PREREQ(2.5)

dnl Some handy macros
define([THE_PACKAGE_NAME],    [pdflite])
define([THE_PACKAGE_VERSION], [0.02])
define([THE_PACKAGE_AUTHOR],  [moocow@ling.uni-potsdam.de])

AC_INIT(THE_PACKAGE_NAME, THE_PACKAGE_VERSION, THE_PACKAGE_AUTHOR)

dnl
dnl source & aux
dnl
AC_CONFIG_AUX_DIR(config)

dnl
dnl use automake
dnl
AM_INIT_AUTOMAKE(THE_PACKAGE_NAME, THE_PACKAGE_VERSION)

dnl
dnl use autoheader
dnl
AM_CONFIG_HEADER(config.h)

dnl
dnl default prefix (== pd-dir)
dnl
AC_PREFIX_DEFAULT(/usr/local/lib/pd)

##-- save user *FLAGS
UCPPFLAGS="$CPPFLAGS"
UCFLAGS="$CFLAGS"
ULDFLAGS="$LDFLAGS"
ULIBS="$LIBS"

dnl
dnl Programs
dnl
AC_PROG_CC
AC_PROG_INSTALL

dnl
dnl Substitutions
dnl 
AC_SUBST(AFLAGS)
AC_SUBST(DFLAGS)
AC_SUBST(IFLAGS)
AC_SUBST(LFLAGS)
AC_SUBST(OFLAGS)
AC_SUBST(WFLAGS)
AC_SUBST(LD)
AC_SUBST(EXT)

dnl version stuff (automatically exported?)
AC_SUBST(PACKAGE_VERSION)
AC_SUBST(PACKAGE_NAME)
AC_SUBST(BUGREPORT)

##-- banner stuff
compiled_by="${LOGNAME:-${USER:-(unknown)}}"
compiled_on="`date`"
test -z "$compiled_on" && compiled_on="?"

AC_DEFINE_UNQUOTED(PDFLITE_COMPILED_BY, "$compiled_by", [User who compiled this external])
AC_DEFINE_UNQUOTED(PDFLITE_COMPILED_ON, "$compiled_on", [When this external was compiled])

dnl
dnl pd-directory/ies
dnl 
AC_ARG_WITH(pd-dir,
	AC_HELP_STRING([--with-pd-dir=DIR], [PD base directory (default=/usr/local/pd)]),
	[PD_DIR="$withval"],
	[PD_DIR="/usr/local/pd"])
AC_SUBST(PD_DIR)

AC_ARG_WITH(pd-include,
	AC_HELP_STRING([--with-pd-include=DIR], [PD include directory (default=${PD_DIR}/src)]),
	[PD_INC="$withval"],
	[PD_INC="${PD_DIR}/src"])
IFLAGS="$IFLAGS -I${PD_INC}"
AC_SUBST(PD_INC)

AC_ARG_WITH(pd-externs,
	AC_HELP_STRING([--with-pd-externs=DIR], [PD externals directory (default=${PD_DIR}/externs)]),
	[PD_EXTDIR="$withval"],
	[PD_EXTDIR="${PD_DIR}/externs"])
AC_SUBST(PD_EXTDIR)


AC_ARG_WITH(pd-doc,
	AC_HELP_STRING([--with-pd-doc=DIR],
	     [PD documentation directory (default=${PD_DIR}/doc/5.reference)]),
	[PD_DOCDIR="$withval"],
	[PD_DOCDIR="${PD_DIR}/doc/5.reference"])
AC_SUBST(PD_DOCDIR)


dnl
dnl flite source directory
dnl 
AC_ARG_WITH(flite-dir,
	AC_HELP_STRING([--with-flite-dir=DIR], [Flite source directory (default=none)]),
	[FLITE_DIR="$withval"],
	)
if test -n "$FLITE_DIR"; then
  IFLAGS="$IFLAGS -I${FLITE_DIR}/include"
  LFLAGS="$LFLAGS -L${FLITE_DIR}/lib"
fi

##-- check: headers: flite.h
CPPFLAGS="$UCPPFLAGS $IFLAGS"
AC_CHECK_HEADER([flite/flite.h],[pdflite_have_header=yes],[pdflite_have_header=no],[ ])
if test "$pdflite_have_header" != "yes"; then
  AC_MSG_WARN([Required header 'flite.h' not found])
  AC_MSG_WARN([- is the directory containing 'flite.h' in your CPPFLAGS variable?])
  AC_MSG_ERROR([Required header not found: aborting],1)
fi

##-- check libs: libflite.a
LDFLAGS="$ULDFLAGS $LFLAGS"
AC_CHECK_LIB(flite,[flite_init],[pdflite_have_lib=yes],[pdflite_have_lib=no],[-lm])
if test "$pdflite_have_lib" != "yes"; then
  for d in \
    /usr/lib /usr/local/lib /sw/lib \
    /usr/lib/flite /usr/local/lib/flite /sw/lib/flite \
    /usr/flite/lib /usr/local/flite/lib /sw/flite/lib \
    /usr/lib/flite/lib /usr/local/lib/flite/lib /sw/lib/flite/lib
  do
    LDFLAGS="$ULDFLAGS $LFLAGS -L$d"
    AC_CHECK_LIB(flite,[flite_init],[pdflite_have_lib=yes],[pdflite_have_lib=no],[-lm])
    if test "$pdflite_have_lib" = "yes"; then
      LFLAGS="$LFLAGS -L$d"
      break
    fi
  done
  ##
  ##-- libflite.a: final check
  if test "$pdflite_have_lib" != "yes"; then
    AC_MSG_WARN([Required library 'flite' not found])
    AC_MSG_WARN([- is the directory containing the 'flite' library in your LDFLAGS variable?])
    AC_MSG_ERROR([Required library not found: aborting],1)
  fi
fi

##-- flite: libs: base
FLITE_LIBS="-lflite -lm"
AC_SUBST(FLITE_LIBS)

dnl
dnl Check for flite : libs : flite_cmulex
dnl
LDFLAGS="$ULDFLAGS $LFLAGS"
AC_CHECK_LIB(flite_cmulex,[cmu_lex_init],[],
	[AC_MSG_ERROR([required library 'flite_cmulex' not found -- quitting],1)],
	[-lflite -lm])
FLITE_LEXLIBS="-lflite_cmulex"
AC_SUBST(FLITE_LEXLIBS)

dnl
dnl Check for flite : libs : flite_usenglish
dnl
LDFLAGS="$ULDFLAGS $LFLAGS"
AC_CHECK_LIB(flite_usenglish,[usenglish_init],[],
	[AC_MSG_ERROR([required library 'flite_usenglish' not found -- quitting],1)],
	[-lflite_cmulex -lflite -lm])
FLITE_LANGLIBS="-lflite_usenglish"
AC_SUBST(FLITE_LANGLIBS)

dnl Check for flite : libs : flite_cmu_us_kal16
dnl
LDFLAGS="$ULDFLAGS $LFLAGS"
AC_CHECK_LIB(flite_cmu_us_kal16,[register_cmu_us_kal],[],
	[AC_MSG_ERROR([required library 'flite_cmu_us_kal16' not found -- quitting],1)],
	[-lflite_usenglish -lflite_cmulex -lflite -lm])
FLITE_VOICELIBS="-lflite_cmu_us_kal16"
AC_SUBST(FLITE_VOICELIBS)

AC_DEFINE([PDFLITE_REGISTER_VOICE],[register_cmu_us_kal],
	[This is the function we will call to register the synth voice])



dnl
dnl debug version?
dnl
AC_MSG_CHECKING([whether we are building a debug version])
AC_ARG_ENABLE([debug],
	AC_HELP_STRING([--enable-debug],[build debug version (default=no)]))

if test "$enable_debug" = "yes" ; then
  AC_MSG_RESULT(yes)
  DEBUG="yes"
  DFLAGS="$DFLAGS -DPDFLITE_DEBUG"
else
  AC_MSG_RESULT(no)
  DEBUG="no"
fi
AC_SUBST(DEBUG)

dnl
dnl compiler warnings
dnl
WFLAGS="-Wall"


dnl
dnl machine-dependent variables
dnl
LD=ld
if test `uname -s` = Linux; 
then
  LFLAGS="$LFLAGS -export_dynamic -shared"
  if test "$DEBUG" = "no"; then
    #OFLAGS="-O6 -funroll-loops -fomit-frame-pointer"
    OFLAGS="-O3 -pipe"
  else
    OFLAGS="-g"
  fi
  OFLAGS="$OFLAGS -fPIC"
  DFLAGS="$DFLAGS -DPIC"
  EXT=pd_linux
fi

if test `uname -m` = alpha; 
then 
 AFLAGS="-mieee  -mcpu=ev56"; 
 OFLAGS="$CFLAGS"
fi

if test `uname -s` = IRIX64; 
then
  LFLAGS="$LFLAGS -n32 -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \
	-OPT:roundoff=3 -OPT:IEEE_arithmetic=3 -OPT:cray_ivdep=true \
	-shared -rdata_shared"
  OFLAGS="$CFLAGS"
EXT=pd_irix6
fi

if test `uname -s` = IRIX32; 
then
  LFLAGS="$LFLAGS -o32 -DUNIX -DIRIX -O2 -shared -rdata_shared"
  OFLAGS="$CFLAGS"
  EXT=pd_irix5
fi

dnl
dnl Flags for MacOSX, borrowed from pd-0.35-test16
dnl
if test `uname -s` = Darwin;
then
  LD=cc
  LFLAGS="$LFLAGS -bundle -undefined suppress  -flat_namespace"
  EXT=pd_darwin
  DFLAGS="$DFLAGS -DMACOSX"

  if test "$DEBUG" = "no"; then
    OFLAGS="-O2"
  else
    OFLAGS="-g"
  fi
fi

dnl
dnl Restore user flags
dnl
CPPFLAGS="$UCPPFLAGS"
CFLAGS="$UCFLAGS"
LDFLAGS="$ULDFLAGS"
LIBS="$ULIBS"

AC_OUTPUT(config/Makefile Makefile)