medit/configure.ac

439 lines
12 KiB
Plaintext

#
# moo/configure.ac
#
m4_define([moo_major_version], [0])
m4_define([moo_minor_version], [5])
m4_define([moo_micro_version], [93])
m4_define([moo_version], [moo_major_version.moo_minor_version.moo_micro_version])
AC_INIT(libmoo, [moo_version], [muntyan@math.tamu.edu], libmoo)
AM_INIT_AUTOMAKE(libmoo, [moo_version])
AC_CONFIG_HEADERS(config.h)
AC_PKG_ARG_ENV_VAR
AC_DEFINE(MOO_VERSION, ["moo_version"], "libmoo version")
MOO_VERSION=\"moo_version\"
MOO_VERSION_MAJOR=moo_major_version
MOO_VERSION_MINOR=moo_minor_version
MOO_VERSION_MICRO=moo_micro_version
AC_SUBST(MOO_VERSION)
AC_SUBST(MOO_VERSION_MAJOR)
AC_SUBST(MOO_VERSION_MINOR)
AC_SUBST(MOO_VERSION_MICRO)
TERMHELPER_VERSION=$MOO_VERSION
TERMHELPER_VERSION_MAJOR=$MOO_VERSION_MAJOR
TERMHELPER_VERSION_MINOR=$MOO_VERSION_MINOR
TERMHELPER_VERSION_MICRO=$MOO_VERSION_MICRO
AC_SUBST(TERMHELPER_VERSION)
AC_SUBST(TERMHELPER_VERSION_MAJOR)
AC_SUBST(TERMHELPER_VERSION_MINOR)
AC_SUBST(TERMHELPER_VERSION_MICRO)
AC_PROG_CC
AC_PROG_CC_STDC
AC_HEADER_STDC
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_WINDRES
AC_PROG_YACC
# for pcre
AC_CHECK_FUNCS(memmove bcopy strerror)
################################################################################
# Terminal stuff
#
AC_CHECK_HEADERS(poll.h errno.h io.h fcntl.h sys/types.h sys/wait.h signal.h)
AC_CHECK_FUNCS([poll pipe _pipe kill signal posix_openpt])
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_TYPE_PID_T
#TODO: freebsd vte port patch removes this
# AC_DEFINE(_XOPEN_SOURCE_EXTENDED,1,[Needed to get declarations for msg_control and msg_controllen on Solaris])
# AC_DEFINE(_XOPEN_SOURCE,1,[Needed to get declarations for msg_control and msg_controllen on Solaris])
# AC_DEFINE(__EXTENSIONS__,1,[Needed to get declarations for msg_control and msg_controllen on Solaris])
# Check for headers.
AC_CHECK_HEADERS(sys/select.h sys/termios.h sys/un.h stropts.h termios.h wchar.h)
AC_HEADER_TIOCGWINSZ
# Check for PTY handling functions.
AC_CHECK_FUNCS(cfmakeraw getpgid getpt grantpt unlockpt ptsname ptsname_r recvmsg)
# Pull in the right libraries for various functions which might not be
# bundled into an exploded libc.
AC_CHECK_FUNC(socket,[have_socket=1],AC_CHECK_LIB(socket,socket,[have_socket=1; LIBS="$LIBS -lsocket"]))
AC_CHECK_FUNC(socketpair,[have_socketpair=1],AC_CHECK_LIB(socket,socketpair,[have_socketpair=1; LIBS="$LIBS -lsocket"]))
if test x$have_socket = x1 ; then
AC_DEFINE(HAVE_SOCKET,1,[Define if you have the socket function.])
fi
if test x$have_socketpair = x1 ; then
AC_DEFINE(HAVE_SOCKETPAIR,1,[Define if you have the socketpair function.])
fi
AC_CHECK_FUNC(floor,,AC_CHECK_LIB(m,floor,LIBS=["$LIBS -lm"]))
################################################################################
# Check debug options
#
AC_CHECK_DEBUG_STUFF([-Wall])
################################################################################
# Check operating system
#
cygwin_build="no"
mingw_build="no"
case $host in
*-*-mingw32*)
echo "++++ building for MINGW32 ++++"
mingw_build="yes"
;;
*-*-cygwin*)
echo "++++ building for CYGWIN ++++"
cygwin_build="yes"
;;
*-*-darwin*)
echo "++++ building for DARWIN ++++"
AC_DEFINE(OS_DARWIN, 1, [darwin])
unix_build=yes
;;
*)
unix_build=yes
;;
esac
AM_CONDITIONAL(UNIX_BUILD, test x$unix_build = "xyes")
AM_CONDITIONAL(MINGW_BUILD, test x$mingw_build = "xyes")
AM_CONDITIONAL(CYGWIN_BUILD, test x$cygwin_build = "xyes")
################################################################################
# GTK libraries
#
PKG_CHECK_MODULES(GTK, gtk+-2.0,,exit)
PKG_CHECK_MODULES(GLIB, glib-2.0,,exit)
PKG_CHECK_MODULES(GDK, gdk-2.0,,exit)
################################################################################
# Python stuff
#
AC_ARG_WITH([pygtk],
AC_HELP_STRING([--with-pygtk], [whether to compile pygtk support (default = autodetect)]),
[
if test x$with_pygtk = "xno"; then
build_pygtk="no"
else
build_pygtk="yes"
fi
], [
build_pygtk="yes"
])
AC_ARG_WITH([python],
AC_HELP_STRING([--with-python], [whether to compile python support (default = AUTO)]),
[
if test x$with_python = "xno"; then
build_python="no"
build_pygtk="no"
else
if test x$with_python = "xyes"; then
python_version=2.2
else
python_version=$with_python
fi
build_python="yes"
fi
], [
if test x$build_pygtk = xyes; then
build_python="yes"
else
build_python="auto"
build_pygtk="no"
fi
python_version=2.2
])
AC_ARG_ENABLE([moo-module],
AC_HELP_STRING([--enable-moo-module], [create standalone python module 'moo' (default = YES)]),
[
if test x$enable_moo_module = "xno"; then
build_pymoo="no"
else
build_pymoo="yes"
fi
], [
build_pymoo="yes"
])
if test x$cygwin_build != "xyes" -a x$build_python != "xno"; then
AC_CHECK_PYTHON($python_version, [
build_python="yes"
AC_MSG_NOTICE([compiling python support])
], [
build_python="no"
build_pygtk="no"
AC_MSG_WARN([Python not found])
])
fi
AM_CONDITIONAL(USE_PYTHON, test x$build_python = "xyes")
if test x$build_python = "xyes"; then
AC_DEFINE(USE_PYTHON,, [USE_PYTHON])
fi
################################################################################
# pygtk
#
if test x$cygwin_build != "xyes"; then
if test x$build_pygtk = xyes; then
AC_CHECK_PYGTK([$python_version], [
build_pygtk="yes"
AC_MSG_NOTICE([compiling pygtk support])
],[
build_pygtk="no"
AC_MSG_NOTICE([usable pygtk not found])
])
fi
fi
AM_CONDITIONAL(USE_PYGTK, test x$build_pygtk = "xyes")
if test x$build_pygtk = "xyes"; then
AC_DEFINE(USE_PYGTK,, [USE_PYGTK])
fi
if test x$build_pygtk = "xyes"; then
if test x$build_pymoo != "xno"; then
build_pymoo="yes"
fi
else
build_pymoo="no"
fi
AM_CONDITIONAL(BUILD_PYMOO, test x$build_pymoo = "xyes")
################################################################################
# libxml2
#
AC_ARG_WITH([xml],
AC_HELP_STRING([--with-xml], [enable xml]),
[use_xml=$withval],
[use_xml=auto]
)
if test x$cygwin_build != "xyes" -a x$use_xml != "xno"; then
AC_CHECK_XML_STUFF([found_xml=yes],[found_xml=no])
fi
if test x$use_xml = "xyes" -a x$found_xml = "xno"; then
AC_MSG_ERROR([libxml2 library not found])
fi
if test x$found_xml = "xyes"; then
use_xml=yes
AC_MSG_NOTICE([compiling with xml support])
AC_DEFINE(USE_XML,, [use libxml])
else
use_xml=no
AC_MSG_NOTICE([compiling without xml support])
fi
AM_CONDITIONAL(USE_XML, test x$use_xml = xyes)
################################################################################
# mime
#
AC_ARG_WITH([mime],
AC_HELP_STRING([--with-mime], [enable mime]),
[use_mime=$withval],
[use_mime=yes]
)
if test x$cygwin_build != "xyes" -a x$use_mime != xno; then
use_mime=yes
use_xdgmime=yes
AC_DEFINE(USE_MIME,, [use mime])
AC_DEFINE(USE_XDGMIME,, [use xdgmime])
fi
AM_CONDITIONAL(USE_MIME, test x$use_mime = xyes)
AM_CONDITIONAL(BUILD_XDGMIME, test x$use_xdgmime = xyes)
################################################################################
# Components
#
AC_ARG_WITH([mooapp],
AC_HELP_STRING([--without-mooapp], [disable building mooapp]),
[build_mooapp=$withval],
[build_mooapp=yes]
)
AC_ARG_WITH([mooedit],
AC_HELP_STRING([--without-mooedit], [disable building mooedit]),
[build_mooedit=$withval],
[build_mooedit=yes]
)
AC_ARG_WITH([mooutils],
AC_HELP_STRING([--without-mooutils], [disable building mooutils]),
[build_mooutils=$withval],
[build_mooutils=yes]
)
AC_ARG_WITH([mooui],
AC_HELP_STRING([--without-mooui], [disable building mooui]),
[build_mooui=$withval],
[build_mooui=yes]
)
AC_ARG_WITH([mooterm],
AC_HELP_STRING([--without-mooterm], [disable building mooterm]),
[build_mooterm=$withval],
[build_mooterm=yes]
)
if test x$cygwin_build = "xyes"; then
build_mooutils="no"
build_mooui="no"
build_mooedit="no"
build_mooapp="no"
fi
if test "x$build_mooapp" != "xno"; then
build_mooedit="yes"
build_mooterm="yes"
fi
if test "x$build_mooedit" != "xno"; then
build_mooui="yes"
fi
if test "x$build_mooterm" != "xno" -a x$cygwin_build != "xyes"; then
build_mooutils="yes"
fi
if test "x$build_mooui" != "xno"; then
build_mooutils="yes"
fi
AM_CONDITIONAL(BUILD_MOOUTILS, test "x$build_mooutils" != "xno")
AM_CONDITIONAL(BUILD_MOOUI, test "x$build_mooui" != "xno")
AM_CONDITIONAL(BUILD_MOOEDIT, test "x$build_mooedit" != "xno")
AM_CONDITIONAL(BUILD_MOOTERM, test "x$build_mooterm" != "xno")
AM_CONDITIONAL(BUILD_MOOAPP, test "x$build_mooapp" != "xno")
moo_top_src_dir=`cd $srcdir && pwd`
moo_top_build_dir=`cd ./$ac_top_builddir && pwd`
MOO_CFLAGS="-I$moo_top_src_dir/moo $GTK_CFLAGS"
MOO_LIBS="$moo_top_build_dir/moo/libmoo.la $GTK_LIBS"
AC_SUBST(MOO_CFLAGS)
AC_SUBST(MOO_LIBS)
################################################################################
# MooEdit stuff
#
if test "x$build_mooedit" != "xno"; then
MOO_CFLAGS="$MOO_CFLAGS $XML_CFLAGS -I$moo_top_src_dir/moo/mooedit"
MOO_LIBS="$MOO_LIBS $XML_LIBS"
fi
################################################################################
# Installation directories, etc.
#
MOO_SRC_PREFIX="moo"
AC_SUBST(MOO_SRC_PREFIX)
if test "x${prefix}" = "xNONE"; then
mooprefix=${ac_default_prefix}
else
mooprefix=${prefix}
fi
moodatadir=share
moorootdir=${moodatadir}/moo
NO_PREFIX_MOO_ROOT_DIR="${moorootdir}"
AC_SUBST(NO_PREFIX_MOO_ROOT_DIR)
MOO_ROOT_DIR="${mooprefix}/${moorootdir}"
AC_SUBST(MOO_ROOT_DIR)
AC_DEFINE_UNQUOTED(MOO_ROOT_DIR, "${mooprefix}/${moorootdir}", [data files go to MOO_ROOT_DIR])
MOO_EDIT_LANG_FILES_DIR="${mooprefix}/${moorootdir}/language-specs"
AC_SUBST(MOO_EDIT_LANG_FILES_DIR)
AC_DEFINE_UNQUOTED(MOO_EDIT_LANG_FILES_DIR, "${mooprefix}/${moorootdir}/language-specs", [lang files dir])
################################################################################
# Created files
#
AC_OUTPUT([
Makefile
moo/Makefile
moo/mooapp/Makefile
moo/mooapp/glade/Makefile
moo/mooedit/Makefile
moo/mooedit/gtksourceview/Makefile
moo/mooedit/xdgmime/Makefile
moo/mooedit/glade/Makefile
moo/mooedit/language-specs/Makefile
moo/mooterm/Makefile
moo/mooterm/glade/Makefile
moo/mooui/Makefile
moo/mooui/glade/Makefile
moo/mooutils/Makefile
moo/mooutils/glade/Makefile
moo/mooutils/newgtk/Makefile
moo/mooutils/pcre/Makefile
moo/mooutils/pixmaps/Makefile
moo/mooutils/unrtf/Makefile
tests/Makefile
tests/medit.c
tests/editor.c
tests/pyapp.py
])
################################################################################
# Configuration info
#
if test x$cygwin_build != "xyes"; then
if test "x$mingw_build" = "xyes"; then
system="MINGW"
elif test "x$darwin_build" = "xyes"; then
system="DARWIN"
else
system="UNIX"
fi
if test x$use_xml != "xyes"; then
use_xml="no"
fi
echo
echo " OS = $system"
echo " prefix = $mooprefix"
echo " python support = $build_python"
echo " pygtk support = $build_pygtk"
echo " standalone 'moo' python module = $build_pymoo"
echo " xml support = $use_xml"
echo
echo " editor lang files go to = $MOO_EDIT_LANG_FILES_DIR"
echo
else
echo
echo " Building termhelper.exe on CYGWIN"
echo
fi