@@ -5302,6 +5302,22 @@ but not implemented on your system"
fi
fi
+##########################################
+# check for system()
+# make sure there is no compile error
+
+have_system_function=no
+cat > $TMPC << EOF
+#include <stdlib.h>
+int main(void) {
+ return system("");
+}
+EOF
+if compile_prog "" "" ; then
+ have_system_function=yes
+fi
+
+
##########################################
# End of CC checks
# After here, no more $cc or $ld runs
@@ -6200,6 +6216,10 @@ if test "$secret_keyring" = "yes" ; then
echo "CONFIG_SECRET_KEYRING=y" >> $config_host_mak
fi
+if test "$have_system_function" = "yes" ; then
+ echo "HAVE_SYSTEM_FUNCTION=y" >> $config_host_mak
+fi
+
echo "ROMS=$roms" >> $config_host_mak
echo "MAKE=$make" >> $config_host_mak
echo "PYTHON=$python" >> $config_host_mak
@@ -682,4 +682,16 @@ char *qemu_get_host_name(Error **errp);
*/
size_t qemu_get_host_physmem(void);
+/**
+ * Platforms which do not support system() return ENOSYS
+ */
+#ifndef HAVE_SYSTEM_FUNCTION
+#define system platform_does_not_support_system
+static inline int platform_does_not_support_system(const char *command)
+{
+ errno = ENOSYS;
+ return -1;
+}
+#endif /* !HAVE_SYSTEM_FUNCTION */
+
#endif
Build without error on hosts without a working system(). If system() is called, return -1 with ENOSYS. Signed-off-by: Joelle van Dyne <j@getutm.app> --- configure | 20 ++++++++++++++++++++ include/qemu/osdep.h | 12 ++++++++++++ 2 files changed, 32 insertions(+)