Commit d83f3685 authored by bguillaum's avatar bguillaum

switch to generic conf/Makfiles

git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/semagramme/dep2pict/trunk@7114 7838e531-6607-4d57-9587-6c381814729c
parent da66347d
......@@ -11,10 +11,14 @@ ifeq (@BUILD_GUI@,yes)
else
@make -C src opt
endif
conf : config/configure.in
cd config && rm -rf ac_lib_checking.*
cd config && wget https://gforge.inria.fr/scm/viewvc.php/*checkout*/ac_lib_checking/ac_lib_checking.m4?root=semagramme --no-check-certificate || true
cd config && mv ac_lib_checking.m4?root=semagramme ac_lib_checking.m4 || true
cd config && aclocal
autoconf -o configure config/configure.in
cd config && autoconf -o ../configure configure.in
rm -rf config.status config.log autom4te.cache config/autom4te.cache
LAUNCHER=/usr/share/applications/dep2pict.desktop
......@@ -28,6 +32,7 @@ FOLDER=[Desktop Entry]\nEncoding=UTF-8\nName=Calligramme\nComment=Calligramme Ap
install : opt
cp bin/dep2pict.opt $(INSTALL_DIR)/dep2pict
ifeq (@BUILD_GUI@,yes)
mkdir -p $(DATA_DIR)
cp src/dep2pict.glade $(DATA_DIR)
cp img/* $(DATA_DIR)
ifeq (@SYSTEM@,Linux)
......@@ -41,7 +46,7 @@ ifeq (@SYSTEM@,Linux)
xdg-desktop-menu forceupdate --mode system
endif
endif
clean :
@make cleanup
@make -C config cleanup
......
......@@ -7,7 +7,8 @@ DOC_DIR = @docdir@dep2pict/
BYTE_FLAGS = -g -dtypes
OPT_FLAGS =
OCAMLC = @OCAMLC@
OCAMLOPT = @OCAMLOPT@
OCAMLLIB = @OCAMLLIB@
OCAMLYACC = @OCAMLYACC@
OCAMLLEX = @OCAMLLEX@
......@@ -28,12 +29,11 @@ LABLGTK_BYTE = $(LABLGTK_DIR) lablgtk.cma lablglade.cma lablrsvg.cma -I +cairo c
LABLGTK_OPT = $(LABLGTK_DIR) lablgtk.cmxa lablglade.cmxa lablrsvg.cmxa -I +cairo cairo.cmxa cairo_lablgtk.cmxa
LABLGTK_OPT_LIGHT = $(LABLGTK_DIR) lablgtk.cmxa -I +cairo cairo.cmxa cairo_lablgtk.cmxa
DEP2PICT_DIR = @DEP2PICT_LIB@
DEP2PICT_DIR = @DEP2PICT_INCLUDE@
DEP2PICT_BYTE = $(DEP2PICT_DIR) dep2pict.cma
DEP2PICT_OPT = $(DEP2PICT_DIR) dep2pict.cmxa
LOG_DIR = @LOG_LIB@
LOG_DIR = @LOG_INCLUDE@
LOG_BYTE = $(LOG_DIR) log.cma
LOG_OPT = $(LOG_DIR) log.cmxa
......
......@@ -6,12 +6,31 @@ AC_INIT(dep2pict, 2.0.3, paul.masson@inria.fr)
AC_ARG_ENABLE(
[config],
[AS_HELP_STRING(
[--enable-config],
[Enable configuration check (default is yes)])],
[AS_HELP_STRING([--enable-config],[Enable configuration check (default is yes)])],
[config=$enableval],
[config=yes])
AC_ARG_ENABLE(
[debug],
[AS_HELP_STRING([--enable-debug], [Display debug trace])],
[with_debug=$enableval],
[with_debug=no])
AC_ARG_ENABLE(
[warning],
[AS_HELP_STRING([--enable-warning], [Display warning trace])],
[with_warning=$enableval],
[with_warning=no])
AC_ARG_ENABLE(
[message],
[AS_HELP_STRING([--enable-message], [Display message trace])],
[with_message=$enableval],
[with_message=yes])
AC_ARG_ENABLE(
[info],
[AS_HELP_STRING([--enable-info], [Display info trace])],
[with_info=$enableval],
[with_info=yes])
if test "$config" = yes ; then
# Checks for programs.
......@@ -19,6 +38,13 @@ if test "$config" = yes ; then
if test "$OCAMLC" = no ; then
AC_MSG_ERROR(Cannot find ocamlc.)
fi
AC_SUBST(OCAMLC)
AC_CHECK_PROGS(OCAMLOPT,ocamlopt.opt ocamlopt,no)
if test "$OCAMLOPT" = no ; then
AC_MSG_ERROR(Cannot find ocamlopt)
fi
AC_SUBST(OCAMLOPT)
# Checks for libraries.
AC_MSG_CHECKING(for ocaml library path)
......@@ -27,203 +53,61 @@ if test "$config" = yes ; then
if test "$OCAMLLIB" = ""; then
AC_MSG_ERROR(Cannot find ocaml library path)
fi
AC_SUBST(OCAMLLIB)
# Look for camllex and camlyacc
AC_PATH_PROG(OCAMLLEX,ocamllex,no)
if test "$OCAMLLEX" = no ; then
AC_MSG_ERROR(Cannot find ocamllex)
fi
AC_SUBST(OCAMLLEX)
AC_PATH_PROG(OCAMLYACC,ocamlyacc,no)
if test "$OCAMLYACC" = no ; then
AC_MSG_ERROR(Cannot find ocamlyacc)
fi
AC_SUBST(OCAMLYACC)
AC_PATH_PROG(RSVG,rsvg,no)
if test "$RSVG" = no ; then
AC_MSG_WARN(Cannot find rsvg)
fi
AC_SUBST(RSVG)
AC_PATH_PROG(RSVG_CONVERT,rsvg-convert,no)
if test "$RSVG_CONVERT" = no ; then
AC_MSG_ERROR(Cannot find rsvg-convert)
fi
AC_SUBST(RSVG_CONVERT)
# Look for ocamlfind
AC_PATH_PROG(OCAMLFIND,ocamlfind,no)
if test "$OCAMLFIND" = no ; then
AC_MSG_WARN(Cannot find ocamlfind)
fi
AC_SUBST(OCAMLFIND)
AC_ARG_ENABLE(
[debug],
[AS_HELP_STRING([--enable-debug], [Display debug trace])],
[with_debug=$enableval],
[with_debug=no])
AC_ARG_ENABLE(
[warning],
[AS_HELP_STRING([--enable-warning], [Display warning trace])],
[with_warning=$enableval],
[with_warning=no])
AC_ARG_ENABLE(
[message],
[AS_HELP_STRING([--enable-message], [Display message trace])],
[with_message=$enableval],
[with_message=yes])
AC_ARG_ENABLE(
[info],
[AS_HELP_STRING([--enable-info], [Display info trace])],
[with_info=$enableval],
[with_info=yes])
# Look for cairo
AC_MSG_CHECKING([for cairo])
if test -f c_check_cairo.ml ; then
if test -w c_check_cairo.ml ; then
rm c_check_cairo.ml >& /dev/null
else
AC_MSG_ERROR(Cannot remove c_check_cairo.ml. Please change its right with chmod 666 c_check_cairo.ml)
fi
fi
echo "open Cairo;;" > c_check_cairo.ml
if (ocamlc -c -I +lablgtk2 lablgtk.cma -I +cairo cairo.cma c_check_cairo.ml >& /dev/null) ; then
AC_MSG_RESULT(standard)
CAIRO="yes"
else
if test "$OCAMLFIND" = no ; then
AC_MSG_ERROR(The cairo library is missing.)
CAIRO=no
else
if $OCAMLFIND query cairo > /dev/null 2>&1 ; then
AC_MSG_RESULT(ocamlfind)
else
AC_MSG_ERROR(The cairo library is missing.)
CAIRO=no
fi
fi
fi
rm c_check_cairo.ml >& /dev/null
rm c_check_cairo.cmo >& /dev/null
rm c_check_cairo.cmi >& /dev/null
# look for dep2pict$
AC_MSG_CHECKING([for dep2pict])
if test -f c_check_dep2pict.ml ; then
if test -w c_check_dep2pict.ml ; then
rm c_check_dep2pict.ml >& /dev/null
else
AC_MSG_ERROR(Cannot remove c_check_dep2pict.ml. Please change its right with chmod 666 c_check_dep2pict.ml)
fi
fi
echo "open Dep2pict;;" > c_check_dep2pict.ml
if (ocaml c_check_dep2pict.ml >& /dev/null) ; then
AC_MSG_RESULT(standard)
DEP2PICT="yes"
else
if test "$OCAMLFIND" = no ; then
AC_MSG_ERROR(The dep2pict lib is missing.)
DEP2PICT=no
else
if $OCAMLFIND query dep2pict > /dev/null 2>&1 ; then
DEP2PICT="yes"
DEP2PICT_LIB="-I `$OCAMLFIND query dep2pict`"
AC_MSG_RESULT(ocamlfind)
else
AC_MSG_ERROR(The dep2pict lib is missing.)
DEP2PICT=no
fi
fi
fi
rm c_check_dep2pict.ml >& /dev/null
# look for log$
AC_MSG_CHECKING([for log])
if test -f c_check_log.ml ; then
if test -w c_check_log.ml ; then
rm c_check_log.ml >& /dev/null
else
AC_MSG_ERROR(Cannot remove c_check_log.ml. Please change its right with chmod 666 c_check_log.ml)
fi
fi
echo "open Log;;" > c_check_log.ml
if (ocaml c_check_log.ml >& /dev/null) ; then
AC_MSG_RESULT(standard)
LOG="yes"
else
if test "$OCAMLFIND" = no ; then
AC_MSG_ERROR(The log lib is missing.)
LOG=no
else
if $OCAMLFIND query log > /dev/null 2>&1 ; then
LOG="yes"
LOG_LIB="-I `$OCAMLFIND query log`"
AC_MSG_RESULT(ocamlfind)
else
AC_MSG_ERROR(The log lib is missing.)
LOG=no
fi
fi
fi
rm c_check_log.ml >& /dev/null
# look for ansiterminal
AC_MSG_CHECKING([for ansiterminal])
if test -f c_check_ansiterminal.ml ; then
if test -w c_check_ansiterminal.ml ; then
rm c_check_ansiterminal.ml >& /dev/null
else
AC_MSG_ERROR(Cannot remove c_check_ansiterminal.ml. Please change its right with chmod 666 c_check_ansiterminal.ml)
fi
fi
echo "open ANSITerminal;;" > c_check_ansiterminal.ml
if (ocaml c_check_ansiterminal.ml >& /dev/null) ; then
AC_MSG_RESULT(standard)
ANSITERMINAL="yes"
else
if test "$OCAMLFIND" = no ; then
AC_MSG_ERROR(The ANSITerminal lib is missing.)
ANSITERMINAL=no
else
if $OCAMLFIND query ANSITerminal > /dev/null 2>&1 ; then
ANSITERMINAL="yes"
ANSITERMINAL_LIB="-I `$OCAMLFIND query ANSITerminal`"
AC_MSG_RESULT(ocamlfind)
else
AC_MSG_ERROR(The ansiterminal lib is missing.)
ANSITERMINAL=no
fi
fi
fi
rm c_check_ansiterminal.ml >& /dev/null
# Look for xml-light
AC_MSG_CHECKING([for Xml-light])
if test -f c_check_xml-light.ml ; then
if test -w c_check_xml-light.ml ; then
rm c_check_xml-light.ml >& /dev/null
else
AC_MSG_ERROR(Cannot remove c_check_xml-light.ml. Please change its right with chmod 666 c_check_xml-light.ml)
fi
fi
echo "open Xml;;" > c_check_xml-light.ml
if ($OCAML -I +xml-light xml-light.cma c_check_xml-light.ml >& /dev/null) ; then
XMLLIGHT_INCLUDE="-I +xml-light"
AC_MSG_RESULT(xml-light)
else
if test "$OCAMLFIND" = no ; then
AC_MSG_ERROR(The xml-light library is missing.)
else
if ocamlfind query xml-light > /dev/null 2>&1 ; then
XMLLIGHT_INCLUDE="-I `ocamlfind query xml-light`"
AC_MSG_RESULT(ocamlfind)
else
AC_MSG_ERROR(The xml-light ocamlfind library is missing.)
fi
fi
fi
rm c_check_xml-light.ml >& /dev/null
m4_include(ac_lib_checking.m4)
AC_LIB_CHECKING(Cairo,cairo,cairo,cairo,Cairo,"",true,true)
AC_SUBST(CAIRO_INCLUDE,$LIB_INCLUDE)
AC_LIB_CHECKING(Dep2pict,dep2pict,dep2pict,dep2pict,Dep2pict,"",true,true)
AC_SUBST(DEP2PICT_INCLUDE,$LIB_INCLUDE)
AC_LIB_CHECKING(Log,log,log,log,Log,"",true,true)
AC_SUBST(LOG_INCLUDE,$LIB_INCLUDE)
AC_LIB_CHECKING(ANSITerminal,ANSITerminal,ANSITerminal,ANSITerminal,ANSITerminal,"",true,true)
AC_SUBST(ANSITERMINAL_INCLUDE,$LIB_INCLUDE)
AC_LIB_CHECKING(Xml-light,xml-light,xml-light,xml-light,XmlParser,"",true)
AC_SUBST(XMLLIGHT_INCLUDE,$LIB_INCLUDE)
# Build GUI.
AC_ARG_ENABLE(
......@@ -352,15 +236,6 @@ if test "$config" = yes ; then
# Checks for library functions.
AC_SUBST(OCAMLLIB)
AC_SUBST(OCAMLYACC)
AC_SUBST(OCAMLLEX)
AC_SUBST(OCAMLFIND)
AC_SUBST(RSVG)
AC_SUBST(XMLLIGHT_INCLUDE)
AC_SUBST(RSVG_CONVERT)
AC_SUBST(DEP2PICT_LIB)
AC_SUBST(LOG_LIB)
AC_SUBST(ANSITERMINAL_LIB)
AC_SUBST(DEBUG)
AC_SUBST(WARNING)
......
This diff is collapsed.
......@@ -15,19 +15,19 @@ ui.ml : dep2pict.glade
mv ui.tmp ui.ml
ui.cmx : ui.ml
ocamlopt -c $(LABLGTK_OPT) ui.ml
$(OCAMLOPT) -c $(LABLGTK_OPT) ui.ml
DEP_OPT= unix.cmxa str.cmxa $(LABLGTK_OPT) $(XML_LIGHT_OPT) $(ANSITERMINAL_OPT) $(LOG_OPT) $(DEP2PICT_OPT)
DEP_OPT_LIGHT= unix.cmxa str.cmxa $(LABLGTK_OPT_LIGHT) $(XML_LIGHT_OPT) $(ANSITERMINAL_OPT) $(LOG_OPT) $(DEP2PICT_OPT)
gui.cmx : gui.ml ui.cmx
ocamlopt -c -pp 'camlp4o pa_macro.cmo -DBUILD_GUI -DDATA_DIR=\"$(DATA_DIR)\" $(LOG) -DVERSION=\"$(VERSION)\"' $(DEP_OPT) ui.cmx gui.ml
$(OCAMLOPT) -c -pp 'camlp4o pa_macro.cmo -DBUILD_GUI -DDATA_DIR=\"$(DATA_DIR)\" $(LOG) -DVERSION=\"$(VERSION)\"' $(DEP_OPT) ui.cmx gui.ml
main.cmx : main.ml
ifeq (@BUILD_GUI@,yes)
ocamlopt -c -pp 'camlp4o pa_macro.cmo -DBUILD_GUI -DDATA_DIR=\"$(DATA_DIR)\" $(LOG) -DVERSION=\"$(VERSION)\"' $(DEP_OPT) ui.cmx gui.cmx main.ml
$(OCAMLOPT) -c -pp 'camlp4o pa_macro.cmo -DBUILD_GUI -DDATA_DIR=\"$(DATA_DIR)\" $(LOG) -DVERSION=\"$(VERSION)\"' $(DEP_OPT) ui.cmx gui.cmx main.ml
else
ocamlopt -c -pp 'camlp4o pa_macro.cmo -DDATA_DIR=\"$(DATA_DIR)\" $(LOG) -DVERSION=\"$(VERSION)\"' $(DEP_OPT) main.ml
$(OCAMLOPT) -c -pp 'camlp4o pa_macro.cmo -DDATA_DIR=\"$(DATA_DIR)\" $(LOG) -DVERSION=\"$(VERSION)\"' $(DEP_OPT) main.ml
endif
......@@ -35,7 +35,7 @@ endif
../bin/dep2pict.opt : main.cmx
mkdir -p ../bin
ifeq (@BUILD_GUI@,yes)
ocamlopt -o ../bin/dep2pict.opt -pp 'camlp4o pa_macro.cmo -DBUILD_GUI -DDATA_DIR=\"$(DATA_DIR)\" $(LOG) -DVERSION=\"$(VERSION)\"' $(DEP_OPT) ui.cmx gui.cmx main.cmx
$(OCAMLOPT) -o ../bin/dep2pict.opt -pp 'camlp4o pa_macro.cmo -DBUILD_GUI -DDATA_DIR=\"$(DATA_DIR)\" $(LOG) -DVERSION=\"$(VERSION)\"' $(DEP_OPT) ui.cmx gui.cmx main.cmx
else
ocamlopt -o ../bin/dep2pict.opt -pp 'camlp4o pa_macro.cmo -DDATA_DIR=\"$(DATA_DIR)\" $(LOG) -DVERSION=\"$(VERSION)\"' $(DEP_OPT_LIGHT) main.cmx
$(OCAMLOPT) -o ../bin/dep2pict.opt -pp 'camlp4o pa_macro.cmo -DDATA_DIR=\"$(DATA_DIR)\" $(LOG) -DVERSION=\"$(VERSION)\"' $(DEP_OPT_LIGHT) main.cmx
endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment