bus: Raise file descriptor limit to match configuration
[platform/upstream/dbus.git] / configure.in
index c0a831b..e6b0fef 100644 (file)
@@ -2,8 +2,8 @@ dnl -*- mode: m4 -*-
 AC_PREREQ(2.52)
 
 m4_define([dbus_major_version], [1])
-m4_define([dbus_minor_version], [3])
-m4_define([dbus_micro_version], [2])
+m4_define([dbus_minor_version], [4])
+m4_define([dbus_micro_version], [3])
 m4_define([dbus_version],
           [dbus_major_version.dbus_minor_version.dbus_micro_version])
 AC_INIT(dbus, [dbus_version])
@@ -12,7 +12,9 @@ AC_CANONICAL_HOST
 AC_LIBTOOL_WIN32_DLL
 AC_LIBTOOL_RC
 
-AM_INIT_AUTOMAKE([1.9 tar-ustar])
+AC_CONFIG_MACRO_DIR([m4])
+
+AM_INIT_AUTOMAKE([1.9 tar-ustar -Wno-portability])
 AM_CONFIG_HEADER(config.h)
 
 # Honor aclocal flags
@@ -39,7 +41,7 @@ LT_CURRENT=8
 
 ## increment any time the source changes; set to
 ##  0 if you increment CURRENT
-LT_REVISION=1
+LT_REVISION=3
 
 ## increment if any interfaces have been added; set to 0
 ## if any interfaces have been changed or removed. removal has
