configure.ac 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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_SRCDIR(RtMidi.cpp)
  4. AC_CONFIG_FILES(tests/Makefile)
  5. # Fill GXX with something before test.
  6. AC_SUBST( GXX, ["no"] )
  7. # Checks for programs.
  8. AC_PROG_CC
  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. # Checks for typedefs, structures, and compiler characteristics.
  14. AC_C_CONST
  15. # Check for debug
  16. AC_MSG_CHECKING(whether to compile debug version)
  17. AC_ARG_ENABLE(debug,
  18. [ --enable-debug = enable various debug output],
  19. [AC_SUBST( debug, [-D__RTMIDI_DEBUG__] ) AC_SUBST( cflags, [-g] ) AC_SUBST( object_path, [Debug] ) AC_MSG_RESULT(yes)],
  20. [AC_SUBST( debug, [] ) AC_SUBST( cflags, [-O2] ) AC_SUBST( object_path, [Release] ) AC_MSG_RESULT(no)])
  21. # Check compiler and use -Wall if gnu.
  22. if [test $GXX = "yes" ;] then
  23. AC_SUBST( warn, [-Wall] )
  24. fi
  25. # Checks for package options and external software
  26. AC_CANONICAL_HOST
  27. AC_MSG_CHECKING(for MIDI API)
  28. case $host in
  29. *-*-linux*)
  30. AC_SUBST( midi_api, [-D__LINUX_ALSASEQ__] )
  31. AC_CHECK_LIB(asound, snd_seq_open, , AC_MSG_ERROR(RtMidi in Linux requires the ALSA asound library!))
  32. # Checks for pthread library.
  33. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtMidi requires the pthread library!))
  34. ;;
  35. *-sgi*)
  36. AC_SUBST( midi_api, ["-D__IRIX_MD__ -LANG:std -w"] )
  37. AC_MSG_RESULT(using IRIX MD)
  38. AC_CHECK_LIB(md, mdInit, , AC_MSG_ERROR(IRIX MIDI support requires the md library!) )
  39. # Checks for pthread library.
  40. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtMidi requires the pthread library!))
  41. ;;
  42. *-apple*)
  43. # Check for CoreAudio framework
  44. AC_CHECK_HEADER(CoreMIDI/CoreMIDI.h, [AC_SUBST( midi_api, [-D__MACOSX_CORE__] )], [AC_MSG_ERROR(CoreMIDI header files not found!)] )
  45. AC_SUBST( frameworks, ["-framework CoreMIDI -framework CoreFoundation -framework CoreAudio"] )
  46. ;;
  47. *-mingw32*)
  48. # Use WinMM library
  49. AC_SUBST( midi_api, [-D__WINDOWS_MM__] )
  50. # I can't get the following check to work so just manually add the library
  51. # AC_CHECK_LIB(winmm, midiInGetNumDevs, , AC_MSG_ERROR(Windows MIDI support requires the winmm library!) )
  52. AC_SUBST( LIBS, [-lwinmm] )
  53. ;;
  54. *)
  55. # Default case for unknown realtime systems.
  56. AC_MSG_ERROR(Unknown system type for MIDI support!)
  57. ;;
  58. esac
  59. # Checks for library functions.
  60. AC_PROG_GCC_TRADITIONAL
  61. AC_OUTPUT