From 05cc02cec03507c47846a668c92e6dcc4ba2e71e Mon Sep 17 00:00:00 2001
From: Josh Blum <josh@joshknows.com>
Date: Tue, 18 Jan 2011 01:00:15 -0800
Subject: cleanup mkdir usage with boost filesystem:

Replaced copy/pasted code and MKDIR_TAKES_ONE_ARG #ifdefs
with portable boost filesystem path and directory creation.

Gets the correct home directory on windows systems: APPDATA.
Replaces large amounts of copypasta with single lines of code.
Removes MKDIR_TAKES_ONE_ARG configuration checks from m4 files.
Adds boost filesystem and system library as build dependencies.
---
 gr-howto-write-a-block/config/gr_pwin32.m4 | 11 -----------
 gr-howto-write-a-block/config/mkstemp.m4   | 11 -----------
 gr-howto-write-a-block/lib/test_all.cc     |  5 +----
 3 files changed, 1 insertion(+), 26 deletions(-)

(limited to 'gr-howto-write-a-block')

diff --git a/gr-howto-write-a-block/config/gr_pwin32.m4 b/gr-howto-write-a-block/config/gr_pwin32.m4
index 495e9dd4d3..85a4a1633d 100644
--- a/gr-howto-write-a-block/config/gr_pwin32.m4
+++ b/gr-howto-write-a-block/config/gr_pwin32.m4
@@ -61,17 +61,6 @@ AC_TRY_LINK([   #include <windows.h>
                 AC_MSG_RESULT(no)
                 )
 
-dnl Under Win32, mkdir prototype in io.h has only one arg
-AC_MSG_CHECKING(whether mkdir accepts only one arg)
-AC_TRY_COMPILE([#include <sys/types.h>
-       #include <sys/stat.h>
-       #include <fcntl.h>], [
-       mkdir("")
- ], [ AC_MSG_RESULT(yes)
-     AC_DEFINE(MKDIR_TAKES_ONE_ARG,[],[Define if mkdir accepts only one arg]) ],
- [ AC_MSG_RESULT(no)
- ])
-
 AH_BOTTOM(
 [
 /* Define missing prototypes, implemented in replacement lib */
diff --git a/gr-howto-write-a-block/config/mkstemp.m4 b/gr-howto-write-a-block/config/mkstemp.m4
index 4af0f0a9b7..2d1fbee9b3 100644
--- a/gr-howto-write-a-block/config/mkstemp.m4
+++ b/gr-howto-write-a-block/config/mkstemp.m4
@@ -75,15 +75,4 @@ AC_DEFUN([jm_PREREQ_TEMPNAME],
   AC_CHECK_FUNCS(__secure_getenv gettimeofday lstat)
   AC_CHECK_DECLS_ONCE(getenv)
   # AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
-
-  dnl Under Win32, mkdir prototype in io.h has only one arg
-  AC_MSG_CHECKING(whether mkdir accepts only one arg)
-  AC_TRY_COMPILE([#include <sys/types.h>
-       #include <sys/stat.h>
-       #include <fcntl.h>], [
-       mkdir("")
-  ], [ AC_MSG_RESULT(yes)
-     AC_DEFINE(MKDIR_TAKES_ONE_ARG,[],[Define if mkdir accepts only one arg]) ],
-   [ AC_MSG_RESULT(no)
-     ])
 ])
diff --git a/gr-howto-write-a-block/lib/test_all.cc b/gr-howto-write-a-block/lib/test_all.cc
index ac1e83839a..c760e1eb7b 100644
--- a/gr-howto-write-a-block/lib/test_all.cc
+++ b/gr-howto-write-a-block/lib/test_all.cc
@@ -29,11 +29,8 @@
 int 
 main (int argc, char **argv)
 {
-  char path[200];
-  get_unittest_path ("gr_howto_write_a_block.xml", path, 200);
- 
   CppUnit::TextTestRunner runner;
-  std::ofstream xmlfile(path);
+  std::ofstream xmlfile(get_unittest_path("gr_howto_write_a_block.xml").c_str());
   CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
 
   runner.addTest(qa_howto::suite ());
-- 
cgit v1.2.3