changeset 31104:b5d59c115e52

Use HAVE_TIFF flag to optionally disable Tiff * __tiff__.cc: Used the HAVE_TIFF flag to disable the internal functions of Tiff.
author magedrifaat <magedrifaat@gmail.com>
date Sun, 03 Jul 2022 23:53:44 +0200
parents 76b21bed2920
children 7c5b8a294f60
files libinterp/dldfcn/__tiff__.cc
diffstat 1 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/dldfcn/__tiff__.cc	Sun Jul 03 22:51:08 2022 +0200
+++ b/libinterp/dldfcn/__tiff__.cc	Sun Jul 03 23:53:44 2022 +0200
@@ -1,3 +1,7 @@
+#if defined (HAVE_CONFIG_H)
+#  include "config.h"
+#endif
+
 #include <string>
 #include <iostream>
 
@@ -6,12 +10,17 @@
 #include "ovl.h"
 #include "error.h"
 
-#include <tiffio.h>
+#include "errwarn.h"
+
+#if defined (HAVE_TIFF)
+#  include <tiffio.h>
+#endif
 
 // TODO(maged): Tidy up the formatting to be consistant with octave
 
 namespace octve
 {
+#if defined (HAVE_TIFF)
   // Error if status is not 1 (success status for TIFFGetField)
   void
   validate_tiff_get_field (bool status, void *p_to_free=NULL)
@@ -347,10 +356,12 @@
     
     return tag_data_ovl;
   }
+#endif
 
   DEFUN_DLD (__open_tiff__, args, nargout,
             "Open a Tiff file and return its handle")
   {
+#if defined (HAVE_TIFF)
     int nargin = args.length ();
 
     if (nargin == 0 || nargin > 2)
@@ -375,12 +386,16 @@
     // TODO(maged): use inheritance of octave_base_value instead
     octave_value tiff_ov = octave_value ((uint64_t)tif);
     return octave_value_list (tiff_ov);
+#else
+    err_disabled_feature ("Tiff", "Tiff");
+#endif
   }
 
 
   DEFUN_DLD (__close_tiff__, args, nargout,
             "Close a tiff file")
   {
+#if defined (HAVE_TIFF)
     int nargin = args.length ();
 
     if (nargin == 0)
@@ -390,12 +405,16 @@
     TIFFClose (tif);
 
     return octave_value_list ();
+#else
+    err_disabled_feature ("close", "Tiff");
+#endif
   }
 
 
   DEFUN_DLD (__tiff_get_tag__, args, nargout,
             "Get the value of a tag from a tiff image")
   {
+#if defined (HAVE_TIFF)
       int nargin = args.length ();
 
       if (nargin == 0)
@@ -430,5 +449,8 @@
       octave_value_list tag_data_ovl = get_field_data (tif, fip);
 
       return tag_data_ovl;
+#else
+    err_disabled_feature ("getTag", "Tiff");
+#endif
   }
 }