Autoconfize cpp program name and popen. This commit inactivates cpp in the

VC build files, as there's no popen.

svn path=/trunk/yasm/; revision=1970
0.6.2
Peter Johnson 17 years ago
parent 43240f8955
commit 4db86bc131
  1. 6
      Mkfiles/dj/config.h
  2. 8
      Mkfiles/vc/config.h
  3. 8
      Mkfiles/vc8/config.h
  4. 3
      configure.ac
  5. 19
      modules/preprocs/cpp/cpp-preproc.c

@ -4,6 +4,9 @@
#define yasm__abspath(path) yasm__abspath_win(path)
#define yasm__combpath(from, to) yasm__combpath_win(from, to)
/* Command name to run C preprocessor */
#define CPP_PROG "gcc -E"
/* */
/* #undef ENABLE_NLS */
@ -55,6 +58,9 @@
/* Define if you have the `mergesort function. */
/* #undef HAVE_MERGESORT */
/* Define to 1 if you have the `popen' function. */
#define HAVE_POPEN 1
/* Define if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1

@ -4,6 +4,9 @@
#define yasm__abspath(path) yasm__abspath_win(path)
#define yasm__combpath(from, to) yasm__combpath_win(from, to)
/* Command name to run C preprocessor */
#define CPP_PROG "cpp"
/* */
/* #undef ENABLE_NLS */
@ -52,9 +55,12 @@
/* Define if you have the <memory.h> header file. */
/* #undef HAVE_MEMORY_H */
/* Define if you have the `mergesort function. */
/* Define if you have the `mergesort' function. */
/* #undef HAVE_MERGESORT */
/* Define to 1 if you have the `popen' function. */
/* #undef HAVE_POPEN */
/* Define if you have the <stdint.h> header file. */
/* #undef HAVE_STDINT_H */

@ -4,6 +4,9 @@
#define yasm__abspath(path) yasm__abspath_win(path)
#define yasm__combpath(from, to) yasm__combpath_win(from, to)
/* Command name to run C preprocessor */
#define CPP_PROG "cpp"
/* */
/* #undef ENABLE_NLS */
@ -52,9 +55,12 @@
/* Define if you have the <memory.h> header file. */
/* #undef HAVE_MEMORY_H */
/* Define if you have the `mergesort function. */
/* Define if you have the `mergesort' function. */
/* #undef HAVE_MERGESORT */
/* Define to 1 if you have the `popen' function. */
/* #undef HAVE_POPEN */
/* Define if you have the <stdint.h> header file. */
/* #undef HAVE_STDINT_H */

@ -72,6 +72,8 @@ esac], enable_python_bindings="auto")
#
# Checks for programs.
#
AC_PROG_CPP
AC_DEFINE_UNQUOTED([CPP_PROG], "${CPP}", [Command name to run C preprocessor])
AC_PROG_CC_STDC
AC_PROG_INSTALL
AC_PROG_LN_S
@ -123,6 +125,7 @@ AX_CREATE_STDINT_H([libyasm-stdint.h])
#
AC_CHECK_FUNCS([abort toascii vsnprintf])
AC_CHECK_FUNCS([strsep mergesort getcwd])
AC_CHECK_FUNCS([popen])
# Look for the case-insensitive comparison functions
AC_CHECK_FUNCS([strcasecmp strncasecmp stricmp _stricmp strcmpi])

@ -97,13 +97,10 @@ cpp_build_cmdline(yasm_preproc_cpp *pp, const char *extra)
char *cmdline, *p, *limit;
cpp_arg_entry *arg;
/*
Initialize command line. We can assume there will be enough space to
store "cpp".
*/
cmdline = p = yasm_xmalloc(CMDLINE_SIZE);
/* Initialize command line. */
cmdline = p = yasm_xmalloc(strlen(CPP_PROG)+CMDLINE_SIZE);
limit = p + CMDLINE_SIZE;
strcpy(p, "cpp");
strcpy(p, CPP_PROG);
p += 3;
arg = TAILQ_FIRST(&pp->cpp_args);
@ -138,9 +135,13 @@ cpp_invoke(yasm_preproc_cpp *pp)
cmdline = cpp_build_cmdline(pp, NULL);
#ifdef HAVE_POPEN
pp->f = popen(cmdline, "r");
if (!pp->f)
yasm__fatal( N_("Failed to execute preprocessor") );
#else
yasm__fatal( N_("Cannot execute preprocessor, no popen available") );
#endif
yasm_xfree(cmdline);
}
@ -166,9 +167,13 @@ cpp_generate_deps(yasm_preproc_cpp *pp)
cmdline = cpp_build_cmdline(pp, "-M");
#ifdef HAVE_POPEN
pp->f_deps = popen(cmdline, "r");
if (!pp->f_deps)
yasm__fatal( N_("Failed to execute preprocessor") );
#else
yasm__fatal( N_("Cannot execute preprocessor, no popen available") );
#endif
yasm_xfree(cmdline);
}
@ -211,8 +216,10 @@ cpp_preproc_destroy(yasm_preproc *preproc)
yasm_preproc_cpp *pp = (yasm_preproc_cpp *)preproc;
if (pp->f) {
#ifdef HAVE_POPEN
if (pclose(pp->f) != 0)
yasm__fatal( N_("Preprocessor exited with failure") );
#endif
}
cpp_destroy_args(pp);

Loading…
Cancel
Save