Codebase list jmagick / scrub-obsolete/main configure.in
scrub-obsolete/main

Tree @scrub-obsolete/main (Download .tar.gz)

configure.in @scrub-obsolete/mainraw · history · blame

dnl Copyright (C) 1999-2005 Eric Yeo. All rights reserved.
dnl This is the autoconf input file for Java Magick.

AC_INIT(src/magick/MagickImage.java)
AC_CANONICAL_SYSTEM

dnl Get the OS name

if test -x "/bin/uname" ; then
  UNAME=/bin/uname
elif test -x "/usr/bin/uname" ; then
  UNAME=/usr/bin/uname
elif test -x "/usr/local/bin/uname" ; then
  UNAME=/usr/local/bin/uname
else
  echo configure: cannot find uname
  exit 1
fi

OS=`$UNAME -s`

dnl The version number must change with every release
VER_MAJOR=6
VER_MINOR=6
VER_MICRO=9
VER_JMSUB=0

SHARED_LIB_EXT=.so

dnl Need the -G flag on Solaris when creating shared libraries.
case "$target" in
*solaris*)
	SHARED_LDFLAGS="-G"
	;;
*freebsd*|*linux*)
	SHARED_LDFLAGS="-shared"
	;;
dnl Make sure we use -dynamiclib parameter for OS X Leopard
*darwin9.*|*darwin10.*)
	SHARED_LDFLAGS="-dynamiclib"
	SHARED_LIB_EXT=.jnilib
	;;
*darwin1.[0-2])
	;;
*darwin*)
	LIBTOOL_LINK_FLAG='-module'
	;;
esac

dnl By default, we look at /usr/local. Need to explicitly do this because
dnl some compilers don't.
LDFLAGS="${LDFLAGS} -L/usr/local/lib"
CFLAGS="${CFLAGS} -I/usr/local/include"

dnl Get the full path of the source directory.
PROJ_BASE_DIR=`cd ${srcdir} && pwd`
AC_SUBST(PROJ_BASE_DIR)

dnl Determine if we have gcc
AC_PROG_CC
if test -z "${CC}"; then
    AC_MSG_ERROR('No suitable C compiler found')
fi
if test "${GCC}" != yes; then
    AC_MSG_WARN('You don't have the GNU GCC. Should\'t you be using one?')
fi
AC_SUBST(CC)

dnl Determine how to run the preprocessor
AC_PROG_CPP

dnl Check for install program
AC_PROG_INSTALL

dnl Check for large file support. This test was taken from ImageMagick.
dnl If this step is removed, there will be a mismatch of structures in
dnl the ImageMagick headers.
AC_PATH_PROG(GETCONF, getconf, not_found)
if (test $GETCONF != not_found); then
    AC_MSG_CHECKING(whether large file support needs explicit enabling)
    result='no'
    NEW_CFLAGS=`$GETCONF LFS_CFLAGS 2> /dev/null`
    if (test -n "$NEW_CFLAGS"); then
        CFLAGS="$CFLAGS $NEW_CFLAGS"
        result='yes'
    fi
    NEW_LDFLAGS=`$GETCONF LFS_LDFLAGS 2> /dev/null`
    if (test -n "$NEW_LDFLAGS"); then
        LDFLAGS="$LDFLAGS $NEW_LDFLAGS"
        result='yes'
    fi
    NEW_LIBS=`$GETCONF LFS_LIBS 2> /dev/null`
    if (test -n "$NEW_LIBS"); then
        LIBS="$LIBS $NEW_LIBS"
        result='yes'
    fi
    AC_MSG_RESULT($result)
fi


dnl Determine the X11 install paths. We don't really need this
dnl if we are using shared libraries.
AC_PATH_X
if (test -n "${x_includes}"); then
    X11_INCLUDES=-I${x_includes}
fi
if (test -n "${x_libraries}"); then
    X11_LIBS=-L${x_libraries}
fi

dnl Determine the OS we are running on and set the class path
dnl separator accordingly.
case ${build_os} in
*cygwin*)
	CLASSSEP=;
	;;
*)
	CLASSSEP=:
esac
AC_SUBST(CLASSSEP)

dnl Determine if we have a decent Java distribution
AC_ARG_WITH(java-home, --with-java-home Java installation path,
            JAVA_HOME=${withval})
AC_ARG_WITH(java-includes, --with-java-includes Java includes path,
            JAVA_INCLUDE_PATH="${withval}")
if test -n "${JAVA_INCLUDE_PATH}" -a -d "${JAVA_INCLUDE_PATH}" ; then
	dnl Java include path supplied
	JAVA_INCLUDES=-I${JAVA_INCLUDE_PATH}
