diff options
Diffstat (limited to 'lib/odbc/configure.in')
-rw-r--r-- | lib/odbc/configure.in | 160 |
1 files changed, 71 insertions, 89 deletions
diff --git a/lib/odbc/configure.in b/lib/odbc/configure.in index 77b576ee88..24e286c290 100644 --- a/lib/odbc/configure.in +++ b/lib/odbc/configure.in @@ -25,6 +25,15 @@ else host_os=win32 fi +if test "$with_odbc" = "no"; then + + rm -f "$ERL_TOP/lib/odbc/SKIP" + echo "odbc disabled by user." > "$ERL_TOP/lib/odbc/SKIP" + +else dnl "$with_odbc" != "no" + +ERL_XCOMP_SYSROOT_INIT + dnl Checks for programs. AC_PROG_CC @@ -48,8 +57,11 @@ fi AC_SUBST(MIXED_CYGWIN_VC) AC_PROG_MAKE_SET -AC_CHECK_PROGS(DED_LD, [ld.sh ld], '$(CC)') -AC_SUBST(DED_LD) + +AC_CHECK_PROG(LD, ld.sh) +AC_CHECK_TOOL(LD, ld, '$(CC)') + +AC_SUBST(LD) # Sockets #-------------------------------------------------------------------- @@ -83,50 +95,6 @@ AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"])) dnl Checks for header files. AC_HEADER_STDC -case $have_pthread_lib-$host_os in - yes-linux*) - dnl NPTL test stolen from $ERL_TOP/erts/aclocal.m4 - AC_MSG_CHECKING(for Native POSIX Thread Library) - case `getconf GNU_LIBPTHREAD_VERSION 2>/dev/null` in - nptl*) nptl=yes;; - NPTL*) nptl=yes;; - *) nptl=no;; - esac - AC_MSG_RESULT($nptl) - if test $nptl = yes; then - need_nptl_incldir=no - AC_CHECK_HEADER(nptl/pthread.h, need_nptl_incldir=yes) - if test $need_nptl_incldir = yes; then - # Ahh... - nptl_path="$C_INCLUDE_PATH:$CPATH:/usr/local/include:/usr/include" - nptl_ws_path= - save_ifs="$IFS"; IFS=":" - for dir in $nptl_path; do - if test "x$dir" != "x"; then - nptl_ws_path="$nptl_ws_path $dir" - fi - done - IFS=$save_ifs - nptl_incldir= - for dir in $nptl_ws_path; do - AC_CHECK_HEADER($dir/nptl/pthread.h, - nptl_incldir=$dir/nptl) - if test "x$nptl_incldir" != "x"; then - CFLAGS="$CFLAGS -isystem $nptl_incldir" - dnl CPPFLAGS is for configure internal use - CPPFLAGS="$CPPFLAGS -isystem $nptl_incldir" - break - fi - done - if test "x$nptl_incldir" = "x"; then - AC_MSG_ERROR(Failed to locate nptl system include directory) - fi - fi - fi - ;; - *) - ;; -esac AC_CHECK_HEADERS([fcntl.h netdb.h stdlib.h string.h sys/socket.h]) dnl Checks for typedefs, structures, and compiler characteristics. @@ -137,20 +105,18 @@ dnl Checks for library functions. AC_CHECK_FUNCS([memset socket]) # ODBC -/bin/rm -f $ERL_TOP/lib/odbc/SKIP +/bin/rm -f "$ERL_TOP/lib/odbc/SKIP" -have_pthread_lib=no -have_odbc_lib=no - +LM_CHECK_THR_LIB +AC_SUBST(THR_DEFS) +AC_SUBST(THR_LIBS) + +odbc_lib_link_success=no AC_SUBST(TARGET_FLAGS) case $host_os in darwin*) TARGET_FLAGS="-DUNIX" - AC_CHECK_LIB(pthread, pthread_create, - [AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have the pthread library (-lpthread).]) - LIBS="$LIBS -lpthread" - have_pthread_lib=yes]) - if test ! -d "$with_odbc"; then + if test ! -d "$with_odbc" || test "$with_odbc" = "yes" ; then ODBC_LIB= -L"/usr/lib" ODBC_INCLUDE="-I/usr/lib/include" else @@ -158,7 +124,7 @@ AC_SUBST(TARGET_FLAGS) ODBC_INCLUDE="-I$with_odbc/include" fi - AC_CHECK_LIB(iodbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -liodbc" odbc_lib_link_sucess=yes]) + AC_CHECK_LIB(iodbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -liodbc"; odbc_lib_link_success=yes]) ;; win32|cygwin) TARGET_FLAGS="-DWIN32" @@ -170,48 +136,64 @@ AC_SUBST(TARGET_FLAGS) ODBC_LIB=-L"$with_odbc/lib" ODBC_INCLUDE="-I$with_odbc/include" fi - AC_CHECK_LIB(odbc32, main, [ODBC_LIB="$ODBC_LIB -lodbc32" odbc_lib_link_sucess=yes]) + AC_CHECK_LIB(odbc32, main, [ODBC_LIB="$ODBC_LIB -lodbc32"; odbc_lib_link_success=yes]) ;; *) - TARGET_FLAGS="-DUNIX" - AC_CHECK_LIB(pthread, pthread_create, - [AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have the pthread library (-lpthread).]) - LIBS="$LIBS -lpthread" - have_pthread_lib=yes]) - if test ! -d "$with_odbc"; then - AC_MSG_CHECKING([for odbc in standard locations]) - for dir in /usr/local/odbc /usr/local /usr/odbc \ - /usr /opt/local/pgm/odbc /usr/local/pgm/odbc - do - if test -f "$dir/include/sql.h"; then - is_odbc_std_location=yes - ODBC_LIB=-L"$dir/lib" - ODBC_INCLUDE="-I$dir/include" - break - fi - done - if test "x$is_odbc_std_location" != "xyes"; then - AC_MSG_RESULT(no) - AC_MSG_WARN([No odbc library found skipping odbc]) - echo "No odbc library found" > $ERL_TOP/lib/odbc/SKIP - else - AC_MSG_RESULT($ODBC_LIB) - AC_CHECK_LIB(odbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -lodbc" odbc_lib_link_sucess=yes]) - fi - else - ODBC_LIB=-L"$with_odbc/lib" - ODBC_INCLUDE="-I$with_odbc/include" - AC_CHECK_LIB(odbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -lodbc" odbc_lib_link_sucess=yes]) - fi + TARGET_FLAGS="-DUNIX" + case "$erl_xcomp_without_sysroot-$with_odbc" in + yes-yes | yes- ) + msg="Dont know where to search for odbc (setting erl_xcomp_sysroot will help)" + AC_MSG_WARN([$msg]) + echo "$msg" > "$ERL_TOP/lib/odbc/SKIP" + odbc_lib_link_success=wont_try + ;; + no- ) + AC_CHECK_SIZEOF(void *) + AC_MSG_CHECKING([for odbc in standard locations]) + for rdir in /usr/local/odbc /usr/local /usr/odbc \ + /usr /opt/local/pgm/odbc /usr/local/pgm/odbc; do + test -f "$erl_xcomp_isysroot$rdir/include/sql.h" || continue + is_odbc_std_location=yes + libdir="$erl_xcomp_sysroot$rdir/lib" + if test "$ac_cv_sizeof_void_p" = "8"; then + dnl "/." in test is important (dir symlinks) + if test -d "${libdir}64/."; then + libdir="${libdir}64" + elif test -d "${libdir}/64/."; then + libdir="${libdir}/64" + fi + fi + ODBC_LIB="-L$libdir" + ODBC_INCLUDE="-I$erl_xcomp_isysroot$rdir/include" + break + done + if test "x$is_odbc_std_location" != "xyes"; then + AC_MSG_RESULT(no) + AC_MSG_WARN([No odbc library found skipping odbc]) + echo "No odbc library found" > "$ERL_TOP/lib/odbc/SKIP" + else + AC_MSG_RESULT($ODBC_LIB) + AC_CHECK_LIB(odbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -lodbc"; odbc_lib_link_success=yes]) + fi + ;; + + no-*) + ODBC_LIB=-L"$with_odbc/lib" + ODBC_INCLUDE="-I$with_odbc/include" + AC_CHECK_LIB(odbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -lodbc"; odbc_lib_link_success=yes]) + ;; + esac ;; esac -if test "x$odbc_lib_link_sucess" != "xyes"; then +if test $odbc_lib_link_success = no; then AC_MSG_WARN(["ODBC library - link check failed"]) echo "ODBC library - link check failed" > $ERL_TOP/lib/odbc/SKIP fi - + AC_SUBST(ODBC_LIB) AC_SUBST(ODBC_INCLUDE) +fi dnl "$with_odbc" != "no" + AC_OUTPUT(c_src/$host/Makefile:c_src/Makefile.in) |