diff --git a/ChangeLog b/ChangeLog index a32ef8ea..565cbe90 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,7 +3,8 @@ * autogen.sh, configure.ac: Modernize configure.ac a bit. * configure.ac, m4/geany-revision.m4, m4/geany-binreloc.m4, - m4/geany-gnu-regex.m4, m4/geany-plugins.m4, m4/geany-i18n.m4: + m4/geany-gnu-regex.m4, m4/geany-plugins.m4, m4/geany-i18n.m4, + m4/geany-mingw.m4, m4/geany-socket.m4, m4/geany-vte.m4: Extract some configure logic to separate files for better readability. diff --git a/configure.ac b/configure.ac index a13d7e5c..9c851007 100644 --- a/configure.ac +++ b/configure.ac @@ -80,56 +80,13 @@ GEANY_CHECK_GNU_REGEX # check for mingw specific settings -case "${host}" in - *mingw*) - AC_CHECK_LIB([iberty], [fnmatch], [], - [AC_MSG_ERROR([fnmatch does not present in libiberty. You need to update it, read http://www.geany.org/Support/CrossCompile for details.])]) - AC_DEFINE([WIN32], [1], [we are cross compiling for WIN32]) - AC_DEFINE([HAVE_SOCKET], [1], [Define if you want to detect a running instance]) - AM_CONDITIONAL([MINGW], true) - want_vte="no" - want_socket="yes" - ;; - *) - AM_CONDITIONAL([MINGW], false) - ;; -esac +GEANY_CHECK_MINGW -# skip check if already decided -if test "x$want_socket" = "x"; then - # socket support - AC_ARG_ENABLE([socket], - [AS_HELP_STRING([--enable-socket], - [enable if you want to detect a running instance [default=yes]])], - [want_socket="$enableval"], - [want_socket="yes"]) - - if test "x$want_socket" = "xyes"; then - AC_DEFINE([HAVE_SOCKET], [1], [Define if you want to detect a running instance]) - # this should bring in libsocket on Solaris: - AC_SEARCH_LIBS([connect],[socket]) - fi -fi +GEANY_CHECK_SOCKET -# skip check if already decided -if test "x$want_vte" = "x"; then - # VTE support - AC_ARG_ENABLE([vte], - [AS_HELP_STRING([--enable-vte], - [enable if you want virtual terminal support [default=yes]])], - [want_vte="$enableval"], - [want_vte="yes"]) - if test "x$want_vte" = "xyes"; then - AC_DEFINE([HAVE_VTE], [1], [Define if you want VTE support]) - fi - AC_ARG_WITH([vte-module-path], - [AS_HELP_STRING([--with-vte-module-path=PATH], - [Path to a loadable libvte [default=None]])], - [AC_DEFINE_UNQUOTED([VTE_MODULE_PATH], - ["$withval"], [Path to a loadable libvte])]) -fi +GEANY_CHECK_VTE # just for a laugh (it has absolutely no effect) @@ -201,8 +158,8 @@ if test -n "${build}" -a -n "${target}"; then fi echo "Using GTK version : ${GTK_VERSION}" echo "Build with plugin support : ${geany_enable_plugins}" -echo "Use virtual terminal support : ${want_vte}" -echo "Use (UNIX domain) socket support : ${want_socket}" +echo "Use virtual terminal support : ${geany_enable_vte}" +echo "Use (UNIX domain) socket support : ${geany_enable_socket}" if test "x$enable_gnu_regex" = "xyes" ; then echo "GNU regex library : built-in" else diff --git a/m4/geany-mingw.m4 b/m4/geany-mingw.m4 new file mode 100644 index 00000000..0fa8e441 --- /dev/null +++ b/m4/geany-mingw.m4 @@ -0,0 +1,20 @@ +dnl GEANY_CHECK_MINGW +dnl Checks whether we're building for MinGW, and defines appropriate stuff +dnl if it is the case. +dnl Most importantly, AM_CODITIONALs MINGW +AC_DEFUN([GEANY_CHECK_MINGW], +[ + case "${host}" in + *mingw*) + AC_CHECK_LIB([iberty], [fnmatch], [], + [AC_MSG_ERROR([fnmatch does not present in libiberty. You need to update it, read http://www.geany.org/Support/CrossCompile for details.])]) + AC_DEFINE([WIN32], [1], [we are cross compiling for WIN32]) + GEANY_CHECK_VTE([no]) + GEANY_CHECK_SOCKET([yes]) + AM_CONDITIONAL([MINGW], true) + ;; + *) + AM_CONDITIONAL([MINGW], false) + ;; + esac +]) diff --git a/m4/geany-socket.m4 b/m4/geany-socket.m4 new file mode 100644 index 00000000..9b34c049 --- /dev/null +++ b/m4/geany-socket.m4 @@ -0,0 +1,42 @@ +dnl _GEANY_CHECK_SOCKET_PREREQ +AC_DEFUN([_GEANY_CHECK_SOCKET_PREREQ], +[ + AC_ARG_ENABLE([socket], + [AS_HELP_STRING([--enable-socket], + [enable if you want to detect a running instance [default=yes]])], + [geany_enable_socket="$enableval"], + [geany_enable_socket="auto"]) +]) + +dnl GEANY_CHECK_SOCKET([enable]) +AC_DEFUN([GEANY_CHECK_SOCKET], +[ + AC_REQUIRE([_GEANY_CHECK_SOCKET_PREREQ]) + + dnl this way of calling once is a bit ugly, but we need to be able to + dnl call this from one or more locations, the first one maybe in a shell + dnl conditional. + if test "x$_geany_enable_socket_done" = x; then + dnl This one gives precedence for user choice + dnl if test "x$geany_enable_socket" = xauto; then + dnl if test -n "$1"; then + dnl geany_enable_socket="$1" + dnl else + dnl geany_enable_socket=yes + dnl fi + dnl fi + if test -n "$1"; then + geany_enable_socket="$1" + elif test "x$geany_enable_socket" = xauto; then + geany_enable_socket=yes + fi + + if test "x$geany_enable_socket" = xyes; then + AC_DEFINE([HAVE_SOCKET], [1], [Define if you want to detect a running instance]) + # this should bring in libsocket on Solaris: + AC_SEARCH_LIBS([connect],[socket]) + fi + + _geany_enable_socket_done=yes + fi +]) diff --git a/m4/geany-vte.m4 b/m4/geany-vte.m4 new file mode 100644 index 00000000..2783bcff --- /dev/null +++ b/m4/geany-vte.m4 @@ -0,0 +1,46 @@ +dnl _GEANY_CHECK_VTE_PREREQ +AC_DEFUN([_GEANY_CHECK_VTE_PREREQ], +[ + AC_ARG_ENABLE([vte], + [AS_HELP_STRING([--enable-vte], + [enable if you want virtual terminal support [default=yes]])], + [geany_enable_vte="$enableval"], + [geany_enable_vte="yes"]) + AC_ARG_WITH([vte-module-path], + [AS_HELP_STRING([--with-vte-module-path=PATH], + [Path to a loadable libvte [default=None]])], + [AC_DEFINE_UNQUOTED([VTE_MODULE_PATH], + ["$withval"], [Path to a loadable libvte])]) +]) + +dnl GEANY_CHECK_VTE([enable]) +AC_DEFUN([GEANY_CHECK_VTE], +[ + AC_REQUIRE([_GEANY_CHECK_VTE_PREREQ]) + + dnl this way of calling once is a bit ugly, but we need to be able to + dnl call this from one or more locations, the first one maybe in a shell + dnl conditional. + dnl see geany-socket.m4 + if test "x$_geany_enable_vte_done" = x; then + dnl This one gives precedence for user choice + dnl if test "x$geany_enable_vte" = xauto; then + dnl if test -n "$1"; then + dnl geany_enable_vte="$1" + dnl else + dnl geany_enable_vte=yes + dnl fi + dnl fi + if test -n "$1"; then + geany_enable_vte="$1" + elif test "x$geany_enable_vte" = xauto; then + geany_enable_vte=yes + fi + + if test "x$geany_enable_vte" = xyes; then + AC_DEFINE([HAVE_VTE], [1], [Define if you want VTE support]) + fi + + _geany_enable_vte_done=yes + fi +])