[Pcsclite-cvs-commit] PCSC configure.in,1.30,1.31

aet-guest@quantz.debian.org aet-guest@quantz.debian.org
Mon, 08 Sep 2003 12:10:49 +0200


Update of /cvsroot/pcsclite/PCSC
In directory quantz:/tmp/cvs-serv30408

Modified Files:
	configure.in 
Log Message:
- Remove --with-common-dir and overly complex libsocket, libresolv
  etc. probes that I added. Probe only for socket() in libsocket.
- Reorder --disable-threadsafe code, needed to get over some
  libtool issues for various platforms.


Index: configure.in
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/configure.in,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- configure.in	7 Sep 2003 20:28:53 -0000	1.30
+++ configure.in	8 Sep 2003 10:10:46 -0000	1.31
@@ -48,42 +48,6 @@
 	;;
 esac
 
-AC_ARG_WITH(common-dir,
-	[  --with-common-dir=PATH  Specify path for common installation libraries],
-	[
-		if test "x$withval" != "xno" ; then
-			trycommondir=$withval
-		fi
-	]
-)
-
-saved_LDFLAGS="$LDFLAGS"
-saved_CPPFLAGS="$CPPFLAGS"
-AC_CACHE_CHECK([for common directory], ac_cv_commondir, [
-	for commondir in $trycommondir "" /usr/local /usr/pkg /opt ; do
-		# Skip directories if they don't exist
-		if test ! -z "$commondir" -a ! -d "$commondir/" ; then
-			continue;
-		fi
-		CPPFLAGS="$saved_CPPFLAGS"
-		LDFLAGS="$saved_LDFLAGS"
-
-		if test ! -z "$commondir" -a "x$commondir" != "x/usr"; then
-			LDFLAGS="-L$commondir/lib $saved_LDFLAGS"
-			if test ! -z "$need_dash_r" ; then
-				LDFLAGS="-R$commondir/lib $LDFLAGS"
-			fi
-			CPPFLAGS="-I$commondir/include $saved_CPPFLAGS"
-		fi
-		break;
-	done
-
-	if test -z "$commondir" ; then
-		commondir="(system)"
-	fi
-	ac_cv_commondir=$commondir
-])
-
 dnl Options
 AM_MAINTAINER_MODE
 
@@ -106,6 +70,23 @@
  AC_MSG_ERROR([POSIX thread support required])
 ])
 
+dnl --enable-threadsafe
+AC_ARG_ENABLE(threadsafe,
+[  --enable-threadsafe     enable client side thread safety.],
+[case "${enableval}" in
+  yes)	threadsafe=true ;;
+  no)	threadsafe=false ;;
+  *) AC_MSG_ERROR([bad value ${enableval} for --enable-threadsafe]) ;;
+ esac], [threadsafe=true])
+
+if test x${threadsafe} = xtrue ; then
+  LIBS="$PTHREAD_LIBS $LIBS"
+  CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+  CC="$PTHREAD_CC"
+fi
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+
 dnl Add libtool support
 AM_PROG_LIBTOOL
 dnl Automatically update the libtool script if it becomes out-of-date
@@ -146,102 +127,8 @@
 esac
 AC_DEFINE_UNQUOTED(PCSC_ARCH, "$uname", [PC/SC target architecture])
 
