4 # - plugins/puredata: add pd compilation
5 # - java: add swig compilation
6 # - doc: add docbook2html and doxygen
7 # - tests: move to new unit test system
21 opt.add_option('--enable-double', action='store_true', default=False,
22 help='compile aubio in double precision mode')
23 opt.add_option('--disable-fftw3f', action='store_true', default=False,
24 help='compile with fftw3 instead of fftw3f')
25 opt.add_option('--disable-complex', action='store_true', default=False,
26 help='compile without C99 complex')
27 opt.add_option('--disable-jack', action='store_true', default=False,
28 help='compile without jack support')
29 opt.add_option('--disable-alsa', action='store_true', default=False,
30 help='compile without alsa support')
31 opt.add_option('--disable-lash', action='store_true', default=False,
32 help='compile without lash support')
33 opt.add_option('--enable-java', action='store_true', default=False,
34 help='compile with java support')
35 opt.add_option('--with-target-platform', type='string',
36 help='set target platform for cross-compilation', dest='target_platform')
37 opt.tool_options('compiler_cc')
38 opt.tool_options('compiler_cxx')
39 opt.tool_options('gnu_dirs')
40 #opt.tool_options('UnitTest')
44 conf.check_tool('compiler_cc')
45 conf.check_tool('compiler_cxx')
46 conf.check_tool('gnu_dirs') # helpful for autotools transition and .pc generation
47 conf.check_tool('misc') # needed for subst
49 if Options.options.target_platform:
50 Options.platform = Options.options.target_platform
52 if Options.platform == 'win32':
53 conf.env['shlib_PATTERN'] = 'lib%s.dll'
55 # check for required headers
56 conf.check(header_name='stdlib.h')
57 conf.check(header_name='stdio.h')
58 conf.check(header_name='math.h')
59 conf.check(header_name='string.h')
61 # optionally use complex.h
62 if (Options.options.disable_complex == False):
63 conf.check(header_name='complex.h')
65 # required dependancies
66 conf.check_cfg(package = 'sndfile', atleast_version = '1.0.4',
67 args = '--cflags --libs')
68 conf.check_cfg(package = 'samplerate', atleast_version = '0.0.15',
69 args = '--cflags --libs')
71 # double precision mode
72 if (Options.options.enable_double == True):
73 conf.define('HAVE_AUBIO_DOUBLE', 1)
75 conf.define('HAVE_AUBIO_DOUBLE', 0)
77 # one of fftwf or fftw3f
78 if (Options.options.disable_fftw3f == True):
79 conf.check_cfg(package = 'fftw3', atleast_version = '3.0.0',
80 args = '--cflags --libs')
82 # fftw3f not disabled, take most sensible one according to enable_double
83 if (Options.options.enable_double == True):
84 conf.check_cfg(package = 'fftw3', atleast_version = '3.0.0',
85 args = '--cflags --libs')
87 conf.check_cfg(package = 'fftw3f', atleast_version = '3.0.0',
88 args = '--cflags --libs')
90 # optional dependancies
91 if (Options.options.disable_jack == False):
92 conf.check_cfg(package = 'jack', atleast_version = '0.15.0',
93 args = '--cflags --libs')
94 if (Options.options.disable_alsa == False):
95 conf.check_cfg(package = 'alsa', atleast_version = '0.0.9',
96 args = '--cflags --libs')
97 if (Options.options.disable_lash == False):
98 conf.check_cfg(package = 'lash-1.0', atleast_version = '0.5.0',
99 args = '--cflags --libs', uselib_store = 'LASH')
102 if conf.find_program('swig', var='SWIG', mandatory = False):
103 conf.check_tool('swig', tooldir='swig')
104 conf.check_swig_version('1.3.27')
107 if conf.find_program('python', mandatory = False):
108 conf.check_tool('python')
109 conf.check_python_version((2,4,2))
110 conf.check_python_headers()
113 if (Options.options.enable_java == True):
114 conf.fatal('Java build not yet implemented')
115 conf.check_tool('java')
117 # check support for C99 __VA_ARGS__ macros
118 check_c99_varargs = '''
120 #define AUBIO_ERR(...) fprintf(stderr, __VA_ARGS__)
122 if conf.check_cc(fragment = check_c99_varargs,
124 msg = 'Checking for C99 __VA_ARGS__ macro'):
125 conf.define('HAVE_C99_VARARGS_MACROS', 1)
127 # write configuration header
128 conf.write_config_header('src/config.h')
130 # check for puredata header
131 conf.check(header_name='m_pd.h')
133 # add some defines used in examples
134 conf.define('AUBIO_PREFIX', conf.env['PREFIX'])
135 conf.define('PACKAGE', APPNAME)
137 # check if docbook-to-man is installed, optional
138 conf.find_program('docbook-to-man', var='DOCBOOKTOMAN', mandatory=False)
141 bld.env['VERSION'] = VERSION
142 bld.env['LIB_VERSION'] = LIB_VERSION
144 # add sub directories
145 bld.add_subdirs('src ext examples cpp tests/src')
147 if bld.env['PYTHON']:
148 bld.add_subdirs('python/aubio python')
152 # create the aubio.pc file for pkg-config
153 aubiopc = bld.new_task_gen('subst')
154 aubiopc.source = 'aubio.pc.in'
155 aubiopc.target = 'aubio.pc'
156 aubiopc.install_path = '${PREFIX}/lib/pkgconfig'
158 # build manpages from sgml files
159 if bld.env['DOCBOOKTOMAN']:
161 TaskGen.declare_chain(
162 name = 'docbooktoman',
163 rule = '${DOCBOOKTOMAN} ${SRC} > ${TGT}',
168 manpages = bld.new_task_gen(name = 'docbooktoman',
169 source=bld.path.ant_glob('doc/*.sgml'))
170 bld.install_files('${MANDIR}/man1', bld.path.ant_glob('doc/*.1'))
172 if bld.env['HAVE_M_PD_H']:
173 bld.add_subdirs('plugins/puredata')
175 # install woodblock sound
176 bld.install_files('${PREFIX}/share/sounds/aubio/',
177 'sounds/woodblock.aiff')
183 ut = UnitTest.unit_test()
184 ut.change_to_testfile_dir = True