+2003-03-17 Fabrice Bellet <Fabrice.Bellet@creatis.insa-lyon.fr>
+ * Makefile.am, acinclude.m4, configure.in, python.m4, Dicts/Makefile.am,
+ Doc/Makefile.am, Test/Makefile.am, gdcmPython/Makefile.am,
+ src/Makefile.am : the project should properly compile and install
+ with the autotools, included the python wrappers part.
+ * gdcm.spec.in : added a spec file for RPM packaging.
+
2003-03-14 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
* src/gdcmUtils.cxx : redifinition of defaults parameters in code
-dictsdir = $(prefix)/dicts
+dictsdir = $(datadir)/gdcm
dicts_DATA = dicomV3.dic README
+
+EXTRA_DIST = dicomV3.dic
--- /dev/null
+HTML_DIR=$(datadir)/gdcm/html
+TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
+
+EXTRA_DIST = Doxyfile requirement.txt
+
+all-local: html/index.html
+
+if ENABLE_DOXYGEN
+html/index.html: Doxyfile
+ doxygen Doxyfile
+else
+html/index.html:
+endif
+
+clean-local:
+ rm -f *~ *.bak
+ rm -rf man latex html rtf
+
+install-data-local: html
+ $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)
+ (installfiles=`echo html/*`; \
+ if test "$$installfiles" = 'html/*'; \
+ then echo '-- Nothing to install' ; \
+ else \
+ for i in $$installfiles; do \
+ echo '-- Installing '$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
+ done; \
+ fi)
+
+dist-hook:
+ rm -rf $(distdir)/html
+
+.PHONY : html latex man
## Process this file with automake to produce Makefile.in
-SUBDIRS = src Test Dicts
+SUBDIRS = src gdcmPython Test Dicts Doc
+
+
+EXTRA_DIST = \
+ AUTHORS \
+ ChangeLog \
+ COPYING \
+ INSTALL \
+ NEWS \
+ README \
+ TODO \
+ gdcm.spec
release:
$(MAKE) dist distdir=$(PACKAGE)-$(VERSION)
--- /dev/null
+## this one is commonly used with AM_PATH_PYTHONDIR ...
+dnl AM_CHECK_PYMOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]])
+dnl Check if a module containing a given symbol is visible to python.
+AC_DEFUN(AM_CHECK_PYMOD,
+[AC_REQUIRE([AM_PATH_PYTHON])
+py_mod_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
+AC_MSG_CHECKING(for ifelse([$2],[],,[$2 in ])python module $1)
+AC_CACHE_VAL(py_cv_mod_$py_mod_var, [
+ifelse([$2],[], [prog="
+import sys
+try:
+ import $1
+except ImportError:
+ sys.exit(1)
+except:
+ sys.exit(0)
+sys.exit(0)"], [prog="
+import $1
+$1.$2"])
+if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
+ then
+ eval "py_cv_mod_$py_mod_var=yes"
+ else
+ eval "py_cv_mod_$py_mod_var=no"
+ fi
+])
+py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"`
+if test "x$py_val" != xno; then
+ AC_MSG_RESULT(yes)
+ ifelse([$3], [],, [$3
+])dnl
+else
+ AC_MSG_RESULT(no)
+ ifelse([$4], [],, [$4
+])dnl
+fi
+])
+
+dnl a macro to check for ability to create python extensions
+dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
+dnl function also defines PYTHON_INCLUDES
+AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
+[AC_REQUIRE([AM_PATH_PYTHON])
+AC_MSG_CHECKING(for headers required to compile python extensions)
+dnl deduce PYTHON_INCLUDES
+py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
+py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
+PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
+if test "$py_prefix" != "$py_exec_prefix"; then
+ PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
+fi
+echo py_prefix= $py_prefix
+echo py_exec_prefix= $py_exec_prefix
+AC_SUBST(PYTHON_INCLUDES)
+dnl check if the headers exist:
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
+AC_TRY_CPP([#include <Python.h>],dnl
+[AC_MSG_RESULT(found)
+$1],dnl
+[AC_MSG_RESULT(not found)
+$2])
+CPPFLAGS="$save_CPPFLAGS"
+])
+
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/gdcmDict.cxx)
-AC_PREFIX_DEFAULT(/usr/local/DCMlib)
-
-AM_INIT_AUTOMAKE(DCMlib, 0.1.0)
+AM_INIT_AUTOMAKE(gdcm, 0.1.0)
AM_MAINTAINER_MODE
AM_CONFIG_HEADER(src/config.h)
-CFLAGS="-Wall -g"
-CXXFLAGS="-Wall -g"
-
dnl Checks for programs.
AM_PROG_LIBTOOL
AC_PROG_CXX
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(long long, 8)
+AC_CHECK_PROG(DOXYGEN, doxygen, true, false)
+AM_CONDITIONAL(HAVE_DOXYGEN, $DOXYGEN)
+AC_SUBST(HAVE_DOXYGEN)
+
+dnl Let people disable the doxygen stuff.
+AC_ARG_ENABLE(docygen, [ --enable-doxygen Use doxygen to build documentation (default=auto)], enable_doxygen="$enableval",
+enable_doxygen=auto)
+
+if test x$enable_doxygen = xauto ; then
+ if test x$DOXYGEN = xtrue ; then
+ enable_doxygen=yes
+ else
+ enable_doxygen=no
+ fi
+fi
+
+dnl NOTE: We need to use a separate automake conditional for this
+dnl to make this work with the tarballs.
+AM_CONDITIONAL(ENABLE_DOXYGEN, test x$enable_doxygen = xyes)
+
+dnl Checks for Python
+AC_ARG_ENABLE(python,
+ [ --enable-python Enable Python language support (default=no).],,
+ [enable_python="no"])
+dnl AC_MSG_RESULT($enable_python)
+build_python=no
+if test "yes" = "$enable_python"; then
+ AM_PATH_PYTHON(2.0)
+ if test -n "$PYTHON"; then
+ AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
+ build_python=yes;
+ fi
+ AC_CHECK_PROGS(SWIG, swig13)
+fi
+AM_CONDITIONAL(BUILD_PYTHON, test x$build_python = xyes)
+
dnl produce Makefile.in files
AC_OUTPUT([
Makefile
+gdcm.spec
src/Makefile
+gdcmPython/Makefile
Test/Makefile
-Dicts/Makefile])
+Dicts/Makefile
+Doc/Makefile])
--- /dev/null
+# Note that this is NOT a relocatable package
+%define ver @VERSION@
+%define RELEASE 1
+%define rel %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE}
+%define prefix /usr
+
+Summary: Dicom library
+Name: gdcm
+Version: %ver
+Release: %rel
+License: GPL
+Group: Development/Tools
+URL: http://www.creatis.insa-lyon.fr/Public/Gdcm
+Source0: http://www.creatis.insa-lyon.fr/Public/Gdcm/gdcm-%{version}.tar.gz
+BuildRoot: %{_tmppath}/gdcm-root
+Requires: python2
+BuildRequires: doxygen, swig13, python2
+Packager: Fabrice Bellet <Fabrice.Bellet@creatis.insa-lyon.fr>
+
+%description
+gdcm is a library dedicated to reading and writing dicom files.
+
+%prep
+%setup -q
+
+%build
+%configure --enable-doxygen --enable-python
+make
+
+%install
+%makeinstall
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root)
+%doc AUTHORS INSTALL NEWS README TODO
+%{_libdir}/libgdcm*
+%{_datadir}/gdcm
+%{_libdir}/python*/site-packages/gdcm
+%{_includedir}/*.h
+
+%changelog
+* Mon Mar 17 2003 Fabrice Bellet <Fabrice.Bellet@creatis.insa-lyon.fr> 0.1.0-1
+- Rebuild for Red Hat Linux 7.3
+- First packaging.
+
--- /dev/null
+## Process this file with automake to produce Makefile.in
+
+## $(top_builddir) is required for idtypes.h
+GDCM_INC = -I$(top_srcdir)/src -I$(top_builddir)
+SWIG_INC = $(GLIB_CFLAGS) $(PYTHON_INCLUDES) $(GDCM_INC)
+INCLUDES = $(GDCM_INC) $(PYTHON_INCLUDES)
+
+LIBADDS = $(top_builddir)/src/libgdcm.la
+
+### Non default rules
+
+pygdcm_la_LDFLAGS = -module -avoid-version -L$(top_builddir)/src/.libs
+
+if BUILD_PYTHON
+pythondir = $(prefix)/lib/python${PYTHON_VERSION}/site-packages/gdcm
+python_LTLIBRARIES = pygdcm.la
+pygdcm_la_SOURCES = gdcm_wrap.cxx
+pygdcm_la_LIBADD = $(LIBADDS)
+gdcm_wrap.cxx: $(srcdir)/gdcm.i
+ $(SWIG) -python -c++ $(SWIG_INC) -o $@ $<
+
+MOSTLYCLEANFILES = $(pygdcm_la_SOURCES)
+BUILT_SOURCES = gdcm_wrap.cxx
+CLEANFILES = gdcm_wrap.cxx
+
+dist-hook:
+ rm -f $(distdir)/gdcm_wrap.cxx
+
+install-data-local:
+ @INSTALL@ -m 0644 gdcm.py $(DESTDIR)$(pythondir)
+ @INSTALL@ -m 0644 __init__.py $(DESTDIR)$(pythondir)
+ cp -a $(DESTDIR)$(pythondir)/pygdcm.so $(DESTDIR)$(pythondir)/_gdcm.so
+else
+all:
+endif
+
+EXTRA_DIST = gdcm.i __init__.py testSuite.py
--- /dev/null
+## ------------------------
+## Python file handling
+## From Andrew Dalke
+## Updated by James Henstridge
+## ------------------------
+
+# AM_PATH_PYTHON([MINIMUM-VERSION])
+
+# Adds support for distributing Python modules and packages. To
+# install modules, copy them to $(pythondir), using the python_PYTHON
+# automake variable. To install a package with the same name as the
+# automake package, install to $(pkgpythondir), or use the
+# pkgpython_PYTHON automake variable.
+
+# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
+# locations to install python extension modules (shared libraries).
+# Another macro is required to find the appropriate flags to compile
+# extension modules.
+
+# If your package is configured with a different prefix to python,
+# users will have to add the install directory to the PYTHONPATH
+# environment variable, or create a .pth file (see the python
+# documentation for details).
+
+# If the MINIUMUM-VERSION argument is passed, AM_PATH_PYTHON will
+# cause an error if the version of python installed on the system
+# doesn't meet the requirement. MINIMUM-VERSION should consist of
+# numbers and dots only.
+
+
+AC_DEFUN([AM_PATH_PYTHON],
+ [
+ dnl Find a version of Python. I could check for python versions 1.4
+ dnl or earlier, but the default installation locations changed from
+ dnl $prefix/lib/site-python in 1.4 to $prefix/lib/python1.5/site-packages
+ dnl in 1.5, and I don't want to maintain that logic.
+
+ AC_PATH_PROG(PYTHON, python2 python2.1 python2.0 python python1.6 python1.5)
+
+ dnl should we do the version check?
+ ifelse([$1],[],,[
+ AC_MSG_CHECKING(if Python version >= $1)
+ changequote(<<, >>)dnl
+ prog="
+import sys, string
+minver = '$1'
+pyver = string.split(sys.version)[0] # first word is version string
+# split strings by '.' and convert to numeric
+minver = map(string.atoi, string.split(minver, '.'))
+pyver = map(string.atoi, string.split(pyver, '.'))
+# we can now do comparisons on the two lists:
+if pyver >= minver:
+ sys.exit(0)
+else:
+ sys.exit(1)"
+ changequote([, ])dnl
+ if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
+ then
+ AC_MSG_RESULT(okay)
+ else
+ AC_MSG_ERROR(too old)
+ fi
+ ])
+
+ AC_MSG_CHECKING([local Python configuration])
+
+ dnl Query Python for its version number. Getting [:3] seems to be
+ dnl the best way to do this; it's what "site.py" does in the standard
+ dnl library. Need to change quote character because of [:3]
+
+ AC_SUBST(PYTHON_VERSION)
+ changequote(<<, >>)dnl
+ PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"`
+ changequote([, ])dnl
+
+
+ dnl Use the values of $prefix and $exec_prefix for the corresponding
+ dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made
+ dnl distinct variables so they can be overridden if need be. However,
+ dnl general consensus is that you shouldn't need this ability.
+
+ AC_SUBST(PYTHON_PREFIX)
+ PYTHON_PREFIX='${prefix}'
+
+ AC_SUBST(PYTHON_EXEC_PREFIX)
+ PYTHON_EXEC_PREFIX='${exec_prefix}'
+
+ dnl At times (like when building shared libraries) you may want
+ dnl to know which OS platform Python thinks this is.
+
+ AC_SUBST(PYTHON_PLATFORM)
+ PYTHON_PLATFORM=`$PYTHON -c "import sys; print sys.platform"`
+
+
+ dnl Set up 4 directories:
+
+ dnl pythondir -- where to install python scripts. This is the
+ dnl site-packages directory, not the python standard library
+ dnl directory like in previous automake betas. This behaviour
+ dnl is more consistent with lispdir.m4 for example.
+ dnl
+ dnl Also, if the package prefix isn't the same as python's prefix,
+ dnl then the old $(pythondir) was pretty useless.
+
+ AC_SUBST(pythondir)
+ pythondir=$PYTHON_PREFIX"/lib/python"$PYTHON_VERSION/site-packages
+
+ dnl pkgpythondir -- $PACKAGE directory under pythondir. Was
+ dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is
+ dnl more consistent with the rest of automake.
+ dnl Maybe this should be put in python.am?
+
+ AC_SUBST(pkgpythondir)
+ pkgpythondir=\${pythondir}/$PACKAGE
+
+ dnl pyexecdir -- directory for installing python extension modules
+ dnl (shared libraries) Was PYTHON_SITE_EXEC in previous betas.
+
+ AC_SUBST(pyexecdir)
+ pyexecdir=$PYTHON_EXEC_PREFIX"/lib/python"$PYTHON_VERSION/site-packages
+
+ dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
+ dnl Maybe this should be put in python.am?
+
+ AC_SUBST(pkgpyexecdir)
+ pkgpyexecdir=\${pyexecdir}/$PACKAGE
+
+ AC_MSG_RESULT([looks good])
+])
lib_LTLIBRARIES = libgdcm.la
-CXXFLAGS = -DPUB_DICT_PATH=\"$(prefix)/dicts/\"
+CXXFLAGS = @CXXFLAGS@ -DPUB_DICT_PATH=\"$(datadir)/gdcm/\"
libgdcm_la_SOURCES= \
gdcmException.cxx \
gdcmJpeg.cxx
libgdcmincludedir = $(includedir)
-libgdcminclude_HEADERS = \
- config.h \
- gdcm.h \
+libgdcminclude_HEADERS = \
gdcmException.h \
- gdcmIdo.h \
+ gdcmHeader.h \
+ gdcmFile.h
+
+EXTRA_DIST = \
gdcmUtil.h \
+ gdcm.h \
+ gdcmIdo.h \
+ gdcmCommon.h \
+ gdcmDictSet.h \
+ gdcmDict.h \
+ gdcmDictEntry.h \
+ gdcmElValue.h \
+ gdcmElValSet.h \
iddcmjpeg.h