OCAML_ROOT = @OCAML_ROOT@
HELM_BIN_DIR = @HELM_BIN_DIR@
+LABLGTK_DIR = @LABLGTK_LIB_DIR@
+LABLGTKMATHVIEW_DIR = @LABLGTKMATHVIEW_LIB_DIR@
+MINIDOM_DIR = @MLMINIDOM_LIB_DIR@
-LABLGTK_DIR = $(OCAML_ROOT)/lablgtk
-LABLGTK_MATHVIEW_DIR = $(OCAML_ROOT)/lablgtk/mathview
-MINIDOM_DIR = $(OCAML_ROOT)/minidom
PXP_DIR = $(OCAML_ROOT)/site-lib/pxp
NETSTRING_DIR = $(OCAML_ROOT)/site-lib/netstring
-OCAMLC = ocamlc -I $(LABLGTK_DIR) -I $(LABLGTK_MATHVIEW_DIR) -I $(PXP_DIR) -I $(NETSTRING_DIR) -I $(MINIDOM_DIR) -I mlmathview
-OCAMLOPT = ocamlopt -I $(LABLGTK_DIR) -I $(LABLGTK_MATHVIEW_DIR) -I mlgtk_devel -I $(PXP_DIR) -I $(NETSTRING_DIR) -I $(MINIDOM_DIR) -I mlmathview
+
+#OCAMLC = ocamlc -I $(LABLGTK_DIR) -I $(LABLGTKMATHVIEW_DIR) -I $(PXP_DIR) -I $(NETSTRING_DIR) -I $(MINIDOM_DIR) -I mlmathview
+#OCAMLOPT = ocamlopt -I $(LABLGTK_DIR) -I $(LABLGTKMATHVIEW_DIR) -I mlgtk_devel -I $(PXP_DIR) -I $(NETSTRING_DIR) -I $(MINIDOM_DIR) -I mlmathview
+OCAMLC = ocamlc -I $(LABLGTK_DIR) -I $(LABLGTKMATHVIEW_DIR) -I $(PXP_DIR) -I $(NETSTRING_DIR) -I $(MINIDOM_DIR)
+OCAMLOPT = ocamlopt -I $(LABLGTK_DIR) -I $(LABLGTKMATHVIEW_DIR) -I $(PXP_DIR) -I $(NETSTRING_DIR) -I $(MINIDOM_DIR)
OCAMLDEP = ocamldep
all: experiment reduction fix_params mmlinterface
lablgtk.cma gtkInit.cmo \
$(MINIDOM_DIR)/minidom.cmo \
$(MINIDOM_DIR)/ominidom.cmo \
- $(LABLGTK_MATHVIEW_DIR)/lablgtkmathview.cma \
+ $(LABLGTKMATHVIEW_DIR)/lablgtkmathview.cma \
$(MMLINTERFACEOBJS) \
-cclib "-lstr -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk \
-rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm \
-lunix `gtkmathview-config --libs` \
- $(LABLGTK_MATHVIEW_DIR)/ml_gtk_mathview.o \
+ $(LABLGTKMATHVIEW_DIR)/ml_gtk_mathview.o \
$(MINIDOM_DIR)/ml_minidom.o" \
-cclib -lmldbm -cclib -lndbm
dbm.cmxa lablgtk.cmxa gtkInit.cmx \
$(MINIDOM_DIR)/minidom.cmx \
$(MINIDOM_DIR)/ominidom.cmx \
- $(LABLGTK_MATHVIEW_DIR)/lablgtkmathview.cmxa \
+ $(LABLGTKMATHVIEW_DIR)/lablgtkmathview.cmxa \
$(MMLINTERFACEOPTOBJS) \
-cclib "-lstr -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk \
-rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm \
-lunix `gtkmathview-config --libs` \
- $(LABLGTK_MATHVIEW_DIR)/ml_gtk_mathview.o \
+ $(LABLGTKMATHVIEW_DIR)/ml_gtk_mathview.o \
$(MINIDOM_DIR)/ml_minidom.o" \
-cclib -lmldbm -cclib -lndbm
dnl ocaml, ocaml-findlib, ocaml-netstring, ocaml-pxp, lablgtk_20001129
dnl lablgtk-20001129_gtkmathview
-dnl General
+dnl Check for Ocaml
+AC_CHECK_PROG(HAVE_OCAMLC, ocamlc, yes, no)
+if test $HAVE_OCAMLC = "no"; then
+ AC_MSG_ERROR(could not find ocamlc in PATH, please make sure ocaml is installed)
+fi
+
+dnl Check for the Ocaml library dir
AC_MSG_CHECKING("for the ocaml library dir")
OCAML_ROOT=`ocamlc -v | grep "^Standard" | sed 's/^.*: *//'`
AC_MSG_RESULT($OCAML_ROOT)
+dnl Check for mlminidom
+RES="yes"
+AC_CHECK_FILE($OCAML_ROOT/mlminidom/minidom.mli,
+ MLMINIDOM_LIB_DIR=$OCAML_ROOT/mlminidom,
+ RES="no"
+)
+
+if test $RES = "no"; then
+ RES=""
+ AC_CACHE_VAL(lablgtkmathview_cv_MLMINIDOM_LIB_DIR,
+ echo "In which directory can I find the mlminidom library? (I haven't found it in the usual location $OCAML_ROOT/mlminidom)"
+ read lablgtkmathview_cv_MLMINIDOM_LIB_DIR
+ RES="Asked"
+ )
+ MLMINIDOM_LIB_DIR=$lablgtkmathview_cv_MLMINIDOM_LIB_DIR
+ if test "$RES" != "Asked"; then
+ MLMINIDOM_LIB_DIR=`eval "echo $MLMINIDOM_LIB_DIR"`
+ fi
+ AC_CACHE_SAVE
+fi
+
+dnl Check for lablgtk
+RES="yes"
+AC_CHECK_FILE($OCAML_ROOT/lablgtk/gtk.ml,
+ LABLGTK_LIB_DIR=$OCAML_ROOT/lablgtk,
+ RES="no"
+)
+
+if test $RES = "no"; then
+ RES=""
+ AC_CACHE_VAL(mmlinterface_cv_LABLGTK_LIB_DIR,
+ echo "In which directory can I find the lablgtk library? (I haven't found it in the usual location $OCAML_ROOT/lablgtk)"
+ read mmlinterface_cv_LABLGTK_LIB_DIR
+ RES="Asked"
+ )
+ LABLGTK_LIB_DIR=$mmlinterface_cv_LABLGTK_LIB_DIR
+ if test "$RES" != "Asked"; then
+ LABLGTK_LIB_DIR=`eval "echo $LABLGTK_LIB_DIR"`
+ fi
+ AC_CACHE_SAVE
+fi
+
+dnl Check for lablgtkmathview
+RES="yes"
+AC_CHECK_FILE($OCAML_ROOT/lablgtkmathview/gtkMathView.ml,
+ LABLGTKMATHVIEW_LIB_DIR=$OCAML_ROOT/lablgtkmathview,
+ RES="no"
+)
+
+if test $RES = "no"; then
+ RES=""
+ AC_CACHE_VAL(mmlinterface_cv_LABLGTKMATHVIEW_LIB_DIR,
+ echo "In which directory can I find the lablgtkmathview library? (I haven't found it in the usual location $OCAML_ROOT/lablgtkmathview)"
+ read mmlinterface_cv_LABLGTKMATHVIEW_LIB_DIR
+ RES="Asked"
+ )
+ LABLGTKMATHVIEW_LIB_DIR=$mmlinterface_cv_LABLGTKMATHVIEW_LIB_DIR
+ if test "$RES" != "Asked"; then
+ LABLGTKMATHVIEW_LIB_DIR=`eval "echo $LABLGTKMATHVIEW_LIB_DIR"`
+ fi
+ AC_CACHE_SAVE
+fi
+
AC_MSG_CHECKING("for the bin dir")
HELM_BIN_DIR=$RESOLVED_EXEC_PREFIX/bin
AC_MSG_RESULT($HELM_BIN_DIR)
fi
AC_SUBST(OCAML_ROOT)
+AC_SUBST(MLMINIDOM_LIB_DIR)
+AC_SUBST(LABLGTK_LIB_DIR)
+AC_SUBST(LABLGTKMATHVIEW_LIB_DIR)
AC_SUBST(HELM_BIN_DIR)
AC_SUBST(HELM_DEFAULT_CONFIGURATION_DIR)
AC_SUBST(PERL_BINARY)