[Xfce4-commits] [xfce/xfce4-power-manager] 01/01: Make conditional checks conditional (Bug 9243)

noreply at xfce.org noreply at xfce.org
Sun Jun 1 14:22:17 CEST 2014


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository xfce/xfce4-power-manager.

commit af69bc562f1f7dbc8f94e246779beb7a8bb45904
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Sun Jun 1 15:18:39 2014 +0300

    Make conditional checks conditional (Bug 9243)
    
    The configure.ac.in script uses AC_CHECK_HEADERS for a ton of
    things but the source files don't use those conditionals. This
    patch adds those. This should fix building on GNU/Hurd.
---
 configure.ac.in             |    7 ++++---
 src/egg-idletime.c          |    4 ++++
 src/xfpm-backlight-helper.c |    8 ++++++++
 src/xfpm-backlight.c        |    7 ++++++-
 src/xfpm-battery.c          |    4 ++++
 src/xfpm-button.c           |    4 ++++
 src/xfpm-console-kit.c      |    4 ++++
 src/xfpm-disks.c            |    4 ++++
 src/xfpm-dpms.c             |    4 ++++
 src/xfpm-inhibit.c          |    4 ++++
 src/xfpm-kbd-backlight.c    |    4 ++++
 src/xfpm-main.c             |    4 ++++
 src/xfpm-manager.c          |    4 ++++
 src/xfpm-polkit.c           |   17 +++++++++++++++--
 src/xfpm-power.c            |    5 ++++-
 src/xfpm-suspend.c          |    8 ++++++++
 src/xfpm-systemd.c          |    4 ++++
 src/xfpm-xfconf.c           |    4 ++++
 18 files changed, 93 insertions(+), 7 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index 26d1342..6cddda9 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -35,9 +35,10 @@ LT_INIT([disable-static])
 #   Check for headers needed for standard interfaces   #
 # ==================================================== #
 AC_HEADER_STDC()
-AC_CHECK_HEADERS([errno.h signal.h stddef.h sys/types.h memory.h stdlib.h \
-                  string.h sys/stat.h sys/types.h sys/wait.h time.h       \
-                  unistd.h sys/resource.h sys/socket.h sys/sysctl.h unistd.h])
+AC_CHECK_HEADERS([errno.h signal.h stddef.h sys/types.h memory.h stdlib.h   \
+                  string.h sys/stat.h sys/user.h sys/wait.h time.h math.h   \
+                  unistd.h sys/resource.h sys/socket.h sys/sysctl.h fcntl.h \
+                  sys/param.h procfs.h])
 
 AC_CHECK_FUNCS([getpwuid setsid sigaction])
 
diff --git a/src/egg-idletime.c b/src/egg-idletime.c
index 2c6b2a8..2c04be7 100644
--- a/src/egg-idletime.c
+++ b/src/egg-idletime.c
@@ -30,8 +30,12 @@
 #include <gdk/gdk.h>
 
 #include <stdio.h>
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
 #include <string.h>
+#endif
 
 #include "egg-idletime.h"
 
diff --git a/src/xfpm-backlight-helper.c b/src/xfpm-backlight-helper.c
index f52bb52..e94b142 100644
--- a/src/xfpm-backlight-helper.c
+++ b/src/xfpm-backlight-helper.c
@@ -21,12 +21,20 @@
 
 #include "config.h"
 
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <glib-object.h>
+#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
 #include <fcntl.h>
+#ifdef HAVE_STRING_H
 #include <string.h>
+#endif
 #include <stdio.h>
 
 #define GCM_BACKLIGHT_HELPER_EXIT_CODE_SUCCESS			0
diff --git a/src/xfpm-backlight.c b/src/xfpm-backlight.c
index 1bff0a6..9b75be3 100644
--- a/src/xfpm-backlight.c
+++ b/src/xfpm-backlight.c
@@ -23,10 +23,15 @@
 #endif
 
 #include <stdio.h>
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
 #include <string.h>
-
+#endif
+#ifdef HAVE_MATH_H
 #include <math.h>
+#endif
 
 #include <gtk/gtk.h>
 #include <libxfce4util/libxfce4util.h>
diff --git a/src/xfpm-battery.c b/src/xfpm-battery.c
index ff14865..15691d8 100644
--- a/src/xfpm-battery.c
+++ b/src/xfpm-battery.c
@@ -23,8 +23,12 @@
 #endif
 
 #include <stdio.h>
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
 #include <string.h>
+#endif
 
 #include <gtk/gtk.h>
 #include <upower.h>
diff --git a/src/xfpm-button.c b/src/xfpm-button.c
index b7023bf..d894d0d 100644
--- a/src/xfpm-button.c
+++ b/src/xfpm-button.c
@@ -30,8 +30,12 @@
 #endif
 
 #include <stdio.h>
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
 #include <string.h>
+#endif
 
 #include <X11/X.h>
 #include <X11/XF86keysym.h>
diff --git a/src/xfpm-console-kit.c b/src/xfpm-console-kit.c
index cbf9784..1796949 100644
--- a/src/xfpm-console-kit.c
+++ b/src/xfpm-console-kit.c
@@ -23,8 +23,12 @@
 #endif
 
 #include <stdio.h>
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
 #include <string.h>
+#endif
 
 #include <dbus/dbus-glib.h>
 
diff --git a/src/xfpm-disks.c b/src/xfpm-disks.c
index 354a9c6..f68e713 100644
--- a/src/xfpm-disks.c
+++ b/src/xfpm-disks.c
@@ -23,8 +23,12 @@
 #endif
 
 #include <stdio.h>
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
 #include <string.h>
