diff options
Diffstat (limited to 'unix')
-rw-r--r-- | unix/Makefile.in | 5 | ||||
-rwxr-xr-x | unix/configure | 70 | ||||
-rw-r--r-- | unix/configure.in | 14 | ||||
-rw-r--r-- | unix/tclUnixCompat.c | 6 | ||||
-rw-r--r-- | unix/tclUnixFile.c | 30 | ||||
-rw-r--r-- | unix/tclUnixPort.h | 1 |
6 files changed, 121 insertions, 5 deletions
diff --git a/unix/Makefile.in b/unix/Makefile.in index a9024db..0c63c3f 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -47,6 +47,7 @@ BIN_INSTALL_DIR = $(INSTALL_ROOT)$(bindir) # Directory in which to install libtcl.so or libtcl.a: LIB_INSTALL_DIR = $(INSTALL_ROOT)$(libdir) +DLL_INSTALL_DIR = @DLL_INSTALL_DIR@ # Path name to use when installing library scripts. SCRIPT_INSTALL_DIR = $(INSTALL_ROOT)$(TCL_LIBRARY) @@ -782,9 +783,9 @@ install-binaries: binaries else true; \ fi; \ done; - @echo "Installing $(LIB_FILE) to @DLL_INSTALL_DIR@/" + @echo "Installing $(LIB_FILE) to $(DLL_INSTALL_DIR)/" @@INSTALL_LIB@ - @chmod 555 "@DLL_INSTALL_DIR@"/$(LIB_FILE) + @chmod 555 "$(DLL_INSTALL_DIR)"/$(LIB_FILE) @echo "Installing ${TCL_EXE} as $(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}" @$(INSTALL_PROGRAM) ${TCL_EXE} "$(BIN_INSTALL_DIR)"/tclsh$(VERSION)${EXE_SUFFIX} @echo "Installing tclConfig.sh to $(CONFIG_INSTALL_DIR)/" diff --git a/unix/configure b/unix/configure index 848d6c3..cb4f9f1 100755 --- a/unix/configure +++ b/unix/configure @@ -19340,6 +19340,76 @@ echo "$as_me:$LINENO: result: $tcl_ok" >&5 echo "${ECHO_T}$tcl_ok" >&6 #-------------------------------------------------------------------- +# The check below checks whether the cpuid instruction is usable. +#-------------------------------------------------------------------- + +echo "$as_me:$LINENO: checking whether the cpuid instruction is usable" >&5 +echo $ECHO_N "checking whether the cpuid instruction is usable... $ECHO_C" >&6 +if test "${tcl_cv_cpuid+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + int index,ax,bx,cx,dx; + __asm__ __volatile__ ("cpuid":\ + "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (index)); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_cpuid=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_cpuid=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $tcl_cv_cpuid" >&5 +echo "${ECHO_T}$tcl_cv_cpuid" >&6 +if test $tcl_cv_cpuid = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_CPUID 1 +_ACEOF + +fi + +#-------------------------------------------------------------------- # The statements below define a collection of symbols related to # building libtcl as a shared library instead of a static library. #-------------------------------------------------------------------- diff --git a/unix/configure.in b/unix/configure.in index 745e1e3..29dc027 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -750,6 +750,20 @@ fi AC_MSG_RESULT([$tcl_ok]) #-------------------------------------------------------------------- +# The check below checks whether the cpuid instruction is usable. +#-------------------------------------------------------------------- + +AC_CACHE_CHECK([whether the cpuid instruction is usable], tcl_cv_cpuid, [ + AC_TRY_LINK(, [ + int index,ax,bx,cx,dx; + __asm__ __volatile__ ("cpuid":\ + "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (index)); + ], tcl_cv_cpuid=yes, tcl_cv_cpuid=no)]) +if test $tcl_cv_cpuid = yes; then + AC_DEFINE(HAVE_CPUID) +fi + +#-------------------------------------------------------------------- # The statements below define a collection of symbols related to # building libtcl as a shared library instead of a static library. #-------------------------------------------------------------------- diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c index 48ba4d3..d3da962 100644 --- a/unix/tclUnixCompat.c +++ b/unix/tclUnixCompat.c @@ -990,7 +990,11 @@ TclWinCPUID( { int status = TCL_ERROR; - /* There is no reason this couldn't be implemented on UNIX as well */ +#ifdef HAVE_CPUID + __asm__ __volatile__ ("cpuid":\ + "=a" (regsPtr[0]), "=b" (regsPtr[1]), "=c" (regsPtr[2]), "=d" (regsPtr[3]) : "a" (index)); + status = TCL_OK; +#endif return status; } diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index fe3c608..05c8058 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -22,7 +22,8 @@ static int NativeMatchType(Tcl_Interp *interp, const char* nativeEntry, * TclpFindExecutable -- * * This function computes the absolute path name of the current - * application, given its argv[0] value. + * application, given its argv[0] value. For Cygwin, argv[0] is + * ignored and the path is determined the same as under win32. * * Results: * None. @@ -38,11 +39,37 @@ TclpFindExecutable( const char *argv0) /* The value of the application's argv[0] * (native). */ { +#ifdef __CYGWIN__ + char buf[PATH_MAX * TCL_UTF_MAX + 1]; + char name[PATH_MAX * TCL_UTF_MAX + 1]; +#else const char *name, *p; Tcl_StatBuf statBuf; Tcl_DString buffer, nameString, cwd, utfName; Tcl_Encoding encoding; +#endif + +#ifdef __CYGWIN__ + /* Make some symbols available without including <windows.h> */ +# define CP_UTF8 65001 + extern int cygwin_conv_to_full_posix_path(const char *, char *); + extern __stdcall int GetModuleFileNameW(void *, const char *, int); + extern __stdcall int WideCharToMultiByte(int, int, const char *, int, + const char *, int, const char *, const char *); + + GetModuleFileNameW(NULL, name, PATH_MAX); + WideCharToMultiByte(CP_UTF8, 0, name, -1, buf, PATH_MAX, NULL, NULL); + cygwin_conv_to_full_posix_path(buf, name); + length = strlen(name); + if ((length > 4) && !strcasecmp(name + length - 4, ".exe")) { + /* Strip '.exe' part. */ + length -= 4; + } + tclNativeExecutableName = (char *) ckalloc(length + 1); + memcpy(tclNativeExecutableName, name, length); + buf[length] = '\0'; +#else if (argv0 == NULL) { return; } @@ -174,6 +201,7 @@ TclpFindExecutable( done: Tcl_DStringFree(&buffer); +#endif } /* diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index 4adb36c..98ef3c8 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -668,7 +668,6 @@ typedef int socklen_t; *--------------------------------------------------------------------------- */ -#define TclpGetPid(pid) ((unsigned long) (pid)) #define TclpReleaseFile(file) /* Nothing. */ /* |