From 4bffedddf551cd9d31a10d54f813842bfd878fef Mon Sep 17 00:00:00 2001 From: Jean-Philippe Orsini Date: Mon, 20 May 2013 08:41:11 +0000 Subject: [PATCH] allow to build psensor-server even if gtk/gconf/x11/xext is not present --- NEWS | 3 +- configure | 128 +++++++++++++++++++++++++------------------------------- configure.ac | 11 +++-- po/Makefile.in | 2 +- src/Makefile.am | 13 +++++- src/Makefile.in | 9 ++-- 6 files changed, 85 insertions(+), 81 deletions(-) diff --git a/NEWS b/NEWS index 90a33e6..2a93373 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ * v0.8.0.2 -** GConf2 optional to allow psensor-server compilation without it. +** GConf2/GTK/XEXT/X11 lib optional to allow psensor-server + compilation without them. ** Added support of libjson-c. * v0.8.0.1 diff --git a/configure b/configure index 292acd7..d610490 100755 --- a/configure +++ b/configure @@ -674,10 +674,16 @@ GCONF_FALSE GCONF_TRUE GCONF_LIBS GCONF_CFLAGS +GTK_FALSE +GTK_TRUE GTK_LIBS GTK_CFLAGS +XEXT_FALSE +XEXT_TRUE XEXT_LIBS XEXT_CFLAGS +X11_FALSE +X11_TRUE X11_LIBS X11_CFLAGS PKG_CONFIG_LIBDIR @@ -7359,31 +7365,13 @@ fi # Put the nasty error message in config.log where it belongs echo "$X11_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements (x11) were not met: - -$X11_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables X11_CFLAGS -and X11_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"x11 missing psensor will not be built\"" >&5 +$as_echo "$as_me: WARNING: \"x11 missing psensor will not be built\"" >&2;} elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables X11_CFLAGS -and X11_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"x11 missing psensor will not be built\"" >&5 +$as_echo "$as_me: WARNING: \"x11 missing psensor will not be built\"" >&2;} else X11_CFLAGS=$pkg_cv_X11_CFLAGS X11_LIBS=$pkg_cv_X11_LIBS @@ -7391,6 +7379,14 @@ else $as_echo "yes" >&6; } fi + if test -n "$X11_LIBS"; then + X11_TRUE= + X11_FALSE='#' +else + X11_TRUE='#' + X11_FALSE= +fi + @@ -7453,31 +7449,13 @@ fi # Put the nasty error message in config.log where it belongs echo "$XEXT_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements (xext) were not met: - -$XEXT_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables XEXT_CFLAGS -and XEXT_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"xext missing psensor will not be built\"" >&5 +$as_echo "$as_me: WARNING: \"xext missing psensor will not be built\"" >&2;} elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables XEXT_CFLAGS -and XEXT_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"xext missing psensor will not be built\"" >&5 +$as_echo "$as_me: WARNING: \"xext missing psensor will not be built\"" >&2;} else XEXT_CFLAGS=$pkg_cv_XEXT_CFLAGS XEXT_LIBS=$pkg_cv_XEXT_LIBS @@ -7485,6 +7463,14 @@ else $as_echo "yes" >&6; } fi + if test -n "$XEXT_LIBS"; then + XEXT_TRUE= + XEXT_FALSE='#' +else + XEXT_TRUE='#' + XEXT_FALSE= +fi + @@ -7548,31 +7534,13 @@ fi # Put the nasty error message in config.log where it belongs echo "$GTK_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements (gtk+-3.0) were not met: - -$GTK_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables GTK_CFLAGS -and GTK_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"gtk missing psensor will not be built\"" >&5 +$as_echo "$as_me: WARNING: \"gtk missing psensor will not be built\"" >&2;} elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables GTK_CFLAGS -and GTK_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"gtk missing psensor will not be built\"" >&5 +$as_echo "$as_me: WARNING: \"gtk missing psensor will not be built\"" >&2;} else GTK_CFLAGS=$pkg_cv_GTK_CFLAGS GTK_LIBS=$pkg_cv_GTK_LIBS @@ -7580,6 +7548,14 @@ else $as_echo "yes" >&6; } fi + if test -n "$GTK_LIBS"; then + GTK_TRUE= + GTK_FALSE='#' +else + GTK_TRUE='#' + GTK_FALSE= +fi + # ensure that only allowed headers are included GTK_CFLAGS+=" -DGTK_DISABLE_SINGLE_INCLUDES " # ensure that no gtk deprecated symbols are used @@ -7650,13 +7626,13 @@ fi # Put the nasty error message in config.log where it belongs echo "$GCONF_PKG_ERRORS" >&5 - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"gconf2 not present\"" >&5 -$as_echo "$as_me: WARNING: \"gconf2 not present\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"gconf2 missing psensor will not be built\"" >&5 +$as_echo "$as_me: WARNING: \"gconf2 missing psensor will not be built\"" >&2;} elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"gconf2 not present\"" >&5 -$as_echo "$as_me: WARNING: \"gconf2 not present\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"gconf2 missing psensor will not be built\"" >&5 +$as_echo "$as_me: WARNING: \"gconf2 missing psensor will not be built\"" >&2;} else GCONF_CFLAGS=$pkg_cv_GCONF_CFLAGS GCONF_LIBS=$pkg_cv_GCONF_LIBS @@ -9034,6 +9010,18 @@ if test -z "${GCONF_SCHEMAS_INSTALL_TRUE}" && test -z "${GCONF_SCHEMAS_INSTALL_F as_fn_error $? "conditional \"GCONF_SCHEMAS_INSTALL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${X11_TRUE}" && test -z "${X11_FALSE}"; then + as_fn_error $? "conditional \"X11\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${XEXT_TRUE}" && test -z "${XEXT_FALSE}"; then + as_fn_error $? "conditional \"XEXT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${GTK_TRUE}" && test -z "${GTK_FALSE}"; then + as_fn_error $? "conditional \"GTK\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${GCONF_TRUE}" && test -z "${GCONF_FALSE}"; then as_fn_error $? "conditional \"GCONF\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/configure.ac b/configure.ac index 57ffa42..4f62441 100644 --- a/configure.ac +++ b/configure.ac @@ -53,16 +53,19 @@ AC_SUBST(SENSORS_LIBS) ### Required -PKG_CHECK_MODULES(X11, x11) +PKG_CHECK_MODULES(X11, x11,,[AC_MSG_WARN("x11 missing psensor will not be built")]) +AM_CONDITIONAL(X11, test -n "$X11_LIBS") AC_SUBST(X11_CFLAGS) AC_SUBST(X11_LIBS) -PKG_CHECK_MODULES(XEXT, xext) +PKG_CHECK_MODULES(XEXT, xext,,[AC_MSG_WARN("xext missing psensor will not be built")]) +AM_CONDITIONAL(XEXT, test -n "$XEXT_LIBS") AC_SUBST(XEXT_CFLAGS) AC_SUBST(XEXT_LIBS) # Checks GTK+ 3.0 -PKG_CHECK_MODULES(GTK, gtk+-3.0) +PKG_CHECK_MODULES(GTK, gtk+-3.0,,[AC_MSG_WARN("gtk missing psensor will not be built")]) +AM_CONDITIONAL(GTK, test -n "$GTK_LIBS") # ensure that only allowed headers are included GTK_CFLAGS+=" -DGTK_DISABLE_SINGLE_INCLUDES " # ensure that no gtk deprecated symbols are used @@ -76,7 +79,7 @@ AC_SUBST(GTK_LIBS) # Check GCONF PKG_CHECK_MODULES(GCONF, gconf-2.0, [AC_DEFINE([HAVE_GCONF2],[1],[Use gconf2])], - [AC_MSG_WARN("gconf2 not present")]) + [AC_MSG_WARN("gconf2 missing psensor will not be built")]) AM_CONDITIONAL(GCONF, test -n "$GCONF_LIBS") AC_SUBST(GCONF_CFLAGS) AC_SUBST(GCONF_LIBS) diff --git a/po/Makefile.in b/po/Makefile.in index ccdb387..a45906f 100644 --- a/po/Makefile.in +++ b/po/Makefile.in @@ -21,7 +21,7 @@ srcdir = . top_srcdir = .. -prefix = /usr/local +prefix = /usr exec_prefix = ${prefix} datarootdir = ${prefix}/share datadir = ${datarootdir} diff --git a/src/Makefile.am b/src/Makefile.am index 8233207..da2b590 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -26,7 +26,17 @@ LIBS = \ $(PTHREAD_LIBS)\ $(SENSORS_LIBS) +if GTK +if X11 +if XEXT +if GCONF bin_PROGRAMS = psensor +dist_man_MANS = psensor.1 +endif +endif +endif +endif + psensor_SOURCES = \ cfg.h cfg.c \ graph.h graph.c \ @@ -58,9 +68,11 @@ AM_CPPFLAGS += $(APPINDICATOR_CFLAGS) endif if NVIDIA +if X11 AM_CPPFLAGS += $(NVIDIA_CFLAGS) LIBS += $(NVIDIA_LIBS) endif +endif if LIBATIADL AM_CPPFLAGS += $(LIBATIADL_CFLAGS) @@ -86,7 +98,6 @@ AM_CPPFLAGS += $(CURL_CFLAGS) $(JSON_CFLAGS) endif endif -dist_man_MANS = psensor.1 EXTRA_DIST = description.txt psensor.schemas diff --git a/src/Makefile.in b/src/Makefile.in index 77c19b1..3ce1622 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -53,7 +53,8 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @JSON_TRUE@@LIBMICROHTTPD_TRUE@am__append_1 = server -bin_PROGRAMS = psensor$(EXEEXT) +@GCONF_TRUE@@GTK_TRUE@@X11_TRUE@@XEXT_TRUE@bin_PROGRAMS = \ +@GCONF_TRUE@@GTK_TRUE@@X11_TRUE@@XEXT_TRUE@ psensor$(EXEEXT) @GTOP_TRUE@am__append_2 = $(GTOP_CFLAGS) @GTOP_TRUE@am__append_3 = $(GTOP_LIBS) @LIBNOTIFY_TRUE@am__append_4 = ui_notify.h ui_notify.c @@ -62,8 +63,8 @@ bin_PROGRAMS = psensor$(EXEEXT) @APPINDICATOR_TRUE@am__append_7 = ui_appindicator.c @APPINDICATOR_TRUE@am__append_8 = $(APPINDICATOR_LIBS) @APPINDICATOR_TRUE@am__append_9 = $(APPINDICATOR_CFLAGS) -@NVIDIA_TRUE@am__append_10 = $(NVIDIA_CFLAGS) -@NVIDIA_TRUE@am__append_11 = $(NVIDIA_LIBS) +@NVIDIA_TRUE@@X11_TRUE@am__append_10 = $(NVIDIA_CFLAGS) +@NVIDIA_TRUE@@X11_TRUE@am__append_11 = $(NVIDIA_LIBS) @LIBATIADL_TRUE@am__append_12 = $(LIBATIADL_CFLAGS) @LIBATIADL_TRUE@am__append_13 = $(LIBATIADL_LIBS) @ATASMART_TRUE@am__append_14 = $(ATASMART_CFLAGS) @@ -359,13 +360,13 @@ AM_CPPFLAGS = -Wno-deprecated-declarations -Wall -Werror \ $(am__append_2) $(am__append_6) $(am__append_9) \ $(am__append_10) $(am__append_12) $(am__append_14) \ $(am__append_17) $(am__append_21) +@GCONF_TRUE@@GTK_TRUE@@X11_TRUE@@XEXT_TRUE@dist_man_MANS = psensor.1 psensor_SOURCES = cfg.h cfg.c graph.h graph.c main.c ui.h ui.c \ ui_appindicator.h ui_color.h ui_color.c ui_graph.h ui_graph.c \ ui_pref.h ui_pref.c ui_sensorlist.h ui_sensorlist.c \ ui_sensorpref.h ui_sensorpref.c ui_status.h ui_status.c \ $(am__append_4) $(am__append_7) $(am__append_16) \ $(am__append_19) -dist_man_MANS = psensor.1 EXTRA_DIST = description.txt psensor.schemas @GCONF_TRUE@schemadir = $(GCONF_SCHEMA_FILE_DIR) @GCONF_TRUE@schema_DATA = psensor.schemas -- 2.7.4