]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Autodetect tiff_runlen_t in configure to build with new & old libtiff.
authorDarren Nickerson <darren.nickerson@ifax.com>
Sun, 28 May 2000 17:49:15 +0000 (17:49 +0000)
committerDarren Nickerson <darren.nickerson@ifax.com>
Sun, 28 May 2000 17:49:15 +0000 (17:49 +0000)
Contributed by Dmitry Bely <dbely@mail.ru>.

configure

index a2d236f4bac992b932b43e9828719cc7157e55b7..28cedb2bced4024a4079fc176293945257471f82 100755 (executable)
--- a/configure
+++ b/configure
@@ -1674,11 +1674,6 @@ EmitConfigurationDefinitions()
         echo
     fi
 
-    #
-    # Define the tiff run length type(...should be configurable)
-    #
-    echo "#define tiff_runlen_t uint32"
-
     #
     # Select the mode to use when opening FIFO files
     # in a server process.  One should be able to open
@@ -2258,6 +2253,80 @@ getConfigTag()
     param=`grep "$1:" $2 | sed -e 's/.*:[      ]*\([^  ]*\).*/\1/'`
 }
 
+#
+# Check if TIFF library is compatible. If successful,
+# set $tiff_runlen_t on exit to "uint16" or "uint32"
+#
+CheckLibtiff()
+{
+    Note "... checking TIFF library version"
+    tiff_runlen_t=""
+    cat>t.c<<EOF
+#include "tiffio.h"
+main()
+{
+    printf( "header_ver=%d lib_ver=%s", TIFFLIB_VERSION, TIFFGetVersion() );
+    exit(0);
+}
+EOF
+    capture cat t.c
+    if runMake t "t:; \${CC} \${CVERSION} -I${OTIFFINC} t.c ${LIBTIFF} ${MACHDEPLIBS}"; then
+        header_ver=0
+        lib_ver=""
+       eval `./a.out | \
+           sed -n -e 's/header_ver=\([0-9]\+\) lib_ver=.*Version *\([0-9]\+\.[0-9]\+\).*/\
+                       header_ver=\1;lib_ver=\2/p'`
+       Note "  Found tiffio.h version ${header_ver}"
+       Note "  Found libtiff version ${lib_ver}"
+       if [ ${header_ver} -ge 19960307 ]; then
+           if [ "${lib_ver}" = "3.4" ]; then
+               tiff_runlen_t="uint16"
+           elif [ "${lib_ver}" = "3.5" ]; then
+               tiff_runlen_t="uint32"
+           fi
+       fi
+    else
+       cat 1>&2 <<EOF
+
+Missing TIFF Library.
+
+Compilation of the following test program failed:
+
+----------------------------------------------------------
+EOF
+        cat t.c 1>&2
+        cat 1>&2 <<EOF
+----------------------------------------------------------
+
+TIFFINC=${OTIFFINC}
+LIBTIFF=${LIBTIFF}
+
+Verify that you have the TIFFINC and LIBTIFF configuration parameters
+set correctly for your system (see above) and that any environment
+variables are setup that are needed to locate a libtiff DSO at runtime
+(e.g. LD_LIBRARY_PATH). Also be sure that any relative pathnames are
+made relative to the top of the build area.
+EOF
+       boom
+       return 1
+    fi
+    if [ "${tiff_runlen_t}" != "" ]; then
+       export tiff_runlen_t
+       return 0
+    else
+       cat 1>&2 <<EOF
+
+Incompatible TIFF Library.
+
+HylaFAX ${VERSION} requires TIFF software distribution ver 3.4 or 3.5.
+If you do not have up to date TIFF software on your system then you can
+retrieve it from the location where you obtained this software.
+EOF
+       boom
+       return 1
+    fi
+}
+
 #
 # Check an existing port.h to see if it was created
 # for the target and compiler we're using.
@@ -2791,6 +2860,10 @@ BuildPortDotH()
        CheckFuncDecl crypt 'extern const char* crypt(const char*, const char*);' unistd.h stdlib.h
     fi
     CheckTermioFuncDecls termios.h
+    if CheckLibtiff; then
+       Note "... add declaration for tiff_runlen_t"
+       echo "#define tiff_runlen_t ${tiff_runlen_t}"
+    fi
     EmitCPlusPlusEpilogue
     )>xport.h
     mv xport.h port.h; chmod 444 port.h
@@ -2894,61 +2967,7 @@ EOF
 else
     Note "Using TIFF binary files from $TIFFBIN"
 fi
-#
-# Verify library is compatible.
-#
-cat>t.c<<EOF
-#include "tiffio.h"
-main()
-{
-    if (TIFFLIB_VERSION < 19960307) {     /* check include file version */
-       printf("old include files: version %u\n", TIFFLIB_VERSION);
-        exit(-1);
-    }
-    if (strncmp(TIFFGetVersion(), "LIBTIFF, Version 3.5", 20) != 0) {
-       printf("old library: version %s\n", TIFFGetVersion());
-       exit(-1);
-    } else
-       exit(0);
-}
-EOF
-capture cat t.c
-if runMake t "t:; \${CC} \${CVERSION} -I${OTIFFINC} t.c ${LIBTIFF} ${MACHDEPLIBS}" && capture ./a.out; then
-    Note "Using TIFF include files from $OTIFFINC"
-    Note "Using pre-built TIFF library $LIBTIFF"
-else
-    cat 1>&2 <<EOF
-
-Incompatible/missing TIFF Library.
 
-Compilation or execution of the following test program failed:
-
-----------------------------------------------------------
-EOF
-    cat t.c 1>&2
-    cat 1>&2 <<EOF
-----------------------------------------------------------
-
-With:
-
-TIFFINC=${OTIFFINC}
-LIBTIFF=${LIBTIFF}
-
-The above program checks the version of the TIFF library to ensure it
-is suitable for use with HylaFAX.  HylaFAX ${VERSION} requires a recent
-TIFF software distribution; one distributed March 7, 1996 or later.  If
-you do not have up to date TIFF software on your system then you can
-retrieve it from the location where you obtained this software.
-Otherwise, if you have the right software, verify that you have the
-TIFFINC and LIBTIFF configuration parameters set correctly for your
-system (see above) and that any environment variables are setup that
-are needed to locate a libtiff DSO at runtime (e.g. LD_LIBRARY_PATH).
-Also be sure that any relative pathnames are made relative to the top
-of the build area.
-
-EOF
-    boom
-fi
 Note "Done checking TIFF support."
 
 if [ $ZLIB != yes ]; then