]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/interface/configure.in
...
[helm.git] / helm / interface / configure.in
index 43d571a2c87ef12263fdba8d3186b5ca8b659277..4dc7a6fecda401576f2336567a461b5ea0adb2e9 100644 (file)
@@ -1,5 +1,20 @@
 AC_INIT(configuration.ml.in)
 
+PACKAGE=helm_gtk_interface
+MAJOR_VERSION=0
+MINOR_VERSION=0
+MICRO_VERSION=2
+VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
+
+DEFAULT_HELM_CONFIGURATION_DIR=/usr/local/etc/helm
+
+AC_ARG_ENABLE(
+       defaults,
+       [  --enable-defaults[=ARG] if yes then use defaults (don't ask user) [default=auto]],
+       USE_DEFAULTS=$enableval,
+       USE_DEFAULTS=auto
+)
+
 if test "x$prefix" != xNONE; then
   RESOLVED_PREFIX=$prefix
 else
@@ -12,10 +27,21 @@ else
   RESOLVED_EXEC_PREFIX=$RESOLVED_PREFIX
 fi
 
+dnl The following is the directory where the binary will be installed
+BIN_DIR=$RESOLVED_EXEC_PREFIX/bin
+
+AC_PATH_PROG(WGET_BINARY,wget,no)
+if test $WGET_BINARY = no; then
+       AC_MSG_WARN(wget is required to update the database)
+fi
+
+AC_PATH_PROG(PERL_BINARY,perl,no)
+if test $PERL_BINARY = no ; then
+   AC_MSG_ERROR(Could not find perl)
+fi
 
 dnl MISSING CHECKS:
-dnl ocaml, ocaml-findlib, ocaml-netstring, ocaml-pxp, lablgtk_20001129
-dnl lablgtk-20001129_gtkmathview
+dnl ocaml-findlib, ocaml-netstring, ocaml-pxp, ocaml-netclient
 
 dnl Check for Ocaml
 AC_CHECK_PROG(HAVE_OCAMLC, ocamlc, yes, no)
@@ -24,102 +50,157 @@ if test $HAVE_OCAMLC = "no"; then
 fi
 
 dnl Check for the Ocaml library dir
-AC_MSG_CHECKING("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)
 
+DEFAULT_MLMINIDOM_LIB_DIR=$OCAML_ROOT/mlminidom
+DEFAULT_LABLGTK_LIB_DIR=$OCAML_ROOT/lablgtk
+DEFAULT_LABLGTKMATHVIEW_LIB_DIR=$OCAML_ROOT/lablgtkmathview
+
 dnl Check for mlminidom
-RES="yes"
-AC_CHECK_FILE($OCAML_ROOT/mlminidom/minidom.mli,
-  MLMINIDOM_LIB_DIR=$OCAML_ROOT/mlminidom,
-  RES="no"
-)
+DEFAULTS=$USE_DEFAULTS
+if test $DEFAULTS = auto; then
+       if test -f $DEFAULT_MLMINIDOM_LIB_DIR/minidom.mli; then
+               MLMINIDOM_LIB_DIR=$DEFAULT_MLMINIDOM_LIB_DIR
+       else
+               DEFAULTS=no
+       fi
+fi
 
-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
+if test $DEFAULTS = no; then
+       echo
+       echo "Where can I find the mlminidom library?"
+       echo
+       echo -n "[[$DEFAULT_MLMINIDOM_LIB_DIR]] ? "
+       echo
+       read MLMINIDOM_LIB_DIR
+       if test "x$MLMINIDOM_LIB_DIR" = x; then
+               MLMINIDOM_LIB_DIR=$DEFAULT_MLMINIDOM_LIB_DIR
+       fi
+elif test $DEFAULTS = yes; then
+       MLMINIDOM_LIB_DIR=$DEFAULT_MLMINIDOM_LIB_DIR
 fi
 
+AC_MSG_CHECKING(for $MLMINIDOM_LIB_DIR/minidom.mli)
+if test ! -f $MLMINIDOM_LIB_DIR/minidom.mli; then
+       AC_MSG_RESULT(no)
+       AC_MSG_ERROR(please check your installation)
+fi
+AC_MSG_RESULT(ok)
+
 dnl Check for lablgtk
-RES="yes"
-AC_CHECK_FILE($OCAML_ROOT/lablgtk/gtk.ml,
-  LABLGTK_LIB_DIR=$OCAML_ROOT/lablgtk,
-  RES="no"
-)
+DEFAULTS=$USE_DEFAULTS
+if test $DEFAULTS = auto; then
+       if test -f $DEFAULT_LABLGTK_LIB_DIR/gtk.ml; then
+               LABLGTK_LIB_DIR=$DEFAULT_LABLGTK_LIB_DIR
+       else
+               DEFAULTS=no
+       fi
+fi
 
-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
+if test $DEFAULTS = no; then
+       echo
+       echo "Where can I find the lablgtk library?"
+       echo
+       echo -n "[[$DEFAULT_LABLGTK_LIB_DIR]] ? "
+       read LABLGTK_LIB_DIR
+       echo
+       if test "x$LABLGTK_LIB_DIR" = x; then
+               LABLGTK_LIB_DIR=$DEFAULT_LABLGTK_LIB_DIR
+       fi
+elif test $DEFAULTS = yes; then
+       LABLGTK_LIB_DIR=$DEFAULT_LABLGTK_LIB_DIR
 fi
 
+AC_MSG_CHECKING(for $LABLGTK_LIB_DIR/gtk.ml)
+if test ! -f $LABLGTK_LIB_DIR/gtk.ml; then
+       AC_MSG_RESULT(no)
+       AC_MSG_ERROR(please check your installation)
+fi
+AC_MSG_RESULT(ok)
+
 dnl Check for lablgtkmathview
-RES="yes"
-AC_CHECK_FILE($OCAML_ROOT/lablgtkmathview/gtkMathView.ml,
-  LABLGTKMATHVIEW_LIB_DIR=$OCAML_ROOT/lablgtkmathview,
-  RES="no"
-)
+DEFAULTS=$USE_DEFAULTS
+if test $DEFAULTS = auto; then
+       if test -f $DEFAULT_LABLGTKMATHVIEW_LIB_DIR/gMathView.ml; then
+               LABLGTKMATHVIEW_LIB_DIR=$DEFAULT_LABLGTKMATHVIEW_LIB_DIR
+       else
+               DEFAULTS=no
+       fi
+fi
 
-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)
-
-AC_MSG_CHECKING("for the helm configuration dir")
-RES=""
-AC_CACHE_VAL(helm_cv_HELM_DEFAULT_CONFIGURATION_DIR,
-  echo "In which directory can I find configuration.xml (part of the helm_configuration package)?"
-  read helm_cv_HELM_DEFAULT_CONFIGURATION_DIR
-  RES="Asked"
-)
-HELM_DEFAULT_CONFIGURATION_DIR=$helm_cv_HELM_DEFAULT_CONFIGURATION_DIR
-if test "$RES" != "Asked" ; then
-   HELM_DEFAULT_CONFIGURATION_DIR=`eval "echo $HELM_DEFAULT_CONFIGURATION_DIR"`
-   AC_MSG_RESULT($HELM_DEFAULT_CONFIGURATION_DIR)
+if test $DEFAULTS = no; then
+       echo
+       echo "Where can I find the lablgtkmathview library?"
+       echo
+       echo -n "[[$DEFAULT_LABLGTKMATHVIEW_LIB_DIR]] ? "
+       read LABLGTKMATHVIEW_LIB_DIR
+       echo
+       if test "x$LABLGTKMATHVIEW_LIB_DIR" = x; then
+               LABLGTKMATHVIEW_LIB_DIR=$DEFAULT_LABLGTKMATHVIEW_LIB_DIR
+       fi
+elif test $DEFAULTS = yes; then
+       LABLGTKMATHVIEW_LIB_DIR=$DEFAULT_LABLGTKMATHVIEW_LIB_DIR
 fi
-AC_CACHE_SAVE
 
-AC_PATH_PROG(PERL_BINARY,perl,no)
-if test $PERL_BINARY = no ; then
-   AC_MSG_ERROR(Could not find perl)
+AC_MSG_CHECKING(for $LABLGTKMATHVIEW_LIB_DIR/gMathView.ml)
+if test ! -f $LABLGTKMATHVIEW_LIB_DIR/gMathView.ml; then
+       AC_MSG_RESULT(no)
+       AC_MSG_ERROR(please check your installation)
+fi
+AC_MSG_RESULT(ok)
+
+dnl Check for HELM
+DEFAULTS=$USE_DEFAULTS
+if test $DEFAULTS = auto; then
+       AC_CHECK_PROG(HAVE_HELM_CONFIG, helm-config, yes, no)
+       if test $HAVE_HELM_CONFIG = yes; then
+               HELM_CONFIGURATION_DIR=`helm-config --etc-dir`
+       else
+               DEFAULTS=no
+       fi
+fi
+
+if test $DEFAULTS = no; then
+       echo
+       echo "\`helm-config' is not installed (or I can't find it in your path)."
+       echo "Please, insert the directory where I can find the configuration"
+       echo "files for HELM (configuration.xml in particular)..."
+       echo
+       echo -n "[[$DEFAULT_HELM_CONFIGURATION_DIR]] ? "
+       read HELM_CONFIGURATION_DIR
+       echo
+       if test "x$HELM_CONFIGURATION_DIR" = "x"; then
+               HELM_CONFIGURATION_DIR=$DEFAULT_HELM_CONFIGURATION_DIR
+       fi
+elif test $DEFAULTS = yes; then
+       HELM_CONFIGURATION_DIR=$DEFAULT_HELM_CONFIGURATION_DIR
 fi
 
+AC_MSG_CHECKING(for configuration.xml)
+if test -f $HELM_CONFIGURATION_DIR/configuration.xml; then
+       AC_MSG_RESULT(ok)
+else
+       AC_MSG_RESULT(no)
+       AC_MSG_ERROR(please check your installation)
+fi
+
+AC_SUBST(PACKAGE)
+AC_SUBST(VERSION)
 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(BIN_DIR)
+AC_SUBST(HELM_CONFIGURATION_DIR)
 AC_SUBST(PERL_BINARY)
 
-AC_OUTPUT([Makefile configuration.ml helm_wget], chmod +x helm_wget)
+AC_OUTPUT([
+  Makefile
+  configuration.ml
+  helm_wget
+  helm_gtk_interface.spec
+],
+  chmod +x helm_wget
+)