@@ -135,8 +137,9 @@ AC_ARG_ENABLE(inotify, AS_HELP_STRING([--enable-inotify],[build with inotify sup
 AC_ARG_ENABLE(kqueue, AS_HELP_STRING([--enable-kqueue],[build with kqueue support]),enable_kqueue=$enableval,enable_kqueue=auto)
 AC_ARG_ENABLE(console-owner-file, AS_HELP_STRING([--enable-console-owner-file],[enable console owner file]),enable_console_owner_file=$enableval,enable_console_owner_file=auto)
 AC_ARG_ENABLE(userdb-cache, AS_HELP_STRING([--enable-userdb-cache],[build with userdb-cache support]),enable_userdb_cache=$enableval,enable_userdb_cache=yes)
+AC_ARG_ENABLE(launchd, AS_HELP_STRING([--enable-launchd],[build with launchd auto-launch support]),enable_launchd=$enableval,enable_launchd=auto)
 
-AC_ARG_WITH(xml, AS_HELP_STRING([--with-xml=[libxml/expat]],[XML library to use]))
+AC_ARG_WITH(xml, AS_HELP_STRING([--with-xml=[libxml/expat]],[XML library to use (libxml may be named libxml2 on some systems)]))
 AC_ARG_WITH(init-scripts, AS_HELP_STRING([--with-init-scripts=[redhat]],[Style of init scripts to install]))
 AC_ARG_WITH(session-socket-dir, AS_HELP_STRING([--with-session-socket-dir=[dirname]],[Where to put sockets for the per-login-session message bus]))
 AC_ARG_WITH(test-socket-dir, AS_HELP_STRING([--with-test-socket-dir=[dirname]],[Where to put sockets for make check]))
@@ -144,6 +147,7 @@ AC_ARG_WITH(system-pid-file, AS_HELP_STRING([--with-system-pid-file=[pidfile]],[
 AC_ARG_WITH(system-socket, AS_HELP_STRING([--with-system-socket=[filename]],[UNIX domain socket for systemwide daemon]))
 AC_ARG_WITH(console-auth-dir, AS_HELP_STRING([--with-console-auth-dir=[dirname]],[directory to check for console ownerhip]))
 AC_ARG_WITH(console-owner-file, AS_HELP_STRING([--with-console-owner-file=[filename]],[file whose owner determines current console owner]))
+AC_ARG_WITH(launchd-agent-dir, AS_HELP_STRING([--with-launchd-agent-dir=[dirname]],[directory to put the launchd agent (default: /Library/LaunchAgents)]))
 AC_ARG_WITH(dbus_user, AS_HELP_STRING([--with-dbus-user=<user>],[User for running the DBUS daemon (messagebus)]))
 AC_ARG_WITH(dbus_daemondir, AS_HELP_STRING([--with-dbus-daemondir=[dirname]],[Directory for installing the DBUS daemon]))
 
@@ -298,7 +302,7 @@ AC_MSG_CHECKING([32-bit integer type])
 
 case 4 in
 $ac_cv_sizeof_short)
-  dbusint32=int
+  dbusint32=short
   ;;
 $ac_cv_sizeof_int)
   dbusint32=int
@@ -528,6 +532,8 @@ closedir(dirp);
        fi
 fi
 
+AC_CHECK_HEADERS(sys/resource.h)
+
 AC_CHECK_HEADERS(dirent.h)
 
 AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])
@@ -690,6 +696,7 @@ AC_CACHE_CHECK([abstract socket namespace],
 #include <errno.h>
 ]],
 [[
+  size_t slen;
   int listen_fd;
   struct sockaddr_un addr;
 
@@ -704,9 +711,13 @@ AC_CACHE_CHECK([abstract socket namespace],
   memset (&addr, '\0', sizeof (addr));
   addr.sun_family = AF_UNIX;
   strcpy (addr.sun_path, "X/tmp/dbus-fake-socket-path-used-in-configure-test");
+  /* SUN_LEN uses strlen() so need to calculate it before adding \0 at the
+   * beginning.
+   */
+  slen = SUN_LEN(&addr);
   addr.sun_path[0] = '\0'; /* this is what makes it abstract */
 
-  if (bind (listen_fd, (struct sockaddr*) &addr, SUN_LEN (&addr)) < 0)
+  if (bind (listen_fd, (struct sockaddr*) &addr, slen) < 0)
     {
        fprintf (stderr, "Abstract socket namespace bind() failed: %s\n",
                 strerror (errno));
@@ -922,6 +933,38 @@ fi
 
 AM_CONDITIONAL(DBUS_BUS_ENABLE_KQUEUE, test x$have_kqueue = xyes)
 
+# launchd checks
+if test x$enable_launchd = xno ; then
+    have_launchd=no
+else
+    have_launchd=yes
+    AC_CHECK_HEADER([launch.h], , have_launchd=no)
+    AC_PATH_PROG([LAUNCHCTL], [launchctl])
+    if test "x$LAUNCHCTL" = "x"; then
+        have_launchd=no
+    fi
+
+    if test x$enable_launchd = xyes && test x$have_launchd = xno ; then
+        AC_MSG_ERROR([launchd support explicitly enabled but not available])
+    fi
+fi
+
+dnl check if launchd is enabled
+if test x$have_launchd = xyes; then
+    AC_DEFINE(DBUS_ENABLE_LAUNCHD,1,[Use launchd autolaunch])
+fi
+
+AM_CONDITIONAL(DBUS_ENABLE_LAUNCHD, test x$have_launchd = xyes)
+
+#### Directory to place launchd agent file
+if test "x$with_launchd_agent_dir" = "x"; then
+   LAUNCHD_AGENT_DIR="/Library/LaunchAgents"
+else
+   LAUNCHD_AGENT_DIR="$with_launchd_agent_dir"
+fi
+
+AC_SUBST(LAUNCHD_AGENT_DIR)
+
 dnl console owner file
 if test x$enable_console_owner_file = xno ; then
     have_console_owner_file=no;
@@ -1002,7 +1045,7 @@ AC_SUBST(DBUS_CLIENT_CFLAGS)
 AC_SUBST(DBUS_CLIENT_LIBS)
 
 DBUS_BUS_CFLAGS="$XML_CFLAGS"
-DBUS_BUS_LIBS="$XML_LIBS $SELINUX_LIBS $INTLLIBS $THREAD_LIBS $ADT_LIBS $NETWORK_libs"
+DBUS_BUS_LIBS="$XML_LIBS $SELINUX_LIBS $THREAD_LIBS $ADT_LIBS $NETWORK_libs"
 AC_SUBST(DBUS_BUS_CFLAGS)
 AC_SUBST(DBUS_BUS_LIBS)
 
@@ -1049,17 +1092,13 @@ fi
 #### gcc warning flags
 
 cc_supports_flag() {
-  AC_MSG_CHECKING(whether $CC supports "$@")
-  Cfile=/tmp/foo${$}
-  touch ${Cfile}.c
-  $CC -c "$@" ${Cfile}.c -o ${Cfile}.o >/dev/null 2>&1
-  rc=$?
-  rm -f ${Cfile}.c ${Cfile}.o
-  case $rc in
-    0) AC_MSG_RESULT(yes);;
-    *) AC_MSG_RESULT(no);;
-  esac
-  return $rc
+  AC_MSG_CHECKING(whether $CC supports "$*")
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$*"
+  AC_TRY_COMPILE([], [], [rc=yes], [rc=no])
+  CFLAGS="$save_CFLAGS"
+  AC_MSG_RESULT([$rc])
+  test "x$rc" = xyes
 }
 
 ld_supports_flag() {
@@ -1138,7 +1177,7 @@ if test "x$GCC" = "xyes"; then
 
   case " $CFLAGS " in
   *[\ \        ]-Wfloat-equal[\ \      ]*) ;;
-  *) if cc_supports_flag -Wfloat-equals; then
+  *) if cc_supports_flag -Wfloat-equal; then
         CFLAGS="$CFLAGS -Wfloat-equal"
      fi
      ;;
@@ -1270,11 +1309,10 @@ AC_SUBST(SECTION_FLAGS)
 AC_SUBST(SECTION_LDFLAGS)
 AC_MSG_RESULT($ac_gcsections)
 
-# Add -D_POSIX_PTHREAD_SEMANTICS if on Solaris
-#
 case $host_os in
     solaris*)
-       CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS" ;;
+        # Solaris' C library apparently needs these runes to be threadsafe...
+        CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT"
 esac
 
 changequote(,)dnl
