Add use_system_libopenjpeg2 build argument

This cl adds the possibility to build pdfium on Linux using a system
provided copy of libopenjpeg2, as it is preferred by many distros.

Change-Id: Id2805ffbf7b75678c2c1a73469ae9dfb9278f97b
Reviewed-on: https://pdfium-review.googlesource.com/c/50750
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 7e7658e..6885fc2 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -20,11 +20,14 @@
   ldflags = []
   include_dirs = [ "." ]
   defines = [
-    "OPJ_STATIC",
     "PNG_PREFIX",
     "PNG_USE_READ_MACROS",
   ]
 
+  if (!use_system_libopenjpeg2) {
+    defines += [ "OPJ_STATIC" ]
+  }
+
   if (pdf_enable_click_logging) {
     defines += [ "PDF_ENABLE_CLICK_LOGGING" ]
   }