"Fossies" - the Fresh Open Source Software Archive

Member "gretl-2020e/macros/unixodbc.m4" (2 Oct 2015, 2556 Bytes) of package /linux/misc/gretl-2020e.tar.xz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # Configure paths for unixODBC
    2 # Allin Cottrell <cottrell@wfu.edu>
    3 
    4 dnl AM_PATH_ODBC([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
    5 dnl Test for unixODBC, and define ODBC_CFLAGS and ODBC_LIBS.
    6 dnl
    7 AC_DEFUN([AM_PATH_ODBC],
    8 [dnl 
    9 AC_ARG_WITH(ODBC-prefix,[  --with-ODBC-prefix=PFX   Prefix where unixODBC is installed (optional)],
   10             ODBC_config_prefix="$withval", ODBC_config_prefix="")
   11 
   12   if test x$ODBC_config_prefix != x ; then
   13      ODBC_config_args="$ODBC_config_args --prefix=$ODBC_config_prefix"
   14   fi
   15 
   16   AC_MSG_CHECKING(for ODBC)
   17   if test x"${ODBC_LIBS}" = x ; then  
   18      ODBC_CFLAGS="-I$ODBC_config_prefix/include"
   19      ODBC_LIBS="-L$ODBC_config_prefix/lib -lodbc"
   20   fi
   21 
   22   ac_save_CFLAGS="$CFLAGS"
   23   ac_save_LIBS="$LIBS"
   24   CFLAGS="$ODBC_CFLAGS $CFLAGS"
   25   LIBS="$ODBC_LIBS $LIBS"
   26 
   27 dnl
   28 dnl Check the installed ODBC.
   29 dnl
   30   rm -f conf.ODBCtest
   31   AC_TRY_RUN([
   32 #include <stdlib.h>
   33 #include <sql.h>
   34 #include <sqlext.h>
   35 #include <sqltypes.h>
   36 int main (void)
   37 {
   38   SQLFreeConnect(NULL);
   39   system ("touch conf.ODBCtest");
   40   return 0;
   41 }
   42 ],, no_ODBC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
   43   CFLAGS="$ac_save_CFLAGS"
   44   LIBS="$ac_save_LIBS"
   45 
   46   if test "x$no_ODBC" = x ; then
   47      AC_MSG_RESULT(yes)
   48      ifelse([$2], , :, [$2])     
   49   else
   50      AC_MSG_RESULT(no)
   51      if test -f conf.ODBCtest ; then
   52        :
   53      else
   54        echo "*** Could not run ODBC test program, checking why..."
   55        CFLAGS="$ODBC_CFLAGS $CFLAGS"
   56        LIBS="$LIBS $ODBC_LIBS"
   57        AC_TRY_LINK([
   58 #include <stdlib.h>
   59 #include <sql.h>
   60 #include <sqlext.h>
   61 #include <sqltypes.h>
   62 ],     [ return (1); ],
   63        [ echo "*** The test program compiled, but did not run. This usually means"
   64          echo "*** that the run-time linker is not finding ODBC. If it is not"
   65          echo "*** finding ODBC, you'll need to set your LD_LIBRARY_PATH "
   66          echo "*** environment variable, or edit /etc/ld.so.conf to point"
   67          echo "*** to the installed location.  Also, make sure you have run"
   68          echo "*** ldconfig if that is required on your system."
   69          echo "***" ],
   70        [ echo "*** The test program failed to compile or link. See config.log for the"
   71          echo "*** exact error that occured. This may mean ODBC was incorrectly installed"
   72          echo "*** or that you have moved ODBC since it was installed." ])
   73          CFLAGS="$ac_save_CFLAGS"
   74          LIBS="$ac_save_LIBS"
   75      fi
   76      ODBC_CFLAGS=""
   77      ODBC_LIBS=""
   78      ifelse([$3], , :, [$3])
   79   fi
   80   AC_SUBST(ODBC_CFLAGS)
   81   AC_SUBST(ODBC_LIBS)
   82   rm -f conf.ODBCtest
   83 ])