1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3#
4### Copyright (C) 2019-2021 John Donoghue <john.donoghue@ieee.org>
5###
6### This program is free software; you can redistribute it and/or
7### modify it under the terms of the GNU General Public License as
8### published by the Free Software Foundation; either version 3 of the
9### License, or (at your option) any later version.
10###
11### This program is distributed in the hope that it will be useful,
12### but WITHOUT ANY WARRANTY; without even the implied warranty of
13### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14### General Public License for more details.
15###
16### You should have received a copy of the GNU General Public License
17### along with this program; if not, see
18### <http://www.gnu.org/licenses/>.
19
20AC_PREREQ([2.67])
21AC_INIT([octave audio package], [2.0.4])
22AC_CONFIG_HEADERS([config.h])
23
24# Avoid warnings for redefining AH-generated preprocessor symbols of
25# Octave.
26AH_TOP([#include "undef-ah-octave.h"])
27
28AC_CONFIG_MACRO_DIRS([m4])
29
30# Checks for programs.
31AC_PROG_CXX
32AC_LANG(C++)
33
34AC_CHECK_TOOL([MKOCTFILE], [mkoctfile], [none])
35if [ test "$MKOCTFILE" = "none" ]; then
36  AC_MSG_ERROR([mkoctfile required to install $PACKAGE_NAME])
37fi
38
39PKG_CHECK_MODULES(RTMIDI,rtmidi,[have_rtmidi=yes],[have_rtmidi=no])
40if test "$have_rtmidi" = "yes"; then
41  AC_DEFINE(HAVE_RTMIDI, 1, [Define to 1 to use the rtmidi library.])
42  CXXFLAGS="$CXXFLAGS $RTMIDI_CFLAGS"
43  LIBS="$LIBS $RTMIDI_LIBS"
44else
45  AC_MSG_ERROR([RTMIDI required to install $PACKAGE_NAME])
46fi
47
48# Check for RtMidi::getApiName
49AC_MSG_CHECKING([RtMidi::getApiName])
50have_get_api_name=no
51AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
52   #include <RtMidi.h>
53   #include <string>
54  ]], [
55    std::string n = RtMidi::getApiName(RtMidi::LINUX_ALSA);
56  ])],
57 [AC_MSG_RESULT([yes])
58  have_api_name=yes],
59 [AC_MSG_RESULT([no])]
60)
61
62if test $have_get_api_name = yes; then
63  AC_DEFINE([HAVE_RTMIDI_GETAPINAME], [1], [have the RtMidi::getApiName function])
64fi
65
66# Checks for octave depreciated symbols
67## Simple symbol alternatives of different Octave versions.
68save_altsyms_CXX="$CXX"
69save_altsyms_CXXFLAGS="$CXXFLAGS"
70save_altsyms_LDFLAGS="$LDFLAGS"
71save_altsyms_LIBS="$LIBS"
72OCTINCLUDEDIR=${OCTINCLUDEDIR:-`$MKOCTFILE -p INCFLAGS`}
73OCTLIBDIR=${OCTLIBDIR:-`$MKOCTFILE -p OCTLIBDIR`}
74CXX=`${MKOCTFILE} -p CXX`
75CXXFLAGS="$OCTINCLUDEDIR $CXXFLAGS"
76LDFLAGS="-L$OCTLIBDIR $LDFLAGS"
77LIBS="-loctinterp $LIBS"
78
79OF_OCTAVE_LIST_ALT_SYMS([
80[dnl
81  [feval],
82  [octave::feval],
83  [[octave::feval ("date");]],
84  [OCTAVE__FEVAL],
85  [[#include <octave/parse.h>]],
86  [[#include <octave/parse.h>]]
87],
88
89[dnl
90  [is_float_type],
91  [isfloat],
92  [[octave_value ().isfloat ();]],
93  [OV_ISFLOAT],
94  [],
95  []
96],
97
98[dnl
99  [is_integer_type],
100  [isinteger],
101  [[octave_value ().isinteger ();]],
102  [OV_ISINTEGER],
103  [],
104  []
105],
106
107[dnl
108  [is_cell],
109  [iscell],
110  [[octave_value ().iscell ();]],
111  [OV_ISCELL],
112  [],
113  []
114]
115
116],[oct-alt-includes.h])
117
118CXX=$save_altsyms_CXX
119CXXFLAGS=$save_altsyms_CXXFLAGS
120LDFLAGS=$save_altsyms_LDFLAGS
121LIBS=$save_altsyms_LIBS
122
123AC_CONFIG_FILES([Makefile])
124AC_OUTPUT
125
126AC_MSG_NOTICE([
127
128$PACKAGE_NAME is configured with:
129  LIBS:     $LIBS
130  CXXFLAGS: $CXXFLAGS $DEFS
131])
132
133