Skip to content

Commit

Permalink
lib/odbc: respect --with-odbc=PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
catap committed Nov 19, 2024
1 parent 5eb3f88 commit baa9875
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 26 deletions.
61 changes: 40 additions & 21 deletions lib/odbc/configure
Original file line number Diff line number Diff line change
Expand Up @@ -4944,26 +4944,6 @@ then :

fi

for ac_header in sql.h sqlext.h
do :
as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | sed "$as_sed_sh"`
ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
"
if eval test \"x\$"$as_ac_Header"\" = x"yes"
then :
cat >>confdefs.h <<_ACEOF
#define `printf "%s\n" "HAVE_$ac_header" | sed "$as_sed_cpp"` 1
_ACEOF
odbc_required_headers=yes
else case e in #(
e) odbc_required_headers=no ;;
esac
fi

done

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
printf %s "checking for an ANSI C-conforming const... " >&6; }
Expand Down Expand Up @@ -5639,6 +5619,8 @@ case $host_os in #(
ODBC_INCLUDE="-I$with_odbc/include"
fi

save_LIBS="$LIBS"
LIBS="$LIBS $ODBC_LIB"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SQLAllocHandle in -liodbc" >&5
printf %s "checking for SQLAllocHandle in -liodbc... " >&6; }
if test ${ac_cv_lib_iodbc_SQLAllocHandle+y}
Expand Down Expand Up @@ -5737,13 +5719,16 @@ then :
fi

fi
LIBS="$save_LIBS"
;; #(
haiku*) :

TARGET_FLAGS="-DUNIX"
ODBC_LIB= -L"/system/lib"
ODBC_INCLUDE="-I/system/develop/headers"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SQLAllocHandle in -lodbc" >&5
save_LIBS="$LIBS"
LIBS="$LIBS $ODBC_LIB"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SQLAllocHandle in -lodbc" >&5
printf %s "checking for SQLAllocHandle in -lodbc... " >&6; }
if test ${ac_cv_lib_odbc_SQLAllocHandle+y}
then :
Expand Down Expand Up @@ -5841,6 +5826,7 @@ then :
fi

fi
LIBS="$save_LIBS"
;; #(
win32|cygwin) :

Expand Down Expand Up @@ -5894,6 +5880,8 @@ fi
ODBC_LIB=-L"$with_odbc/lib"
ODBC_INCLUDE="-I$with_odbc/include"
fi
save_LIBS="$LIBS"
LIBS="$LIBS $ODBC_LIB"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for main in -lodbc32" >&5
printf %s "checking for main in -lodbc32... " >&6; }
if test ${ac_cv_lib_odbc32_main+y}
Expand Down Expand Up @@ -5933,6 +5921,7 @@ then :
ODBC_LIB="$ODBC_LIB -lodbc32"; odbc_lib_link_success=yes
fi

LIBS="$save_LIBS"
;; #(
*) :

Expand Down Expand Up @@ -6011,6 +6000,8 @@ printf "%s\n" "$as_me: WARNING: No odbc library found skipping odbc" >&2;}
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ODBC_LIB" >&5
printf "%s\n" "$ODBC_LIB" >&6; }
save_LIBS="$LIBS"
LIBS="$LIBS $ODBC_LIB"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SQLAllocHandle in -lodbc" >&5
printf %s "checking for SQLAllocHandle in -lodbc... " >&6; }
if test ${ac_cv_lib_odbc_SQLAllocHandle+y}
Expand Down Expand Up @@ -6109,12 +6100,15 @@ then :
fi

fi
LIBS="$save_LIBS"
fi
;; #(
*) :

ODBC_LIB=-L"$with_odbc/lib"
ODBC_INCLUDE="-I$with_odbc/include"
save_LIBS="$LIBS"
LIBS="$LIBS $ODBC_LIB"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SQLAllocHandle in -lodbc" >&5
printf %s "checking for SQLAllocHandle in -lodbc... " >&6; }
if test ${ac_cv_lib_odbc_SQLAllocHandle+y}
Expand Down Expand Up @@ -6213,11 +6207,36 @@ then :
fi

fi
LIBS="$save_LIBS"
;;
esac
;;
esac

save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $ODBC_INCLUDE"
for ac_header in sql.h sqlext.h
do :
as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | sed "$as_sed_sh"`
ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
"
if eval test \"x\$"$as_ac_Header"\" = x"yes"
then :
cat >>confdefs.h <<_ACEOF
#define `printf "%s\n" "HAVE_$ac_header" | sed "$as_sed_cpp"` 1
_ACEOF
odbc_required_headers=yes
else case e in #(
e) odbc_required_headers=no ;;
esac
fi

