configure.ac 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_INIT([linux-gpib], [3.2.14])
  3. # libtool version: current:revision:age
  4. #
  5. # If the library source code has changed at all since the last update, then
  6. # increment revision (`c:r:a' becomes `c:r+1:a').
  7. #
  8. # If any interfaces have been added, removed, or changed since the last update,
  9. # increment current, and set revision to 0.
  10. #
  11. # If any interfaces have been added since the last public release, then
  12. # increment age.
  13. #
  14. # If any interfaces have been removed since the last public release, then set
  15. # age to 0.
  16. GPIB_SO_VERSION=1:7:1
  17. AC_CONFIG_SRCDIR([drivers/gpib/sys/osfuncs.c])
  18. AM_INIT_AUTOMAKE
  19. AM_MAINTAINER_MODE
  20. dnl create a config.h file (Automake will add -DHAVE_CONFIG_H)
  21. AC_CONFIG_HEADERS([config.h])
  22. AC_SUBST([VERSION])
  23. AC_SUBST([GPIB_SO_VERSION])
  24. [ISODATE=`date +%Y-%m-%d`]
  25. AC_SUBST([ISODATE])
  26. AC_CANONICAL_HOST
  27. AC_ENABLE_SHARED([yes])
  28. AC_ENABLE_STATIC([no])
  29. AC_ARG_ENABLE([pcmcia],[ --enable-pcmcia Enable support for PCMCIA cards in GPIB kernel drivers],
  30. [ENABLE_PCMCIA=$enableval],[ENABLE_PCMCIA="no"])
  31. if test "$ENABLE_PCMCIA" == "yes" ; then
  32. AC_DEFINE([GPIB_CONFIG_PCMCIA],[1],[Define to enable pcmcia support in drivers])
  33. fi
  34. AC_ARG_ENABLE([driver-debug],[ --enable-driver-debug Enable debug spam to console in GPIB kernel drivers],
  35. [ENABLE_DRIVER_SPAM=$enableval],[ENABLE_DRIVER_SPAM="no"])
  36. if test "$ENABLE_DRIVER_SPAM" == "yes" ; then
  37. AC_DEFINE([GPIB_CONFIG_KERNEL_DEBUG],[1],[Define to enable debug spam to console in drivers])
  38. fi
  39. AC_ARG_ENABLE([guile-binding],[ --disable-guile-binding Disable Guile binding to libgpib],
  40. [BIND_GUILE=$enableval],[BIND_GUILE="yes"])
  41. AC_ARG_ENABLE([perl-binding],[ --disable-perl-binding Disable Perl binding to libgpib],
  42. [BIND_PERL=$enableval],[BIND_PERL="yes"])
  43. AC_ARG_ENABLE([php-binding],[ --disable-php-binding Disable PHP binding to libgpib],
  44. [BIND_PHP=$enableval],[BIND_PHP="yes"])
  45. AC_ARG_ENABLE([python-binding],[ --disable-python-binding Disable Python binding to libgpib],
  46. [BIND_PYTHON=$enableval],[BIND_PYTHON="yes"])
  47. AC_ARG_ENABLE([tcl-binding],[ --disable-tcl-binding Disable TCL binding to libgpib],
  48. [BIND_TCL=$enableval],[BIND_TCL="yes"])
  49. AC_ARG_ENABLE([documentation],[ --disable-documentation Disable building documentation from SGML sources],
  50. [BUILD_DOCS=$enableval],[BUILD_DOCS="yes"])
  51. dnl check kernel source directory
  52. AC_ARG_WITH([linux-srcdir],
  53. [ --with-linux-srcdir=DIR location of Linux kernel source directory [[DIR=/lib/modules/$(uname -r)/build/]]],
  54. [LINUX_SRCDIR=$withval],[LINUX_SRCDIR=/lib/modules/$(uname -r)/build/])
  55. if test "$LINUX_SRCDIR" == "no" ; then
  56. AC_MSG_WARN([A Linux kernel source directory is required to compile driver modules. Use --with-linux-srcdir=DIR.])
  57. fi
  58. AC_SUBST([LINUX_SRCDIR])
  59. AC_MSG_CHECKING([Linux kernel directory])
  60. if [[ ! -d "$LINUX_SRCDIR" ]]; then
  61. AC_MSG_WARN([Linux kernel directory $LINUX_SRCDIR does not exist. Specify using --with-linux-srcdir=DIR.])
  62. fi
  63. if [[ ! -f "$LINUX_SRCDIR/.config" ]]; then
  64. AC_MSG_WARN([Kernel source tree at $LINUX_SRCDIR is not configured. Copy the
  65. appropriate configuration file to $LINUX_SRCDIR/.config and then run 'make oldconfig'
  66. in the kernel source directory.])
  67. fi
  68. AC_MSG_RESULT([ok])
  69. dnl get compile flags for modules from linux kernel source tree
  70. AC_MSG_CHECKING([Linux kernel compile flags])
  71. FLAGDIR=$(pwd)/util/linux_flags
  72. env LDFLAGS="" CFLAGS="" make --quiet -C ${LINUX_SRCDIR} V=1 SUBDIRS=${FLAGDIR} LINUXDIR=${LINUX_SRCDIR} modules > /dev/null
  73. if [[ $? != 0 ]]; then
  74. AC_MSG_WARN([Failed to get compile flags from Linux kernel directory.])
  75. fi
  76. AC_MSG_RESULT([ok])
  77. dnl Checks for programs.
  78. AC_PROG_INSTALL
  79. AC_PROG_CC
  80. AM_PROG_CC_C_O
  81. AM_PROG_LEX
  82. AC_PROG_YACC
  83. AC_PROG_LIBTOOL
  84. AC_PATH_PROG([JW_PATH], [jw], [no])
  85. if test "$JW_PATH" == "no" ; then
  86. AC_MSG_NOTICE([docbook-tools (jw) not found, disabling documentation])
  87. BUILD_DOCS="no"
  88. fi
  89. AC_PATH_PROG([DEPMOD], [depmod], [true], [PATH:/sbin:/usr/sbin:/usr/local/sbin])
  90. if test "$DEPMOD" == "true" ; then
  91. AC_MSG_WARN([unable to find the 'depmod' program. Is it in your path?])
  92. fi
  93. if test "$BIND_PYTHON" == "yes"; then
  94. AM_PATH_PYTHON()
  95. PYTHON_MAJOR_VERSION=$(echo $PYTHON_VERSION | cut -d. -f1 )
  96. PYTHON_MINOR_VERSION=$(echo $PYTHON_VERSION | cut -d. -f2 )
  97. if (( $PYTHON_MAJOR_VERSION < 2 )); then
  98. AC_MSG_WARN([python version less than 2.0, disabling python binding])
  99. BIND_PYTHON="no"
  100. fi
  101. fi
  102. AC_PATH_PROG([PERL], [perl], [no], [])
  103. if test "$PERL" == "no"; then
  104. AC_MSG_NOTICE([perl not found, disabling perl binding])
  105. BIND_PERL="no"
  106. fi
  107. SC_PATH_TCLCONFIG
  108. if [[ $no_tcl ]]; then
  109. AC_MSG_NOTICE([TCL config not found, disabling TCL binding])
  110. BIND_TCL="no"
  111. else
  112. SC_LOAD_TCLCONFIG
  113. fi
  114. AC_PATH_PROG([PHP_CONFIG], [php-config], [no],[])
  115. if test "$PHP_CONFIG" == "no"; then
  116. AC_MSG_NOTICE([php-config not found, disabling PHP binding])
  117. BIND_PHP="no"
  118. fi
  119. dnl Checks for libraries.
  120. AC_CHECK_LIB([guile],[gh_define],[echo this prevents default actions from occurring > /dev/null],
  121. [BIND_GUILE="no";AC_MSG_NOTICE([libguile not found, disabling guile binding])],[])
  122. dnl Checks for header files.
  123. AC_HEADER_STDC
  124. AC_CHECK_HEADERS(unistd.h sys/param.h sys/time.h time.h sys/mkdev.h sys/sysmacros.h string.h memory.h fcntl.h dirent.h sys/ndir.h ndir.h alloca.h locale.h )
  125. AM_CHECK_PYTHON_HEADERS([],[BIND_PYTHON=no;AC_MSG_NOTICE([python headers not found, disabling python binding])])
  126. AC_CHECK_HEADER([libguile.h],[],[BIND_GUILE="no";AC_MSG_NOTICE([libguile headers not found, disabling guile binding])])
  127. if test "$BIND_TCL" != "no"; then
  128. SAVE_CPPFLAGS=$CPPFLAGS
  129. CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC"
  130. AC_CHECK_HEADER([tcl.h],[],[BIND_TCL="no";AC_MSG_NOTICE([TCL headers not found, disabling TCL binding])])
  131. CPPFLAGS=$SAVE_CPPFLAGS
  132. fi
  133. if test "$PHP_CONFIG" != "no"; then
  134. SAVE_CPPFLAGS=$CPPFLAGS
  135. CPPFLAGS="$CPPFLAGS $($PHP_CONFIG --includes)"
  136. AC_CHECK_HEADER([php.h],[],[BIND_PHP="no";AC_MSG_NOTICE([PHP headers not found, disabling PHP binding])])
  137. CPPFLAGS=$SAVE_CPPFLAGS
  138. fi
  139. AC_HEADER_MAJOR
  140. AC_FUNC_ALLOCA
  141. AC_STRUCT_TM
  142. AC_STRUCT_ST_BLOCKS
  143. AC_FUNC_CLOSEDIR_VOID
  144. AC_CHECK_FUNCS([mkfifo])
  145. AC_CHECK_FUNC([mknod])
  146. dnl Checks for typedefs, structures, and compiler characteristics.
  147. dnl Checks for library functions.
  148. LIBGPIB_CFLAGS="-I\$(top_srcdir)/include -D_REENTRANT"
  149. LIBGPIB_LDFLAGS="\$(top_srcdir)/lib/libgpib.la -lpthread"
  150. AC_SUBST([LIBGPIB_CFLAGS])
  151. AC_SUBST([LIBGPIB_LDFLAGS])
  152. IBMAJOR=160
  153. AC_SUBST([IBMAJOR])
  154. AC_DEFINE([IBMAJOR],[160],[Major number of device files])
  155. echo
  156. echo Configuration:
  157. AM_CONDITIONAL([BUILD_DOCS], [test "$BUILD_DOCS" == "yes"])
  158. echo "SGML Documentation: $BUILD_DOCS"
  159. AM_CONDITIONAL([BIND_GUILE], [test "$BIND_GUILE" == "yes"])
  160. echo "Guile binding: $BIND_GUILE"
  161. AM_CONDITIONAL([BIND_PERL], [test "$BIND_PERL" == "yes"])
  162. echo "Perl binding: $BIND_PERL"
  163. AM_CONDITIONAL([BIND_PHP], [test "$BIND_PHP" == "yes"])
  164. echo "PHP binding: $BIND_PHP"
  165. AM_CONDITIONAL([BIND_PYTHON], [test "$BIND_PYTHON" == "yes"])
  166. echo "Python binding: $BIND_PYTHON"
  167. AM_CONDITIONAL([BIND_TCL], [test "$BIND_TCL" == "yes"])
  168. echo "TCL binding: $BIND_TCL"
  169. AC_OUTPUT([\
  170. Makefile \
  171. lib/Makefile \
  172. lib/gpib_config/Makefile \
  173. examples/Makefile \
  174. test/Makefile \
  175. drivers/Makefile \
  176. drivers/gpib/include/Makefile \
  177. doc/Makefile \
  178. include/Makefile \
  179. language/Makefile \
  180. language/guile/Makefile \
  181. language/php/Makefile \
  182. language/php/TESTS/Makefile \
  183. language/python/Makefile \
  184. language/tcl/Makefile \
  185. usb/Makefile \
  186. usb/ni_usb_gpib/Makefile \
  187. usb/agilent_82357a/Makefile \
  188. ]
  189. )