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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
|
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], [pd-gfsm])
define([THE_PACKAGE_VERSION], [0.05])
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 save user's CFLAGS,CPPFLAGS
dnl
UCPPFLAGS="$CPPFLAGS"
UCFLAGS="$CFLAGS"
#UCXXFLAGS="$CXXFLAGS"
dnl
dnl use automake
dnl
AM_INIT_AUTOMAKE(THE_PACKAGE_NAME, THE_PACKAGE_VERSION)
dnl
dnl use autoheader
dnl
AM_CONFIG_HEADER([src/config.h])
dnl
dnl Programs, prefix
dnl
AC_PROG_CC
dnl AC_PROG_CXX
AC_PROG_INSTALL
AC_PREFIX_DEFAULT(/usr/local)
dnl v--- needed if Makefile.am uses _LTLIBRARIES targets
AC_PROG_LIBTOOL
dnl
dnl Substitutions
dnl
AC_SUBST(DEFS)
AC_SUBST(AFLAGS)
AC_SUBST(DFLAGS)
AC_SUBST(IFLAGS)
AC_SUBST(LFLAGS)
AC_SUBST(OFLAGS)
AC_SUBST(WFLAGS)
AC_SUBST(LD)
AC_SUBST(PDEXT)
dnl version stuff (automatically exported?)
AC_SUBST(PACKAGE_VERSION)
AC_SUBST(PACKAGE_NAME)
AC_SUBST(BUGREPORT)
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)]),
[pddir="$withval"],
[pddir="/usr/local/pd"])
pddocdir="${pddir}/doc/5.reference"
AC_SUBST(pddir)
AC_SUBST(pddocdir)
AC_ARG_WITH(pd-include,
AC_HELP_STRING([--with-pd-include=DIR], [PD include directory (default=${PD_DIR}/src)]),
[pdincludedir="$withval"],
[pdincludedir="${PD_DIR}/src"])
AC_SUBST(pdincludedir)
AC_ARG_WITH(pd-extdir,
AC_HELP_STRING([--with-pd-extdir=DIR], [Directory for PD externals (default=PDDIR/externs)]),
[pdexternsdir="$withval"],
[pdexternsdir="$pddir/externs"])
AC_SUBST(pdexternsdir)
dnl
dnl Check for m_pd.h
dnl
CPPFLAGS="$CPPFLAGS $IFLAGS"
AC_CHECK_HEADER(m_pd.h,[],
AC_MSG_WARN([-----------------------------------------------------------------])
AC_MSG_WARN([could not find PD header file 'm_pd.h' -- things might get ugly.])
AC_MSG_WARN([-----------------------------------------------------------------]),
[/* nonempty includes: compile only */])
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 -DDEBUG"
else
AC_MSG_RESULT(no)
DEBUG="no"
fi
AC_SUBST(DEBUG)
dnl ---------------------------------------------------------------
dnl pkg-config : program
dnl
AC_ARG_VAR(PKG_CONFIG, [How to run the pkg-config program])
AC_ARG_VAR(PKG_CONFIG_PATH, [Directories to search for pkg-config])
if test -z "$PKG_CONFIG" ; then
AC_PATH_PROG(PKG_CONFIG,pkg-config,[])
fi
dnl pkg-config: destination directory
AC_ARG_WITH(pkgconfig-dir,
AC_HELP_STRING([--with-pkgconfig-dir=DIR],
[install pkg-config metafile(s) in DIR (default=LIBDIR/pkgconfig)]),
[ac_cv_pkgconfigdir="$withval"])
if test -z "$ac_cv_pkgconfigdir" ; then
ac_cv_pkgconfigdir="\$(libdir)/pkgconfig"
fi
pkgconfigdir="$ac_cv_pkgconfigdir"
AC_SUBST(pkgconfigdir)
AC_SUBST(PKG_CONFIG)
dnl
dnl pkg-config
dnl ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
##vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
## gfsm:select
AC_ARG_ENABLE([system-gfsm],
AC_HELP_STRING([--enable-system-gfsm],
[Use system-wide (shared) libgfsm if present (default=no)]),
[ac_cv_enable_system_gfsm="$enableval"],
[ac_cv_enable_system_gfsm="no"])
if test "$ac_cv_enable_system_gfsm" = "yes" ; then
PKG_CHECK_MODULES(GFSM, [gfsm >= 0.0.8], [PC_HAVE_GFSM="yes"], [PC_HAVE_GFSM=""])
if test "$PC_HAVE_GFSM" != "yes" ; then
AC_MSG_WARN([])
AC_MSG_WARN([----------------------------------------------------------------])
AC_MSG_WARN([ system-wide gfsm library not found!])
AC_MSG_WARN([ - Is the directory containing gfsm.pc in your])
AC_MSG_WARN([ 'PKG_CONFIG_PATH' environment variable?])
AC_MSG_WARN([ - falling back to static local libgfsm])
AC_MSG_WARN([----------------------------------------------------------------])
AC_MSG_WARN([])
ac_cv_have_system_gfsm="no"
ac_cv_enable_system_gfsm="no"
else
ac_cv_have_system_gfsm="yes"
fi
fi
## /gfsm:select
##^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
##vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
## gfsm:flags
##
AC_MSG_CHECKING([which libgfsm to use])
if test "$ac_cv_enable_system_gfsm" != "yes"; then
##-- gfsm:local
AC_MSG_RESULT([local])
AC_CONFIG_SUBDIRS(gfsm)
PD_GFSM_SUBDIRS="gfsm"
##-- gfsm:local: flags
IFLAGS="$IFLAGS -I\$(top_srcdir)/gfsm/src/libgfsm -I\$(top_builddir)/gfsm/src/libgfsm \`\$(PKG_CONFIG) --cflags-only-I \$(top_builddir)/gfsm/gfsm.pc\`"
LFLAGS="$LFLAGS -L\$(top_builddir)/gfsm/src/libgfsm \`\$(PKG_CONFIG) --cflags-only-I \$(top_builddir)/gfsm/gfsm.pc\`"
LIBS="$LIBS \$(top_builddir)/gfsm/src/libgfsm/libgfsm.la \`\$(PKG_CONFIG) --libs-only-l \$(top_builddir)/gfsm/gfsm.pc | sed -e's/\-lgfsm//g'\`"
PD_GFSM_WHICH="static local"
else
##-- gfsm:system
AC_MSG_RESULT([system])
PD_GFSM_SUBDIRS=""
PD_GFSM_WHICH="system global"
##-- gfsm:system: flags
IFLAGS="$IFLAGS `$PKG_CONFIG --cflags-only-I gfsm`"
LFLAGS="$LFLAGS `$PKG_CONFIG --libs-only-L gfsm`"
LIBS="$LIBS `$PKG_CONFIG --libs-only-l gfsm`"
fi
AC_SUBST(PD_GFSM_SUBDIRS)
AC_DEFINE_UNQUOTED(PD_GFSM_WHICH, "$PD_GFSM_WHICH", [Which version of gfsm are we using?])
AC_DEFINE_UNQUOTED(PD_GFSM_DATE, "`date`", [Date this external was configured])
AC_DEFINE_UNQUOTED(PD_GFSM_USER, "$USER", [User who configured this external])
## /gfsm:local
##^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
##vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
## gfsm:any
AC_ARG_ENABLE(gfsm,
AC_HELP_STRING([--disable-gfsm], [Globally disable gfsm support (causes build to fail)]),
[ac_cv_enable_gfsm="$enableval"],
[ac_cv_enable_gfsm="yes"])
if test "$ac_cv_enable_gfsm" != "yes" ; then
AC_MSG_ERROR([gfsm support disabled by user],1)
fi
## /gfsm:any
##^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
dnl --------------------------------------------------------------------
dnl BEGIN import from pd configure.in
dnl --------------------------------------------------------------------
dnl
dnl machine-dependent variables
dnl
LD=ld
if test `uname -s` = Linux;
then
LFLAGS="-export_dynamic -shared"
if test "$DEBUG" = "no"; then
#OFLAGS="-O6 -funroll-loops -fomit-frame-pointer -finline-limit-10000000"
#OFLAGS="-O6 -funroll-loops -fomit-frame-pointer"
OFLAGS="-O3 -pipe"
else
OFLAGS="-g"
fi
DFLAGS="$DFLAGS -DPIC"
OFLAGS="$OFLAGS -fPIC"
PDEXT=pd_linux
fi
if test `uname -m` = alpha;
then
AFLAGS="-mieee -mcpu=ev56";
OFLAGS="$CFLAGS"
fi
if test `uname -s` = IRIX64;
then
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"
PDEXT=pd_irix6
fi
if test `uname -s` = IRIX32;
then
LFLAGS="-o32 -DUNIX -DIRIX -O2 -shared -rdata_shared"
OFLAGS="$CFLAGS"
PDEXT=pd_irix5
fi
dnl
dnl Flags for MacOSX, borrowed from pd-0.35-test16
dnl
if test `uname -s` = Darwin;
then
LD=cc
LFLAGS="-bundle -undefined suppress -flat_namespace"
PDEXT=pd_darwin
DFLAGS="$DFLAGS -DMACOSX"
if test "$DEBUG" = "no"; then
OFLAGS="-O2"
else
OFLAGS="-g"
fi
fi
dnl --------------------------------------------------------------------
dnl END import from pd configure.in
dnl --------------------------------------------------------------------
dnl
dnl restore user's CFLAGS
dnl
CFLAGS="$UCFLAGS"
CPPFLAGS="$UCPPFLAGS"
#CXXFLAGS="$UCXXFLAGS"
AC_OUTPUT(config/Makefile src/Makefile Makefile)
|