[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: pcb.git: branch: master updated (60f6fa16eda93c10dfc1ed8d030bebeeb0cb9693)



The branch, master has been updated
       via  60f6fa16eda93c10dfc1ed8d030bebeeb0cb9693 (commit)
       via  9bf4aff635db035db91c601547b60de92db76abb (commit)
      from  64bbe4248f8b194a6a8d620c477744f702d1781b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 configure.ac             |    5 ++
 m4/m4_ax_func_mkdir.m4   |   99 ++++++++++++++++++++++++++++++++++++++++++++++
 src/hid/common/hidinit.c |    6 +--
 src/hid/gtk/gui-config.c |    5 +-
 src/misc.h               |   23 +++++++++++
 5 files changed, 131 insertions(+), 7 deletions(-)
 create mode 100644 m4/m4_ax_func_mkdir.m4


=================
 Commit Messages
=================

commit 60f6fa16eda93c10dfc1ed8d030bebeeb0cb9693
Author: DJ Delorie <dj@xxxxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    Make io.h inclusion conditional on the mingw case.

:100644 100644 0ab8002... 208ef88... M	src/misc.h

commit 9bf4aff635db035db91c601547b60de92db76abb
Author: Bob Paddock <bobpspam@xxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    mkdir() takes only one argument under WIN32.
    
    Add check whether mkdir() is mkdir or _mkdir, and whether it takes one
    or two arguments.  WIN32 mkdir takes one argument and POSIX takes
    two.
    
    Use MKDIR() macro from misc.h everyplace to get correct behavior
    depending on platform.

:100644 100644 b139388... 87814cd... M	configure.ac
:000000 100644 0000000... 6c213e5... A	m4/m4_ax_func_mkdir.m4
:100644 100644 9c4f8ee... 554e592... M	src/hid/common/hidinit.c
:100644 100644 516feb5... 79d543d... M	src/hid/gtk/gui-config.c
:100644 100644 776e309... 0ab8002... M	src/misc.h

=========
 Changes
=========

commit 60f6fa16eda93c10dfc1ed8d030bebeeb0cb9693
Author: DJ Delorie <dj@xxxxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    Make io.h inclusion conditional on the mingw case.

diff --git a/src/misc.h b/src/misc.h
index 0ab8002..208ef88 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -133,9 +133,9 @@ void NetlistChanged (int force_unfreeze);
  * two.
  */
 #if HAVE_MKDIR
-#include <io.h> /* mkdir under MinGW only takes one argument */
         #if MKDIR_TAKES_ONE_ARG
          /* MinGW32 */
+#include <io.h> /* mkdir under MinGW only takes one argument */
          #define MKDIR(a, b) mkdir(a)
         #else
          #define MKDIR(a, b) mkdir(a, b)

commit 9bf4aff635db035db91c601547b60de92db76abb
Author: Bob Paddock <bobpspam@xxxxxxxxx>
Commit: DJ Delorie <dj@xxxxxxxxxxx>

    mkdir() takes only one argument under WIN32.
    
    Add check whether mkdir() is mkdir or _mkdir, and whether it takes one
    or two arguments.  WIN32 mkdir takes one argument and POSIX takes
    two.
    
    Use MKDIR() macro from misc.h everyplace to get correct behavior
    depending on platform.

diff --git a/configure.ac b/configure.ac
index b139388..87814cd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1007,6 +1007,11 @@ AC_ARG_ENABLE([debug],
 AC_MSG_RESULT([$enable_debug])
 AM_CONDITIONAL(DEBUG_BUILD, test x$enable_debug = xyes)
 
+# ------------- mkdir required for win32 compatibility ------------
+# WIN32 mkdir takes only one argument, POSIX takes two.
+# #include "misc.h" where mkdir is required.
+m4_include([m4/m4_ax_func_mkdir.m4])
+AX_FUNC_MKDIR
 
 # ------------- Complete set of CFLAGS and LIBS -------------------
 
diff --git a/m4/m4_ax_func_mkdir.m4 b/m4/m4_ax_func_mkdir.m4
new file mode 100644
index 0000000..6c213e5
--- /dev/null
+++ b/m4/m4_ax_func_mkdir.m4
@@ -0,0 +1,99 @@
+# ===========================================================================
+#       http://www.gnu.org/software/autoconf-archive/ax_func_mkdir.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_FUNC_MKDIR
+#
+# DESCRIPTION
+#
+#   Check whether mkdir() is mkdir or _mkdir, and whether it takes one or
+#   two arguments.
+#
+#   This macro can define HAVE_MKDIR, HAVE__MKDIR, and MKDIR_TAKES_ONE_ARG,
+#   which are expected to be used as follows:
+#
+#     #if HAVE_MKDIR
+#     #  if MKDIR_TAKES_ONE_ARG
+#          /* MinGW32 */
+#     #    define mkdir(a, b) mkdir(a)
+#     #  endif
+#     #else
+#     #  if HAVE__MKDIR
+#          /* plain Windows 32 */
+#     #    define mkdir(a, b) _mkdir(a)
+#     #  else
+#     #    error "Don't know how to create a directory on this system."
+#     #  endif
+#     #endif
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Alexandre Duret-Lutz <adl@xxxxxxx>
+#
+#   This program is free software; you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation; either version 2 of the License, or (at your
+#   option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+#serial 4
+
+AU_ALIAS([AC_FUNC_MKDIR], [AX_FUNC_MKDIR])
+AC_DEFUN([AX_FUNC_MKDIR],
+[AC_CHECK_FUNCS([mkdir _mkdir])
+AC_CACHE_CHECK([whether mkdir takes one argument],
+               [ac_cv_mkdir_takes_one_arg],
+[AC_TRY_COMPILE([
+#include <sys/stat.h>
+#if HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
+], [mkdir (".");],
+[ac_cv_mkdir_takes_one_arg=yes], [ac_cv_mkdir_takes_one_arg=no])])
+if test x"$ac_cv_mkdir_takes_one_arg" = xyes; then
+  AC_DEFINE([MKDIR_TAKES_ONE_ARG], 1,
+            [Define if mkdir takes only one argument.])
+fi
+])
+
+dnl Note:
+dnl =====
+dnl I have not implemented the following suggestion because I don't have
+dnl access to such a broken environment to test the macro.  So I'm just
+dnl appending the comments here in case you have, and want to fix
+dnl AX_FUNC_MKDIR that way.
+dnl
+dnl |Thomas E. Dickey (dickey@xxxxxxxxxxxxxxxx) said:
+dnl |  it doesn't cover the problem areas (compilers that mistreat mkdir
+dnl |  may prototype it in dir.h and dirent.h, for instance).
+dnl |
+dnl |Alexandre:
+dnl |  Would it be sufficient to check for these headers and #include
+dnl |  them in the AC_TRY_COMPILE block?  (and is AC_HEADER_DIRENT
+dnl |  suitable for this?)
+dnl |
+dnl |Thomas:
+dnl |  I think that might be a good starting point (with the set of recommended
+dnl |  ifdef's and includes for AC_HEADER_DIRENT, of course).
diff --git a/src/hid/common/hidinit.c b/src/hid/common/hidinit.c
index 9c4f8ee..554e592 100644
--- a/src/hid/common/hidinit.c
+++ b/src/hid/common/hidinit.c
@@ -431,11 +431,7 @@ hid_save_settings (int locally)
       fname = Concat (homedir, PCB_DIR_SEPARATOR_S, ".pcb", NULL);
 
       if (stat (fname, &st))
-#ifdef WIN32
-	if (mkdir (fname))
-#else
-	if (mkdir (fname, 0777))
-#endif
+	if (MKDIR (fname, 0777))
 	  {
 	    free (fname);
 	    return;
diff --git a/src/hid/gtk/gui-config.c b/src/hid/gtk/gui-config.c
index 516feb5..79d543d 100644
--- a/src/hid/gtk/gui-config.c
+++ b/src/hid/gtk/gui-config.c
@@ -45,6 +45,7 @@
 #include "file.h"
 #include "error.h"
 #include "draw.h"
+#include "misc.h" /* MKDIR() */
 #include "set.h"
 
 #if 0
@@ -196,7 +197,7 @@ config_file_open (gchar * mode)
       config_dir =
 	g_build_path (G_DIR_SEPARATOR_S, homedir, PCB_CONFIG_DIR, NULL);
       if (!g_file_test (config_dir, G_FILE_TEST_IS_DIR)
-	  && mkdir (config_dir, 0755) < 0)
+	  && MKDIR (config_dir, 0755) < 0)
 	{
 	  g_message ("config_file_open: Can't make \"%s\" directory!",
 		     config_dir);
@@ -212,7 +213,7 @@ config_file_open (gchar * mode)
 	g_build_path (G_DIR_SEPARATOR_S, config_dir, PCB_COLORS_DIR, NULL);
       if (!g_file_test (color_dir, G_FILE_TEST_IS_DIR))
 	{
-	  if (mkdir (color_dir, 0755) < 0)
+	  if (MKDIR (color_dir, 0755) < 0)
 	    {
 	      g_message ("config_file_open: Can't make \"%s\" directory!",
 			 color_dir);
diff --git a/src/misc.h b/src/misc.h
index 776e309..0ab8002 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -127,4 +127,27 @@ int ElementOrientation (ElementType *e);
 
 void NetlistChanged (int force_unfreeze);
 
+/*
+ * Check whether mkdir() is mkdir or _mkdir, and whether it takes one
+ * or two arguments.  WIN32 mkdir takes one argument and POSIX takes
+ * two.
+ */
+#if HAVE_MKDIR
+#include <io.h> /* mkdir under MinGW only takes one argument */
+        #if MKDIR_TAKES_ONE_ARG
+         /* MinGW32 */
+         #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)
+        #else
+         #error "Don't know how to create a directory on this system."
+        #endif
 #endif
+
+#endif /* __MISC_INCLUDED__ */
+




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs