Browse Source

build: check for getcwd() and _getcwd() and configure time.

legacy
Sam Hocevar sam 12 years ago
parent
commit
e7806e96cc
2 changed files with 8 additions and 2 deletions
  1. +2
    -0
      configure.ac
  2. +6
    -2
      src/sys/init.cpp

+ 2
- 0
configure.ac View File

@@ -80,6 +80,8 @@ AC_CHECK_HEADERS(linux/kdev_t.h linux/major.h)
AC_CHECK_HEADERS(security/pam_appl.h security/pam_misc.h) AC_CHECK_HEADERS(security/pam_appl.h security/pam_misc.h)
AC_CHECK_HEADERS(pam/pam_appl.h pam/pam_misc.h) AC_CHECK_HEADERS(pam/pam_appl.h pam/pam_misc.h)


AC_CHECK_FUNCS(getcwd _getcwd)

if test "${enable_debug}" = "yes"; then if test "${enable_debug}" = "yes"; then
AC_DEFINE(LOL_DEBUG, 1, Define to 1 to activate debug) AC_DEFINE(LOL_DEBUG, 1, Define to 1 to activate debug)
OPT="-O" OPT="-O"


+ 6
- 2
src/sys/init.cpp View File

@@ -38,14 +38,18 @@ namespace System
void Init(int argc, char *argv[], void Init(int argc, char *argv[],
String const projectdir, String const solutiondir) String const projectdir, String const solutiondir)
{ {
using namespace std;

/* /*
* Retrieve binary directory, defaulting to current dir. * Retrieve binary directory, defaulting to current dir.
*/ */


#if defined _WIN32
#if defined HAVE_GETCWD
char *cwd = getcwd(NULL, 0);
#elif defined HAVE__GETCWD || (defined _WIN32 && !defined _XBOX)
char *cwd = _getcwd(NULL, 0); char *cwd = _getcwd(NULL, 0);
#else #else
char *cwd = getcwd(NULL, 0);
char *cwd = NULL;
#endif #endif
String binarydir = String(cwd ? cwd : ".") + SEPARATOR; String binarydir = String(cwd ? cwd : ".") + SEPARATOR;
free(cwd); free(cwd);


Loading…
Cancel
Save