File: unixodbc.m4

package info (click to toggle)
gretl 2025b-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 64,984 kB
  • sloc: ansic: 426,435; sh: 4,916; makefile: 3,257; cpp: 2,777; xml: 610; perl: 364
file content (83 lines) | stat: -rw-r--r-- 2,556 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Configure paths for unixODBC
# Allin Cottrell <cottrell@wfu.edu>

dnl AM_PATH_ODBC([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for unixODBC, and define ODBC_CFLAGS and ODBC_LIBS.
dnl
AC_DEFUN([AM_PATH_ODBC],
[dnl 
AC_ARG_WITH(ODBC-prefix,[  --with-ODBC-prefix=PFX   Prefix where unixODBC is installed (optional)],
            ODBC_config_prefix="$withval", ODBC_config_prefix="")

  if test x$ODBC_config_prefix != x ; then
     ODBC_config_args="$ODBC_config_args --prefix=$ODBC_config_prefix"
  fi

  AC_MSG_CHECKING(for ODBC)
  if test x"${ODBC_LIBS}" = x ; then  
     ODBC_CFLAGS="-I$ODBC_config_prefix/include"
     ODBC_LIBS="-L$ODBC_config_prefix/lib -lodbc"
  fi

  ac_save_CFLAGS="$CFLAGS"
  ac_save_LIBS="$LIBS"
  CFLAGS="$ODBC_CFLAGS $CFLAGS"
  LIBS="$ODBC_LIBS $LIBS"

dnl
dnl Check the installed ODBC.
dnl
  rm -f conf.ODBCtest
  AC_TRY_RUN([
#include <stdlib.h>
#include <sql.h>
#include <sqlext.h>
#include <sqltypes.h>
int main (void)
{
  SQLFreeConnect(NULL);
  system ("touch conf.ODBCtest");
  return 0;
}
],, no_ODBC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
  CFLAGS="$ac_save_CFLAGS"
  LIBS="$ac_save_LIBS"

  if test "x$no_ODBC" = x ; then
     AC_MSG_RESULT(yes)
     ifelse([$2], , :, [$2])     
  else
     AC_MSG_RESULT(no)
     if test -f conf.ODBCtest ; then
       :
     else
       echo "*** Could not run ODBC test program, checking why..."
       CFLAGS="$ODBC_CFLAGS $CFLAGS"
       LIBS="$LIBS $ODBC_LIBS"
       AC_TRY_LINK([
#include <stdlib.h>
#include <sql.h>
#include <sqlext.h>
#include <sqltypes.h>
],     [ return (1); ],
       [ echo "*** The test program compiled, but did not run. This usually means"
         echo "*** that the run-time linker is not finding ODBC. If it is not"
         echo "*** finding ODBC, you'll need to set your LD_LIBRARY_PATH "
         echo "*** environment variable, or edit /etc/ld.so.conf to point"
         echo "*** to the installed location.  Also, make sure you have run"
         echo "*** ldconfig if that is required on your system."
         echo "***" ],
       [ echo "*** The test program failed to compile or link. See config.log for the"
         echo "*** exact error that occured. This may mean ODBC was incorrectly installed"
         echo "*** or that you have moved ODBC since it was installed." ])
         CFLAGS="$ac_save_CFLAGS"
         LIBS="$ac_save_LIBS"
     fi
     ODBC_CFLAGS=""
     ODBC_LIBS=""
     ifelse([$3], , :, [$3])
  fi
  AC_SUBST(ODBC_CFLAGS)
  AC_SUBST(ODBC_LIBS)
  rm -f conf.ODBCtest
])