diff --git a/acinclude.m4 b/acinclude.m4 index ca5a7893..a2335302 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -227,5 +227,5 @@ AC_DEFUN([AM_PATH_XFT], CFLAGS="$CFLAGS $XFT_CFLAGS" CXXFLAGS="$CXXFLAGS $XFT_CFLAGS" - LIBS="$LIBS $XFT_LIBS" + LIBS="$XFT_LIBS $LIBS" ]) diff --git a/configure.in b/configure.in index 6e4a53c4..71c86d10 100644 --- a/configure.in +++ b/configure.in @@ -60,10 +60,10 @@ AC_FUNC_REALLOC AC_FUNC_SELECT_ARGTYPES AC_FUNC_STAT -AC_CHECK_FUNCS(basename, , AC_CHECK_LIB(gen, basename, LIBS="$LIBS -lgen")) +AC_CHECK_FUNCS(basename, , AC_CHECK_LIB(gen, basename, LIBS="-lgen $LIBS")) AC_CHECK_FUNCS(catclose catgets catopen getpid gettimeofday memset mkdir \ nl_langinfo putenv regcomp select setenv setlocale sigaction snprintf \ - sqrt strcasecmp strcasestr strchr strstr strtol strtoul vsnprintf) + sqrt strcasecmp strcasestr strchr strstr strtol strtoul sync vsnprintf) dnl The autoconf test for strftime is broken now (due to gcc 3.3 bug?): dnl Gcc 3.3 testprog = ``extern "C" char strftime;'', build with g++ test.cc @@ -130,13 +130,13 @@ if test "x$ac_cv_header_iconv_h" = "xyes"; then AC_CHECK_LIB([iconv], [iconv_open], [ - LIBS="$LIBS -liconv" + LIBS="-liconv $LIBS" ], []) AC_CHECK_LIB([iconv], [libiconv_open], [ - LIBS="$LIBS -liconv" + LIBS="-liconv $LIBS" ], []) @@ -163,8 +163,8 @@ dnl Check if iconv uses const in prototype declaration fi fi -AC_CHECK_LIB(nsl, t_open, LIBS="$LIBS -lnsl") -AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket") +AC_CHECK_LIB(nsl, t_open, LIBS="-lnsl $LIBS") +AC_CHECK_LIB(socket, socket, LIBS="-lsocket $LIBS") dnl Check for X headers and libraries AC_PATH_X @@ -177,18 +177,18 @@ test x$x_libraries = "x" && x_libraries="/usr/lib" CFLAGS="$CFLAGS $X_CFLAGS" CXXFLAGS="$CXXFLAGS $X_CFLAGS" -LIBS="$LIBS $X_LIBS" +LIBS="$X_LIBS $LIBS" LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS" dnl Check for required functions in -lX11 AC_CHECK_LIB(X11, XOpenDisplay, - LIBS="$LIBS -lX11", + LIBS="-lX11 $LIBS", AC_MSG_ERROR([Could not find XOpenDisplay in -lX11.]) ) -LIBS="$LIBS $X_EXTRA_LIBS" +LIBS="$X_EXTRA_LIBS $LIBS" -AC_CHECK_LIB(xpg4, setlocale, LIBS="$LIBS -lxpg4") +AC_CHECK_LIB(xpg4, setlocale, LIBS="-lxpg4 $LIBS") AC_CHECK_PROGS(gencat_cmd, gencat) if test x$gencat_cmd = "x"; then @@ -397,14 +397,14 @@ AC_ARG_ENABLE( AC_MSG_RESULT([yes]) AC_CHECK_LIB(Xrender, XRenderCreatePicture, AC_DEFINE(HAVE_XRENDER, 1, "Xrender support") - LIBS="$LIBS -lXrender") + LIBS="-lXrender $LIBS") else AC_MSG_RESULT([no]) fi, AC_MSG_RESULT([yes]) AC_CHECK_LIB(Xrender, XRenderCreatePicture, AC_DEFINE(HAVE_XRENDER, 1, "Xrender support") - LIBS="$LIBS -lXrender") + LIBS="-lXrender $LIBS") ) XPM=false @@ -417,7 +417,7 @@ AC_ARG_ENABLE( AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, AC_DEFINE(HAVE_XPM, 1, "Xpm support") XPM=true - LIBS="$LIBS -lXpm") + LIBS="-lXpm $LIBS") else AC_MSG_RESULT([no]) fi, @@ -425,7 +425,7 @@ AC_ARG_ENABLE( AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, AC_DEFINE(HAVE_XPM, 1, "Xpm support") XPM=true - LIBS="$LIBS -lXpm") + LIBS="-lXpm $LIBS") ) AM_CONDITIONAL(XPM, test x$XPM = xtrue) @@ -445,7 +445,7 @@ if test x$enable_imlib2 = "xyes"; then AC_DEFINE(HAVE_IMLIB2, [], [Imlib2 support]) IMLIB2_LIBS=`imlib2-config --libs` IMLIB2_CFLAGS=`imlib2-config --cflags` - LIBS="$LIBS $IMLIB2_LIBS" + LIBS="$IMLIB2_LIBS $LIBS" CXXFLAGS="$CXXFLAGS $IMLIB2_CFLAGS" ], [ AC_MSG_RESULT(no)] ) @@ -494,7 +494,7 @@ if test "x$enableval" = "xyes"; then , XineramaQueryScreens(0, 0), AC_MSG_RESULT([yes]) AC_DEFINE(XINERAMA, [1], [Define to 1 if you have XINERAMA]) - LIBS="$LIBS -lXinerama", + LIBS="-lXinerama $LIBS", AC_MSG_RESULT([no]))) else AC_MSG_RESULT([no]) @@ -519,7 +519,7 @@ if test "x$enableval" = "xyes"; then , long foo = ShapeSet, AC_MSG_RESULT([yes]) AC_DEFINE(SHAPE, [1], [Define to 1 if you have SHAPE]) - LIBS="$LIBS -lXext" + LIBS="-lXext $LIBS" FEATURES="$FEATURES XShape", AC_MSG_RESULT([no]))) else @@ -547,7 +547,7 @@ if test "x$enableval" = "xyes"; then , XRRQueryExtension(0, 0, 0), AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_RANDR, [1], [Define to 1 if you have RANDR]) - LIBS="$LIBS -lXrandr", + LIBS="-lXrandr $LIBS", AC_MSG_RESULT([no]))) else AC_MSG_RESULT([no]) @@ -571,7 +571,7 @@ if test "x$enableval" = "xyes"; then , XRRUpdateConfiguration(0), AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_RANDR1_2, [1], [Define to 1 if you have RANDR 1.2]) - LIBS="$LIBS -lXrandr", + LIBS="-lXrandr $LIBS", AC_MSG_RESULT([no]))) else AC_MSG_RESULT([no]) @@ -613,7 +613,7 @@ if test "x$enableval" = "xyes"; then , fribidi_version_info, AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_FRIBIDI, [1], [Define to 1 if you have FRIBIDI]) - LIBS="$LIBS -lfribidi", + LIBS="-lfribidi $LIBS", AC_MSG_RESULT([no]))) else AC_MSG_RESULT([no]) diff --git a/src/FbTk/App.cc b/src/FbTk/App.cc index 81578390..f494a0e1 100644 --- a/src/FbTk/App.cc +++ b/src/FbTk/App.cc @@ -60,8 +60,13 @@ App::App(const char *displayname):m_done(false), m_display(0) { if (displayname != 0 && displayname[0] == '\0') displayname = 0; m_display = XOpenDisplay(displayname); - if (!m_display) - throw std::string("Couldn't connect to XServer"); + if (!m_display) { + if (displayname) { + throw std::string("Couldn't connect to XServer") + displayname; + } else { + throw std::string("Couldn't connect to XServer passing null display"); + } + } FbStringUtil::init(); } diff --git a/src/FbTk/FileUtil.cc b/src/FbTk/FileUtil.cc index 5de560ba..c92b3361 100644 --- a/src/FbTk/FileUtil.cc +++ b/src/FbTk/FileUtil.cc @@ -63,9 +63,14 @@ bool FileUtil::isExecutable(const char* filename) { if (!filename || stat(filename, &buf)) return false; - return buf.st_mode & S_IXUSR || - buf.st_mode & S_IXGRP || - buf.st_mode & S_IXOTH; + return buf.st_mode & S_IXUSR +#ifdef S_IXGRP + || buf.st_mode & S_IXGRP +#endif +#ifdef S_IXOTH + || buf.st_mode & S_IXOTH +#endif + ; } bool FileUtil::copyFile(const char* from, const char* to) { diff --git a/src/FbTk/I18n.cc b/src/FbTk/I18n.cc index 81ff0780..3daa2e9f 100644 --- a/src/FbTk/I18n.cc +++ b/src/FbTk/I18n.cc @@ -72,17 +72,17 @@ void NLSInit(const char *catalog) { I18n::I18n():m_multibyte(false), m_utf8_translate(false), m_catalog_fd((nl_catd)(-1)) { -#ifdef HAVE_SETLOCALE +#if defined(HAVE_SETLOCALE) && defined(NLS) //make sure we don't get 0 to m_locale string char *temp = setlocale(LC_MESSAGES, ""); m_locale = ( temp ? temp : ""); if (m_locale.empty()) { cerr<<"Warning: Failed to set locale, reverting to \"C\""< #endif -#include +#ifdef HAVE_SYS_SELECT_H +# include +#endif namespace FbTk { diff --git a/src/Makefile.am b/src/Makefile.am index 8c204db7..1a04e4eb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -63,6 +63,7 @@ defaults.hh: Makefile defaults.cc: force @( \ GITDIR=$(top_srcdir)/.git; \ + echo '// This file is generated from Makefile. Do not edit!'; \ echo '#include "defaults.hh"'; \ echo ''; \ echo 'std::string realProgramName(const std::string& name) {'; \ diff --git a/src/RootTheme.cc b/src/RootTheme.cc index d303834d..a2aa4a8b 100644 --- a/src/RootTheme.cc +++ b/src/RootTheme.cc @@ -40,7 +40,10 @@ #include #include +#ifdef HAVE_SYS_WAIT_H #include +#endif + #ifdef HAVE_CSTRING #include #else diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 2e5e3731..ff44e9f7 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -124,7 +124,9 @@ #include #endif // HAVE_SYS_STAT_H +#ifdef HAVE_SYS_WAIT_H #include +#endif // HAVE_SYS_WAIT_H #include #include diff --git a/src/main.cc b/src/main.cc index c47e1d8e..7541a288 100644 --- a/src/main.cc +++ b/src/main.cc @@ -34,6 +34,7 @@ #include "FbTk/I18n.hh" #include "FbTk/CommandParser.hh" #include "FbTk/FileUtil.hh" +#include "FbTk/StringUtil.hh" //use GNU extensions #ifndef _GNU_SOURCE @@ -114,22 +115,22 @@ static void showInfo(ostream &ostr) { ostr <<_FB_CONSOLETEXT(Common, DefaultMenuFile, " menu", "default menu file (right aligned - make sure same width as other default values)") << ": " - << DEFAULTMENU << endl; + << FbTk::StringUtil::expandFilename(DEFAULTMENU) << endl; ostr << _FB_CONSOLETEXT(Common, DefaultStyle, " style", "default style (right aligned - make sure same width as other default values)") << ": " - << DEFAULTSTYLE << endl; + << FbTk::StringUtil::expandFilename(DEFAULTSTYLE) << endl; ostr << _FB_CONSOLETEXT(Common, DefaultKeyFile, " keys", "default key file (right aligned - make sure same width as other default values)") << ": " - << DEFAULTKEYSFILE << endl; + << FbTk::StringUtil::expandFilename(DEFAULTKEYSFILE) << endl; ostr << _FB_CONSOLETEXT(Common, DefaultInitFile, " init", "default init file (right aligned - make sure same width as other default values)") << ": " - << DEFAULT_INITFILE << endl; + << FbTk::StringUtil::expandFilename(DEFAULT_INITFILE) << endl; #ifdef NLS ostr << _FB_CONSOLETEXT(Common, DefaultLocalePath, " nls", "location for localization files (right aligned - make sure same width as other default values)") << ": " - << LOCALEPATH << endl; + << FbTk::StringUtil::expandFilename(LOCALEPATH) << endl; #endif const char NOT[] = "-"; @@ -220,12 +221,12 @@ struct Options { const char* env; env = getenv("DISPLAY"); - if (env) { + if (env && strlen(env) > 0) { session_display.assign(env); } env = getenv("HOME"); - if (env) { + if (env && strlen(env) > 0) { rc_path.assign(std::string(env) + "/." + realProgramName("fluxbox")); rc_file = rc_path + "/init"; } @@ -369,14 +370,15 @@ void setupConfigFiles(const std::string& dirname, const std::string& rc) { // copy default files if needed for (size_t i = 0; i < nr_of_cfiles; ++i) { if (cfiles[i].create_file) { - FbTk::FileUtil::copyFile(cfiles[i].default_name, cfiles[i].filename.c_str()); + FbTk::FileUtil::copyFile(FbTk::StringUtil::expandFilename(cfiles[i].default_name).c_str(), cfiles[i].filename.c_str()); sync_fs = true; } } - +#ifdef HAVE_SYNC if (sync_fs) { sync(); } +#endif } @@ -413,7 +415,9 @@ void updateConfigFilesIfNeeded(const std::string& rc_file) { << commandargs << "' failed." << endl; } +#ifdef HAVE_SYNC sync(); +#endif // HAVE_SYNC } }