-#
-#  We check for various libraries
-#  - SysVr4 style of "-lsocket" at first (unless in libc)
-#    The hallmark is  connect()  routine (we presume)
-#
-AC_SUBST(LIBSOCKET)dnl
-ac_cv_libsocket_both=1
-AC_CHECK_FUNC(connect, ac_cv_libsocket_both=0)
-AC_CHECK_FUNC(gethostbyname, ac_cv_libsocket_both=0)
-if test "$ac_cv_libsocket_both" = 1 ; then
-  # Check cache
-  if test "$ac_cv_func_socket_lsocket" = yes ; then
-    AC_MSG_RESULT([need -lsocket library (cached)])
-    LIBSOCKET="-lsocket"
-    if test "$ac_cv_func_gethostbyname_lnsl" = yes ; then
-	LIBSOCKET="-lsocket -lnsl"
-    fi
-  else
-    # Well, will this work ?  SysVR4, but not Sun Solaris ?
-    AC_CHECK_LIB(socket, connect, [LIBSOCKET="-lsocket"
-				   ac_cv_func_socket_lsocket=yes],
-				   ac_cv_func_socket_lsocket=no)
-    if test "$ac_cv_func_socket_lsocket" = yes ; then
-      t_oldLibs="$LIBS"
-      LIBS="$LIBS -lsocket $LIBRESOLV"
-      AC_TRY_LINK([],[gethostbyname();], ,[
-	  LIBS="$LIBS -lnsl" # Add this Solaris library
-	  AC_TRY_LINK([],[gethostbyname();],[
-			LIBSOCKET="-lsocket -lnsl"
-			ac_cv_func_gethostbyname_lnsl=yes
-		], [
-		   AC_MSG_ERROR([Weird, '$LIBS' not enough to find  gethostbyname() ?!])
-		])
-	])
-      LIBS="$t_oldLibs"
-    fi
-  fi
-fi
-
-AC_SUBST(LIBRESOLV)dnl
-if test "x$LIBRESOLV" = "x"; then
-  # Ok, No  -lresolv,  is this enough for the  _res  to appear ?
-  t_oldLibs="$LIBS"
-  LIBS="$LIBS $LIBSOCKET"
-  ac_cv_var__res_options=no
-  # This following is for IRIX6.4, and I sincerely hope it
-  # will not fail on other systems...  It did! It did!
-  # Many systems don't have idemponent headers, they need specific
-  # includes before latter ones, or the latter ones won't be successful
-  AC_TRY_LINK([#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <resolv.h>],
-	      [_res.options = RES_INIT;],
-		ac_cv_var__res_options=yes);
-  if test "$ac_cv_var__res_options" != "yes"; then
-    LIBRESOLV="-lresolv"
-  fi
-  LIBS="$t_oldLibs"
-fi
-
-if test "x$LIBRESOLV" = "x"; then
-  # glibc 2.2.4 and libresolv is difficult
-  #  -	gethostbyname won't require lresolv because all
-  #	queries are made through the nsswitch
-  #  -	checking for the variable _res will not require
-  #	lresolv because _res is defined somewhere
-  AC_CHECK_LIB(resolv, res_query, [LIBRESOLV=-lresolv])
-  LIBS="$t_oldLibs"
-fi
-
-# See about the routines that possibly exist at the libraries
-LIBS="$t_oldLibs $LIBSOCKET"
-AC_CHECK_FUNCS(socket socketpair)
-LIBS="$t_oldLibs"
-
-if test "$ac_cv_func_socket" = no -a "$LIBSOCKET" != ""; then
-  LIBS="$LIBS $LIBSOCKET"
-  AC_TRY_LINK([],[socket();], ac_cv_func_socket=yes)
-  if test $ac_cv_func_socket = yes; then
-    AC_DEFINE(HAVE_SOCKET, 1, [Have socket])
-  fi
-  LIBS="$t_oldLibs"
-fi
-if test "$ac_cv_func_socketpair" = no -a "$LIBSOCKET" != ""; then
-  LIBS="$LIBS $LIBSOCKET"
-  AC_TRY_LINK([],[socketpair();], ac_cv_func_socketpair=yes)
-  if test $ac_cv_func_socketpair = yes; then
-    AC_DEFINE(HAVE_SOCKETPAIR, 1, [Have socketpair])
-  fi
-  LIBS="$t_oldLibs"
-fi
-
-# Always link lib{socket,nsl,resolv) if found, sigh
-LIBS="$LIBS $LIBSOCKET $LIBRESOLV"
+dnl See if socket() is found from libsocket
+AC_CHECK_LIB(socket, socket, [LIBS="$LIBS -lsocket"])
 
 dnl Probe for a proper flex library
 AC_SUBST(LIBFL)
@@ -282,19 +169,6 @@
   AC_DEFINE(HAVE_LIBUSB,1, [Libusb is available])
 fi
 
-dnl --enable-threadsafe
-AC_ARG_ENABLE(threadsafe,
-[  --enable-threadsafe     enable client side thread safety.],
-[case "${enableval}" in
-  yes)	threadsafe=true ;;
-  no)	threadsafe=false ;;
-  *) AC_MSG_ERROR([bad value ${enableval} for --enable-threadsafe]) ;;
- esac], [threadsafe=true])
-
-AC_MSG_RESULT([enable threadsafe client      : $threadsafe])
-
-AM_CONDITIONAL(PCSC_THR_SAFE, test x$threadsafe = xtrue)
-
 dnl --enable-usbdropdir=DIR
 AC_ARG_ENABLE(usbdropdir,
 [  --enable-usbdropdir=DIR directory containing USB drivers                                                (default /usr/local/pcsc/drivers/)],
@@ -413,13 +287,13 @@
 	AC_MSG_RESULT([enable ipcdir                 : /var/run/ (default)])
 fi
 
+AC_MSG_RESULT([enable threadsafe client      : $threadsafe])
+AM_CONDITIONAL(PCSC_THR_SAFE, test x$threadsafe = xtrue)
+
 dnl warning about pthread
 if test x${threadsafe} = xtrue ; then
   AC_MSG_RESULT([NOTE :: You must link pthread libraries with your app.])
   AC_DEFINE(USE_THREAD_SAFETY, 1, [enable client side thread safety.])
-  LIBS="$PTHREAD_LIBS $LIBS"
-  CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-  CC="$PTHREAD_CC"
 fi
 
 CPPFLAGS="-I\${top_srcdir}/src $CPPFLAGS"