From 55959b4f7ebc717c22909dea5eb632323fc13948 Mon Sep 17 00:00:00 2001 From: Tamas TEVESZ Date: Tue, 23 Mar 2010 20:27:53 +0100 Subject: [PATCH] Half-assed fix to make autoconf bend - this should make platform detection automagic - also fixes debian builds that broke in the meantime - fix osdep_darwin.c --- configure.ac | 35 ++++++++++++++++++++++++ src/Makefile.am | 2 +- src/osdep/stub.c | 11 -------- src/osdep/test.c | 49 ---------------------------------- src/{osdep/bsd.c => osdep_bsd.c} | 2 +- src/{osdep/darwin.c => osdep_darwin.c} | 4 +++ src/{osdep/linux.c => osdep_linux.c} | 2 +- src/osdep_stub.c | 19 +++++++++++++ 8 files changed, 61 insertions(+), 63 deletions(-) delete mode 100644 src/osdep/stub.c delete mode 100644 src/osdep/test.c rename src/{osdep/bsd.c => osdep_bsd.c} (99%) rename src/{osdep/darwin.c => osdep_darwin.c} (97%) rename src/{osdep/linux.c => osdep_linux.c} (98%) create mode 100644 src/osdep_stub.c diff --git a/configure.ac b/configure.ac index d4a9bcb9..4e8a632c 100644 --- a/configure.ac +++ b/configure.ac @@ -37,6 +37,41 @@ dnl AC_PROG_INSTALL -- already done by AM_INIT_AUTOMAKE AC_PROG_LN_S AC_PROG_GCC_TRADITIONAL +dnl Platform-specific Makefile setup +dnl ================================ + +case "${host}" in + *-*-linux*) + WM_OSDEP="linux" + ;; + *-*-freebsd*) + WM_OSDEP="bsd" + CFLAGS="$CFLAGS -DFREEBSD" + ;; + *-*-netbsd*) + WM_OSDEP="bsd" + CFLAGS="$CFLAGS -DNETBSD" + ;; + *-*-openbsd*) + WM_OSDEP="bsd" + CFLAGS="$CFLAGS -DOPENBSD" + ;; + *-*-dragonfly*) + WM_OSDEP="bsd" + CFLAGS="$CFLAGS -DDRAGONFLYBSD" + ;; + *-apple-darwin*) + WM_OSDEP="darwin" + ;; + *-*-solaris*) + WM_OSDEP="stub" # solaris.c when done + ;; + *) + WM_OSDEP="stub" + ;; +esac +AC_SUBST(WM_OSDEP) + dnl the prefix dnl ========== diff --git a/src/Makefile.am b/src/Makefile.am index dbab5a2e..ae658707 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -45,7 +45,7 @@ wmaker_SOURCES = \ menu.c \ menu.h \ misc.c \ - osdep/linux.c \ + osdep_@WM_OSDEP@.c \ monitor.c \ motif.c \ motif.h \ diff --git a/src/osdep/stub.c b/src/osdep/stub.c deleted file mode 100644 index 38b98203..00000000 --- a/src/osdep/stub.c +++ /dev/null @@ -1,11 +0,0 @@ - -#include -#include "../wconfig.h" - -Bool GetCommandForPid(int pid, char ***argv, int *argc) -{ - *argv = NULL; - *argc = 0; - - return False; -} diff --git a/src/osdep/test.c b/src/osdep/test.c deleted file mode 100644 index 3bba44ec..00000000 --- a/src/osdep/test.c +++ /dev/null @@ -1,49 +0,0 @@ - -#include -#include - -#include - -/* - * gcc -D{$os} -I ../../WINGs ${includes...} -Wall -Wextra -g -ggdb3 -c -o ${plat}.o ${plat}.c - * gcc -I ../../WINGs ${includes...} -g -ggdb3 -c -o test.o test.c - * gcc -g -ggdb3 -o test ${plat}.o ../../WINGs/.libs/libWUtil.a test.o - * - * $ ./test 1 2 'foo bar' "`date`" `date` - * arg[0] = [./test] - * arg[1] = [1] - * arg[2] = [2] - * arg[3] = [foo bar] - * arg[4] = [Sat Mar 20 18:36:22 CET 2010] - * arg[5] = [Sat] - * arg[6] = [Mar] - * arg[7] = [20] - * arg[8] = [18:36:22] - * arg[9] = [CET] - * arg[10] = [2010] - * $ - */ - -Bool GetCommandForPid(int pid, char ***argv, int *argc); -extern char *__progname; - -int main(int argc, char **argv) { - - char **nargv; - int i, nargc; - - if (argc < 2) { - printf("Usage: %s arg arg arg ...\n", __progname); - return 0; - } - - if (GetCommandForPid(getpid(), &nargv, &nargc) == False) { - printf("GetCommandForPid() failed\n"); - } else { - printf("nargv = %d\n", nargc); - for(i = 0; i < nargc; i++) - printf("arg[%d] = [%s]\n", i, nargv[i]); - } - - return 0; -} diff --git a/src/osdep/bsd.c b/src/osdep_bsd.c similarity index 99% rename from src/osdep/bsd.c rename to src/osdep_bsd.c index 0057adc8..e3063a97 100644 --- a/src/osdep/bsd.c +++ b/src/osdep_bsd.c @@ -24,7 +24,7 @@ #include -#include "../wconfig.h" +#include "wconfig.h" /* * copy argc and argv for an existing process identified by `pid' diff --git a/src/osdep/darwin.c b/src/osdep_darwin.c similarity index 97% rename from src/osdep/darwin.c rename to src/osdep_darwin.c index e037b5df..ca38df2c 100644 --- a/src/osdep/darwin.c +++ b/src/osdep_darwin.c @@ -6,6 +6,10 @@ #include #include +#include + +#include "wconfig.h" + /* * copy argc and argv for an existing process identified by `pid' * into suitable storage given in ***argv and *argc. diff --git a/src/osdep/linux.c b/src/osdep_linux.c similarity index 98% rename from src/osdep/linux.c rename to src/osdep_linux.c index a754bb6b..ed4953f9 100644 --- a/src/osdep/linux.c +++ b/src/osdep_linux.c @@ -11,7 +11,7 @@ #include -#include "../wconfig.h" +#include "wconfig.h" /* * copy argc and argv for an existing process identified by `pid' diff --git a/src/osdep_stub.c b/src/osdep_stub.c new file mode 100644 index 00000000..6a24e180 --- /dev/null +++ b/src/osdep_stub.c @@ -0,0 +1,19 @@ + +#include + +#include "wconfig.h" + +Bool GetCommandForPid(int pid, char ***argv, int *argc) +{ + *argv = NULL; + *argc = 0; + static int notified = 0; + + if (!notified) { + wwarning(_("%s is not implemented on this platform; " + "notify wmaker-dev@lists.windowmaker.info"), __FUNCTION__); + notified = 1; + } + + return False; +} -- 2.11.4.GIT