1# ------------------------------------------------------------- 2# Tecplot 3# ------------------------------------------------------------- 4AC_DEFUN([CONFIGURE_TECPLOT], 5[ 6 AC_ARG_ENABLE(tecplot, 7 AS_HELP_STRING([--enable-tecplot], 8 [build with Tecplot binary file I/O support (using distributed libraries)]), 9 [AS_CASE("${enableval}", 10 [yes], [enabletecplot=yes], 11 [no], [enabletecplot=no], 12 [AC_MSG_ERROR(bad value ${enableval} for --enable-tecplot)])], 13 [enabletecplot=no]) 14 15 dnl Can't support both vendor-provided libraries and building from source, and we prefer the latter 16 AS_IF([test "x$enabletecplot" = "xyes" && test "x$enabletecio" = "xyes"], 17 [ 18 AC_MSG_RESULT([>>> Not using vendor provided tecio libraries, deferring to source build <<<]) 19 enabletecplot=no 20 ]) 21 22 dnl The Tecplot API is distributed with libmesh. 23 AS_IF([test "x$enabletecplot" = "xyes"], 24 [ 25 dnl We will check to see if we can actually link against the Tecplot library momentarily, 26 dnl now we just see if the file exists, without using AC_CHECK_FILE! 27 TECPLOT_LIBRARY_PATH="" 28 AS_IF([test -r $top_srcdir/contrib/tecplot/binary/lib/$host/tecio.a], 29 [TECPLOT_LIBRARY_PATH=$top_srcdir/contrib/tecplot/binary/lib/$host], 30 [ 31 AC_MSG_RESULT([>>> Configuring Tecplot failed, no tecio exists for $host <<<]) 32 enabletecplot=no 33 ]) 34 35 dnl Note: AC_CHECK_HEADER seems to fail if the path to the header 36 dnl is a relative one, i.e containing ".." in it. We'll work around this 37 dnl by setting the relevant path in $CPPFLAGS. 38 old_CPPFLAGS="$CPPFLAGS" 39 CPPFLAGS="$CPPFLAGS -I$top_srcdir/contrib/tecplot/binary/include" 40 41 AC_CHECK_HEADER(TECIO.h, 42 [TECPLOT_INCLUDE_PATH=$top_srcdir/contrib/tecplot/binary/include 43 TECPLOT_INCLUDE="-I\$(top_srcdir)/contrib/tecplot/binary/include"]) 44 45 dnl Reset CPPFLAGS 46 CPPFLAGS="$old_CPPFLAGS" 47 48 dnl And don't step on anybody's toes 49 unset old_CPPFLAGS 50 ]) 51 52 AS_IF([test "x$enabletecplot" = "xyes"], 53 [ 54 AS_IF([test -r $TECPLOT_LIBRARY_PATH/tecio.a && test -r $TECPLOT_INCLUDE_PATH/TECIO.h], 55 [ 56 dnl -------------------------------------------------------------------------- 57 dnl OK, the library and header are there, how about linking with the library? 58 dnl -------------------------------------------------------------------------- 59 save_CPPFLAGS=$CPPFLAGS 60 save_LIBS=$LIBS 61 62 CPPFLAGS="-I$TECPLOT_INCLUDE_PATH $CPPFLAGS" 63 LIBS="$TECPLOT_LIBRARY_PATH/tecio.a $LIBS" 64 65 AC_LINK_IFELSE( 66 [ 67 AC_LANG_PROGRAM([@%:@include <TECIO.h>], 68 [int ierr = TECEND112 ();]) 69 ], 70 [ 71 AC_DEFINE(HAVE_TECPLOT_API, 1, 72 [Flag indicating whether the library will be compiled with Tecplot TecIO API support]) 73 AC_DEFINE(HAVE_TECPLOT_API_112, 1, 74 [Flag indicating tecplot API understands newer features]) 75 AC_MSG_RESULT(<<< Configuring library with Tecplot API support (v11.2) >>>) 76 ], 77 [ 78 AC_LINK_IFELSE( 79 [ 80 AC_LANG_PROGRAM([@%:@include <TECIO.h>], 81 [int ierr = TECEND ();]) 82 ], 83 [ 84 AC_DEFINE(HAVE_TECPLOT_API, 1, 85 [Flag indicating whether the library shall be compiled to use the Tecplot interface]) 86 AC_MSG_RESULT(<<< Configuring library with legacy Tecplot API support >>>) 87 ], 88 [ 89 AC_MSG_RESULT( [WARNING: Found $TECPLOT_LIBRARY_PATH/tecio.a but cannot link with it!] ) 90 enabletecplot=no 91 ]) 92 ]) 93 94 LIBS=$save_LIBS 95 CPPFLAGS=$save_CPPFLAGS 96 ], 97 [ 98 AC_MSG_RESULT([>>> Configuring Tecplot failed, could not find at least one of tecio.a or TECIO.h <<<]) 99 enabletecplot=no 100 ]) 101 ]) 102]) 103