@@ -1311,7 +1349,7 @@ if test x$enable_doxygen_docs = xyes; then
 fi
 
 AM_CONDITIONAL(DBUS_DOXYGEN_DOCS_ENABLED, test x$enable_doxygen_docs = xyes)
-AC_MSG_RESULT(yes)
+AC_MSG_RESULT($enable_doxygen_docs)
 
 ### XML Documentation
 
@@ -1340,7 +1378,15 @@ if test x$enable_xml_docs = xyes; then
 fi
 
 AM_CONDITIONAL(DBUS_XML_DOCS_ENABLED, test x$enable_xml_docs = xyes)
-AC_MSG_RESULT(yes)
+AC_MSG_RESULT($enable_xml_docs)
+
+AC_PATH_PROG([MAN2HTML], [man2html])
+AC_ARG_VAR([MAN2HTML], [Path to man2html (optional)])
+AM_CONDITIONAL(DBUS_HAVE_MAN2HTML, test x$MAN2HTML != x)
+
+AM_CONDITIONAL(DBUS_CAN_UPLOAD_DOCS,
+    test x$enable_doxygen_docs = xyes -a x$enable_xml_docs = xyes -a \
+         x$MAN2HTML != x)
 
 #### Have to go $localstatedir->$prefix/var->/usr/local/var
 
@@ -1388,8 +1434,10 @@ AM_CONDITIONAL(DBUS_INIT_SCRIPTS_CYGWIN, test x$with_init_scripts = xcygwin)
 AC_ARG_WITH([systemdsystemunitdir],
 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
         [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
-AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
-AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir"])
+if test "x$with_systemdsystemunitdir" != xno; then
+   AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+fi
+AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
 
 ##### Set up location for system bus socket
 if ! test -z "$with_system_socket"; then
@@ -1531,6 +1579,8 @@ else
    DEFAULT_SOCKET_DIR=/tmp
 fi
 
+DEFAULT_SOCKET_DIR=`echo $DEFAULT_SOCKET_DIR | sed 's/+/%2B/g'`
+
 if ! test -z "$with_test_socket_dir" ; then
    TEST_SOCKET_DIR="$with_test_socket_dir"
 else
@@ -1549,6 +1599,8 @@ AC_SUBST(DBUS_SESSION_SOCKET_DIR)
 
 if test x$dbus_win = xyes; then
         DBUS_SESSION_BUS_DEFAULT_ADDRESS="nonce-tcp:"
+elif test x$have_launchd = xyes; then
+        DBUS_SESSION_BUS_DEFAULT_ADDRESS="launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET"
 else
         DBUS_SESSION_BUS_DEFAULT_ADDRESS="unix:tmpdir=$DBUS_SESSION_SOCKET_DIR"
 fi
@@ -1574,8 +1626,8 @@ bus/system.conf
 bus/session.conf
 bus/messagebus
 bus/messagebus-config
+bus/org.freedesktop.dbus-session.plist
 bus/rc.messagebus
-bus/dbus-daemon.1
 bus/dbus.service
 bus/dbus.socket
 Makefile
@@ -1585,6 +1637,7 @@ tools/Makefile
 test/Makefile
 test/name-test/Makefile
 doc/Makefile
+doc/dbus-daemon.1
 dbus-1.pc
 test/data/valid-config-files/debug-allow-all.conf
 test/data/valid-config-files/debug-allow-all-sha1.conf
@@ -1626,8 +1679,9 @@ echo "
        64-bit int:               ${DBUS_INT64_TYPE}
        32-bit int:               ${DBUS_INT32_TYPE}
        16-bit int:               ${DBUS_INT16_TYPE}
-        Doxygen:                  ${DOXYGEN}
-        xmlto:                    ${XMLTO}"
+        Doxygen:                  ${DOXYGEN:-not found}
+        xmlto:                    ${XMLTO:-not found}
+        man2html:                 ${MAN2HTML:-not found}"
 
 echo "
         Maintainer mode:          ${USE_MAINTAINER_MODE}
@@ -1644,7 +1698,7 @@ echo "
         Building Doxygen docs:    ${enable_doxygen_docs}
         Building XML docs:        ${enable_xml_docs}
         Building cache support:   ${enable_userdb_cache}
-        Gettext libs (empty OK):  ${INTLLIBS}
+        Building launchd support: ${have_launchd}
         Using XML parser:         ${with_xml}
         Init scripts style:       ${with_init_scripts}
         Abstract socket names:    ${ac_cv_have_abstract_sockets}
@@ -1659,6 +1713,10 @@ echo "
        Session bus services dir: ${EXPANDED_DATADIR}/dbus-1/services
         'make check' socket dir:  ${TEST_SOCKET_DIR}
 "
+if test x$have_launchd = xyes; then
+        echo "        launchd agent dir:        ${LAUNCHD_AGENT_DIR}"
+fi
+echo
 
 if test x$enable_tests = xyes; then
         echo "NOTE: building with unit tests increases the size of the installed library and renders it insecure."