1
if($^O =~ /mswin32/i) {exit}
5
/******************************
6
* pdl.c - perldl spawner
7
* Works around a problem with many unices that you can't use an interpreter
8
* to run an interpreter -- so "#!/usr/bin/perldl" won't work.
9
* This is a compiled piece of code that launches perldl "directly",
10
* so that the poor kernel's mind isn't blown.
12
* If you feed in a single non-switch argument it gets prepended with a
13
* "-" to let perldl know that it's an input file. That way you can be lazy
14
* and say "#!/usr/bin/pdl" at the top of your script.
16
* Don't modify this .c code -- modify the generator, pdl.PL, instead.
25
#include <sys/types.h>
28
main(int argc, char **argv) {
34
if(pipe(pipes)) {perror; exit(1);}
39
system("which perldl");
42
read(pipes[0],perldl,BUFSIZ);
44
if(! WIFEXITED(status) ) {
45
fprintf(stderr,"Hmmm... couldn't seem to find perldl anywhere. Quitting.\n");
49
/* Remove trailing newline */
50
for(i=0;i<BUFSIZ && perldl[i]; i++)
51
if(perldl[i]=='\n' || perldl[i]=='\r')
56
char **argv2 = malloc((argc+2)*sizeof(char *));
70
fprintf(stderr,"couldn't execv %s\n",perldl);
77
fprintf(stderr,"couldn't execv %s (%d args)\n",perldl,argc);
81
perror("pdl (perldl trampoline)");
89
#manually create directory. Older versions of EU::MM (at least as late
90
#as 6.17 which ships with perl 5.8.6) don't automatically create it.
91
mkdir $dir unless -e $dir && -d $dir;
92
`$Config{cc} -o $dir/pdl pdl.c`;