done
CFLAGS="$save_CFLAGS"

if test $odbc_required_headers = no; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: \"ODBC library - header check failed\"" >&5
printf "%s\n" "$as_me: WARNING: \"ODBC library - header check failed\"" >&2;}
Expand Down
29 changes: 24 additions & 5 deletions lib/odbc/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,6 @@ AC_PROG_EGREP
AC_CHECK_HEADERS([fcntl.h netdb.h stdlib.h string.h sys/socket.h winsock2.h])
AC_CHECK_HEADERS([windows.h])
AC_CHECK_HEADERS([sql.h sqlext.h], [odbc_required_headers=yes], [odbc_required_headers=no],
[[#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
]])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
Expand Down Expand Up @@ -161,10 +156,13 @@ AS_CASE([$host_os],
ODBC_INCLUDE="-I$with_odbc/include"
fi
save_LIBS="$LIBS"
LIBS="$LIBS $ODBC_LIB"
AC_CHECK_LIB(iodbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -liodbc"; odbc_lib_link_success=yes])
if test $odbc_lib_link_success = no; then
AC_CHECK_LIB(odbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -lodbc"; odbc_lib_link_success=yes])
fi
LIBS="$save_LIBS"
],
[haiku*],
Expand All @@ -173,10 +171,13 @@ AS_CASE([$host_os],
ODBC_LIB= -L"/system/lib"
ODBC_INCLUDE="-I/system/develop/headers"
dnl Haiku's package manager will deal with this for us
save_LIBS="$LIBS"
LIBS="$LIBS $ODBC_LIB"
AC_CHECK_LIB(odbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -lodbc"; odbc_lib_link_success=yes])
if test $odbc_lib_link_success = no; then
AC_CHECK_LIB(iodbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -liodbc"; odbc_lib_link_success=yes])
fi
LIBS="$save_LIBS"
],
[win32|cygwin],
Expand All @@ -190,7 +191,10 @@ AS_CASE([$host_os],
ODBC_LIB=-L"$with_odbc/lib"
ODBC_INCLUDE="-I$with_odbc/include"
fi
save_LIBS="$LIBS"
LIBS="$LIBS $ODBC_LIB"
AC_CHECK_LIB(odbc32, main, [ODBC_LIB="$ODBC_LIB -lodbc32"; odbc_lib_link_success=yes])
LIBS="$save_LIBS"
],
[
Expand Down Expand Up @@ -233,23 +237,38 @@ AS_CASE([$host_os],
echo "No odbc library found" > "$ERL_TOP/lib/odbc/SKIP"
else
AC_MSG_RESULT($ODBC_LIB)
save_LIBS="$LIBS"
LIBS="$LIBS $ODBC_LIB"
AC_CHECK_LIB(odbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -lodbc"; odbc_lib_link_success=yes])
if test $odbc_lib_link_success = no; then
AC_CHECK_LIB(iodbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -liodbc"; odbc_lib_link_success=yes])
fi
LIBS="$save_LIBS"
fi
],
[
ODBC_LIB=-L"$with_odbc/lib"
ODBC_INCLUDE="-I$with_odbc/include"
save_LIBS="$LIBS"
LIBS="$LIBS $ODBC_LIB"
AC_CHECK_LIB(odbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -lodbc"; odbc_lib_link_success=yes])
if test $odbc_lib_link_success = no; then
AC_CHECK_LIB(iodbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -liodbc"; odbc_lib_link_success=yes])
fi
LIBS="$save_LIBS"
])
])
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $ODBC_INCLUDE"
AC_CHECK_HEADERS([sql.h sqlext.h], [odbc_required_headers=yes], [odbc_required_headers=no],
[[#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
]])
CFLAGS="$save_CFLAGS"
if test $odbc_required_headers = no; then
AC_MSG_WARN(["ODBC library - header check failed"])
echo "ODBC library - header check failed" > $ERL_TOP/lib/odbc/SKIP
Expand Down

0 comments on commit baa9875

Please sign in to comment.