diff options
Diffstat (limited to 'configure.ac')
| -rw-r--r-- | configure.ac | 169 |
1 files changed, 101 insertions, 68 deletions
diff --git a/configure.ac b/configure.ac index 8620050..5ac7aad 100644 --- a/configure.ac +++ b/configure.ac @@ -2,10 +2,10 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.65]) -AC_INIT([SciTECO], [2.4.0], - [robin.haberkorn@googlemail.com], +AC_INIT([SciTECO], [2.5.0], + [hackers@fmsbw.de], [sciteco], - [https://github.com/rhaberkorn/sciteco]) + [https://sciteco.fmsbw.de/]) AC_CONFIG_MACRO_DIR(m4) AC_CONFIG_AUX_DIR(config) AM_INIT_AUTOMAKE @@ -38,6 +38,30 @@ AC_SUBST(SCINTILLA_CXXFLAGS) # Necessary so we can change their default values here AC_SUBST(AM_CPPFLAGS) +# This cannot be done with --enable-static as it only controls +# which kind of libraries libtool builds. +# Also, it cannot be controlled reliably by setting LDFLAGS for +# ./configure, as this would be used for linking the test cases +# without libtool and libtool would ignore it. +# It is only possible to call `make LDFLAGS="-all-static"` but +# this is inconvenient... +AC_ARG_ENABLE(static-executables, + AS_HELP_STRING([--enable-static-executables], + [Link in as many runtime dependencies as possible + statically [default=no]]), + [static_executables=$enableval], [static_executables=no]) +AM_CONDITIONAL(STATIC_EXECUTABLES, [test x$static_executables = xyes]) + +# Wrapper around PKG_CHECK_MODULES(), but takes --enable-static-executables +# into account. +AC_DEFUN([TE_CHECK_MODULES], [ + AS_IF([test x$static_executables = xyes], [ + PKG_CHECK_MODULES_STATIC([$1], [$2], [$3], [$4]) + ], [ + PKG_CHECK_MODULES([$1], [$2], [$3], [$4]) + ]) +]) + # Auxiliary functions # expand $1 and print its absolute path @@ -77,6 +101,13 @@ AC_PROG_CXX([c++ g++ clang++]) AX_CXX_COMPILE_STDCXX(17, noext, mandatory) AC_CHECK_TOOL(AR, ar) +# If ptrdiff_t does not alias int, we need a workaround +# in Scintilla. +AX_PTRDIFF_ALIASES_INT +if [[ "x$ax_cv_ptrdiff_aliases_int" = "xno" ]]; then + SCINTILLA_CXXFLAGS="$SCINTILLA_CXXFLAGS -DPTRDIFF_DOESNT_ALIAS_INT" +fi + # Whether $CC is Clang AM_CONDITIONAL(CLANG, [$CC --version | $GREP -i clang >/dev/null]) @@ -115,6 +146,14 @@ if [[ x$GROFF = x ]]; then AC_MSG_ERROR([GNU roff required!]) fi +# preconv was added only in Groff v1.20, which is still missig +# in NetBSD. +AC_CHECK_PROG(PRECONV, preconv, preconv) +if [[ x$PRECONV != x ]]; then + GROFF_FLAGS="-Kutf-8" +fi +AC_SUBST(GROFF_FLAGS) + # Doxygen is not necessarily required as long as # you do not run `make devdoc`. AC_CHECK_PROG(DOXYGEN, doxygen, doxygen) @@ -127,7 +166,7 @@ AC_SUBST(DOXYGEN_HAVE_DOT) AC_CHECK_PROG(SCITECO, sciteco, sciteco) # Checks for libraries. -PKG_CHECK_MODULES(LIBGLIB, [glib-2.0 >= 2.44 gmodule-2.0], [ +TE_CHECK_MODULES(LIBGLIB, [glib-2.0 >= 2.44 gmodule-2.0], [ CFLAGS="$CFLAGS $LIBGLIB_CFLAGS" CXXFLAGS="$CXXFLAGS $LIBGLIB_CFLAGS" LIBS="$LIBS $LIBGLIB_LIBS" @@ -174,7 +213,9 @@ AC_CHECK_FUNCS([memset setlocale strchr strrchr fstat sscanf], , [ # glib defines G_OS_UNIX instead... case $host in *-*-linux* | *-*-*bsd* | *-*-darwin* | *-*-cygwin* | *-*-haiku*) - AC_CHECK_FUNCS([realpath readlink pathconf fchown dup dup2 getpid open read kill mmap popen pclose], , [ + # NOTE: Keep this on a single line for compatibility + # with ancient versions of Autoconf. + AC_CHECK_FUNCS([realpath readlink pathconf fchown dup dup2 getpid open read kill mmap popen pclose isatty fork setsid], , [ AC_MSG_ERROR([Missing libc function]) ]) AC_SEARCH_LIBS(dladdr, [dl], , [ @@ -246,55 +287,68 @@ AC_ARG_WITH(interface, case $INTERFACE in *curses*) case $INTERFACE in - ncurses | netbsd-curses) + ncurses) # This gives precendence to the widechar version of ncurses, # which is necessary for Unicode support even when not using widechar APIs. - AX_WITH_CURSES + # However we also accept libncurses.so if it also contains the + # enhanced definitions. + # NOTE: This also defines CURSES_CFLAGS and CURSES_LIBS arguments, + # which are used by all the other curses variants as well. + AX_WITH_NCURSES if [[ x$ax_cv_curses_enhanced != xyes -o x$ax_cv_curses_color != xyes ]]; then - AC_MSG_ERROR([X/Open curses compatible library not found!]) + AC_MSG_ERROR([X/Open-compatible libncurses not found! Perhaps you must point CURSES_CFLAGS to the correct curses.h.]) fi + CFLAGS="$CFLAGS $CURSES_CFLAGS" CXXFLAGS="$CXXFLAGS $CURSES_CFLAGS" LIBS="$LIBS $CURSES_LIBS" AC_CHECK_FUNCS([tigetstr]) + ;; + + netbsd-curses) + # NetBSD's curses can theoretically be detected by checking for + # ti_puts(), but since both netbsd-curses and ncurses can be + # installed, we want this to be an explicit setting. + AC_DEFINE(NETBSD_CURSES, 1, [Building against netbsd-curses]) + + CFLAGS="$CFLAGS $CURSES_CFLAGS" + CXXFLAGS="$CXXFLAGS $CURSES_CFLAGS" + LIBS="$LIBS $CURSES_LIBS" - if [[ x$INTERFACE = xnetbsd-curses ]]; then - # NetBSD's curses can act as a ncurses - # drop-in replacement and ships with a ncurses - # pkg-config file. Still we define a symbol since - # it's hard to detect at build-time. - AC_DEFINE(NETBSD_CURSES, 1, [Building against netbsd-curses]) + if [[ "x$CURSES_LIBS" = "x" ]]; then + # libncurses.pc is only shipped by Void Linux' fork, + # not in NetBSD itself. + AC_CHECK_LIB(curses, ti_puts, , [ + AC_MSG_ERROR([NetBSD's libcurses missing!]) + ]) + else + AC_MSG_CHECKING([checking for netbsd-curses (CURSES_LIBS)]) + AC_MSG_RESULT([$CURSES_LIBS]) + LIBS="$LIBS $CURSES_LIBS" fi + + AC_CHECK_FUNCS([tigetstr]) ;; xcurses) AC_CHECK_PROG(XCURSES_CONFIG, xcurses-config, xcurses-config) - AC_ARG_VAR(XCURSES_CFLAGS, [ - C compiler flags for XCurses, - overriding the autoconf check - ]) - if [[ "x$XCURSES_CFLAGS" = "x" -a "x$XCURSES_CONFIG" != "x" ]]; then - XCURSES_CFLAGS=`$XCURSES_CONFIG --cflags` + if [[ "x$CURSES_CFLAGS" = "x" -a "x$XCURSES_CONFIG" != "x" ]]; then + CURSES_CFLAGS=`$XCURSES_CONFIG --cflags` fi - CFLAGS="$CFLAGS $XCURSES_CFLAGS" - CXXFLAGS="$CXXFLAGS $XCURSES_CFLAGS" + CFLAGS="$CFLAGS $CURSES_CFLAGS" + CXXFLAGS="$CXXFLAGS $CURSES_CFLAGS" - AC_ARG_VAR(XCURSES_LIBS, [ - linker flags for XCurses, - overriding the autoconf check - ]) AC_MSG_CHECKING([checking for XCurses]) - if [[ "x$XCURSES_LIBS" = "x" -a "x$XCURSES_CONFIG" != "x" ]]; then - XCURSES_LIBS=`$XCURSES_CONFIG --libs` + if [[ "x$CURSES_LIBS" = "x" -a "x$XCURSES_CONFIG" != "x" ]]; then + CURSES_LIBS=`$XCURSES_CONFIG --libs` fi - if [[ "x$XCURSES_LIBS" = "x" ]]; then - AC_MSG_ERROR([libXCurses not configured correctly! - xcurses-config must be present or XCURSES_LIBS must be specified.]) + if [[ "x$CURSES_LIBS" = "x" ]]; then + AC_MSG_ERROR([libXCurses not configured correctly! xcurses-config must be present or CURSES_LIBS must be specified.]) fi - AC_MSG_RESULT([$XCURSES_LIBS]) - LIBS="$LIBS $XCURSES_LIBS" + AC_MSG_RESULT([$CURSES_LIBS]) + LIBS="$LIBS $CURSES_LIBS" # It is crucial to define XCURSES before including curses.h. AC_DEFINE(XCURSES, 1, [Enable PDCurses/XCurses extensions]) @@ -303,26 +357,17 @@ case $INTERFACE in ;; pdcurses*) - AC_ARG_VAR(PDCURSES_CFLAGS, [ - C compiler flags for PDCurses, - overriding the autoconf check - ]) - CFLAGS="$CFLAGS $PDCURSES_CFLAGS" - CXXFLAGS="$CXXFLAGS $PDCURSES_CFLAGS" + CFLAGS="$CFLAGS $CURSES_CFLAGS" + CXXFLAGS="$CXXFLAGS $CURSES_CFLAGS" - AC_ARG_VAR(PDCURSES_LIBS, [ - linker flags for PDCurses, - overriding the autoconf check - ]) - if [[ "x$PDCURSES_LIBS" = "x" ]]; then + if [[ "x$CURSES_LIBS" = "x" ]]; then AC_CHECK_LIB(pdcurses, PDC_get_version, , [ - AC_MSG_ERROR([libpdcurses missing! - Perhaps it is not named correctly or has wrong permissions.]) + AC_MSG_ERROR([libpdcurses missing!]) ]) else - AC_MSG_CHECKING([checking for PDCurses (PDCURSES_LIBS)]) - AC_MSG_RESULT([$PDCURSES_LIBS]) - LIBS="$LIBS $PDCURSES_LIBS" + AC_MSG_CHECKING([checking for PDCurses (CURSES_LIBS)]) + AC_MSG_RESULT([$CURSES_LIBS]) + LIBS="$LIBS $CURSES_LIBS" fi # It is crucial to define PDC_WIDE before including curses.h. @@ -349,8 +394,6 @@ case $INTERFACE in ;; esac - # AX_WITH_CURSES defines per-header symbols, but we currently - # demand that CPPFLAGS are set up such, that we can find curses.h anyway. AC_CHECK_HEADERS([curses.h], , [ AC_MSG_ERROR([Curses header missing!]) ]) @@ -361,7 +404,7 @@ case $INTERFACE in ;; gtk) - PKG_CHECK_MODULES(LIBGTK, [gtk+-3.0 >= 3.12], [ + TE_CHECK_MODULES(LIBGTK, [gtk+-3.0 >= 3.24], [ CFLAGS="$CFLAGS $LIBGTK_CFLAGS" CXXFLAGS="$CXXFLAGS $LIBGTK_CFLAGS" LIBS="$LIBS $LIBGTK_LIBS" @@ -410,10 +453,8 @@ AC_ARG_ENABLE(malloc-replacement, [malloc_replacement=$enableval], [malloc_replacement=check]) if [[ $malloc_replacement = check ]]; then # We currently do not support dlmalloc on Windows and Mac OS. - # It works on FreeBSD, but is slower than the polling fallback, - # it has been disabled by default. case $host in - *-*-*bsd* | *-*-darwin* | *-mingw*) malloc_replacement=no;; + *-*-darwin* | *-mingw*) malloc_replacement=no;; *) malloc_replacement=yes;; esac fi @@ -467,19 +508,11 @@ else esac fi -# This cannot be done with --enable-static as it only controls -# which kind of libraries libtool builds. -# Also, it cannot be controlled reliably by setting LDFLAGS for -# ./configure, as this would be used for linking the test cases -# without libtool and libtool would ignore it. -# It is only possible to call `make LDFLAGS="-all-static"` but -# this is inconvenient... -AC_ARG_ENABLE(static-executables, - AS_HELP_STRING([--enable-static-executables], - [Link in as many runtime dependencies as possible - statically [default=no]]), - [static_executables=$enableval], [static_executables=no]) -AM_CONDITIONAL(STATIC_EXECUTABLES, [test x$static_executables = xyes]) +AC_ARG_WITH(launcher, + AS_HELP_STRING([--with-launcher=LAUNCHER], + [Use the given launcher when executing SciTECO (e.g. wine)]), + [LAUNCHER=$withval], [LAUNCHER=]) +AC_SUBST(LAUNCHER) AC_CONFIG_FILES([GNUmakefile:Makefile.in src/GNUmakefile:src/Makefile.in] [src/interface-gtk/GNUmakefile:src/interface-gtk/Makefile.in] |
