Index: trunk/config.auto.h.in =================================================================== --- trunk/config.auto.h.in (revision 2543) +++ trunk/config.auto.h.in (revision 2544) @@ -2,9 +2,6 @@ /**** TODO ****/ -/* Define to 1 if you have the header file. */ -#define HAVE_DLFCN_H 1 - /* Define to 1 if you have the `getpwuid' function. */ #define HAVE_GETPWUID 1 @@ -29,13 +26,6 @@ /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_WAIT_H 1 - - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_WINDOWS_H */ - /* Define to 1 if you have the `_spawnvp' function. */ /* #undef HAVE__SPAWNVP */ @@ -114,6 +104,10 @@ print {\n\n/* Define to 1 if translation of program messages to the user's native language is requested. */\n} print_ternary /local/pcb/want_nls {#define ENABLE_NLS 1} {/*#undef ENABLE_NLS */} +print {\n\n/* Define to 1 if we should use windows api for dynamic linking. */\n} +print_ternary ?libs/LoadLibrary/presents {#define USE_LOADLIBRARY 1} {/* #undef USE_LOADLIBRARY */} + + print [@ /* The host "triplet" - it's really a pair now: machine-os */ Index: trunk/scconfig/hooks.c =================================================================== --- trunk/scconfig/hooks.c (revision 2543) +++ trunk/scconfig/hooks.c (revision 2544) @@ -166,6 +166,13 @@ require("cc/fpic", 0, 1); + if (require("libs/ldl", 0, 0) != 0) { + if (require("libs/LoadLibrary", 0, 0) != 0) { + report_repeat("\nERROR: no dynamic linking found on your system. Can not compile pcb-rnd.\n\n"); + return 1; + } + } + if (want_intl) { require("libs/sul/gettext/presents", 0, 0); if (!istrue(get("libs/sul/gettext/presents"))) { @@ -475,6 +482,8 @@ printf("Generating config.auto.h (%d)\n", generr |= tmpasm("..", "config.auto.h.in", "config.auto.h")); + printf("Generating compat_inc.h (%d)\n", generr |= tmpasm("../src", "compat_inc.h.in", "compat_inc.h")); + if (plug_is_enabled("gpmi")) gpmi_config(); Index: trunk/src/Makefile.in =================================================================== --- trunk/src/Makefile.in (revision 2543) +++ trunk/src/Makefile.in (revision 2544) @@ -202,7 +202,7 @@ SRCS=@/local/pcb/SRCS@ CFLAGS=@/local/pcb/CFLAGS@ LDFLAGS=@/local/pcb/LDFLAGS@ -LIBS=@/local/pcb/LIBS@ -lm -ldl +LIBS=@/local/pcb/LIBS@ -lm @?/target/libs/ldl@ EXEDEPS=@/local/pcb/EXEDEPS@ CLEANFILES=@/local/pcb/CLEANFILES@ CLEANRULES=@/local/pcb/CLEANRULES@ Index: trunk/src/compat_dl.c =================================================================== --- trunk/src/compat_dl.c (revision 2543) +++ trunk/src/compat_dl.c (revision 2544) @@ -25,7 +25,7 @@ #include "compat_dl.h" #include "global.h" -#if !defined(HAVE_DLFCN_H) && defined(WIN32) +#ifdef USE_LOADLIBRARY #include void *dlopen(const char *f, int ATTRIBUTE_UNUSED flag) Index: trunk/src/compat_dl.h =================================================================== --- trunk/src/compat_dl.h (revision 2543) +++ trunk/src/compat_dl.h (revision 2544) @@ -24,9 +24,9 @@ #define PCB_COMPAT_DL_H #include "config.h" +#include "compat_inc.h" - -#if !defined(HAVE_DLFCN_H) && defined(WIN32) +#ifdef USE_LOADLIBRARY void *dlopen(const char *, int); void dlclose(void *); char *dlerror(void); @@ -33,9 +33,17 @@ void *dlsym(void *, const char *); +#ifndef RTLD_NOW #define RTLD_NOW 2 +#endif + +#ifndef RTLD_LOCAL #define RTLD_LOCAL 0 +#endif + +#ifndef RTLD_GLOBAL #define RTLD_GLOBAL 4 +#endif #endif Index: trunk/src/compat_fs.c =================================================================== --- trunk/src/compat_fs.c (revision 2543) +++ trunk/src/compat_fs.c (revision 2544) @@ -43,16 +43,13 @@ #include "compat_fs.h" #include "compat_misc.h" -#ifdef HAVE_SYS_WAIT_H -#include +#ifndef HAVE__SPAWNVP +/* The UNIX way of doing this: fork() and wait(). */ +# include +# include #endif -/* for access(), fork() and friends */ -#ifdef HAVE_UNISTD_H -#include -#endif - #include #include "global.h" Index: trunk/src/compat_inc.h.in =================================================================== --- trunk/src/compat_inc.h.in (nonexistent) +++ trunk/src/compat_inc.h.in (revision 2544) @@ -0,0 +1,14 @@ +uniq /local/pcb/compat_inc [@ +@?libs/ldl/includes@ +@?libs/LoadLibrary/includes@ +@] + +print [@ +/*** DO NOT EDIT - automatically generated by scconfig ***/ + +/* system-dependent includes, as detected in ./configure */ + +@/local/pcb/compat_inc@ + +@] +