elif test -d ${JAVA_HOME}/include ; then
	JAVA_INCLUDES=-I${JAVA_HOME}/include
	dnl The Blackdown JDK seems to have genunix.
	if test -d ${JAVA_HOME}/include/genunix ; then
		JAVA_INCLUDES="$JAVA_INCLUDES -I${JAVA_HOME}/include/genunix"
	fi
	dnl The Sun Linux JDK seems to use linux
	if test -d ${JAVA_HOME}/include/linux ; then
		JAVA_INCLUDES="$JAVA_INCLUDES -I${JAVA_HOME}/include/linux"
	fi
	dnl The Sun Solaris JDK seems to use solaris
	if test -d ${JAVA_HOME}/include/solaris ; then
		JAVA_INCLUDES="$JAVA_INCLUDES -I${JAVA_HOME}/include/solaris"
	fi
	dnl The Sun FreeBSD JDK seems to use freebsd
	if test -d ${JAVA_HOME}/include/freebsd ; then
		JAVA_INCLUDES="$JAVA_INCLUDES -I${JAVA_HOME}/include/freebsd"
	fi
	dnl The Sun Windows JDK seems to use win32
	if test -d ${JAVA_HOME}/include/win32 ; then
		JAVA_INCLUDES="$JAVA_INCLUDES -I${JAVA_HOME}/include/win32"
	fi
        if test -d ${JAVA_HOME}/include/bsd ; then
                JAVA_INCLUDES="$JAVA_INCLUDES -I${JAVA_HOME}/include/bsd"
        fi
dnl check for Mac OS X series of systems
elif test -d ${JAVA_HOME}/Headers; then
	JAVA_INCLUDES=-I${JAVA_HOME}/Headers
else
	AC_MSG_ERROR('Unable to locate Java directories')
fi

dnl Determine if there is a shared library extension supplied
AC_ARG_WITH(shared_lib_ext, --with-shared-lib-ext Shared library file extension,
            SHARED_LIB_EXT=${withval}, SHARED_LIB_EXT=${SHARED_LIB_EXT})

dnl Determine if jni.h is available
OLD_CPPFLAGS=${CPPFLAGS}
CPPFLAGS="${JAVA_INCLUDES} ${CPPFLAGS}"
AC_CHECK_HEADER(jni.h, HAVE_JNI_HEADER=yes, HAVE_JNI_HEADER=no)
if test ${HAVE_JNI_HEADER} = no ; then
	AC_MSG_ERROR('Unable to locate jni.h')
fi
CPPFLAGS=${OLD_CPPFLAGS}

dnl Determine where the Java interpreter is
AC_PATH_PROG(JAVA, java, not_found)
if test ${JAVA} = not_found; then
	AC_MSG_ERROR('No Java interpreter found')
fi
AC_SUBST(JAVA)

dnl Determine if we prefer to use Jikes.
AC_ARG_WITH(jikes, --with-jikes	use the IBM Jikes compiler,
            PREFER_JIKES=yes,
            PREFER_JIKES=no)
if test ${PREFER_JIKES} = yes; then
	dnl Determine if Jikes is available.
	AC_PATH_PROG(JIKES, jikes, not_found)
	if test ${JIKES} = not_found; then
		dnl Jikes not found, so we check for javac
		AC_PATH_PROG(JAVAC, javac, not_found)
		if test ${JAVAC} = not_found; then
			AC_MSG_ERROR('No Java compiler found')
		else
			AC_MSG_WARN('Jikes not found. Use javac.')
		fi
	else
		JAVAC=${JIKES}
	fi
else
	dnl Determine if we have the Java compiler.
	AC_PATH_PROG(JAVAC, javac, not_found)
	if test ${JAVAC} = not_found; then
		AC_PATH_PROG(JIKES, jikes, not_found)
		if test ${JIKES} = not_found; then
			AC_MSG_ERROR('No Java compiler found')
		else
			JAVAC=${JIKES}
		fi
	fi
fi
AC_SUBST(JAVAC)

dnl Determine if we have the Java header file generator
AC_PATH_PROG(JAVAH, javah, not_found)
if test ${JAVAH} = not_found; then
	AC_MSG_ERROR('No Java header generator (javah) found')
fi
AC_SUBST(JAVAH)

dnl Determine if we have jar
AC_PATH_PROG(JAR, jar, not_found)
if test ${JAR} = not_found; then
	AC_MSG_ERROR('No jar found')
fi
AC_SUBST(JAR)

dnl Determine if we have javadoc
AC_PATH_PROG(JAVADOC, javadoc, )
AC_SUBST(JAVADOC)

dnl Check if javadoc destination specified
JAVADOC_DIR='${prefix}/share/doc/jmagick'
AC_ARG_WITH(javadoc-dir, --with-javadoc-dir=path where Javadoc is generated,
            JAVADOC_DIR=${withval})
AC_SUBST(JAVADOC_DIR)

dnl Do you print extra diagnostic?
AC_ARG_ENABLE(diagnostic,
              --enable-diagnostic enable C diagnostic output (default off),
              C_DEBUG=-DDIAGNOSTIC,C_DEBUG=)
