From 62799c9e70963add48ee21d841ae07d248986757 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Wed, 21 Dec 2005 04:29:16 +0000 Subject: [PATCH] different cpp invokation attempt SVN revision: 19196 --- legacy/edje/src/bin/edje_cc_parse.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/legacy/edje/src/bin/edje_cc_parse.c b/legacy/edje/src/bin/edje_cc_parse.c index e8a72356ad..6bf08b25c7 100644 --- a/legacy/edje/src/bin/edje_cc_parse.c +++ b/legacy/edje/src/bin/edje_cc_parse.c @@ -653,6 +653,29 @@ compile(void) strcat(def, " "); } } + + /* + * Run the input through the C pre-processor. + * + * On some BSD based systems (MacOS, OpenBSD), the default cpp + * in the path is a wrapper script that chokes on the -o option. + * If the preprocessor is invoked via gcc -E, it will treat + * file_in as a linker file. The safest route seems to be to + * run cpp with the output as the second non-option argument. + */ + snprintf(buf, sizeof(buf), "cpp -I%s %s %s %s", + inc, def, file_in, tmpn); + ret = system(buf); + if (ret < 0) + { + snprintf(buf, sizeof(buf), "gcc -I%s %s -E -o %s %s", + inc, def, tmpn, file_in); + ret = system(buf); + } + if (ret == EXIT_SUCCESS) + file_in = tmpn; + free(def); +/* OLD CODE snprintf(buf, sizeof(buf), "cat %s | cpp -I%s %s -E -o %s", file_in, inc, def, tmpn); ret = system(buf); @@ -664,6 +687,7 @@ compile(void) } if (ret >= 0) file_in = tmpn; free(def); + */ } fd = open(file_in, O_RDONLY); if (fd < 0)