2.4. Configure Scripting

Like many other open source projects, Bochs uses a configure script created with autoconf. The configure script generates all makefiles and a set of header and support files from templates.

This example shows how to add an option to the template file configure.in. The resulting configure script sets up symbols like BX_SUPPORT_BUSMOUSE in the output file config.h and replaces @BUSM_OBJS@ entries in the makefile output.

BUSM_OBJS=''
AC_MSG_CHECKING(for Busmouse support)
AC_ARG_ENABLE(busmouse,
  AS_HELP_STRING([--enable-busmouse], [enable Busmouse support (InPort)]),
  [if test "$enableval" = yes; then
    AC_MSG_RESULT(yes)
    AC_DEFINE(BX_SUPPORT_BUSMOUSE, 1)
    BUSM_OBJS='busmouse.o'
   else
    AC_MSG_RESULT(no)
    AC_DEFINE(BX_SUPPORT_BUSMOUSE, 0)
   fi],
  [
    AC_DEFINE(BX_SUPPORT_BUSMOUSE, 0)
    AC_MSG_RESULT(no)]
  )
AC_SUBST(BUSM_OBJS)

These output files are generated by the configure script in addition to the makefiles.