AC_SUBST(C_DEBUG)

dnl Check if ImageMagick home specified
AC_ARG_WITH(magick-home, --with-magick-home=path home directory of ImageMagick,
            MAGICK_HOME=${withval})
for MPATH in /usr /usr/local /usr/local/ImageMagick /usr/local/ImageMagick-${VER_MAJOR}.${VER_MINOR}.${VER_MICRO} ${MAGICK_HOME} ; do
	# Location before IM 6.3.8.something
	if  test -f ${MPATH}/include/magick/api.h  ; then
		MAGICK_LIB_PATH=${MPATH}/lib
		MAGICK_LIBS="-L${MPATH}/lib -lMagick"
		MAGICK_INCLUDES=-I${MPATH}/include
		MAGICK_REALHOME=${MPATH}
	fi
	# Location after IM 6.3.8.something
	if  test -f ${MPATH}/include/ImageMagick/magick/api.h  ; then
		MAGICK_LIB_PATH=${MPATH}/lib
		MAGICK_LIBS="-L${MPATH}/lib -lMagick"
		MAGICK_INCLUDES=-I${MPATH}/include/ImageMagick
		MAGICK_REALHOME=${MPATH}
	fi
done

dnl Check if MagickCore-conf exists
OLDPATH=${PATH}
PATH=${MAGICK_REALHOME}/bin:${PATH}
export PATH
AC_PATH_PROG(MAGICKCONF, MagickCore-config, not_found)
PATH=${OLDPATH}
export PATH
dnl Added $MAGICK_LIB_PATH and $MAGICK_INCLUDES here because of
dnl a possible bug in Magick-conf for ImageMagick 5.4.6
if (test $MAGICKCONF != not_found); then
	LDFLAGS="${LDFLAGS} `$MAGICKCONF --ldflags`"
	MAGICK_LIBS=`$MAGICKCONF --libs`
	MAGICK_INCLUDES="`$MAGICKCONF --cppflags`"
fi

dnl Check if ImageMagick library path specified
AC_ARG_WITH(magick-lib-dir,
            --with-magick-lib-dir=path library path of ImageMagick,
            MAGICK_LIB_PATH=${withval}
            MAGICK_LIBS=-L${withval})

dnl Check if ImageMagick include path specified
AC_ARG_WITH(magick-inc-dir,
            --with-magick-inc-dir=path include path of ImageMagick,
            MAGICK_INCLUDES=-I${withval})
if ( test -f ${MAGICK_INCLUDE_PATH}/magick/api.h ) ; then
	MAGICK_INCLUDES=-I${MAGICK_INCLUDE_PATH}
fi

dnl Check for the ImageMagick header file magick/api.h
OLD_CPPFLAGS=${CPPFLAGS}
if test -n "${MAGICK_INCLUDES}"; then
	CPPFLAGS="${MAGICK_INCLUDES} ${CPPFLAGS}"
fi
AC_CHECK_HEADER(magick/api.h, HAVE_MAGICK_HEADER=yes, HAVE_MAGICK_HEADER=no)
if test ${HAVE_MAGICK_HEADER} = no ; then
	AC_MSG_ERROR('Unable to find ImageMagick header files')
fi
CPPFLAGS=${OLD_CPPFLAGS}

dnl Check for the ImageMagick library
OLD_LDFLAGS=${LDFLAGS}
if test -n "${MAGICK_LIBS}"; then
	LDFLAGS="${MAGICK_LIBS} ${LDFLAGS}"
fi
AC_CHECK_LIB(Magick, ConstituteImage,
             HAVE_MAGICK_LIB=yes, HAVE_MAGICK_LIB=no)
if test ${HAVE_ImageMagick-6.2.4MAGICK_LIB} = no; then
	AC_MSG_ERROR('Unable to find ImageMagick library')
fi
LDFLAGS=${OLD_LDFLAGS}



dnl Configure libtool
AC_DISABLE_STATIC
AC_PROG_LIBTOOL

AC_SUBST(JAVA_INCLUDES)
AC_SUBST(X11_LIBS)
AC_SUBST(X11_INCLUDES)
AC_SUBST(MAGICK_LIB_PATH)
AC_SUBST(MAGICK_LIBS)
AC_SUBST(MAGICK_INCLUDES)
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(JFLAGS)
AC_SUBST(LIBS)
AC_SUBST(SHARED_LDFLAGS)
AC_SUBST(LIBTOOL_LINK_FLAG)
AC_SUBST(VER_MAJOR)
AC_SUBST(VER_MINOR)
AC_SUBST(VER_MICRO)
AC_SUBST(VER_JMSUB)
AC_SUBST(SHARED_LIB_EXT)
AC_SUBST(OS)

AC_OUTPUT([Make.def])