XDG Compliant user (early) packages tree.
[sxemacs] / configure.ac
index b60d62b..766f76f 100644 (file)
@@ -31,7 +31,7 @@ AC_COPYRIGHT(
 #### Copyright (C) 2005 Malcolm Purvis.
 #### Copyright (C) 2005, 2006, 2007 Steve Youngs.
 #### Copyright (C) 2006, 2007, 2008 Sebastian Freundt.
-#### Copyright (C) 2007, 2010, 2011 Nelson Ferreira
+#### Copyright (C) 2007, 2010, 2011, 2012 Nelson Ferreira
 
 ### Don't edit this script!
 ### This script was automatically generated by the `autoconf' program
@@ -178,7 +178,7 @@ OG_ARG_WITH([package-prefix],
        AS_HELP_STRING([--with-package-prefix=PATH],
                [What to use as a prefix to the system-wide package
                directories.  It doesn't affect the package directories
-               under ~/.sxemacs, and is totally ignored if
+               under the user's home directory, and is totally ignored if
                --with-package-path is set.
                Normally, you would not need to set this.]),
        [none], [None], [og_any],
@@ -333,6 +333,7 @@ OG_MULTIARG_WITH([modules], [dnl
        [all], [all], [dnl
        OG_MULTIARG_ITEM([ase], [ase], [algebraic structures])
        OG_MULTIARG_ITEM([cl], [cl], [fast Common Lisp implementation])
+       OG_MULTIARG_ITEM([dbus], [dbus], [D-BUS bindings])
 ])
 
 OG_MULTIARG_WITH([static-modules], [dnl
@@ -344,11 +345,9 @@ OG_MULTIARG_WITH([static-modules], [dnl
        [none], [NONE], [dnl
        OG_MULTIARG_ITEM([ase], [ase], [algebraic structures])
        OG_MULTIARG_ITEM([cl], [cl], [fast Common Lisp implementation])
+       OG_MULTIARG_ITEM([dbus], [dbus], [D-BUS bindings])
 ])
 
-dnl _OG_MULTIARG_ITEM([ent], [int], [int], [native integer arithmetics])
-dnl _OG_MULTIARG_ITEM([ent], [fpfloat], [fpfloat], [native fixed precision floats])
-dnl _OG_MULTIARG_ITEM([ent], [indef], [indef], [abstract indefinites])
 OG_MULTIARG_WITH([ent], [dnl
        AS_HELP_STRING([--with-ent], [
                Compile in support for enhanced number types,
@@ -551,6 +550,27 @@ OG_ARG_WITH([ncurses],
                [Use the ncurses library for tty support.]),
        [auto], [Autodetect])
 
+OG_ARG_WITH([curses],
+       AS_HELP_STRING([--with-curses],
+               [Use the curses library for tty support.]),
+       [auto], [Autodetect])
+
+OG_ARG_WITH([terminfo],
+       AS_HELP_STRING([--with-terminfo],
+               [Use the terminfo library for tty support.]),
+       [auto], [Autodetect])
+
+OG_ARG_WITH([termlib],
+       AS_HELP_STRING([--with-termlib],
+               [Use the termlib library for tty support.]),
+       [auto], [Autodetect])
+
+OG_ARG_WITH([termcap],
+       AS_HELP_STRING([--with-termcap],
+               [Use the termcap library for tty support.]),
+       [auto], [Autodetect])
+
+
 OG_ARG_WITH([gpm],
        AS_HELP_STRING([--with-gpm],
                [Compile in GPM mouse support for ttys.]),
@@ -600,23 +620,16 @@ OG_MULTIARG_WITH([image], [dnl
 OG_MULTIARG_WITH([sound], [dnl
        AS_HELP_STRING([--with-sound=TYPE],
                [Compile with sound support.])],
-       [auto], [Autodetect all sound support (except Pulse)], [dnl
+       [auto], [Autodetect all sound support], [dnl
        OG_MULTIARG_ITEM([alsa], [ALSA], [kernel-based linux sound standard])
        OG_MULTIARG_ITEM([ao], [ao], [generic audio output layer])
        OG_MULTIARG_ITEM([esd], [ESD], [Enlightenment Sound Daemon])
        OG_MULTIARG_ITEM([jack], [Jack], [a low-latency audio server])
        OG_MULTIARG_ITEM([nas], [NAS], [Network Audio System])
        OG_MULTIARG_ITEM([oss], [OSS], [Open Sound System])
+       OG_MULTIARG_ITEM([pulse], [PulseAudio], [PulseAudio Sound Server])
 ])
 
-OG_ARG_WITH([pulseaudio],
-       AS_HELP_STRING([--with-pulseaudio],
-               [Compile with support for the PulseAudio audio server.
-               This has been turned off by default because of too many
-               bugs in recent versions of PA.  Use at your own risk,
-               YMMV, and all that.]),
-       [no], [NO])
-
 OG_MULTIARG_WITH([media], [dnl
        AS_HELP_STRING([--with-media=TYPE],
                [Compile with media stream support.])],
@@ -740,9 +753,8 @@ dnl
 ## -------------------------------------------------------------------------
 ## Check for users who regularly forget about running autoconf
 ## -------------------------------------------------------------------------
-if test -f $0.ac -a $0.ac -nt $0; then
-       AC_MSG_ERROR([What are you doing? RUN autoreconf NOW!!!])
-fi
+AS_IF([test -f "$0.ac" -a "$0.ac" -nt "$0"],
+   AC_MSG_ERROR([What are you doing? RUN autoreconf NOW!!!]))
 
 #
 # Turn off core generation. We are already verifying the program fails, no need
@@ -787,6 +799,7 @@ dnl -------------------------------------------------------------------------
 SXE_CHECK_COMMAND_LINE
 
 AM_INIT_AUTOMAKE([foreign -Wall])
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
 SXE_CHECK_BUILDCHAIN
 AC_SUBST(EGREP)
 
@@ -810,22 +823,16 @@ AC_CHECK_PROG([have_git], [git], [yes], [no])
 AC_MSG_CHECKING([for SXEmacs version])
 AC_MSG_RESULT([SXEmacs SXEM4CS_VERSION])
 dnl Must do the following first to determine verbosity for AC_DEFINE
-if test -n "[]SXEM4CS_BETA_P[]"; then
-       beta=yes
-else
-       beta=no
-fi
+AS_IF([test -n "[]SXEM4CS_BETA_P[]"],beta=yes,beta=no)
 : "${extra_verbose=$beta}"
 
 AC_MSG_CHECKING([for SXEmacs patchlevel])
 CURDIR=$(pwd)
 cd "$sxe_srcdir"
-if test "$have_git" = "yes"; then
-       sxemacs_git_version="$(git describe | head -1)"
-fi
-if test -z "$sxemacs_git_version" ; then
-       sxemacs_git_version="[]SXEM4CS_GIT_VERSION[]"
-fi
+AS_IF([test "$have_git" = "yes"], 
+           [sxemacs_git_version=`git describe 2> /dev/null | head -1`])
+AS_IF([test -z "$sxemacs_git_version"],
+       sxemacs_git_version="[]SXEM4CS_GIT_VERSION[]")
 AC_MSG_RESULT([$sxemacs_git_version])
 version="$sxemacs_git_version"
 cd "$CURDIR"
@@ -1250,9 +1257,8 @@ SXE_CHECK_FILE_LOCK
 
 case "$opsys" in decosf*)
        AC_CHECK_LIB([pthreads], [cma_open])
-       if test "$ac_cv_lib_pthreads_cma_open" = "yes"; then
-               c_switch_site="$c_switch_site -threads"
-       fi
+       AS_IF([test "$ac_cv_lib_pthreads_cma_open" = "yes"],
+               c_switch_site="$c_switch_site -threads")
        ;;
 esac
 
@@ -1674,7 +1680,12 @@ dnl Check for POSIX functions.
 dnl ----------------------------------------------------------------
 
 SXE_CHECK_BASIC_FUNS
-AC_CHECK_FUNCS([alarm cbrt closedir dup2 eaccess endpwent floor fmod fpathconf frexp fsync ftime ftruncate getaddrinfo getcwd gethostbyname gethostname getnameinfo getpagesize getrlimit gettimeofday getwd isascii link logb lrand48 matherr memchr memmove memset mkdir mktime munmap perror poll pow putenv random re_comp readlink regcomp rename res_init rint rmdir select setitimer setlocale setpgid setsid sigblock sighold sigprocmask snprintf socket sqrt stpcpy strcasecmp strchr strdup strerror strlwr strrchr strspn strtol strupr symlink tzset ulimit umask uname usleep utime vlimit vsnprintf waitpid wcscmp wcslen])
+AC_CHECK_FUNCS([alarm cbrt closedir dup2 eaccess endpwent floor fmod fpathconf frexp fsync ftime ftruncate getaddrinfo getcwd gethostbyname gethostname getnameinfo getpagesize getrlimit gettimeofday getwd isascii isatty link logb lrand48 matherr memchr memmove memset mkdir mktime munmap perror poll pow putenv random re_comp readlink regcomp rename res_init rint rmdir select setitimer setlocale setpgid setsid sigblock sighold sigprocmask snprintf socket sqrt stpcpy strncpy strncat strcasecmp strchr strdup strerror strlwr strrchr strspn strtol strupr symlink ttyname tzset ulimit umask uname usleep utime vlimit vsnprintf waitpid wcscmp wcslen])
+
+AS_IF([test "$have_isatty" = "yes"],
+       AC_DEFINE([HAVE_ISATTY], [1], [isatty is available]))
+AS_IF([test "$have_ttyname" = "yes"],
+       AC_DEFINE([HAVE_TTYNAME], [1], [ttyname is available]))
 
 
 ## combines all these time structures and funs
@@ -1798,8 +1809,24 @@ else
                AC_MSG_WARN([Sorry no bison means no cl module for you.])
        fi
 fi
+
 SXE_EMOD_STATMOD([cl])
 
+dnl D-Bus
+SXE_CHECK_DBUS
+if test "$have_dbus" = "yes"; then
+       if test "$with_modules_dbus" = "yes"; then
+               have_modules_dbus=yes
+       fi
+       if test "$with_static_modules_dbus" = "yes"; then
+               have_static_modules_dbus=yes
+       fi
+else
+       AC_MSG_WARN([I cannot believe you do not have d-bus.])
+fi
+
+SXE_EMOD_STATMOD([dbus])
+
 AM_CONDITIONAL([AUTARKIC], [test "0" = "1"])
 MODARCHDIR=
 MAKE_DOCFILE="$sxe_blddir/lib-src/make-docfile"
@@ -2375,9 +2402,8 @@ if test "$with_x11" = "yes"; then
        dnl Avoid version mismatch for shared library libXm.so on osf4
        case "$opsys" in
        decosf*)
-               if test "$GCC" = yes -a -d "/usr/shlib"; then
-                       SXE_APPEND([-L/usr/shlib], [X_LIBS]);
-               fi
+               AS_IF([test "$GCC" = yes -a -d "/usr/shlib"],
+                       SXE_APPEND([-L/usr/shlib], [X_LIBS]))
                ;;
        esac
 
@@ -2555,11 +2581,6 @@ fi
 
 dnl Test for features that require X11 support
 if test "$with_x11" != "yes"; then
-  dnl It ought to be reasonable to have no output device at all, and only use
-  dnl SXEmacs in --batch mode.
-  dnl if test "$with_tty" = "no" ; then
-  dnl   AC_MSG_ERROR([No window system support and no TTY support - Unable to proceed.])
-  dnl fi
   for feature in offix wmcommand xim xmu nas_sound
   do
     if eval "test -n \"\$with_${feature}\" -a \"\$with_${feature}\" != no" ; then
@@ -2693,17 +2714,64 @@ dnl ---------------------
 dnl checks for header files
 AC_CHECK_HEADERS([libintl.h nlist.h sgtty.h termio.h termios.h])
 
-if test "$with_tty" != "no"  ; then
-       AS_MESSAGE(checking for TTY-related features)
-       AC_DEFINE([HAVE_TTY], [1], [Description here!])
-       AC_DEFINE([HAVE_UNIXOID_EVENT_LOOP], [1], [Description here!])
-       SXE_ADD_SXEUITTY_OBJS([console-tty.o device-tty.o event-tty.o frame-tty.o objects-tty.o redisplay-tty.o cm.o])
+AS_IF([test "$with_tty" != "no"],[
+   AS_MESSAGE(checking for TTY-related features)
+   dnl Check if needed calls are available at all...
+   tty_libs="ncurses curses terminfo termlib termcap"
+   tty_funcs="tgetent tgetstr tgetflag tparm tgoto tputs"
+   for func in $tty_funcs; do
+       AC_SEARCH_LIBS($func,$tty_libs)
+   done
+   AS_IF([test "$ac_cv_search_tgetent"  = "no" -a \
+              "$ac_cv_search_tgetflag" = "no" -a \
+              "$ac_cv_search_tgetstr"  = "no" -a \
+              "$ac_cv_search_tgoto"    = "no" -a \
+              "$ac_cv_search_tparm"    = "no" -a \
+              "$ac_cv_search_tputs"    = "no" ], 
+                  have_tty=no)
+   AS_IF([test "$with_tty" = "yes" -a "$have_tty" = "no" ],[
+      AC_MSG_ERROR([Your system lacks necessary functions for requested TTY support])])
+],[
+  for feature in ncurses curses termcap terminfo termlib gpm; do
+    if eval "test -n \"\$with_${feature}\" -a \"\$with_${feature}\" != no" ; then
+      AC_MSG_WARN([--with-${feature} ignored:  Not valid without TTY support])
+    fi
+    eval "with_${feature}=no"
+  done
+])
+
+AS_IF([test "$with_tty" != "no" -a "$have_tty" != "no" ],[
+   for lib in $tty_libs; do 
+      SXE_CHECK_LINK_LIB($lib, , eval have_${lib}=no)
+      with_lib_eval=`eval echo \\$with_$lib`
+      have_lib_eval=`eval echo \\$have_$lib`
+      AS_IF([test "$have_lib_eval" = "yes" ], [
+        for func in $tty_funcs; do
+            AC_CHECK_LIB($lib, tgetent)
+            AC_CHECK_LIB($lib, tgetstr)
+            AC_CHECK_LIB($lib, tgetflags)
+            AC_CHECK_LIB($lib, tparm)
+            AC_CHECK_LIB($lib, tgoto)
+            AC_CHECK_LIB($lib, tputs)
+        done
+      ])
+      have_lib_eval=`eval echo \\$have_$lib`
+      AS_IF([test "$with_lib_eval" = "yes" -a \
+                 "$have_lib_eval" = "no" ],
+       AC_MSG_WARN([Errors detected trying to use requested $lib. Continuing with autodetection.]))
+   done
+   AS_IF([test "$sxe_cv_c_lib_ncurses"  = "no" -a \
+               "$sxe_cv_c_lib_curses"   = "no" -a \
+              "$sxe_cv_c_lib_termcap"  = "no" -a \
+              "$sxe_cv_c_lib_terminfo" = "no" -a \
+              "$sxe_cv_c_lib_termlib"  = "no"], 
+                  have_tty=no)
+   AS_IF([test "$with_tty" = "yes" -a "$have_tty" = "no"],
+      AC_MSG_ERROR([Your system lacks necessary libraries for requested TTY support.]))
+])
 
-  dnl Autodetect ncurses.
-  AC_CHECK_LIB(ncurses, tgetent, , with_ncurses=no)
-  AC_CHECK_LIB(ncurses, tgetstr, , with_ncurses=no)
-  AC_CHECK_LIB(ncurses, tparm, , with_ncurses=no)
-  if test "$with_ncurses" != "no"; then
+
+AS_IF([test "$with_tty" != "no" -a "$have_tty" != "no" ],[
     AC_DEFINE([HAVE_NCURSES], [1], [Description here!])
     with_ncurses=yes
     AC_CHECK_HEADER(ncurses/ncurses.h, curses_h_file=ncurses/ncurses.h)
@@ -2744,7 +2812,9 @@ if test "$with_tty" != "no"  ; then
        else c_switch_site="$save_c_switch_site"
       fi
     fi
-  fi
+])
+
+AS_IF([test "$with_tty" != "no" -a "$have_ncurses" != "no" ],[
   if test "$with_ncurses" = "no" -o -z "$curses_h_file" ; then
 
     # Check alternate library includes
@@ -2778,32 +2848,36 @@ if test "$with_tty" != "no"  ; then
   AC_DEFINE_UNQUOTED([CURSES_H_FILE], ["${curses_h_file-curses.h}"], [The curses.h header file])
   AC_DEFINE_UNQUOTED([TERMCAP_H_FILE], ["${termcap_h_file-termcap.h}"], [The termcap.h header file])
   AC_DEFINE_UNQUOTED([TERM_H_FILE], ["${term_h_file-term.h}"], [The term.h header file])
+])
 
+AS_IF([test "$with_tty" != "no" -a "$have_tty" != no], [
+       AC_DEFINE([HAVE_TTY], [1], [Include TTY support for SXEmacs])
+       AC_DEFINE([HAVE_UNIXOID_EVENT_LOOP], [1], [Include Unixoid event loop - TTY provided])
+       SXE_ADD_SXEUITTY_OBJS([console-tty.o device-tty.o event-tty.o frame-tty.o objects-tty.o redisplay-tty.o cm.o])
+])
+AS_IF([test "$with_tty" != "no" -a "$have_tty" != no], [
   dnl General Purpose Mouse (libgpm) support
-  if test "$with_gpm" != "no"; then
+  AS_IF([test "$with_gpm" != "no"], [
     AC_CHECK_HEADER(gpm.h, [
       AC_CHECK_LIB(gpm, Gpm_Open, have_gpm=yes)])
-    if test "$have_gpm" = "yes"; then
+    AS_IF([test "$have_gpm" = "yes"], [
       with_gpm=yes
       AC_DEFINE([HAVE_GPM], [1], [General Purpose Mouse (libgpm) is available])
       SXE_ADD_SXEUITTY_OBJS(gpmevent.o)
-      SXE_PREPEND(-lgpm, LIBS)
-    else
-      with_gpm=no
-    fi
-  fi
-
-else dnl "$with_tty" = "no"
-  for feature in ncurses gpm; do
-    if eval "test -n \"\$with_${feature}\" -a \"\$with_${feature}\" != no" ; then
-      AC_MSG_WARN([--with-${feature} ignored:  Not valid without TTY support])
-    fi
-    eval "with_${feature}=no"
-  done
-fi dnl with_tty
+      SXE_PREPEND(-lgpm, LIBS) ],[ with_gpm=no ])
+  ])
+])
 
 SXE_CHECK_UI_SUFFICIENCY
 
+AS_IF([test -z "$window_system" -o "$window_system" = "none" ], [
+    dnl It ought to be reasonable to have no output device at all, and only use
+    dnl SXEmacs in --batch mode.
+    AS_IF([test "$have_tty" = "no"],
+       AC_MSG_ERROR([No window system nor TTY support. SXEmacs cannot be compiled.
+Check INSTALL and PROBLEMS files for hints on how to solve.]))
+])
+
 ## Uncertain options
 ## =================
 echo
@@ -2993,7 +3067,6 @@ fi
 
 dnl sox support
 if test "$with_media_sox" != "no"; then
-       ## defines $LIBST_CONFIG
        SXE_MM_CHECK_SOX([have_media_sox=yes], [have_media_sox=no])
 
        AC_MSG_CHECKING([for sufficient SoX support])
@@ -3098,24 +3171,18 @@ if test "$with_sound_esd" != "no"; then
 fi
 
 dnl PulseAudio Sound support
-if test "$with_pulseaudio" != "no"; then
+if test "$with_sound_pulse" != "no"; then
        SXE_MM_CHECK_PULSE([have_sound_pulse=yes], [have_sound_pulse=no])
 
        AC_MSG_CHECKING([for sufficient PulseAudio support])
        if test "$have_sound_pulse" = "yes"; then
                AC_MSG_RESULT([yes])
-               PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse`
-               pulse_version=`$PKG_CONFIG --modversion libpulse`
-               pulse_major_version=0
-               pulse_minor_version=`echo $pulse_version | \
-                       sed -e "s/0\.\([[0-9]]*\).*/\1/"`
                need_internal_media=yes
                SXE_ADD_MM_OBJS([sound-pulse.o])
-               SXE_PREPEND($PULSEAUDIO_LIBS, MM_LIBS)
+               SXE_PREPEND($PULSE_LIBS, MM_LIBS)
+               SXE_PREPEND_UNDUP($PULSE_CFLAGS, MM_CPPFLAGS)
                AC_DEFINE([HAVE_PULSE_SOUND], [1],
                        [Whether to put in support for PulseAudio.])
-               AC_DEFINE_UNQUOTED([PULSE_VERSION], [$pulse_minor_version],
-                       [Version of the underlying pulse lib.])
        else
                AC_MSG_RESULT(no)
                have_sound_pulse=no
@@ -3495,19 +3562,6 @@ int main(int c, char *v[])
        [have_setitimer=$?],[have_setitimer=0])
 AM_CONDITIONAL([HAVE_SETITIMER], [test "$have_setitimer" = "1"])
 
-## whether to build with sheap.o
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-int main(int c, char *v[])
-{
-#if defined(HEAP_IN_DATA) && !defined(PDUMP)
-       return 1;
-#else
-       return 0;
-#endif
-}]])], [./conftest; build_sheap=$?],
-       [build_sheap=$?],[build_sheap=0])
-AM_CONDITIONAL([BUILD_SHEAP], [test "$build_sheap" = "1"])
-
 
 dnl There are no more compile tests; remove the core they created.
 rm -f core