OCaml and CMake

Carsten Niehaus cniehaus at gmx.de
Tue Mar 28 12:47:30 CEST 2006


Hi

Kalzium of KDE 3.5 supports a solver for chemical equations. The solver is 
written by Thomas Nagy in OCaml. AFAIK (and google tells me) CMake does not 
support OCaml right now. Unsermake/autotools didn't support it either, so we 
created a static Makefile (attached) which worked on most systems and the 
following ugly configure.in-check.
I would now like to activate OCaml in Kalzium but have not the slightest idea 
how to do that...

Carsten

PS: facile (libfacile) is a lib written in OCaml we use for the solver.

ocaml_installed=no
facile_installed=no
eqchem_enabled=no

AC_DEFUN([OCAML_PROG],[
    KDE_FIND_PATH(ocamlopt, OCAML, [$bindir],
      [
        OCAML=''
      ])
])

AC_DEFUN([FACILE_PROG],[
    AC_REQUIRE([OCAML_PROG])

    AC_MSG_CHECKING([if the facile constraint solver is installed])
    FACILE="`ocamlopt -where`/facile"
    if test -d "$FACILE" ; then
        eqchem_enabled=yes
        AC_MSG_RESULT([yes])
        facile_installed=yes
    else
        eqchem_enabled=no
        AC_MSG_RESULT([no])
        facile_installed=no
    fi

    AC_SUBST([FACILE])
])

AC_ARG_ENABLE( ocamlsolver,
  [  --disable-ocamlsolver        Disable support for the OCaml solver 
@<:@default=check@:>@]],
  [  with_ocamlsolver=$enableval ],
  [  with_ocamlsolver=check] )

if test "x$with_ocamlsolver" != xno; then
  OCAML_PROG
  if test -n "$OCAML"; then
    ocaml_installed=yes
    FACILE_PROG
  fi

  AH_TEMPLATE(HAVE_FACILE, facile solver available?)

  EQCHEM_SUB=
  OCAMLLIB=
  EQCHEM_LDADD=
  if test "$eqchem_enabled" = "yes"; then
    EQCHEM_SUB=solver
    OCAMLLIB=`ocamlc -where`
    FACILELIB=`ocamlc -where`/facile
    EQCHEM_LDADD="-lasmrun -lstr -lnums -lm -ldl solver.o modwrap.o"

    AC_DEFINE(HAVE_FACILE, 1)
  fi

  AC_SUBST(EQCHEM_SUB)
  AC_SUBST(OCAMLLIB)
  AC_SUBST(FACILELIB)
  AC_SUBST(EQCHEM_LDADD)

  if test "$eqchem_enabled" = "yes"; then
    with_ocamlsolver=yes
  fi
fi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: text/x-makefile
Size: 2111 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-buildsystem/attachments/20060328/25004319/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-buildsystem/attachments/20060328/25004319/attachment.pgp 


More information about the Kde-buildsystem mailing list