+#endif
 
 #include <dbus/dbus-glib.h>
 
diff --git a/src/xfpm-dpms.c b/src/xfpm-dpms.c
index 32d682d..0bd5771 100644
--- a/src/xfpm-dpms.c
+++ b/src/xfpm-dpms.c
@@ -24,8 +24,12 @@
 #endif
 
 #include <stdio.h>
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
 #include <string.h>
+#endif
 
 #include <gdk/gdk.h>
 
diff --git a/src/xfpm-inhibit.c b/src/xfpm-inhibit.c
index 0f842a3..a3c2cd8 100644
--- a/src/xfpm-inhibit.c
+++ b/src/xfpm-inhibit.c
@@ -23,8 +23,12 @@
 #endif
 
 #include <stdio.h>
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
 #include <string.h>
+#endif
 
 #include <glib.h>
 
diff --git a/src/xfpm-kbd-backlight.c b/src/xfpm-kbd-backlight.c
index c45283d..03753a3 100644
--- a/src/xfpm-kbd-backlight.c
+++ b/src/xfpm-kbd-backlight.c
@@ -19,8 +19,12 @@
  */
 
 #include <stdio.h>
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
 #include <string.h>
+#endif
 
 #include <dbus/dbus-glib.h>
 
diff --git a/src/xfpm-main.c b/src/xfpm-main.c
index 83ea293..c54307b 100644
--- a/src/xfpm-main.c
+++ b/src/xfpm-main.c
@@ -23,8 +23,12 @@
 #endif
 
 #include <stdio.h>
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
 #include <string.h>
+#endif
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
diff --git a/src/xfpm-manager.c b/src/xfpm-manager.c
index 465c2e7..e65fab4 100644
--- a/src/xfpm-manager.c
+++ b/src/xfpm-manager.c
@@ -23,8 +23,12 @@
 #endif
 
 #include <stdio.h>
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
 #include <string.h>
+#endif
 
 #include <gtk/gtk.h>
 #include <glib.h>
diff --git a/src/xfpm-polkit.c b/src/xfpm-polkit.c
index 221c2d8..7d1bbf4 100644
--- a/src/xfpm-polkit.c
+++ b/src/xfpm-polkit.c
@@ -23,17 +23,28 @@
 #endif
 
 #include <stdio.h>
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
 #include <string.h>
-
+#endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
+#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
-#include <sys/param.h> 
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_SYSCTL_H
 #include <sys/sysctl.h>
+#endif
+#ifdef HAVE_SYS_USER_H
 #include <sys/user.h>
+#endif
 
 #if defined(__FreeBSD__)
 #include <sys/stat.h>
@@ -42,7 +53,9 @@
 #include <procfs.h>
 #endif
 
+#ifdef HAVE_ERRNO_H
 #include <errno.h>
+#endif
 
 #include <dbus/dbus-glib.h>
 
diff --git a/src/xfpm-power.c b/src/xfpm-power.c
index e3a1d68..9d98fab 100644
--- a/src/xfpm-power.c
+++ b/src/xfpm-power.c
@@ -23,9 +23,12 @@
 #endif
 
 #include <stdio.h>
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
 #include <string.h>
-
+#endif
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
 #endif
diff --git a/src/xfpm-suspend.c b/src/xfpm-suspend.c
index ff053c6..d398799 100644
--- a/src/xfpm-suspend.c
+++ b/src/xfpm-suspend.c
@@ -22,8 +22,12 @@
 #endif
 
 #include <stdio.h>
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
 #include <string.h>
+#endif
 #ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
 #endif
@@ -174,7 +178,9 @@ xfpm_suspend_sudo_init (XfpmSuspend *suspend,
                         GError   **error)
 {
     gchar  *cmd;
+#ifdef HAVE_SYS_RESOURCE_H
     struct  rlimit rlp;
+#endif
     gchar   buf[15];
     gint    parent_pipe[2];
     gint    child_pipe[2];
@@ -239,6 +245,7 @@ xfpm_suspend_sudo_init (XfpmSuspend *suspend,
         dup2 (parent_pipe[1], STDOUT_FILENO);
         dup2 (parent_pipe[1], STDERR_FILENO);
 
+#ifdef HAVE_SYS_RESOURCE_H
         /* close all other file handles */
         getrlimit (RLIMIT_NOFILE, &rlp);
         for (n = 0; n < (gint) rlp.rlim_cur; ++n)
@@ -246,6 +253,7 @@ xfpm_suspend_sudo_init (XfpmSuspend *suspend,
             if (n != STDIN_FILENO && n != STDOUT_FILENO && n != STDERR_FILENO)
                 close (n);
         }
+#endif
 
         /* execute sudo with the helper */
         execl (cmd, "sudo", "-H", "-S", "-p",
diff --git a/src/xfpm-systemd.c b/src/xfpm-systemd.c
index 236d8cc..d5c05ff 100644
--- a/src/xfpm-systemd.c
+++ b/src/xfpm-systemd.c
@@ -24,8 +24,12 @@
 #endif
 
 #include <stdio.h>
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
 #include <string.h>
+#endif
 
 #include <gio/gio.h>
 
diff --git a/src/xfpm-xfconf.c b/src/xfpm-xfconf.c
index 9583896..d301538 100644
--- a/src/xfpm-xfconf.c
+++ b/src/xfpm-xfconf.c
@@ -23,8 +23,12 @@
 #endif
 
 #include <stdio.h>
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
 #include <string.h>
+#endif
 
 #include <glib.h>
 #include <libxfce4util/libxfce4util.h>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list