On Jul 30, 2014, at 12:59 AM, Richard Biener <richard.guent...@gmail.com> wrote:
>> So I do compiler testing on my toaster oven by doing native builds of gcc 
>> running on a binutils simulator and it doesn’t have a working popen (it’s in 
>> my newlib, but it wants vfork, which I don’t have).  I do have fork and 
>> system however.  :-) Could we replace the if 1 with if HAVE_popen where that 
>> is done by an autoconf link test?
> 
> Sure - patches welcome.  You could also use _POSIX_C_SOURCE >= 2
> || _XOPEN_SOURCE || _BSD_SOURCE || _SVID_SOURCE which I'm sure
> your newlib provide anyway(?)

Autoconf trivially solves the problem.  :-)  Thanks.

Committed revision 213309.

2014-07-30  Mike Stump  <mikest...@comcast.net>

        * configure.ac: Also check for popen.
        * tree-loop-distribution.c (dot_rdg): Autoconfize popen use.
        * configure: Regenerate.
        * config.in:  Regenerate.

2014-07-30  Mike Stump  <mikest...@comcast.net>

        * configure.ac: Also check for popen.
        * tree-loop-distribution.c (dot_rdg): Autoconfize popen use.
        * configure: Regenerate.
        * config.in:  Regenerate.

Index: config.in
===================================================================
--- config.in   (revision 213308)
+++ config.in   (working copy)
@@ -1468,6 +1468,12 @@
 #endif
 
 
+/* Define to 1 if you have the `popen' function. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_POPEN
+#endif
+
+
 /* Define to 1 if you have the `putchar_unlocked' function. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_PUTCHAR_UNLOCKED
Index: configure
===================================================================
--- configure   (revision 213308)
+++ configure   (working copy)
@@ -9285,7 +9285,7 @@ fi
 
 
 for ac_func in times clock kill getrlimit setrlimit atoll atoq \
-       sysconf strsignal getrusage nl_langinfo \
+       popen sysconf strsignal getrusage nl_langinfo \
        gettimeofday mbstowcs wcswidth mmap setlocale \
        clearerr_unlocked feof_unlocked   ferror_unlocked fflush_unlocked 
fgetc_unlocked fgets_unlocked   fileno_unlocked fprintf_unlocked fputc_unlocked 
fputs_unlocked   fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked  
 putchar_unlocked putc_unlocked madvise
 do :
Index: configure.ac
===================================================================
--- configure.ac        (revision 213308)
+++ configure.ac        (working copy)
@@ -1113,7 +1113,7 @@ define(gcc_UNLOCKED_FUNCS, clearerr_unlo
   fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl
   putchar_unlocked putc_unlocked)
 AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoll atoq \
-       sysconf strsignal getrusage nl_langinfo \
+       popen sysconf strsignal getrusage nl_langinfo \
        gettimeofday mbstowcs wcswidth mmap setlocale \
        gcc_UNLOCKED_FUNCS madvise)
 
Index: tree-loop-distribution.c
===================================================================
--- tree-loop-distribution.c    (revision 213308)
+++ tree-loop-distribution.c    (working copy)
@@ -228,7 +228,7 @@ DEBUG_FUNCTION void
 dot_rdg (struct graph *rdg)
 {
   /* When debugging, you may want to enable the following code.  */
-#if 1
+#ifdef HAVE_POPEN
   FILE *file = popen ("dot -Tx11", "w");
   if (!file)
     return;

Reply via email to