75 |
|
|
76 |
if (scriptStatus == -1) { |
if (scriptStatus == -1) { |
77 |
fprintf( stderr, "%s EXIT FAILURE: pclose returned %d (%s)\n", |
fprintf( stderr, "%s EXIT FAILURE: pclose returned %d (%s)\n", |
78 |
ltmainOptions.pzProgName, errno, strerror( errno )); |
libtoolOptions.pzProgName, errno, strerror( errno )); |
79 |
scriptStatus = EXIT_FAILURE; |
scriptStatus = EXIT_FAILURE; |
80 |
return; |
return; |
81 |
} |
} |
82 |
|
|
83 |
if (! WIFEXITED( scriptStatus )) { |
if (! WIFEXITED( scriptStatus )) { |
84 |
fprintf( stderr, "%s EXIT FAILURE: %s did not exit - code %x\n", |
fprintf( stderr, "%s EXIT FAILURE: %s did not exit - code %x\n", |
85 |
ltmainOptions.pzProgName, pz_cmd_name, scriptStatus ); |
libtoolOptions.pzProgName, pz_cmd_name, scriptStatus ); |
86 |
scriptStatus = EXIT_FAILURE; |
scriptStatus = EXIT_FAILURE; |
87 |
return; |
return; |
88 |
} |
} |
90 |
scriptStatus = WEXITSTATUS(scriptStatus); |
scriptStatus = WEXITSTATUS(scriptStatus); |
91 |
if (scriptStatus != 0) { |
if (scriptStatus != 0) { |
92 |
fprintf( stderr, "%s BAD EXIT: %s exited %d\n", |
fprintf( stderr, "%s BAD EXIT: %s exited %d\n", |
93 |
ltmainOptions.pzProgName, pz_cmd_name, scriptStatus ); |
libtoolOptions.pzProgName, pz_cmd_name, scriptStatus ); |
94 |
return; |
return; |
95 |
} |
} |
96 |
|
|
106 |
|
|
107 |
default: |
default: |
108 |
fprintf( stderr, "%s WRONG SIGNAL: %d\n", |
fprintf( stderr, "%s WRONG SIGNAL: %d\n", |
109 |
ltmainOptions.pzProgName, signalReceived ); |
libtoolOptions.pzProgName, signalReceived ); |
110 |
scriptStatus = EXIT_FAILURE; |
scriptStatus = EXIT_FAILURE; |
111 |
} |
} |
112 |
} |
} |
265 |
FILE* fp = HAVE_OPT( DRY_RUN ) ? stdout : popen( pz_shell, "w" ); |
FILE* fp = HAVE_OPT( DRY_RUN ) ? stdout : popen( pz_shell, "w" ); |
266 |
if (fp == (FILE*)NULL) { |
if (fp == (FILE*)NULL) { |
267 |
tSCC zErr[] = "%s error: fs error %d (%s) on popen( \"%s\",\"w\")\n"; |
tSCC zErr[] = "%s error: fs error %d (%s) on popen( \"%s\",\"w\")\n"; |
268 |
fprintf( stderr, zErr, ltmainOptions.pzProgPath, errno, |
fprintf( stderr, zErr, libtoolOptions.pzProgPath, errno, |
269 |
strerror( errno ), pz_shell ); |
strerror( errno ), pz_shell ); |
270 |
exit( EXIT_FAILURE ); |
exit( EXIT_FAILURE ); |
271 |
} |
} |
283 |
CKSERV; |
CKSERV; |
284 |
fputs( apz_mode_cmd[ 0 ], fp ); |
fputs( apz_mode_cmd[ 0 ], fp ); |
285 |
CKSERV; |
CKSERV; |
286 |
fprintf( fp, zChkEcho, ltmainOptions.pzProgPath ); |
fprintf( fp, zChkEcho, libtoolOptions.pzProgPath ); |
287 |
CKSERV; |
CKSERV; |
288 |
|
|
289 |
fprintf( fp, zQuiet, HAVE_OPT( QUIET ) ? ":" : "\"$echo\"" ); |
fprintf( fp, zQuiet, HAVE_OPT( QUIET ) ? ":" : "\"$echo\"" ); |
300 |
|
|
301 |
if (HAVE_OPT( DEBUG )) { |
if (HAVE_OPT( DEBUG )) { |
302 |
fprintf( stderr, "%s: enabling shell trace mode\n", |
fprintf( stderr, "%s: enabling shell trace mode\n", |
303 |
ltmainOptions.pzProgName ); |
libtoolOptions.pzProgName ); |
304 |
fputs( zDbgFmt, fp ); |
fputs( zDbgFmt, fp ); |
305 |
} |
} |
306 |
CKSERV; |
CKSERV; |
323 |
* Insert our modal stuff and one shell option processing dinkleberry |
* Insert our modal stuff and one shell option processing dinkleberry |
324 |
* that one of the command scripts depends upon. |
* that one of the command scripts depends upon. |
325 |
*/ |
*/ |
326 |
fprintf( fp, zModeName, ltmainOptions.pzProgName, |
fprintf( fp, zModeName, libtoolOptions.pzProgName, |
327 |
ltmainOptions.pOptDesc[ WHICH_OPT_COMPILE ].pz_Name ); |
libtoolOptions.pOptDesc[ OPT_VALUE_MODE ].pz_Name ); |
328 |
CKSERV; |
CKSERV; |
329 |
fprintf( fp, zMode, ltmainOptions.pzProgName ); |
fprintf( fp, zMode, libtoolOptions.pzProgName ); |
330 |
CKSERV; |
CKSERV; |
331 |
|
|
332 |
/* |
/* |
355 |
* macro will detect that, call closeScript() and return so as to |
* macro will detect that, call closeScript() and return so as to |
356 |
* avoid segfaults and more SIGPIPEs. |
* avoid segfaults and more SIGPIPEs. |
357 |
*/ |
*/ |
358 |
fputs( apz_mode_cmd[ WHICH_OPT_COMPILE ], fp ); |
fputs( apz_mode_cmd[ OPT_VALUE_MODE ], fp ); |
359 |
CLOSEOK; |
CLOSEOK; |
360 |
|
|
361 |
fputc( '\n', fp ); |
fputc( '\n', fp ); |
382 |
* Make sure the resulting state is sane. |
* Make sure the resulting state is sane. |
383 |
*/ |
*/ |
384 |
{ |
{ |
385 |
int ct = optionProcess( <mainOptions, argc, argv ); |
int ct = optionProcess( &libtoolOptions, argc, argv ); |
386 |
argc -= ct; |
argc -= ct; |
387 |
argv += ct; |
argv += ct; |
388 |
if (! HAVE_OPT( MODE )) |
if (! HAVE_OPT( MODE )) |
399 |
* Options prohibited for all states except link & compile |
* Options prohibited for all states except link & compile |
400 |
*/ |
*/ |
401 |
if (HAVE_OPT( OUTPUT_FILE )) { |
if (HAVE_OPT( OUTPUT_FILE )) { |
402 |
fprintf( stderr, zBadOpt, ltmainOptions.pzProgName, "output-file" ); |
fprintf( stderr, zBadOpt, libtoolOptions.pzProgName, "output-file" ); |
403 |
USAGE( EXIT_FAILURE ); |
USAGE( EXIT_FAILURE ); |
404 |
/* NOTREACHED */ |
/* NOTREACHED */ |
405 |
} |
} |
406 |
if (HAVE_OPT( STATIC )) { |
if (HAVE_OPT( STATIC )) { |
407 |
fprintf( stderr, zBadOpt, ltmainOptions.pzProgName, "static" ); |
fprintf( stderr, zBadOpt, libtoolOptions.pzProgName, "static" ); |
408 |
USAGE( EXIT_FAILURE ); |
USAGE( EXIT_FAILURE ); |
409 |
/* NOTREACHED */ |
/* NOTREACHED */ |
410 |
} |
} |
411 |
if (HAVE_OPT( DYNAMIC )) { |
if (HAVE_OPT( DYNAMIC )) { |
412 |
fprintf( stderr, zBadOpt, ltmainOptions.pzProgName, "dynamic" ); |
fprintf( stderr, zBadOpt, libtoolOptions.pzProgName, "dynamic" ); |
413 |
USAGE( EXIT_FAILURE ); |
USAGE( EXIT_FAILURE ); |
414 |
/* NOTREACHED */ |
/* NOTREACHED */ |
415 |
} |
} |
425 |
case MODE_LINK: |
case MODE_LINK: |
426 |
case MODE_COMPILE: |
case MODE_COMPILE: |
427 |
if (HAVE_OPT( DLOPEN )) { |
if (HAVE_OPT( DLOPEN )) { |
428 |
fprintf( stderr, zBadOpt, ltmainOptions.pzProgName, "dlopen" ); |
fprintf( stderr, zBadOpt, libtoolOptions.pzProgName, "dlopen" ); |
429 |
USAGE( EXIT_FAILURE ); |
USAGE( EXIT_FAILURE ); |
430 |
/* NOTREACHED */ |
/* NOTREACHED */ |
431 |
} |
} |
446 |
return EXIT_SUCCESS; |
return EXIT_SUCCESS; |
447 |
|
|
448 |
default: |
default: |
449 |
fprintf( stderr, zBadMode, ltmainOptions.pzProgName ); |
fprintf( stderr, zBadMode, libtoolOptions.pzProgName ); |
450 |
USAGE( EXIT_FAILURE ); |
USAGE( EXIT_FAILURE ); |
451 |
/* NOTREACHED */ |
/* NOTREACHED */ |
452 |
} |
} |