orcc: check version of liborc to make sure the right lib is being used
authorTim-Philipp Müller <tim@centricular.com>
Wed, 2 Mar 2016 19:04:35 +0000 (19:04 +0000)
committerTim-Philipp Müller <tim@centricular.com>
Wed, 2 Mar 2016 19:08:52 +0000 (19:08 +0000)
Interesting compilation failures might otherwise ensue.

tools/orcc.c

index b2d4201..5e940fc 100644 (file)
@@ -90,6 +90,7 @@ void help (void)
 int
 main (int argc, char *argv[])
 {
+  const char *orc_version;
   char *code;
   int n;
   int i;
@@ -102,6 +103,16 @@ main (int argc, char *argv[])
 
   orc_init ();
 
+  orc_version = orc_version_string ();
+  if (strcmp (orc_version, VERSION) != 0) {
+    fprintf (stderr, "WARNING: unexpected liborc library version %s is being "
+        "picked up by %s, which is version %s. This might be because orc was "
+        "installed from source and is also installed via packages, and liborc "
+        "from the wrong prefix is used. Check your system setup.\n",
+        orc_version, argv[0], VERSION);
+    exit(1);
+  }
+
   for(i=1;i<argc;i++) {
     if (strcmp(argv[i], "--header") == 0) {
       mode = MODE_HEADER;