Index: trunk/config.auto.h.in =================================================================== --- trunk/config.auto.h.in (revision 2546) +++ trunk/config.auto.h.in (revision 2547) @@ -5,15 +5,6 @@ /* Define to 1 if you have the `getpwuid' function. */ #define HAVE_GETPWUID 1 -/* Define to 1 if you have the `mkdir' function. */ -#define HAVE_MKDIR 1 - -/* Define to 1 if you have the `_mkdir' function. */ -/* #undef HAVE__MKDIR */ - -/* Define to 1 if you have the `mkdtemp' function. */ -#define HAVE_MKDTEMP 1 - /* Define to 1 if you have the header file. */ #define HAVE_PWD_H 1 @@ -26,10 +17,6 @@ /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 -/* Define if mkdir takes only one argument. */ -/* #undef MKDIR_TAKES_ONE_ARG */ - - /****************************************************************************/ /* Static defines to enable extra features on some systems; once we get testers on those systems, we can remove them and see if scconfig figured @@ -110,13 +97,24 @@ 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 {\n\n/* Define to 1 if we should use mkdtemp for creating temp files. */\n} +print_ternary ?libs/fs/mkdtemp/presents {#define HAVE_MKDTEMP 1} {/* #undef HAVE_MKDTEMP */} + print {\n\n/* Select which mechanism to use for running child processes. */\n} print_ternary ?/target/libs/proc/wait/presents {#define USE_FORK_WAIT 1} {/* #undef USE_FORK_WAIT */} print {\n} print_ternary ?/target/libs/proc/_spawnvp/presents {#define USE_SPAWNVP 1} {/* #undef USE_SPAWNVP */} +print {\n\n/* Select which mechanism to use for creating a directory. */\n} +print_ternary ?/target/libs/fs/mkdir/presents {#define USE_MKDIR 1} {/* #undef USE_MKDIR */} +print {\n} +print_ternary ?/target/libs/fs/_mkdir/presents {#define USE__MKDIR 1} {/* #undef USE__MKDIR */} print [@ +#define MKDIR_NUM_ARGS 0@?/target/libs/fs/_mkdir/num_args@@?/target/libs/fs/mkdir/num_args@ +@] +print [@ + /* The host "triplet" - it's really a pair now: machine-os */ #define HOST "@sys/sysid@" Index: trunk/doc-rnd/TODO =================================================================== --- trunk/doc-rnd/TODO (revision 2546) +++ trunk/doc-rnd/TODO (revision 2547) @@ -113,6 +113,7 @@ - dynstyle: remove existing style (gtk hid, maybe key 'del'?) Low prio: +- replace mkdtemp() with something safer - display net names on pins, vias (and maybe tracks?) when zoomed in enough - DRC should warn for thin poly hair - rotate shaped vias don't rotate the shape (is via rotated at all?) Index: trunk/scconfig/hooks.c =================================================================== --- trunk/scconfig/hooks.c (revision 2546) +++ trunk/scconfig/hooks.c (revision 2547) @@ -165,6 +165,7 @@ want_stroke = plug_is_enabled("stroke"); require("cc/fpic", 0, 1); + require("libs/fs/mkdtemp", 0, 0); if (require("libs/ldl", 0, 0) != 0) { if (require("libs/LoadLibrary", 0, 0) != 0) { @@ -180,6 +181,13 @@ } } + if (require("libs/fs/_mkdir", 0, 0) != 0) { + if (require("libs/fs/mkdir", 0, 0) != 0) { + report_repeat("\nERROR: no mkdir() or _mkdir(). Can not compile pcb-rnd.\n\n"); + return 1; + } + } + if (require("libs/fs/getcwd/*", 0, 0) != 0) if (require("libs/fs/_getcwd/*", 0, 0) != 0) if (require("libs/fs/getwd/*", 0, 0) != 0) { Index: trunk/src/compat_fs.c =================================================================== --- trunk/src/compat_fs.c (revision 2546) +++ trunk/src/compat_fs.c (revision 2547) @@ -69,10 +69,24 @@ #endif } +#if defined(USE_MKDIR) +# define MKDIR mkdir +#elif defined(USE__MKDIR) +# define MKDIR _mkdir +#else +# error no mkdir() available +#endif int pcb_mkdir(const char *path, int mode) { +#if MKDIR_NUM_ARGS == 1 + return MKDIR(path); +#elif MKDIR_NUM_ARGS == 2 return MKDIR(path, mode); +#else +# error invalid number of arguments for mkdir +#endif } +#undef MKDIR int pcb_spawnvp(char **argv) { Index: trunk/src/compat_fs.h =================================================================== --- trunk/src/compat_fs.h (revision 2546) +++ trunk/src/compat_fs.h (revision 2547) @@ -1,30 +1,6 @@ char *GetWorkingDirectory(char *); -/* Portable mkdir() implentation. - * Check whether mkdir() is mkdir or _mkdir, and whether it takes one - * or two arguments. WIN32 mkdir takes one argument and POSIX takes - * two. - */ int pcb_mkdir(const char *path, int mode); -#if HAVE_MKDIR -#if MKDIR_TAKES_ONE_ARG - /* MinGW32 */ -#include /* mkdir under MinGW only takes one argument */ -#define MKDIR(a, b) mkdir(a) -#else -#define MKDIR(a, b) mkdir(a, b) -#endif -#else -#if HAVE__MKDIR - /* plain Windows 32 */ -#define MKDIR(a, b) _mkdir(a) -#endif -#endif - -#ifndef MKDIR -# error "Don't know how to create a directory on this system." -#endif - int pcb_spawnvp(char **argv); char *tempfile_name_new(char *name); int tempfile_unlink(char *name);