configure.ac 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. # Process this file with autoconf to produce a configure script.
  2. AC_INIT(RtMidi, 1.0, gary@music.mcgill.ca, rtmidi)
  3. AC_CONFIG_AUX_DIR(config)
  4. AC_CONFIG_SRCDIR(RtMidi.cpp)
  5. AC_CONFIG_FILES(tests/Makefile)
  6. # Fill GXX with something before test.
  7. AC_SUBST( GXX, ["no"] )
  8. # Checks for programs.
  9. AC_PROG_CXX(g++ CC c++ cxx)
  10. # Checks for header files.
  11. AC_HEADER_STDC
  12. #AC_CHECK_HEADERS(sys/ioctl.h unistd.h)
  13. # Check for debug
  14. AC_MSG_CHECKING(whether to compile debug version)
  15. AC_ARG_ENABLE(debug,
  16. [ --enable-debug = enable various debug output],
  17. [AC_SUBST( cppflag, [-D__RTMIDI_DEBUG__] ) AC_SUBST( cxxflag, [-g] ) AC_SUBST( object_path, [Debug] ) AC_MSG_RESULT(yes)],
  18. [AC_SUBST( cppflag, [] ) AC_SUBST( cxxflag, [-O3] ) AC_SUBST( object_path, [Release] ) AC_MSG_RESULT(no)])
  19. # For -I and -D flags
  20. CPPFLAGS="$CPPFLAGS $cppflag"
  21. # For debugging and optimization ... overwrite default because it has both -g and -O2
  22. #CXXFLAGS="$CXXFLAGS $cxxflag"
  23. CXXFLAGS="$cxxflag"
  24. # Check compiler and use -Wall if gnu.
  25. if [test $GXX = "yes" ;] then
  26. AC_SUBST( cxxflag, [-Wall] )
  27. fi
  28. CXXFLAGS="$CXXFLAGS $cxxflag"
  29. # Checks for package options and external software
  30. AC_CANONICAL_HOST
  31. AC_MSG_CHECKING(for MIDI API)
  32. case $host in
  33. *-*-linux*)
  34. AC_SUBST( api, [""] )
  35. AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (linux only)], [
  36. AC_SUBST( api, [-D__LINUX_JACK__] )
  37. AC_MSG_RESULT(using JACK)
  38. AC_CHECK_LIB(jack, jack_client_open, , AC_MSG_ERROR(JACK support requires the jack library!))], )
  39. if [test "$api" == "";] then
  40. AC_SUBST( api, [-D__LINUX_ALSASEQ__] )
  41. AC_CHECK_LIB(asound, snd_seq_open, , AC_MSG_ERROR(RtMidi in Linux requires the ALSA asound library!))
  42. # Checks for pthread library.
  43. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtMidi requires the pthread library!))
  44. fi
  45. ;;
  46. *-sgi*)
  47. AC_SUBST( api, ["-D__IRIX_MD__ -LANG:std -w"] )
  48. AC_MSG_RESULT(using IRIX MD)
  49. AC_CHECK_LIB(md, mdInit, , AC_MSG_ERROR(IRIX MIDI support requires the md library!) )
  50. # Checks for pthread library.
  51. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtMidi requires the pthread library!))
  52. ;;
  53. *-apple*)
  54. # Check for CoreAudio framework
  55. AC_CHECK_HEADER(CoreMIDI/CoreMIDI.h, [AC_SUBST( api, [-D__MACOSX_CORE__] )], [AC_MSG_ERROR(CoreMIDI header files not found!)] )
  56. AC_SUBST( LIBS, ["-framework CoreMIDI -framework CoreFoundation -framework CoreAudio"] )
  57. ;;
  58. *-mingw32*)
  59. # Use WinMM library
  60. AC_SUBST( api, [-D__WINDOWS_MM__] )
  61. # I can't get the following check to work so just manually add the library
  62. # AC_CHECK_LIB(winmm, midiInGetNumDevs, , AC_MSG_ERROR(Windows MIDI support requires the winmm library!) )
  63. AC_SUBST( LIBS, [-lwinmm] )
  64. ;;
  65. *)
  66. # Default case for unknown realtime systems.
  67. AC_MSG_ERROR(Unknown system type for MIDI support!)
  68. ;;
  69. esac
  70. CPPFLAGS="$CPPFLAGS $api"
  71. AC_OUTPUT