aboutsummaryrefslogtreecommitdiffstats
path: root/lib/odbc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/odbc')
l---------lib/odbc/aclocal.m41
-rw-r--r--lib/odbc/c_src/Makefile.in22
-rw-r--r--lib/odbc/configure.in160
3 files changed, 83 insertions, 100 deletions
diff --git a/lib/odbc/aclocal.m4 b/lib/odbc/aclocal.m4
new file mode 120000
index 0000000000..151fd5ea5a
--- /dev/null
+++ b/lib/odbc/aclocal.m4
@@ -0,0 +1 @@
+../../erts/aclocal.m4 \ No newline at end of file
diff --git a/lib/odbc/c_src/Makefile.in b/lib/odbc/c_src/Makefile.in
index 6a9a174417..ed3eeb1d42 100644
--- a/lib/odbc/c_src/Makefile.in
+++ b/lib/odbc/c_src/Makefile.in
@@ -1,19 +1,19 @@
#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 1999-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 1999-2010. All Rights Reserved.
+#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at http://www.erlang.org/.
-#
+#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
-#
+#
# %CopyrightEnd%
#
@@ -78,11 +78,11 @@ ODBC_INCLUDE = @ODBC_INCLUDE@
# FLAGS
# ----------------------------------------------------
CC = @CC@
-CFLAGS = $(TYPEFLAGS) @CFLAGS@
+CFLAGS = $(TYPEFLAGS) @CFLAGS@ @THR_DEFS@ @DEFS@
EI_LDFLAGS = -L$(EI_ROOT)/obj$(TYPEMARKER)/$(TARGET)
-LD = @DED_LD@
+LD = @LD@
LDFLAGS = $(ODBC_LIB) $(EI_LDFLAGS)
-LIBS = @LIBS@ $(EI_LIB)
+LIBS = @LIBS@ @THR_LIBS@ $(EI_LIB)
INCLUDES = -I. $(ODBC_INCLUDE) $(EI_INCLUDE)
TARGET_FLAGS = @TARGET_FLAGS@
@@ -106,17 +106,17 @@ docs:
# ----------------------------------------------------
ifdef UNIX_TARGET
-$(UNIX_TARGET): $(BIN_DIR) $(OBJ_DIR)/odbcserver.o
+$(UNIX_TARGET): $(OBJ_DIR)/odbcserver.o
$(CC) $(CFLAGS) -o $@ $(OBJ_DIR)/odbcserver.o $(LDFLAGS) $(LIBS)
endif
ifdef WIN32_TARGET
-$(WIN32_TARGET): $(BIN_DIR) $(OBJ_DIR)/odbcserver.o
+$(WIN32_TARGET): $(OBJ_DIR)/odbcserver.o
$(LD) $(LDFLAGS) -o $@ $(OBJ_DIR)/odbcserver.o $(ENTRY_OBJ) \
$(LIBS) $(ENTRY_LDFLAGS)
endif
-$(OBJ_DIR)/odbcserver.o: $(OBJ_DIR) odbcserver.c
+$(OBJ_DIR)/odbcserver.o: odbcserver.c
$(CC) $(CFLAGS) $(INCLUDES) $(TARGET_FLAGS) -o $@ -c odbcserver.c
create_dirs:
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)