Permalink
Browse files

Autotoolize Makefile

  • Loading branch information...
1 parent 840cc51 commit 7de2166d97c1b729e2227304b60df3362ce4f888 @bgilbert bgilbert committed Oct 27, 2011
Showing with 146 additions and 21 deletions.
  1. +17 −2 .gitignore
  2. +0 −19 Makefile
  3. +39 −0 Makefile.am
  4. +33 −0 acinclude.m4
  5. +57 −0 configure.ac
View
@@ -1,4 +1,19 @@
+/aclocal.m4
+/autom4te.cache
/bin
+/build-aux
+/configure
+/config.h
+/config.h.in
+/config.log
+/config.status
+/libtool
+/stamp-h1
+
+.deps
+.libs
+Makefile
+Makefile.in
*.jar
-*.so
-*.dll
+*.la
+*.lo
View
@@ -1,19 +0,0 @@
-# simple makefile for now
-
-CC = gcc
-JAVAC = javac
-JAVA_HOME = /usr/lib/jvm/java
-JAVA_PLATFORM = linux
-
-all: libopenslide-jni.so
- ant
-
-libopenslide-jni.so: openslide-jni.c
- $(CC) $(CFLAGS) -fPIC -shared -g -O2 -Wall -o $@ $< -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/$(JAVA_PLATFORM) $$(pkg-config openslide --cflags --libs)
-
-clean:
- ant clean
- $(RM) libopenslide-jni.so openslide_wrap.c *~ bin
-
-
-.PHONY: all clean
View
@@ -0,0 +1,39 @@
+ACLOCAL_AMFLAGS = -I m4
+
+pkglib_LTLIBRARIES = libopenslide-jni.la
+libopenslide_jni_la_SOURCES = openslide-jni.c
+libopenslide_jni_la_CFLAGS = -Wall $(JNI_CFLAGS) $(OPENSLIDE_CFLAGS)
+libopenslide_jni_la_LDFLAGS = -avoid-version $(OPENSLIDE_LIBS)
+
+pkglib_DATA = openslide.jar
+JAVA_SRC = build.xml \
+ src/edu/cmu/cs/openslide/AssociatedImageMap.java \
+ src/edu/cmu/cs/openslide/OpenSlideDisposedException.java \
+ src/edu/cmu/cs/openslide/OpenSlide.java \
+ src/edu/cmu/cs/openslide/OpenSlideJNI.java \
+ src/edu/cmu/cs/openslide/TestCLI.java \
+ src/edu/cmu/cs/openslide/gui/Annotation.java \
+ src/edu/cmu/cs/openslide/gui/DefaultAnnotation.java \
+ src/edu/cmu/cs/openslide/gui/DefaultSelectionListModel.java \
+ src/edu/cmu/cs/openslide/gui/Demo.java \
+ src/edu/cmu/cs/openslide/gui/OpenSlideView.java \
+ src/edu/cmu/cs/openslide/gui/SelectionListModel.java \
+ src/org/openslide/dzi/DeepZoomGenerator.java
+
+openslide.jar: $(JAVA_SRC)
+ @$(ANT)
+
+mostlyclean-local:
+ @$(ANT) clean
+
+install-exec-hook:
+ chmod -x $(DESTDIR)$(pkglibdir)/libopenslide-jni.so
+ rm -f $(DESTDIR)$(pkglibdir)/libopenslide-jni.la
+
+EXTRA_DIST = \
+ CHANGELOG.txt \
+ LICENSE.txt \
+ TODO.txt \
+ lgpl-2.1.txt \
+ mingw32-cheatsheet.txt \
+ $(JAVA_SRC)
View
@@ -0,0 +1,33 @@
+# FIND_FILE([OUTPUT], [FILE_NAME], [SEARCH_PATHS])
+# The paths in SEARCH_PATHS are searched to determine whether they contain
+# the file FILE_NAME. If so, OUTPUT is set to the directory containing
+# the file. Otherwise, an error is produced.
+# ------------------------------------------------------------------------
+AC_DEFUN([FIND_FILE], [
+ AC_MSG_CHECKING([for $2])
+ $1=
+ for ac__path in $3
+ do
+ if test -r $ac__path/$2 ; then
+ AC_MSG_RESULT([$ac__path])
+ $1=$ac__path
+ break
+ fi
+ done
+ if test z$$1 = z ; then
+ AC_MSG_RESULT([not found])
+ AC_MSG_ERROR([cannot find $2 in $3])
+ fi
+])
+
+
+# JOIN_EACH([OUTPUT], [PATHS], [SUBDIR])
+# Append SUBDIR to each of the PATHS and put the result in OUTPUT.
+# ----------------------------------------------------------------
+AC_DEFUN([JOIN_EACH], [
+ $1=
+ for dir in $2
+ do
+ $1="$$1 $dir/$3"
+ done
+])
View
@@ -0,0 +1,57 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.66])
+AC_INIT([OpenSlide Java], [0.9.2], [openslide-users@lists.andrew.cmu.edu])
+AC_CONFIG_AUX_DIR([build-aux])
+AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_SRCDIR([openslide-jni.c])
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([foreign dist-xz])
+AM_SILENT_RULES([yes])
+LT_INIT([disable-static])
+
+# Checks for programs.
+
+PKG_PROG_PKG_CONFIG()
+AC_PROG_CC
+
+AC_PATH_PROG([ANT], [ant])
+AC_ARG_VAR([ANT], [path to ant])
+if test z$ANT = z ; then
+ AC_MSG_ERROR([ant not found])
+fi
+
+# Checks for libraries.
+
+PKG_CHECK_MODULES([OPENSLIDE], [openslide])
+
+# Checks for header files.
+
+AC_ARG_VAR([JAVA_HOME], [path to JDK])
+AC_ARG_WITH([java], [AS_HELP_STRING([--with-java], [path to JDK])], [],
+ [with_java="$JAVA_HOME /usr/lib/jvm/java"])
+# Find jni.h
+JOIN_EACH([include_paths], [$with_java], [include])
+FIND_FILE([jni_h_dir], [jni.h], [$include_paths])
+# Find jni_md.h
+AS_CASE([$host],
+ [*-*-linux-gnu], [include_subdir=linux],
+ [*-*-mingw32], [include_subdir=win32],
+ [include_subdir=]
+)
+JOIN_EACH([platform_include_paths], [$include_paths], [$include_subdir])
+FIND_FILE([jni_md_h_dir], [jni_md.h],
+ [$platform_include_paths $include_paths])
+JNI_CFLAGS="-I$jni_h_dir -I$jni_md_h_dir"
+AC_SUBST([JNI_CFLAGS])
+
+# Checks for typedefs, structures, and compiler characteristics.
+
+AC_TYPE_INT64_T
+AC_TYPE_UINT32_T
+
+# Checks for library functions.
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT

0 comments on commit 7de2166

Please sign in to comment.