fi
-for ac_func in vsnprintf
+
+for ac_func in vsnprintf vfork
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2930: checking for $ac_func" >&5
+echo "configure:2931: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2935 "configure"
+#line 2936 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:2958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
for ac_func in nanosleep
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2986: checking for $ac_func" >&5
+echo "configure:2987: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2991 "configure"
+#line 2992 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:3014: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for nanosleep in -lposix4""... $ac_c" 1>&6
-echo "configure:3039: checking for nanosleep in -lposix4" >&5
+echo "configure:3040: checking for nanosleep in -lposix4" >&5
ac_lib_var=`echo posix4'_'nanosleep | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lposix4 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3047 "configure"
+#line 3048 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
nanosleep()
; return 0; }
EOF
-if { (eval echo configure:3058: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
else
echo "$ac_t""no" 1>&6
+for ac_func in usleep
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3083: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3088 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ cat >> confdefs.h <<\EOF
+#define HAVE_USLEEP 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+echo "configure: warning: Sleep() function will not work" 1>&2
+
+fi
+done
+
+
fi
+
fi
done
-for ac_func in usleep
+
+for ac_func in uname gethostname
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3087: checking for $ac_func" >&5
+echo "configure:3151: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3092 "configure"
+#line 3156 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:3115: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
cat >> confdefs.h <<EOF
#define $ac_tr_func 1
EOF
-
+ break
else
echo "$ac_t""no" 1>&6
fi
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3152: checking for $ac_hdr" >&5
+echo "configure:3216: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3157 "configure"
+#line 3221 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3162: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3226: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:3203: checking for uid_t in sys/types.h" >&5
+echo "configure:3267: checking for uid_t in sys/types.h" >&5
if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3208 "configure"
+#line 3272 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
fi
echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6
-echo "configure:3237: checking type of array argument to getgroups" >&5
+echo "configure:3301: checking type of array argument to getgroups" >&5
if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_type_getgroups=cross
else
cat > conftest.$ac_ext <<EOF
-#line 3245 "configure"
+#line 3309 "configure"
#include "confdefs.h"
/* Thanks to Mike Rendell for this test. */
}
EOF
-if { (eval echo configure:3270: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3334: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_type_getgroups=gid_t
else
if test $ac_cv_type_getgroups = cross; then
cat > conftest.$ac_ext <<EOF
-#line 3284 "configure"
+#line 3348 "configure"
#include "confdefs.h"
#include <unistd.h>
EOF
echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:3308: checking for mode_t" >&5
+echo "configure:3372: checking for mode_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3313 "configure"
+#line 3377 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:3341: checking for off_t" >&5
+echo "configure:3405: checking for off_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3346 "configure"
+#line 3410 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:3374: checking for pid_t" >&5
+echo "configure:3438: checking for pid_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3379 "configure"
+#line 3443 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:3407: checking return type of signal handlers" >&5
+echo "configure:3471: checking return type of signal handlers" >&5
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3412 "configure"
+#line 3476 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
int i;
; return 0; }
EOF
-if { (eval echo configure:3429: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3493: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:3448: checking for size_t" >&5
+echo "configure:3512: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3453 "configure"
+#line 3517 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:3481: checking for uid_t in sys/types.h" >&5
+echo "configure:3545: checking for uid_t in sys/types.h" >&5
if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3486 "configure"
+#line 3550 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
-echo "configure:3517: checking whether stat file-mode macros are broken" >&5
+echo "configure:3581: checking whether stat file-mode macros are broken" >&5
if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3522 "configure"
+#line 3586 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
fi
echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:3573: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:3637: checking whether time.h and sys/time.h may both be included" >&5
if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3578 "configure"
+#line 3642 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
struct tm *tp;
; return 0; }
EOF
-if { (eval echo configure:3587: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3651: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_time=yes
else
fi
echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6
-echo "configure:3608: checking for st_blksize in struct stat" >&5
+echo "configure:3672: checking for st_blksize in struct stat" >&5
if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3613 "configure"
+#line 3677 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
struct stat s; s.st_blksize;
; return 0; }
EOF
-if { (eval echo configure:3621: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3685: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_st_blksize=yes
else
fi
echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6
-echo "configure:3642: checking for st_blocks in struct stat" >&5
+echo "configure:3706: checking for st_blocks in struct stat" >&5
if eval "test \"`echo '$''{'ac_cv_struct_st_blocks'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3647 "configure"
+#line 3711 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
struct stat s; s.st_blocks;
; return 0; }
EOF
-if { (eval echo configure:3655: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3719: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_st_blocks=yes
else
fi
echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6
-echo "configure:3678: checking for st_rdev in struct stat" >&5
+echo "configure:3742: checking for st_rdev in struct stat" >&5
if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3683 "configure"
+#line 3747 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
struct stat s; s.st_rdev;
; return 0; }
EOF
-if { (eval echo configure:3691: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3755: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_st_rdev=yes
else
fi
echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:3712: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:3776: checking whether struct tm is in sys/time.h or time.h" >&5
if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3717 "configure"
+#line 3781 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <time.h>
struct tm *tp; tp->tm_sec;
; return 0; }
EOF
-if { (eval echo configure:3725: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3789: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm=time.h
else
fi
echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
-echo "configure:3746: checking for tm_zone in struct tm" >&5
+echo "configure:3810: checking for tm_zone in struct tm" >&5
if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3751 "configure"
+#line 3815 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_cv_struct_tm>
struct tm tm; tm.tm_zone;
; return 0; }
EOF
-if { (eval echo configure:3759: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3823: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm_zone=yes
else
else
echo $ac_n "checking for tzname""... $ac_c" 1>&6
-echo "configure:3779: checking for tzname" >&5
+echo "configure:3843: checking for tzname" >&5
if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3784 "configure"
+#line 3848 "configure"
#include "confdefs.h"
#include <time.h>
#ifndef tzname /* For SGI. */
atoi(*tzname);
; return 0; }
EOF
-if { (eval echo configure:3794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3858: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
ac_cv_var_tzname=yes
else
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:3818: checking for working const" >&5
+echo "configure:3882: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3823 "configure"
+#line 3887 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:3872: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3936: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:3893: checking for inline" >&5
+echo "configure:3957: checking for inline" >&5
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat > conftest.$ac_ext <<EOF
-#line 3900 "configure"
+#line 3964 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
-if { (eval echo configure:3907: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3971: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
esac
echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6
-echo "configure:3933: checking whether char is unsigned" >&5
+echo "configure:3997: checking whether char is unsigned" >&5
if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$GCC" = yes; then
# GCC predefines this symbol on systems where it applies.
cat > conftest.$ac_ext <<EOF
-#line 3940 "configure"
+#line 4004 "configure"
#include "confdefs.h"
#ifdef __CHAR_UNSIGNED__
yes
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 3962 "configure"
+#line 4026 "configure"
#include "confdefs.h"
/* volatile prevents gcc2 from optimizing the test away on sparcs. */
#if !defined(__STDC__) || __STDC__ != 1
volatile char c = 255; exit(c < 0);
}
EOF
-if { (eval echo configure:3972: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4036: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_c_char_unsigned=yes
else
fi
echo $ac_n "checking for long double""... $ac_c" 1>&6
-echo "configure:3996: checking for long double" >&5
+echo "configure:4060: checking for long double" >&5
if eval "test \"`echo '$''{'ac_cv_c_long_double'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 4007 "configure"
+#line 4071 "configure"
#include "confdefs.h"
int main() {
/* The Stardent Vistra knows sizeof(long double), but does not support it. */
/* On Ultrix 4.3 cc, long double is 4 and double is 8. */
exit(sizeof(long double) < sizeof(double)); }
EOF
-if { (eval echo configure:4015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4079: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_c_long_double=yes
else
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:4040: checking whether byte ordering is bigendian" >&5
+echo "configure:4104: checking whether byte ordering is bigendian" >&5
if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
cat > conftest.$ac_ext <<EOF
-#line 4047 "configure"
+#line 4111 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
#endif
; return 0; }
EOF
-if { (eval echo configure:4058: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4122: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
# It does; now see whether it defined to BIG_ENDIAN or not.
cat > conftest.$ac_ext <<EOF
-#line 4062 "configure"
+#line 4126 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
#endif
; return 0; }
EOF
-if { (eval echo configure:4073: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4137: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_bigendian=yes
else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 4093 "configure"
+#line 4157 "configure"
#include "confdefs.h"
main () {
/* Are we little or big endian? From Harbison&Steele. */
exit (u.c[sizeof (long) - 1] == 1);
}
EOF
-if { (eval echo configure:4106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_c_bigendian=no
else
echo $ac_n "checking size of int *""... $ac_c" 1>&6
-echo "configure:4131: checking size of int *" >&5
+echo "configure:4195: checking size of int *" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_int_p'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 4139 "configure"
+#line 4203 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
exit(0);
}
EOF
-if { (eval echo configure:4150: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4214: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_int_p=`cat conftestval`
else
echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:4170: checking size of int" >&5
+echo "configure:4234: checking size of int" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 4178 "configure"
+#line 4242 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
exit(0);
}
EOF
-if { (eval echo configure:4189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_int=`cat conftestval`
else
echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:4209: checking size of long" >&5
+echo "configure:4273: checking size of long" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 4217 "configure"
+#line 4281 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
exit(0);
}
EOF
-if { (eval echo configure:4228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long=`cat conftestval`
else
echo $ac_n "checking size of long long""... $ac_c" 1>&6
-echo "configure:4248: checking size of long long" >&5
+echo "configure:4312: checking size of long long" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 4256 "configure"
+#line 4320 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
exit(0);
}
EOF
-if { (eval echo configure:4267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long_long=`cat conftestval`
else
echo $ac_n "checking for long file names""... $ac_c" 1>&6
-echo "configure:4291: checking for long file names" >&5
+echo "configure:4355: checking for long file names" >&5
if eval "test \"`echo '$''{'ac_cv_sys_long_file_names'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4342: checking for $ac_word" >&5
+echo "configure:4406: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
# Extract the first word of "flex", so it can be a program name with args.
set dummy flex; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4375: checking for $ac_word" >&5
+echo "configure:4439: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
*) ac_lib=l ;;
esac
echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6
-echo "configure:4408: checking for yywrap in -l$ac_lib" >&5
+echo "configure:4472: checking for yywrap in -l$ac_lib" >&5
ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-l$ac_lib $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4416 "configure"
+#line 4480 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
yywrap()
; return 0; }
EOF
-if { (eval echo configure:4427: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking lex output file root""... $ac_c" 1>&6
-echo "configure:4450: checking lex output file root" >&5
+echo "configure:4514: checking lex output file root" >&5
if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6
-echo "configure:4471: checking whether yytext is a pointer" >&5
+echo "configure:4535: checking whether yytext is a pointer" >&5
if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="$LIBS $LEXLIB"
cat > conftest.$ac_ext <<EOF
-#line 4483 "configure"
+#line 4547 "configure"
#include "confdefs.h"
`cat $LEX_OUTPUT_ROOT.c`
int main() {
; return 0; }
EOF
-if { (eval echo configure:4490: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4554: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
ac_cv_prog_lex_yytext_pointer=yes
else
for ac_func in dlopen
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4517: checking for $ac_func" >&5
+echo "configure:4581: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4522 "configure"
+#line 4586 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:4545: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4609: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:4570: checking for dlopen in -ldl" >&5
+echo "configure:4634: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4578 "configure"
+#line 4642 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
dlopen()
; return 0; }
EOF
-if { (eval echo configure:4589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
-echo "configure:4611: checking for dld_link in -ldld" >&5
+echo "configure:4675: checking for dld_link in -ldld" >&5
ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldld $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4619 "configure"
+#line 4683 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
dld_link()
; return 0; }
EOF
-if { (eval echo configure:4630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4694: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
for ac_func in shl_load
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4654: checking for $ac_func" >&5
+echo "configure:4718: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4659 "configure"
+#line 4723 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:4682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo $ac_n "checking for underscore before symbols""... $ac_c" 1>&6
-echo "configure:4722: checking for underscore before symbols" >&5
+echo "configure:4786: checking for underscore before symbols" >&5
if eval "test \"`echo '$''{'libltdl_cv_uscore'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test x"$ac_cv_func_dlopen" = xyes ||
test x"$ac_cv_lib_dl_dlopen" = xyes ; then
echo $ac_n "checking whether we have to add an underscore for dlsym""... $ac_c" 1>&6
-echo "configure:4744: checking whether we have to add an underscore for dlsym" >&5
+echo "configure:4808: checking whether we have to add an underscore for dlsym" >&5
if eval "test \"`echo '$''{'libltdl_cv_need_uscore'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
else
cat > conftest.$ac_ext <<EOF
-#line 4753 "configure"
+#line 4817 "configure"
#include "confdefs.h"
#include <dlfcn.h>
if(ptr1 && !ptr2) exit(0); } exit(1); }
EOF
-if { (eval echo configure:4764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
libltdl_cv_need_uscore=no
else
for ac_func in strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4793: checking for $ac_func" >&5
+echo "configure:4857: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4798 "configure"
+#line 4862 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:4821: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:4858: checking host system type" >&5
+echo "configure:4922: checking host system type" >&5
host_alias=$host
case "$host_alias" in
echo $ac_n "checking "for gtk"""... $ac_c" 1>&6
-echo "configure:5105: checking "for gtk"" >&5
+echo "configure:5169: checking "for gtk"" >&5
# Check whether --with-gtk or --without-gtk was given.
if test "${with_gtk+set}" = set; then
withval="$with_gtk"
echo $ac_n "checking "for qt"""... $ac_c" 1>&6
-echo "configure:5135: checking "for qt"" >&5
+echo "configure:5199: checking "for qt"" >&5
# Check whether --with-qt or --without-qt was given.
if test "${with_qt+set}" = set; then
withval="$with_qt"
echo $ac_n "checking "for motif"""... $ac_c" 1>&6
-echo "configure:5165: checking "for motif"" >&5
+echo "configure:5229: checking "for motif"" >&5
# Check whether --with-motif or --without-motif was given.
if test "${with_motif+set}" = set; then
withval="$with_motif"
echo $ac_n "checking "for shared"""... $ac_c" 1>&6
-echo "configure:5196: checking "for shared"" >&5
+echo "configure:5260: checking "for shared"" >&5
# Check whether --with-shared or --without-shared was given.
if test "${with_shared+set}" = set; then
withval="$with_shared"
echo $ac_n "checking "for optimise"""... $ac_c" 1>&6
-echo "configure:5226: checking "for optimise"" >&5
+echo "configure:5290: checking "for optimise"" >&5
# Check whether --with-optimise or --without-optimise was given.
if test "${with_optimise+set}" = set; then
withval="$with_optimise"
echo $ac_n "checking "for debug_flag"""... $ac_c" 1>&6
-echo "configure:5256: checking "for debug_flag"" >&5
+echo "configure:5320: checking "for debug_flag"" >&5
# Check whether --with-debug_flag or --without-debug_flag was given.
if test "${with_debug_flag+set}" = set; then
withval="$with_debug_flag"
echo $ac_n "checking "for debug_info"""... $ac_c" 1>&6
-echo "configure:5286: checking "for debug_info"" >&5
+echo "configure:5350: checking "for debug_info"" >&5
# Check whether --with-debug_info or --without-debug_info was given.
if test "${with_debug_info+set}" = set; then
withval="$with_debug_info"
echo $ac_n "checking "for debug_gdb"""... $ac_c" 1>&6
-echo "configure:5316: checking "for debug_gdb"" >&5
+echo "configure:5380: checking "for debug_gdb"" >&5
# Check whether --with-debug_gdb or --without-debug_gdb was given.
if test "${with_debug_gdb+set}" = set; then
withval="$with_debug_gdb"
echo $ac_n "checking "for mem_tracing"""... $ac_c" 1>&6
-echo "configure:5346: checking "for mem_tracing"" >&5
+echo "configure:5410: checking "for mem_tracing"" >&5
# Check whether --with-mem_tracing or --without-mem_tracing was given.
if test "${with_mem_tracing+set}" = set; then
withval="$with_mem_tracing"
echo $ac_n "checking "for dmalloc"""... $ac_c" 1>&6
-echo "configure:5376: checking "for dmalloc"" >&5
+echo "configure:5440: checking "for dmalloc"" >&5
# Check whether --with-dmalloc or --without-dmalloc was given.
if test "${with_dmalloc+set}" = set; then
withval="$with_dmalloc"
echo $ac_n "checking "for profile"""... $ac_c" 1>&6
-echo "configure:5406: checking "for profile"" >&5
+echo "configure:5470: checking "for profile"" >&5
# Check whether --with-profile or --without-profile was given.
if test "${with_profile+set}" = set; then
withval="$with_profile"
echo $ac_n "checking "for apple_ieee"""... $ac_c" 1>&6
-echo "configure:5436: checking "for apple_ieee"" >&5
+echo "configure:5500: checking "for apple_ieee"" >&5
# Check whether --with-apple_ieee or --without-apple_ieee was given.
if test "${with_apple_ieee+set}" = set; then
withval="$with_apple_ieee"
echo $ac_n "checking "for threads"""... $ac_c" 1>&6
-echo "configure:5466: checking "for threads"" >&5
+echo "configure:5530: checking "for threads"" >&5
# Check whether --with-threads or --without-threads was given.
if test "${with_threads+set}" = set; then
withval="$with_threads"
echo $ac_n "checking "for dynlib"""... $ac_c" 1>&6
-echo "configure:5496: checking "for dynlib"" >&5
+echo "configure:5560: checking "for dynlib"" >&5
# Check whether --with-dynlib or --without-dynlib was given.
if test "${with_dynlib+set}" = set; then
withval="$with_dynlib"
echo $ac_n "checking "for zlib"""... $ac_c" 1>&6
-echo "configure:5527: checking "for zlib"" >&5
+echo "configure:5591: checking "for zlib"" >&5
# Check whether --with-zlib or --without-zlib was given.
if test "${with_zlib+set}" = set; then
withval="$with_zlib"
echo $ac_n "checking "for libpng"""... $ac_c" 1>&6
-echo "configure:5557: checking "for libpng"" >&5
+echo "configure:5621: checking "for libpng"" >&5
# Check whether --with-libpng or --without-libpng was given.
if test "${with_libpng+set}" = set; then
withval="$with_libpng"
echo $ac_n "checking "for libjpeg"""... $ac_c" 1>&6
-echo "configure:5587: checking "for libjpeg"" >&5
+echo "configure:5651: checking "for libjpeg"" >&5
# Check whether --with-libjpeg or --without-libjpeg was given.
if test "${with_libjpeg+set}" = set; then
withval="$with_libjpeg"
echo $ac_n "checking "for odbc"""... $ac_c" 1>&6
-echo "configure:5617: checking "for odbc"" >&5
+echo "configure:5681: checking "for odbc"" >&5
# Check whether --with-odbc or --without-odbc was given.
if test "${with_odbc+set}" = set; then
withval="$with_odbc"
echo $ac_n "checking "for timedate"""... $ac_c" 1>&6
-echo "configure:5648: checking "for timedate"" >&5
+echo "configure:5712: checking "for timedate"" >&5
# Check whether --with-timedate or --without-timedate was given.
if test "${with_timedate+set}" = set; then
withval="$with_timedate"
echo $ac_n "checking "for intl"""... $ac_c" 1>&6
-echo "configure:5678: checking "for intl"" >&5
+echo "configure:5742: checking "for intl"" >&5
# Check whether --with-intl or --without-intl was given.
if test "${with_intl+set}" = set; then
withval="$with_intl"
echo $ac_n "checking "for config"""... $ac_c" 1>&6
-echo "configure:5708: checking "for config"" >&5
+echo "configure:5772: checking "for config"" >&5
# Check whether --with-config or --without-config was given.
if test "${with_config+set}" = set; then
withval="$with_config"
echo $ac_n "checking "for streams"""... $ac_c" 1>&6
-echo "configure:5738: checking "for streams"" >&5
+echo "configure:5802: checking "for streams"" >&5
# Check whether --with-streams or --without-streams was given.
if test "${with_streams+set}" = set; then
withval="$with_streams"
echo $ac_n "checking "for serial"""... $ac_c" 1>&6
-echo "configure:5768: checking "for serial"" >&5
+echo "configure:5832: checking "for serial"" >&5
# Check whether --with-serial or --without-serial was given.
if test "${with_serial+set}" = set; then
withval="$with_serial"
echo $ac_n "checking "for sockets"""... $ac_c" 1>&6
-echo "configure:5798: checking "for sockets"" >&5
+echo "configure:5862: checking "for sockets"" >&5
# Check whether --with-sockets or --without-sockets was given.
if test "${with_sockets+set}" = set; then
withval="$with_sockets"
echo $ac_n "checking "for afmfonts"""... $ac_c" 1>&6
-echo "configure:5829: checking "for afmfonts"" >&5
+echo "configure:5893: checking "for afmfonts"" >&5
# Check whether --with-afmfonts or --without-afmfonts was given.
if test "${with_afmfonts+set}" = set; then
withval="$with_afmfonts"
echo $ac_n "checking "for normalized"""... $ac_c" 1>&6
-echo "configure:5859: checking "for normalized"" >&5
+echo "configure:5923: checking "for normalized"" >&5
# Check whether --with-normalized or --without-normalized was given.
if test "${with_normalized+set}" = set; then
withval="$with_normalized"
echo $ac_n "checking "for postscript"""... $ac_c" 1>&6
-echo "configure:5889: checking "for postscript"" >&5
+echo "configure:5953: checking "for postscript"" >&5
# Check whether --with-postscript or --without-postscript was given.
if test "${with_postscript+set}" = set; then
withval="$with_postscript"
echo $ac_n "checking "for unicode"""... $ac_c" 1>&6
-echo "configure:5920: checking "for unicode"" >&5
+echo "configure:5984: checking "for unicode"" >&5
# Check whether --with-unicode or --without-unicode was given.
if test "${with_unicode+set}" = set; then
withval="$with_unicode"
echo $ac_n "checking "for wcsrtombs"""... $ac_c" 1>&6
-echo "configure:5950: checking "for wcsrtombs"" >&5
+echo "configure:6014: checking "for wcsrtombs"" >&5
# Check whether --with-wcsrtombs or --without-wcsrtombs was given.
if test "${with_wcsrtombs+set}" = set; then
withval="$with_wcsrtombs"
echo $ac_n "checking "for wxresources"""... $ac_c" 1>&6
-echo "configure:5981: checking "for wxresources"" >&5
+echo "configure:6045: checking "for wxresources"" >&5
# Check whether --with-wxresources or --without-wxresources was given.
if test "${with_wxresources+set}" = set; then
withval="$with_wxresources"
echo $ac_n "checking "for prologio"""... $ac_c" 1>&6
-echo "configure:6011: checking "for prologio"" >&5
+echo "configure:6075: checking "for prologio"" >&5
# Check whether --with-prologio or --without-prologio was given.
if test "${with_prologio+set}" = set; then
withval="$with_prologio"
echo $ac_n "checking "for RPC"""... $ac_c" 1>&6
-echo "configure:6041: checking "for RPC"" >&5
+echo "configure:6105: checking "for RPC"" >&5
# Check whether --with-rpc or --without-rpc was given.
if test "${with_rpc+set}" = set; then
withval="$with_rpc"
echo $ac_n "checking "for IPC"""... $ac_c" 1>&6
-echo "configure:6072: checking "for IPC"" >&5
+echo "configure:6136: checking "for IPC"" >&5
# Check whether --with-ipc or --without-ipc was given.
if test "${with_ipc+set}" = set; then
withval="$with_ipc"
echo $ac_n "checking "for resources"""... $ac_c" 1>&6
-echo "configure:6102: checking "for resources"" >&5
+echo "configure:6166: checking "for resources"" >&5
# Check whether --with-resources or --without-resources was given.
if test "${with_resources+set}" = set; then
withval="$with_resources"
echo $ac_n "checking "for clipboard"""... $ac_c" 1>&6
-echo "configure:6132: checking "for clipboard"" >&5
+echo "configure:6196: checking "for clipboard"" >&5
# Check whether --with-clipboard or --without-clipboard was given.
if test "${with_clipboard+set}" = set; then
withval="$with_clipboard"
echo $ac_n "checking "for tooltips"""... $ac_c" 1>&6
-echo "configure:6162: checking "for tooltips"" >&5
+echo "configure:6226: checking "for tooltips"" >&5
# Check whether --with-tooltips or --without-tooltips was given.
if test "${with_tooltips+set}" = set; then
withval="$with_tooltips"
echo $ac_n "checking "for dnd"""... $ac_c" 1>&6
-echo "configure:6192: checking "for dnd"" >&5
+echo "configure:6256: checking "for dnd"" >&5
# Check whether --with-dnd or --without-dnd was given.
if test "${with_dnd+set}" = set; then
withval="$with_dnd"
echo $ac_n "checking "for mdi"""... $ac_c" 1>&6
-echo "configure:6223: checking "for mdi"" >&5
+echo "configure:6287: checking "for mdi"" >&5
# Check whether --with-mdi or --without-mdi was given.
if test "${with_mdi+set}" = set; then
withval="$with_mdi"
echo $ac_n "checking "for docview"""... $ac_c" 1>&6
-echo "configure:6253: checking "for docview"" >&5
+echo "configure:6317: checking "for docview"" >&5
# Check whether --with-docview or --without-docview was given.
if test "${with_docview+set}" = set; then
withval="$with_docview"
echo $ac_n "checking "for printarch"""... $ac_c" 1>&6
-echo "configure:6283: checking "for printarch"" >&5
+echo "configure:6347: checking "for printarch"" >&5
# Check whether --with-printarch or --without-printarch was given.
if test "${with_printarch+set}" = set; then
withval="$with_printarch"
echo $ac_n "checking "for help"""... $ac_c" 1>&6
-echo "configure:6313: checking "for help"" >&5
+echo "configure:6377: checking "for help"" >&5
# Check whether --with-help or --without-help was given.
if test "${with_help+set}" = set; then
withval="$with_help"
if test "$USE_LINUX" = 1; then
echo $ac_n "checking for gettext in -lc""... $ac_c" 1>&6
-echo "configure:6351: checking for gettext in -lc" >&5
+echo "configure:6415: checking for gettext in -lc" >&5
ac_lib_var=`echo c'_'gettext | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6359 "configure"
+#line 6423 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
gettext()
; return 0; }
EOF
-if { (eval echo configure:6370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6434: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
# Extract the first word of "gtk-config", so it can be a program name with args.
set dummy gtk-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6441: checking for $ac_word" >&5
+echo "configure:6505: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
min_gtk_version=1.0.4
echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6
-echo "configure:6472: checking for GTK - version >= $min_gtk_version" >&5
+echo "configure:6536: checking for GTK - version >= $min_gtk_version" >&5
no_gtk=""
if test "$GTK_CONFIG" != "no" ; then
GTK_CFLAGS=`$GTK_CONFIG --cflags`
echo $ac_n "cross compiling; assumed OK... $ac_c"
else
cat > conftest.$ac_ext <<EOF
-#line 6485 "configure"
+#line 6549 "configure"
#include "confdefs.h"
#include <gtk/gtk.h>
}
EOF
-if { (eval echo configure:6509: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6573: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
:
else
if test "$wxUSE_QT" = 1; then
echo $ac_n "checking for Qt includes""... $ac_c" 1>&6
-echo "configure:6549: checking for Qt includes" >&5
+echo "configure:6613: checking for Qt includes" >&5
ac_find_includes=
for ac_dir in $SEARCH_INCLUDE;
if test "$ac_find_includes" != "" ; then
echo "$ac_t""found $ac_find_includes" 1>&6
echo $ac_n "checking for Qt library""... $ac_c" 1>&6
-echo "configure:6563: checking for Qt library" >&5
+echo "configure:6627: checking for Qt library" >&5
ac_find_libraries=
for ac_dir in $SEARCH_LIB;
if test "$wxUSE_MOTIF" = 1; then
echo $ac_n "checking for Motif/Lesstif includes""... $ac_c" 1>&6
-echo "configure:6614: checking for Motif/Lesstif includes" >&5
+echo "configure:6678: checking for Motif/Lesstif includes" >&5
ac_find_includes=
for ac_dir in $SEARCH_INCLUDE;
if test "$ac_find_includes" != "" ; then
echo "$ac_t""found $ac_find_includes" 1>&6
echo $ac_n "checking for Motif/Lesstif library""... $ac_c" 1>&6
-echo "configure:6628: checking for Motif/Lesstif library" >&5
+echo "configure:6692: checking for Motif/Lesstif library" >&5
ac_find_libraries=
for ac_dir in $SEARCH_LIB;
CHECK_INCLUDE="$CHECK_INCLUDE $ac_path_to_include"
echo "$ac_t""found at $ac_find_libraries" 1>&6
echo $ac_n "checking for Xt library""... $ac_c" 1>&6
-echo "configure:6665: checking for Xt library" >&5
+echo "configure:6729: checking for Xt library" >&5
ac_find_libraries=
for ac_dir in $SEARCH_LIB;
CHECK_LINK="$CHECK_LIB $ac_path_to_link"
echo "$ac_t""found at $ac_find_libraries" 1>&6
echo $ac_n "checking for Xpm library""... $ac_c" 1>&6
-echo "configure:6691: checking for Xpm library" >&5
+echo "configure:6755: checking for Xpm library" >&5
ac_find_libraries=
for ac_dir in $SEARCH_LIB;
EOF
echo $ac_n "checking for in -ljpeg""... $ac_c" 1>&6
-echo "configure:6863: checking for in -ljpeg" >&5
+echo "configure:6927: checking for in -ljpeg" >&5
ac_lib_var=`echo jpeg'_' | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ljpeg $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6871 "configure"
+#line 6935 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
()
; return 0; }
EOF
-if { (eval echo configure:6882: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6946: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
for ac_func in dlopen
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6972: checking for $ac_func" >&5
+echo "configure:7036: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6977 "configure"
+#line 7041 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:7000: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:7025: checking for dlopen in -ldl" >&5
+echo "configure:7089: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7033 "configure"
+#line 7097 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
dlopen()
; return 0; }
EOF
-if { (eval echo configure:7044: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7108: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
for ac_func in shl_load
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7073: checking for $ac_func" >&5
+echo "configure:7137: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7078 "configure"
+#line 7142 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:7101: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
if test "$wxUSE_THREADS" = "1"; then
echo $ac_n "checking for pthread_create in -lpthread-0.7""... $ac_c" 1>&6
-echo "configure:7275: checking for pthread_create in -lpthread-0.7" >&5
+echo "configure:7339: checking for pthread_create in -lpthread-0.7" >&5
ac_lib_var=`echo pthread-0.7'_'pthread_create | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lpthread-0.7 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7283 "configure"
+#line 7347 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
pthread_create()
; return 0; }
EOF
-if { (eval echo configure:7294: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
- UNIX_THREAD="gtk/threadpsx.cpp"
+ UNIX_THREAD="unix/threadpsx.cpp"
THREADS_LINK="pthread-0.7"
else
ac_safe=`echo "sys/prctl.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sys/prctl.h""... $ac_c" 1>&6
-echo "configure:7318: checking for sys/prctl.h" >&5
+echo "configure:7382: checking for sys/prctl.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7323 "configure"
+#line 7387 "configure"
#include "confdefs.h"
#include <sys/prctl.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7328: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7392: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking for pthread_setcanceltype in -lpthread""... $ac_c" 1>&6
-echo "configure:7354: checking for pthread_setcanceltype in -lpthread" >&5
+echo "configure:7418: checking for pthread_setcanceltype in -lpthread" >&5
ac_lib_var=`echo pthread'_'pthread_setcanceltype | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lpthread $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7362 "configure"
+#line 7426 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
pthread_setcanceltype()
; return 0; }
EOF
-if { (eval echo configure:7373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7437: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
- UNIX_THREAD="gtk/threadpsx.cpp"
+ UNIX_THREAD="unix/threadpsx.cpp"
THREADS_LINK="pthread"
else
if test "x$THREADS_LINK" = "x"; then
echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
-echo "configure:7402: checking for pthread_create in -lc_r" >&5
+echo "configure:7466: checking for pthread_create in -lc_r" >&5
ac_lib_var=`echo c_r'_'pthread_create | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lc_r $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7410 "configure"
+#line 7474 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
pthread_create()
; return 0; }
EOF
-if { (eval echo configure:7421: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7485: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
- UNIX_THREAD="gtk/threadpsx.cpp"
+ UNIX_THREAD="unix/threadpsx.cpp"
THREADS_LINK="c_r"
else
fi
fi
-if test "$wxUSE_MOTIF" = "1"; then
- UNIX_THREAD="motif/thread.cpp"
-fi
-
if test -z "$UNIX_THREAD"; then
wxUSE_THREADS=0
fi
if test "$wxUSE_THREADS" = "1"; then
THREADS_LINK2=""
echo $ac_n "checking for sched_yield in -l$THREADS_LINK""... $ac_c" 1>&6
-echo "configure:7465: checking for sched_yield in -l$THREADS_LINK" >&5
+echo "configure:7525: checking for sched_yield in -l$THREADS_LINK" >&5
ac_lib_var=`echo $THREADS_LINK'_'sched_yield | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-l$THREADS_LINK $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7473 "configure"
+#line 7533 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
sched_yield()
; return 0; }
EOF
-if { (eval echo configure:7484: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for sched_yield in -l"posix4"""... $ac_c" 1>&6
-echo "configure:7506: checking for sched_yield in -l"posix4"" >&5
+echo "configure:7566: checking for sched_yield in -l"posix4"" >&5
ac_lib_var=`echo "posix4"'_'sched_yield | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-l"posix4" $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7514 "configure"
+#line 7574 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
sched_yield()
; return 0; }
EOF
-if { (eval echo configure:7525: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7585: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo $ac_n "checking for sched_get_priority_min in -l$THREADS_LINK""... $ac_c" 1>&6
-echo "configure:7555: checking for sched_get_priority_min in -l$THREADS_LINK" >&5
+echo "configure:7615: checking for sched_get_priority_min in -l$THREADS_LINK" >&5
ac_lib_var=`echo $THREADS_LINK'_'sched_get_priority_min | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-l$THREADS_LINK $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7563 "configure"
+#line 7623 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
sched_get_priority_min()
; return 0; }
EOF
-if { (eval echo configure:7574: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for sched_get_priority_min in -l"posix4"""... $ac_c" 1>&6
-echo "configure:7596: checking for sched_get_priority_min in -l"posix4"" >&5
+echo "configure:7656: checking for sched_get_priority_min in -l"posix4"" >&5
ac_lib_var=`echo "posix4"'_'sched_get_priority_min | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-l"posix4" $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7604 "configure"
+#line 7664 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
sched_get_priority_min()
; return 0; }
EOF
-if { (eval echo configure:7615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7675: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo $ac_n "checking for pthread_cancel in -l$THREADS_LINK""... $ac_c" 1>&6
-echo "configure:7645: checking for pthread_cancel in -l$THREADS_LINK" >&5
+echo "configure:7705: checking for pthread_cancel in -l$THREADS_LINK" >&5
ac_lib_var=`echo $THREADS_LINK'_'pthread_cancel | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-l$THREADS_LINK $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7653 "configure"
+#line 7713 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
pthread_cancel()
; return 0; }
EOF
-if { (eval echo configure:7664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7724: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
mv ${OSTYPE}.system.cache.tmp ${OSTYPE}.system.cache
+
dnl check for vprintf/vsprintf() which are GNU extensions
AC_FUNC_VPRINTF
-dnl check for vsnprintf() which is another GNU extension
-AC_CHECK_FUNCS(vsnprintf)
+
+dnl check for several standard functions we use if they are available
+AC_CHECK_FUNCS(vsnprintf vfork)
dnl check for usleep() and nanosleep() which is better in MT programs
-AC_CHECK_FUNCS(nanosleep,
- AC_DEFINE(HAVE_NANOSLEEP),
- [AC_CHECK_LIB(posix4, nanosleep, AC_DEFINE(HAVE_NANOSLEEP))])
-AC_CHECK_FUNCS(usleep)
+dnl AC_CHECK_FUNCS(nanosleep, AC_DEFINE(HAVE_NANOSLEEP),
+dnl [
+dnl AC_CHECK_LIB(posix4, nanosleep,
+dnl AC_DEFINE(HAVE_NANOSLEEP),
+dnl AC_CHECK_FUNCS(usleep))
+dnl ]
+dnl )
+AC_CHECK_FUNCS(nanosleep, AC_DEFINE(HAVE_NANOSLEEP),
+[AC_CHECK_LIB(posix4, nanosleep, AC_DEFINE(HAVE_NANOSLEEP),
+ [AC_CHECK_FUNCS(usleep, AC_DEFINE(HAVE_USLEEP),
+ AC_MSG_WARN(Sleep() function will not work)
+ )]
+ )]
+)
+
+dnl check for uname (POSIX) and gethostname (BSD)
+AC_CHECK_FUNCS(uname gethostname, break)
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
dnl For glibc 2 users who have the old libc 5 too
AC_CHECK_LIB(pthread-0.7, pthread_create, [
- UNIX_THREAD="gtk/threadpsx.cpp"
+ UNIX_THREAD="unix/threadpsx.cpp"
THREADS_LINK="pthread-0.7"
],[
AC_CHECK_HEADER(sys/prctl.h, [
dnl the case for pthread_setcanceltype.
AC_CHECK_LIB(pthread, pthread_setcanceltype, [
- UNIX_THREAD="gtk/threadpsx.cpp"
+ UNIX_THREAD="unix/threadpsx.cpp"
THREADS_LINK="pthread"
])
])
dnl thread functions are in libc_r under FreeBSD
AC_CHECK_LIB(c_r, pthread_create,
[
- UNIX_THREAD="gtk/threadpsx.cpp"
+ UNIX_THREAD="unix/threadpsx.cpp"
THREADS_LINK="c_r"
])
fi
fi
fi
-if test "$wxUSE_MOTIF" = "1"; then
- UNIX_THREAD="motif/thread.cpp"
-fi
-
if test -z "$UNIX_THREAD"; then
wxUSE_THREADS=0
fi
AC_OUTPUT(./setup/substit ./wx-config:./wx-config.in,./setup/general/createall)
AC_OVERRIDES_DONE
+
#else // !wxUSE_THREADS
+#include <wx/defs.h> // for WXDLLEXPORT
+
// no thread support
inline void WXDLLEXPORT wxMutexGuiEnter() { }
inline void WXDLLEXPORT wxMutexGuiLeave() { }
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: unix/execute.h
+// Purpose: private details of wxExecute() implementation
+// Author: Vadim Zeitlin
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling, Julian Smart, Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIX_EXECUTE_H
+#define _WX_UNIX_EXECUTE_H
+
+// if pid > 0, the execution is async and the data is freed in the callback
+// executed when the process terminates, if pid < 0, the execution is
+// synchronous and the caller (wxExecute) frees the data
+struct wxEndProcessData
+{
+ int pid, // pid of the process
+ tag; // port dependent value
+ wxProcess *process; // if !NULL: notified on process termination
+ int exitcode; // the exit code
+};
+
+// this function is called when the process terminates from port specific
+// callback function and is common to all ports (src/unix/utilsunx.cpp)
+extern void wxHandleProcessTermination(wxEndProcessData *proc_data);
+
+// this function is called to associate the port-specific callback with the
+// child process. The return valus is port-specific.
+extern int wxAddProcessCallback(wxEndProcessData *proc_data, int fd);
+
+#endif // _WX_UNIX_EXECUTE_H
/* Define if you have nanosleep() */
#undef HAVE_NANOSLEEP
-/* Define if you have usleep() */
-#undef HAVE_USLEEP
+/* Define if you have vfork() */
+#undef HAVE_VFORK
+
+/* Define if you have uname() */
+#undef HAVE_UNAME
+
+/* Define if you have gethostname() */
+#undef HAVE_GETHOSTNAME
/* Define if you have sched_yield */
#undef HAVE_SCHED_YIELD
}
#endif
-// Overloaded functions, taking a wxString
-bool wxGetHostName(wxString& name)
-{
- bool success = wxGetHostName(wxBuffer, 500);
- if (success)
- {
- name = wxBuffer;
- return TRUE;
- }
- else
- return FALSE;
-}
-
bool wxGetUserId(wxString& buf)
{
bool success = wxGetUserId(wxBuffer, 500);
return FALSE;
}
+bool wxGetHostName(wxString& buf)
+{
+ static const size_t hostnameSize = 257;
+ bool ok = wxGetHostName(buf.GetWriteBuf(hostnameSize), hostnameSize);
+
+ buf.UngetWriteBuf();
+
+ return ok;
+}
+
gtk/utilsgtk.cpp \
gtk/utilsres.cpp \
gtk/window.cpp \
+\
+ unix/utilsunx.cpp \
\
generic/choicdgg.cpp \
generic/dcpsg.cpp \
// Copyright: (c) Wolfram Gloger (1996, 1997); Guilhem Lavaux (1998)
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
+
#ifdef __GNUG__
-#pragma implementation "thread.h"
+ #pragma implementation "thread.h"
#endif
#include "wx/wx.h"
wxMutex::wxMutex()
{
- m_locked = 0;
+ m_locked = 0;
}
wxMutex::~wxMutex()
{
- if (m_locked)
- wxLogDebug( "wxMutex warning: destroying a locked mutex (%d locks)\n", m_locked );
+ if (m_locked)
+ wxLogDebug( "wxMutex warning: destroying a locked mutex (%d locks)", m_locked );
}
wxMutexError wxMutex::Lock()
{
- m_locked++;
- return wxMUTEX_NO_ERROR;
+ m_locked++;
+ return wxMUTEX_NO_ERROR;
}
wxMutexError wxMutex::TryLock()
{
- if (m_locked > 0)
- return wxMUTEX_BUSY;
- m_locked++;
- return wxMUTEX_NO_ERROR;
+ if (m_locked > 0)
+ return wxMUTEX_BUSY;
+ m_locked++;
+ return wxMUTEX_NO_ERROR;
}
wxMutexError wxMutex::Unlock()
{
- if (m_locked == 0)
- return wxMUTEX_UNLOCKED;
- m_locked--;
- return wxMUTEX_NO_ERROR;
+ if (m_locked == 0)
+ return wxMUTEX_UNLOCKED;
+ m_locked--;
+ return wxMUTEX_NO_ERROR;
}
wxCondition::wxCondition()
}
bool wxCondition::Wait(wxMutex& WXUNUSED(mutex), unsigned long WXUNUSED(sec),
- unsigned long WXUNUSED(nsec))
+ unsigned long WXUNUSED(nsec))
{
- return FALSE;
+ return FALSE;
}
void wxCondition::Signal()
{
}
-struct wxThreadInternal {
- int thread_id;
- void* exit_status;
+struct wxThreadInternal
+{
+ int thread_id;
+ void* exit_status;
};
wxThreadError wxThread::Create()
{
- p_internal->exit_status = Entry();
- OnExit();
- return wxTHREAD_NO_ERROR;
+ p_internal->exit_status = Entry();
+ OnExit();
+ return wxTHREAD_NO_ERROR;
}
wxThreadError wxThread::Destroy()
{
- return wxTHREAD_NOT_RUNNING;
+ return wxTHREAD_NOT_RUNNING;
}
wxThreadError wxThread::Pause()
{
- return wxTHREAD_NOT_RUNNING;
+ return wxTHREAD_NOT_RUNNING;
}
wxThreadError wxThread::Resume()
{
- return wxTHREAD_NOT_RUNNING;
+ return wxTHREAD_NOT_RUNNING;
}
void wxThread::DeferDestroy( bool WXUNUSED(on) )
void *wxThread::Join()
{
- return p_internal->exit_status;
+ return p_internal->exit_status;
}
unsigned long wxThread::GetID() const
{
- return 0;
+ return 0;
}
bool wxThread::IsMain()
{
- return TRUE;
+ return TRUE;
}
bool wxThread::IsRunning() const
{
- return FALSE;
+ return FALSE;
}
bool wxThread::IsAlive() const
{
- return FALSE;
+ return FALSE;
}
void wxThread::SetPriority(int WXUNUSED(prio)) { }
wxThread::wxThread()
{
- p_internal = new wxThreadInternal();
+ p_internal = new wxThreadInternal();
}
wxThread::~wxThread()
{
- Destroy();
- Join();
- delete p_internal;
+ Destroy();
+ Join();
+ delete p_internal;
}
// The default callback just joins the thread and throws away the result.
void wxThread::OnExit()
{
- Join();
+ Join();
}
-
IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule)
-bool wxThreadModule::OnInit()
+bool wxThreadModule::OnInit()
{
- wxMainMutex = new wxMutex();
- wxMainMutex->Lock();
- return TRUE;
+ wxMainMutex = new wxMutex();
+ wxMainMutex->Lock();
+ return TRUE;
}
void wxThreadModule::OnExit()
{
- wxMainMutex->Unlock();
- delete wxMainMutex;
+ wxMainMutex->Unlock();
+ delete wxMainMutex;
}
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/utils.h"
#include "wx/process.h"
+#include "wx/unix/execute.h"
+
#include <stdarg.h>
#include <dirent.h>
#include <string.h>
#include <netdb.h>
#include <signal.h>
#include <fcntl.h> // for O_WRONLY and friends
-#include <time.h> // nanosleep() and/or usleep()
#include <glib.h>
#include <gdk/gdk.h>
#include <gtk/gtkfeatures.h>
#include <gdk/gdkx.h>
-#ifdef __SVR4__
- #include <sys/systeminfo.h>
-#endif
-
-// many versions of Unices have this function, but it is not defined in system
-// headers - please add your system here if it is the case for your OS.
-// SunOS < 5.6 (i.e. Solaris < 2.6) and DG-UX are like this.
-#if (defined(__SUN__) && !defined(__SunOs_5_6) && \
- !defined(__SunOs_5_7) && !defined(__SUNPRO_CC)) || \
- defined(__osf__)
- extern "C"
- {
- void usleep(unsigned long usec);
- };
-#endif // Unices without usleep()
-
-// many versions of Unices have this function, but it is not defined in system
-// headers - please add your system here if it is the case for your OS.
-// SunOS (and Solaris) and DG-UX are like this.
-#if defined(__SOLARIS__) || defined(__osf__)
- extern "C"
- {
- pid_t wait4(pid_t pid, int *statusp, int options,
- struct rusage *rusage);
- }
-
- #define wxWait4(pid, stat, flags, rusage) wait4(pid, stat, flags, rusage)
-#elif defined(__sgi) || defined(__HPUX__)
- // no wait4() at all on these systems
- // TODO verify whether wait3() really works in this situation
- #define wxWait4(pid, stat, flags, rusage) wait3(stat, flags, rusage)
-#else
- // other Unices: assume have wait4(), although it's not standard (but
- // Linux and FreeBSD do have it)
- #define wxWait4(pid, stat, flags, rusage) wait4(pid, stat, flags, rusage)
-#endif // wait4()
-
-//------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
// misc.
-//------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
-void wxBell(void)
+void wxBell()
{
gdk_beep();
}
-void wxSleep(int nSecs)
-{
- sleep(nSecs);
-}
-
-void wxUsleep(unsigned long milliseconds)
-{
-#if defined(HAVE_NANOSLEEP)
- timespec tmReq;
- tmReq.tv_sec = milliseconds / 1000;
- tmReq.tv_nsec = (milliseconds % 1000) * 1000 * 1000;
-
- // we're not interested in remaining time nor in return value
- (void)nanosleep(&tmReq, (timespec *)NULL);
-#elif defined(HAVE_USLEEP)
- // uncomment this if you feel brave or if you are sure that your version
- // of Solaris has a safe usleep() function but please notice that usleep()
- // is known to lead to crashes in MT programs in Solaris 2.[67] and is not
- // documented as MT-Safe
- #if defined(__SUN__) && defined(wxUSE_THREADS)
- #error "usleep() cannot be used in MT programs under Solaris."
- #endif // Sun
-
- usleep(milliseconds * 1000); // usleep(3) wants microseconds
-#else // !sleep function
- #error "usleep() or nanosleep() function required for wxUsleep"
-#endif // sleep function
-}
-
-int wxKill(long pid, int sig)
-{
- return kill(pid, sig);
-}
+// ----------------------------------------------------------------------------
+// display characterstics
+// ----------------------------------------------------------------------------
void wxDisplaySize( int *width, int *height )
{
gdk_window_get_pointer( (GdkWindow*) NULL, x, y, (GdkModifierType*) NULL );
}
-bool wxColourDisplay(void)
+bool wxColourDisplay()
{
return TRUE;
}
-int wxDisplayDepth(void)
+int wxDisplayDepth()
{
return gdk_window_get_visual( (GdkWindow*) &gdk_root_parent )->depth;
}
return wxGTK;
}
-//------------------------------------------------------------------------
-// user and home routines
-//------------------------------------------------------------------------
-
-const char* wxGetHomeDir( wxString *home )
-{
- *home = wxGetUserHome( wxString() );
- if (home->IsNull()) *home = "/";
- return *home;
-}
-
-char *wxGetUserHome( const wxString &user )
-{
- struct passwd *who = (struct passwd *) NULL;
-
- if (user.IsNull() || (user== ""))
- {
- register char *ptr;
-
- if ((ptr = getenv("HOME")) != NULL)
- {
- return ptr;
- }
- if ((ptr = getenv("USER")) != NULL || (ptr = getenv("LOGNAME")) != NULL)
- {
- who = getpwnam(ptr);
- }
-
- /* We now make sure the the user exists! */
- if (who == NULL)
- {
- who = getpwuid(getuid());
- }
- }
- else
- {
- who = getpwnam (user);
- }
-
- return who ? who->pw_dir : (char*)NULL;
-}
-
-//------------------------------------------------------------------------
-// id routines
-//------------------------------------------------------------------------
-
-bool wxGetHostName(char *buf, int sz)
-{
- *buf = '\0';
-#if defined(__SVR4__) && !defined(__sgi)
- //KB: does this return the fully qualified host.domain name?
- return (sysinfo(SI_HOSTNAME, buf, sz) != -1);
-#else /* BSD Sockets */
- char name[255], domain[255];
- //struct hostent *h;
- // Get hostname
- if (gethostname(name, sizeof(name)/sizeof(char)-1) == -1)
- return FALSE;
- if (getdomainname(domain, sizeof(domain)/sizeof(char)-1) == -1)
- return FALSE;
- // Get official full name of host
- // doesn't return the full qualified name, replaced by following
- // code (KB)
- // strncpy(buf, (h=gethostbyname(name))!=NULL ? h->h_name : name, sz-1);
- if((unsigned)sz > strlen(name)+strlen(domain)+1)
- {
- strcpy(buf, name);
- if(strcmp(domain,"(none)") == 0) // standalone machine
- {
- strcat(buf,".");
- strcat(buf,domain);
- }
- }
- else
- return FALSE;
- return TRUE;
-#endif
-}
-
-bool wxGetUserId(char *buf, int sz)
-{
- struct passwd *who;
-
- *buf = '\0';
- if ((who = getpwuid(getuid ())) != NULL) {
- strncpy (buf, who->pw_name, sz-1);
- return TRUE;
- }
- return FALSE;
-}
-
-bool wxGetUserName(char *buf, int sz)
-{
- struct passwd *who;
- char *comma;
-
- *buf = '\0';
- if ((who = getpwuid (getuid ())) != NULL) {
- comma = strchr(who->pw_gecos,'c');
- if(comma) *comma = '\0'; // cut off non-name comment fields
- strncpy (buf, who->pw_gecos, sz - 1);
- return TRUE;
- }
- return FALSE;
-}
-
-//------------------------------------------------------------------------
-// error and debug output routines
-//------------------------------------------------------------------------
-
-void wxDebugMsg( const char *format, ... )
-{
- va_list ap;
- va_start( ap, format );
- vfprintf( stderr, format, ap );
- fflush( stderr );
- va_end(ap);
-}
-
-void wxError( const wxString &msg, const wxString &title )
-{
- fprintf( stderr, "Error " );
- if (!title.IsNull()) fprintf( stderr, "%s ", WXSTRINGCAST(title) );
- if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) );
- fprintf( stderr, ".\n" );
-}
-
-void wxFatalError( const wxString &msg, const wxString &title )
-{
- fprintf( stderr, "Error " );
- if (!title.IsNull()) fprintf( stderr, "%s ", WXSTRINGCAST(title) );
- if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) );
- fprintf( stderr, ".\n" );
- exit(3); // the same exit code as for abort()
-}
-
-//------------------------------------------------------------------------
-// directory routines
-//------------------------------------------------------------------------
-
-bool wxDirExists( const wxString& dir )
-{
- char buf[500];
- strcpy( buf, WXSTRINGCAST(dir) );
- struct stat sbuf;
- return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE);
-}
-
-//------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
// subprocess routines
-//------------------------------------------------------------------------
-
-// if pid > 0, the execution is async and the data is freed in
-// GTK_EndProcessDetector, if pid < 0, the execution is synchronous and the
-// caller (wxExecute) frees the data
-struct wxEndProcessData
-{
- gint pid, tag;
- wxProcess *process;
- int exitcode;
-};
+// ----------------------------------------------------------------------------
static void GTK_EndProcessDetector(gpointer data, gint source,
GdkInputCondition WXUNUSED(condition) )
{
wxEndProcessData *proc_data = (wxEndProcessData *)data;
- int pid;
-
- pid = (proc_data->pid > 0) ? proc_data->pid : -(proc_data->pid);
- int status = 0;
- wxWait4(pid, &status, 0, (rusage *) NULL);
+ wxHandleProcessTermination(proc_data);
close(source);
gdk_input_remove(proc_data->tag);
-
- if (proc_data->process)
- proc_data->process->OnTerminate(proc_data->pid, status);
-
- if (proc_data->pid > 0)
- {
- delete proc_data;
- }
- else
- {
- // wxExecute() will know about it
- proc_data->exitcode = status;
-
- proc_data->pid = 0;
- }
}
-long wxExecute( char **argv, bool sync, wxProcess *process )
+int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
{
- wxEndProcessData *data = new wxEndProcessData;
- int end_proc_detect[2];
-
- wxCHECK_MSG( *argv, 0, "can't exec empty command" );
-
- /* Create pipes */
- if (pipe(end_proc_detect) == -1)
- {
- wxLogSysError( _("Pipe creation failed") );
- return 0;
- }
+ int tag = gdk_input_add(fd,
+ GDK_INPUT_READ,
+ GTK_EndProcessDetector,
+ (gpointer)proc_data);
- /* fork the process */
-#if defined(sun) || defined(__ultrix) || defined(__bsdi__)
- pid_t pid = vfork();
-#else
- pid_t pid = fork();
-#endif
- if (pid == -1)
- {
- wxLogSysError( _("Fork failed") );
- return 0;
- }
- else if (pid == 0)
- {
- // we're in child
- close(end_proc_detect[0]); // close reading side
-
- // These three lines close the open file descriptors to to avoid any
- // input/output which might block the process or irritate the user. If
- // one wants proper IO for the subprocess, the "right thing to do is
- // to start an xterm executing it.
- close(STDIN_FILENO);
- close(STDOUT_FILENO);
-
- // leave stderr opened, it won't do any hurm
-#if 0
- close(STDERR_FILENO);
-
- // some programs complain about stderr not being open, so redirect
- // them:
- open("/dev/null", O_RDONLY); // stdin
- open("/dev/null", O_WRONLY); // stdout
- open("/dev/null", O_WRONLY); // stderr
-#endif
-
-#ifdef _AIX
- execvp ((const char *)*argv, (const char **)argv);
-#else
- execvp (*argv, argv);
-#endif
-
- // there is no return after successful exec()
- fprintf(stderr, _("Can't execute '%s'\n"), *argv);
-
- _exit(-1);
- }
- else
- {
- // we're in parent
- close(end_proc_detect[1]); // close writing side
- data->tag = gdk_input_add(end_proc_detect[0], GDK_INPUT_READ,
- GTK_EndProcessDetector, (gpointer)data);
- if ( sync )
- {
- wxASSERT_MSG( !process, "wxProcess param ignored for sync exec" );
- data->process = NULL;
-
- // sync execution: indicate it by negating the pid
- data->pid = -pid;
-
- // it will be set to 0 from GTK_EndProcessDetector
- while (data->pid != 0)
- wxYield();
-
- int exitcode = data->exitcode;
-
- delete data;
-
- return exitcode;
- }
- else
- {
- // async execution, nothing special to do - caller will be
- // notified about the process terminationif process != NULL, data
- // will be deleted in GTK_EndProcessDetector
- data->process = process;
- data->pid = pid;
-
- return pid;
- }
- }
+ return tag;
}
-long wxExecute( const wxString& command, bool sync, wxProcess *process )
-{
- static const char *IFS = " \t\n";
-
- wxCHECK_MSG( !command.IsEmpty(), 0, "can't exec empty command" );
-
- int argc = 0;
- char *argv[127];
- char *tmp = new char[command.Len() + 1];
- strcpy(tmp, command);
-
- argv[argc++] = strtok(tmp, IFS);
- while ((argv[argc++] = strtok((char *) NULL, IFS)) != NULL)
- /* loop */ ;
-
- long lRc = wxExecute(argv, sync, process);
-
- delete [] tmp;
-
- return lRc;
-}
// Copyright: (c) Wolfram Gloger (1996, 1997); Guilhem Lavaux (1998)
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
+
#ifdef __GNUG__
-#pragma implementation "thread.h"
+ #pragma implementation "thread.h"
#endif
#include "wx/wx.h"
wxMutex::wxMutex()
{
- m_locked = 0;
+ m_locked = 0;
}
wxMutex::~wxMutex()
{
- if (m_locked)
- wxLogDebug( "wxMutex warning: destroying a locked mutex (%d locks)\n", m_locked );
+ if (m_locked)
+ wxLogDebug( "wxMutex warning: destroying a locked mutex (%d locks)", m_locked );
}
wxMutexError wxMutex::Lock()
{
- m_locked++;
- return wxMUTEX_NO_ERROR;
+ m_locked++;
+ return wxMUTEX_NO_ERROR;
}
wxMutexError wxMutex::TryLock()
{
- if (m_locked > 0)
- return wxMUTEX_BUSY;
- m_locked++;
- return wxMUTEX_NO_ERROR;
+ if (m_locked > 0)
+ return wxMUTEX_BUSY;
+ m_locked++;
+ return wxMUTEX_NO_ERROR;
}
wxMutexError wxMutex::Unlock()
{
- if (m_locked == 0)
- return wxMUTEX_UNLOCKED;
- m_locked--;
- return wxMUTEX_NO_ERROR;
+ if (m_locked == 0)
+ return wxMUTEX_UNLOCKED;
+ m_locked--;
+ return wxMUTEX_NO_ERROR;
}
wxCondition::wxCondition()
}
bool wxCondition::Wait(wxMutex& WXUNUSED(mutex), unsigned long WXUNUSED(sec),
- unsigned long WXUNUSED(nsec))
+ unsigned long WXUNUSED(nsec))
{
- return FALSE;
+ return FALSE;
}
void wxCondition::Signal()
{
}
-struct wxThreadInternal {
- int thread_id;
- void* exit_status;
+struct wxThreadInternal
+{
+ int thread_id;
+ void* exit_status;
};
wxThreadError wxThread::Create()
{
- p_internal->exit_status = Entry();
- OnExit();
- return wxTHREAD_NO_ERROR;
+ p_internal->exit_status = Entry();
+ OnExit();
+ return wxTHREAD_NO_ERROR;
}
wxThreadError wxThread::Destroy()
{
- return wxTHREAD_NOT_RUNNING;
+ return wxTHREAD_NOT_RUNNING;
}
wxThreadError wxThread::Pause()
{
- return wxTHREAD_NOT_RUNNING;
+ return wxTHREAD_NOT_RUNNING;
}
wxThreadError wxThread::Resume()
{
- return wxTHREAD_NOT_RUNNING;
+ return wxTHREAD_NOT_RUNNING;
}
void wxThread::DeferDestroy( bool WXUNUSED(on) )
void *wxThread::Join()
{
- return p_internal->exit_status;
+ return p_internal->exit_status;
}
unsigned long wxThread::GetID() const
{
- return 0;
+ return 0;
}
bool wxThread::IsMain()
{
- return TRUE;
+ return TRUE;
}
bool wxThread::IsRunning() const
{
- return FALSE;
+ return FALSE;
}
bool wxThread::IsAlive() const
{
- return FALSE;
+ return FALSE;
}
void wxThread::SetPriority(int WXUNUSED(prio)) { }
wxThread::wxThread()
{
- p_internal = new wxThreadInternal();
+ p_internal = new wxThreadInternal();
}
wxThread::~wxThread()
{
- Destroy();
- Join();
- delete p_internal;
+ Destroy();
+ Join();
+ delete p_internal;
}
// The default callback just joins the thread and throws away the result.
void wxThread::OnExit()
{
- Join();
+ Join();
}
-
IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule)
-bool wxThreadModule::OnInit()
+bool wxThreadModule::OnInit()
{
- wxMainMutex = new wxMutex();
- wxMainMutex->Lock();
- return TRUE;
+ wxMainMutex = new wxMutex();
+ wxMainMutex->Lock();
+ return TRUE;
}
void wxThreadModule::OnExit()
{
- wxMainMutex->Unlock();
- delete wxMainMutex;
+ wxMainMutex->Unlock();
+ delete wxMainMutex;
}
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/utils.h"
#include "wx/process.h"
+#include "wx/unix/execute.h"
+
#include <stdarg.h>
#include <dirent.h>
#include <string.h>
#include <netdb.h>
#include <signal.h>
#include <fcntl.h> // for O_WRONLY and friends
-#include <time.h> // nanosleep() and/or usleep()
#include <glib.h>
#include <gdk/gdk.h>
#include <gtk/gtkfeatures.h>
#include <gdk/gdkx.h>
-#ifdef __SVR4__
- #include <sys/systeminfo.h>
-#endif
-
-// many versions of Unices have this function, but it is not defined in system
-// headers - please add your system here if it is the case for your OS.
-// SunOS < 5.6 (i.e. Solaris < 2.6) and DG-UX are like this.
-#if (defined(__SUN__) && !defined(__SunOs_5_6) && \
- !defined(__SunOs_5_7) && !defined(__SUNPRO_CC)) || \
- defined(__osf__)
- extern "C"
- {
- void usleep(unsigned long usec);
- };
-#endif // Unices without usleep()
-
-// many versions of Unices have this function, but it is not defined in system
-// headers - please add your system here if it is the case for your OS.
-// SunOS (and Solaris) and DG-UX are like this.
-#if defined(__SOLARIS__) || defined(__osf__)
- extern "C"
- {
- pid_t wait4(pid_t pid, int *statusp, int options,
- struct rusage *rusage);
- }
-
- #define wxWait4(pid, stat, flags, rusage) wait4(pid, stat, flags, rusage)
-#elif defined(__sgi) || defined(__HPUX__)
- // no wait4() at all on these systems
- // TODO verify whether wait3() really works in this situation
- #define wxWait4(pid, stat, flags, rusage) wait3(stat, flags, rusage)
-#else
- // other Unices: assume have wait4(), although it's not standard (but
- // Linux and FreeBSD do have it)
- #define wxWait4(pid, stat, flags, rusage) wait4(pid, stat, flags, rusage)
-#endif // wait4()
-
-//------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
// misc.
-//------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
-void wxBell(void)
+void wxBell()
{
gdk_beep();
}
-void wxSleep(int nSecs)
-{
- sleep(nSecs);
-}
-
-void wxUsleep(unsigned long milliseconds)
-{
-#if defined(HAVE_NANOSLEEP)
- timespec tmReq;
- tmReq.tv_sec = milliseconds / 1000;
- tmReq.tv_nsec = (milliseconds % 1000) * 1000 * 1000;
-
- // we're not interested in remaining time nor in return value
- (void)nanosleep(&tmReq, (timespec *)NULL);
-#elif defined(HAVE_USLEEP)
- // uncomment this if you feel brave or if you are sure that your version
- // of Solaris has a safe usleep() function but please notice that usleep()
- // is known to lead to crashes in MT programs in Solaris 2.[67] and is not
- // documented as MT-Safe
- #if defined(__SUN__) && defined(wxUSE_THREADS)
- #error "usleep() cannot be used in MT programs under Solaris."
- #endif // Sun
-
- usleep(milliseconds * 1000); // usleep(3) wants microseconds
-#else // !sleep function
- #error "usleep() or nanosleep() function required for wxUsleep"
-#endif // sleep function
-}
-
-int wxKill(long pid, int sig)
-{
- return kill(pid, sig);
-}
+// ----------------------------------------------------------------------------
+// display characterstics
+// ----------------------------------------------------------------------------
void wxDisplaySize( int *width, int *height )
{
gdk_window_get_pointer( (GdkWindow*) NULL, x, y, (GdkModifierType*) NULL );
}
-bool wxColourDisplay(void)
+bool wxColourDisplay()
{
return TRUE;
}
-int wxDisplayDepth(void)
+int wxDisplayDepth()
{
return gdk_window_get_visual( (GdkWindow*) &gdk_root_parent )->depth;
}
return wxGTK;
}
-//------------------------------------------------------------------------
-// user and home routines
-//------------------------------------------------------------------------
-
-const char* wxGetHomeDir( wxString *home )
-{
- *home = wxGetUserHome( wxString() );
- if (home->IsNull()) *home = "/";
- return *home;
-}
-
-char *wxGetUserHome( const wxString &user )
-{
- struct passwd *who = (struct passwd *) NULL;
-
- if (user.IsNull() || (user== ""))
- {
- register char *ptr;
-
- if ((ptr = getenv("HOME")) != NULL)
- {
- return ptr;
- }
- if ((ptr = getenv("USER")) != NULL || (ptr = getenv("LOGNAME")) != NULL)
- {
- who = getpwnam(ptr);
- }
-
- /* We now make sure the the user exists! */
- if (who == NULL)
- {
- who = getpwuid(getuid());
- }
- }
- else
- {
- who = getpwnam (user);
- }
-
- return who ? who->pw_dir : (char*)NULL;
-}
-
-//------------------------------------------------------------------------
-// id routines
-//------------------------------------------------------------------------
-
-bool wxGetHostName(char *buf, int sz)
-{
- *buf = '\0';
-#if defined(__SVR4__) && !defined(__sgi)
- //KB: does this return the fully qualified host.domain name?
- return (sysinfo(SI_HOSTNAME, buf, sz) != -1);
-#else /* BSD Sockets */
- char name[255], domain[255];
- //struct hostent *h;
- // Get hostname
- if (gethostname(name, sizeof(name)/sizeof(char)-1) == -1)
- return FALSE;
- if (getdomainname(domain, sizeof(domain)/sizeof(char)-1) == -1)
- return FALSE;
- // Get official full name of host
- // doesn't return the full qualified name, replaced by following
- // code (KB)
- // strncpy(buf, (h=gethostbyname(name))!=NULL ? h->h_name : name, sz-1);
- if((unsigned)sz > strlen(name)+strlen(domain)+1)
- {
- strcpy(buf, name);
- if(strcmp(domain,"(none)") == 0) // standalone machine
- {
- strcat(buf,".");
- strcat(buf,domain);
- }
- }
- else
- return FALSE;
- return TRUE;
-#endif
-}
-
-bool wxGetUserId(char *buf, int sz)
-{
- struct passwd *who;
-
- *buf = '\0';
- if ((who = getpwuid(getuid ())) != NULL) {
- strncpy (buf, who->pw_name, sz-1);
- return TRUE;
- }
- return FALSE;
-}
-
-bool wxGetUserName(char *buf, int sz)
-{
- struct passwd *who;
- char *comma;
-
- *buf = '\0';
- if ((who = getpwuid (getuid ())) != NULL) {
- comma = strchr(who->pw_gecos,'c');
- if(comma) *comma = '\0'; // cut off non-name comment fields
- strncpy (buf, who->pw_gecos, sz - 1);
- return TRUE;
- }
- return FALSE;
-}
-
-//------------------------------------------------------------------------
-// error and debug output routines
-//------------------------------------------------------------------------
-
-void wxDebugMsg( const char *format, ... )
-{
- va_list ap;
- va_start( ap, format );
- vfprintf( stderr, format, ap );
- fflush( stderr );
- va_end(ap);
-}
-
-void wxError( const wxString &msg, const wxString &title )
-{
- fprintf( stderr, "Error " );
- if (!title.IsNull()) fprintf( stderr, "%s ", WXSTRINGCAST(title) );
- if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) );
- fprintf( stderr, ".\n" );
-}
-
-void wxFatalError( const wxString &msg, const wxString &title )
-{
- fprintf( stderr, "Error " );
- if (!title.IsNull()) fprintf( stderr, "%s ", WXSTRINGCAST(title) );
- if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) );
- fprintf( stderr, ".\n" );
- exit(3); // the same exit code as for abort()
-}
-
-//------------------------------------------------------------------------
-// directory routines
-//------------------------------------------------------------------------
-
-bool wxDirExists( const wxString& dir )
-{
- char buf[500];
- strcpy( buf, WXSTRINGCAST(dir) );
- struct stat sbuf;
- return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE);
-}
-
-//------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
// subprocess routines
-//------------------------------------------------------------------------
-
-// if pid > 0, the execution is async and the data is freed in
-// GTK_EndProcessDetector, if pid < 0, the execution is synchronous and the
-// caller (wxExecute) frees the data
-struct wxEndProcessData
-{
- gint pid, tag;
- wxProcess *process;
- int exitcode;
-};
+// ----------------------------------------------------------------------------
static void GTK_EndProcessDetector(gpointer data, gint source,
GdkInputCondition WXUNUSED(condition) )
{
wxEndProcessData *proc_data = (wxEndProcessData *)data;
- int pid;
-
- pid = (proc_data->pid > 0) ? proc_data->pid : -(proc_data->pid);
- int status = 0;
- wxWait4(pid, &status, 0, (rusage *) NULL);
+ wxHandleProcessTermination(proc_data);
close(source);
gdk_input_remove(proc_data->tag);
-
- if (proc_data->process)
- proc_data->process->OnTerminate(proc_data->pid, status);
-
- if (proc_data->pid > 0)
- {
- delete proc_data;
- }
- else
- {
- // wxExecute() will know about it
- proc_data->exitcode = status;
-
- proc_data->pid = 0;
- }
}
-long wxExecute( char **argv, bool sync, wxProcess *process )
+int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
{
- wxEndProcessData *data = new wxEndProcessData;
- int end_proc_detect[2];
-
- wxCHECK_MSG( *argv, 0, "can't exec empty command" );
-
- /* Create pipes */
- if (pipe(end_proc_detect) == -1)
- {
- wxLogSysError( _("Pipe creation failed") );
- return 0;
- }
+ int tag = gdk_input_add(fd,
+ GDK_INPUT_READ,
+ GTK_EndProcessDetector,
+ (gpointer)proc_data);
- /* fork the process */
-#if defined(sun) || defined(__ultrix) || defined(__bsdi__)
- pid_t pid = vfork();
-#else
- pid_t pid = fork();
-#endif
- if (pid == -1)
- {
- wxLogSysError( _("Fork failed") );
- return 0;
- }
- else if (pid == 0)
- {
- // we're in child
- close(end_proc_detect[0]); // close reading side
-
- // These three lines close the open file descriptors to to avoid any
- // input/output which might block the process or irritate the user. If
- // one wants proper IO for the subprocess, the "right thing to do is
- // to start an xterm executing it.
- close(STDIN_FILENO);
- close(STDOUT_FILENO);
-
- // leave stderr opened, it won't do any hurm
-#if 0
- close(STDERR_FILENO);
-
- // some programs complain about stderr not being open, so redirect
- // them:
- open("/dev/null", O_RDONLY); // stdin
- open("/dev/null", O_WRONLY); // stdout
- open("/dev/null", O_WRONLY); // stderr
-#endif
-
-#ifdef _AIX
- execvp ((const char *)*argv, (const char **)argv);
-#else
- execvp (*argv, argv);
-#endif
-
- // there is no return after successful exec()
- fprintf(stderr, _("Can't execute '%s'\n"), *argv);
-
- _exit(-1);
- }
- else
- {
- // we're in parent
- close(end_proc_detect[1]); // close writing side
- data->tag = gdk_input_add(end_proc_detect[0], GDK_INPUT_READ,
- GTK_EndProcessDetector, (gpointer)data);
- if ( sync )
- {
- wxASSERT_MSG( !process, "wxProcess param ignored for sync exec" );
- data->process = NULL;
-
- // sync execution: indicate it by negating the pid
- data->pid = -pid;
-
- // it will be set to 0 from GTK_EndProcessDetector
- while (data->pid != 0)
- wxYield();
-
- int exitcode = data->exitcode;
-
- delete data;
-
- return exitcode;
- }
- else
- {
- // async execution, nothing special to do - caller will be
- // notified about the process terminationif process != NULL, data
- // will be deleted in GTK_EndProcessDetector
- data->process = process;
- data->pid = pid;
-
- return pid;
- }
- }
+ return tag;
}
-long wxExecute( const wxString& command, bool sync, wxProcess *process )
-{
- static const char *IFS = " \t\n";
-
- wxCHECK_MSG( !command.IsEmpty(), 0, "can't exec empty command" );
-
- int argc = 0;
- char *argv[127];
- char *tmp = new char[command.Len() + 1];
- strcpy(tmp, command);
-
- argv[argc++] = strtok(tmp, IFS);
- while ((argv[argc++] = strtok((char *) NULL, IFS)) != NULL)
- /* loop */ ;
-
- long lRc = wxExecute(argv, sync, process);
-
- delete [] tmp;
-
- return lRc;
-}
{
while (wxTheApp && wxTheApp->Pending())
wxTheApp->Dispatch();
+
+ // VZ: is it the same as this (taken from old wxExecute)?
+#if 0
+ XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMAll);
+#endif
+
return TRUE;
}
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
-// Note: this is done in utilscmn.cpp now.
-// #pragma implementation
-// #pragma implementation "utils.h"
-#endif
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
#include "wx/setup.h"
#include "wx/utils.h"
#include <netdb.h>
#include <signal.h>
-#if defined(__SOLARIS__) || defined(__SVR4__) && !defined(__HPUX__)
-#include <sys/systeminfo.h>
-#endif
-
#if (defined(__SUNCC__) || defined(__CLCC__))
-#include <sysent.h>
+ #include <sysent.h>
#endif
#include <Xm/Xm.h>
#include "wx/motif/private.h"
+// ----------------------------------------------------------------------------
+// private functions
+// ----------------------------------------------------------------------------
+
// Yuck this is really BOTH site and platform dependent
// so we should use some other strategy!
#ifdef sun
-# define DEFAULT_XRESOURCE_DIR "/usr/openwin/lib/app-defaults"
+ #define DEFAULT_XRESOURCE_DIR "/usr/openwin/lib/app-defaults"
#else
-# define DEFAULT_XRESOURCE_DIR "/usr/lib/X11/app-defaults"
+ #define DEFAULT_XRESOURCE_DIR "/usr/lib/X11/app-defaults"
#endif
static char *GetIniFile (char *dest, const char *filename);
extern wxList wxTopLevelWindows;
-// Get full hostname (eg. DoDo.BSn-Germany.crg.de)
-bool wxGetHostName(char *buf, int maxSize)
-{
-#if defined(__SOLARIS__) || defined(__SVR4__) && !defined(__HPUX__)
- return (sysinfo (SI_HOSTNAME, buf, maxSize) != -1);
-#else /* BSD Sockets */
- char name[255];
- struct hostent *h;
-
- // Get hostname
- if (gethostname (name, sizeof (name) / sizeof (char) - 1) == -1)
- return FALSE;
- // Get official full name of host
- strncpy (buf
- ,(h = gethostbyname (name)) != NULL ? h->h_name : name
- ,maxSize - 1);
- return TRUE;
-#endif
-}
+// ============================================================================
+// implementation
+// ============================================================================
-// Get user ID e.g. jacs
-bool wxGetUserId(char *buf, int maxSize)
-{
-#ifdef VMS
- *buf = '\0'; // return empty string
- return FALSE;
-#else
- struct passwd *who;
-
- if ((who = getpwuid (getuid ())) != NULL)
- {
- strncpy (buf, who->pw_name, maxSize - 1);
- return TRUE;
- }
- return FALSE;
-#endif
-}
-
-// Get user name e.g. Julian Smart
-bool wxGetUserName(char *buf, int maxSize)
-{
-#ifdef VMS
- *buf = '\0'; // return empty string
- return FALSE;
-#else
- struct passwd *who;
-
- if ((who = getpwuid (getuid ())) != NULL)
- {
- strncpy (buf, who->pw_gecos, maxSize - 1);
- return TRUE;
- }
- return FALSE;
-#endif
-}
-
-int wxKill(long pid, int sig)
-{
- int unixSignal = 0;
- switch (sig)
- {
- case wxSIGTERM:
- default:
- unixSignal = SIGTERM;
- }
- return kill( (int)pid, unixSignal);
-}
-
-//
-// Execute a program in an Interactive Shell
-//
-bool wxShell(const wxString& command)
-{
-#ifdef VMS
- return(FALSE);
-#else
-#if defined(sun) || defined(__ultrix) || defined(__bsdi__)
- pid_t pid = vfork ();
-#else
- pid_t pid = fork ();
-#endif
- switch( pid ) {
- case -1: /* error */
- return(FALSE);
- case 0: /* child */
- // Generic X windows terminal window
- if (command != "")
- execlp("xterm", "-e", (char *) (const char*) command, NULL);
- else
- execlp("xterm", NULL);
- _exit(127);
- }
- return TRUE;
-#endif
- // End VMS
-}
-
-// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
-long wxGetFreeMemory()
-{
- return -1;
-}
-
-void wxSleep(int nSecs)
-{
- sleep(nSecs);
-}
+// ----------------------------------------------------------------------------
+// async event processing
+// ----------------------------------------------------------------------------
// Consume all events until no more left
void wxFlushEvents()
{
Display *display = (Display*) wxGetDisplay();
-
+
XSync (display, FALSE);
XEvent event;
// XtAppPending returns availability of events AND timers/inputs, which
- // are processed via callbacks, so XtAppNextEvent will not return if
+ // are processed via callbacks, so XtAppNextEvent will not return if
// there are no events. So added '& XtIMXEvent' - Sergey.
while (XtAppPending ((XtAppContext) wxTheApp->GetAppContext()) & XtIMXEvent)
{
}
}
-// Output a debug message, in a system dependent fashion.
-void wxDebugMsg(const char *fmt ...)
+// Check whether this window wants to process messages, e.g. Stop button
+// in long calculations.
+bool wxCheckForInterrupt(wxWindow *wnd)
{
- va_list ap;
- char buffer[BUFSIZ];
-
- if (!wxTheApp->GetWantDebugOutput())
- return ;
-
- va_start (ap, fmt);
-
- vsprintf (buffer, fmt, ap);
- cerr << buffer;
-
- va_end (ap);
+ wxCHECK_MSG( wnd, FALSE, "NULL window in wxCheckForInterrupt" );
+
+ Display *dpy=(Display*) wnd->GetXDisplay();
+ Window win=(Window) wnd->GetXWindow();
+ XEvent event;
+ XFlush(dpy);
+ if (wnd->GetMainWidget())
+ {
+ XmUpdateDisplay((Widget)(wnd->GetMainWidget()));
+ }
+
+ bool hadEvents = FALSE;
+ while( XCheckMaskEvent(dpy,
+ ButtonPressMask|ButtonReleaseMask|ButtonMotionMask|
+ PointerMotionMask|KeyPressMask|KeyReleaseMask,
+ &event) )
+ {
+ if ( event.xany.window == win )
+ {
+ hadEvents = TRUE;
+
+ XtDispatchEvent(&event);
+ }
+ }
+
+ return hadEvents;
}
-// Non-fatal error: pop up message box and (possibly) continue
-void wxError(const wxString& msg, const wxString& title)
+// ----------------------------------------------------------------------------
+// wxExecute stuff
+// ----------------------------------------------------------------------------
+
+static void xt_notify_end_process(XtPointer client, int *fid,
+ XtInputId *id)
{
- cerr << (const char*) title << ": " << (const char*) msg << "\n";
+ wxEndProcessData *proc_data = (wxEndProcessData *)data;
+
+ wxHandleProcessTermination(proc_data);
+
+ // VZ: I think they should be the same...
+ wxASSERT( (int)*id == proc_data->tag );
+
+ XtRemoveInput(*id);
}
-// Fatal error: pop up message box and abort
-void wxFatalError(const wxString& msg, const wxString& title)
+int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
{
- cerr << (const char*) title << ": " << (const char*) msg << "\n";
- exit (1);
+ XtInputId id = XtAppAddInput((XtAppContext) wxTheApp->GetAppContext(),
+ fd,
+ (XtPointer *) XtInputReadMask,
+ (XtInputCallbackProc) xt_notify_end_process,
+ (XtPointer) process_data);
+
+ return (int)id;
}
+// ----------------------------------------------------------------------------
+// misc
+// ----------------------------------------------------------------------------
+
// Emit a beeeeeep
void wxBell()
{
int wxGetOsVersion(int *majorVsn, int *minorVsn)
{
- // TODO
+ // FIXME TODO
// This code is WRONG!! Does NOT return the
// Motif version of the libs but the X protocol
- // version! @@@@@ Fix ME!!!!!!!!!
+ // version!
Display *display = XtDisplay ((Widget) wxTheApp->GetTopLevelWidget());
if (majorVsn)
*majorVsn = ProtocolVersion (display);
if (minorVsn)
*minorVsn = ProtocolRevision (display);
+
return wxMOTIF_X;
}
+// ----------------------------------------------------------------------------
// Reading and writing resources (eg WIN.INI, .Xdefaults)
+// ----------------------------------------------------------------------------
+
+// Read $HOME for what it says is home, if not
+// read $USER or $LOGNAME for user name else determine
+// the Real User, then determine the Real home dir.
+static char * GetIniFile (char *dest, const char *filename)
+{
+ char *home = NULL;
+ if (filename && wxIsAbsolutePath(filename))
+ {
+ strcpy(dest, filename);
+ }
+ else if ((home = wxGetUserHome("")) != NULL)
+ {
+ strcpy(dest, home);
+ if (dest[strlen(dest) - 1] != '/')
+ strcat (dest, "/");
+ if (filename == NULL)
+ {
+ if ((filename = getenv ("XENVIRONMENT")) == NULL)
+ filename = ".Xdefaults";
+ }
+ else if (*filename != '.')
+ strcat (dest, ".");
+ strcat (dest, filename);
+ } else
+ {
+ dest[0] = '\0';
+ }
+ return dest;
+}
+
#if wxUSE_RESOURCES
static char *GetResourcePath(char *buf, const char *name, bool create = FALSE)
strcpy(buf, name);
return buf; // Exists so ...
}
-
+
if (*name == '/')
strcpy(buf, name);
else {
strcat (buf, "/");
strcat (buf, (const char*) wxFileNameFromPath (name));
}
-
+
if (create) {
// Touch the file to create it
FILE *fd = fopen (buf, "w");
wxList wxResourceCache (wxKEY_STRING);
-void
+void
wxFlushResources (void)
{
char nameBuffer[512];
-
+
wxNode *node = wxResourceCache.First ();
while (node)
{
const char *file = node->GetKeyString();
// If file doesn't exist, create it first.
(void)GetResourcePath(nameBuffer, file, TRUE);
-
+
XrmDatabase database = (XrmDatabase) node->Data ();
XrmPutFileDatabase (database, nameBuffer);
XrmDestroyDatabase (database);
bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file)
{
char buffer[500];
-
+
(void) GetIniFile (buffer, file);
-
+
XrmDatabase database;
wxNode *node = wxResourceCache.Find (buffer);
if (node)
database = XrmGetFileDatabase (buffer);
wxResourceCache.Append (buffer, (wxObject *) database);
}
-
+
char resName[300];
strcpy (resName, (const char*) section);
strcat (resName, ".");
strcat (resName, (const char*) entry);
-
+
XrmPutStringResource (&database, resName, value);
return TRUE;
}
Display *display = (Display*) wxGetDisplay();
wxXMergeDatabases (wxTheApp, display);
}
-
+
XrmDatabase database;
-
+
if (file != "")
{
char buffer[500];
-
+
// Is this right? Trying to get it to look in the user's
// home directory instead of current directory -- JACS
(void) GetIniFile (buffer, file);
-
+
wxNode *node = wxResourceCache.Find (buffer);
if (node)
database = (XrmDatabase) node->Data ();
}
else
database = wxResourceDatabase;
-
+
XrmValue xvalue;
char *str_type[20];
char buf[150];
strcpy (buf, section);
strcat (buf, ".");
strcat (buf, entry);
-
+
Bool success = XrmGetResource (database, buf, "*", str_type,
&xvalue);
// Try different combinations of upper/lower case, just in case...
{
if (*value)
delete[] *value;
-
+
*value = new char[xvalue.size + 1];
strncpy (*value, xvalue.addr, (int) xvalue.size);
return TRUE;
if (succ)
{
// Handle True, False here
- // True, Yes, Enables, Set or Activated
+ // True, Yes, Enables, Set or Activated
if (*s == 'T' || *s == 'Y' || *s == 'E' || *s == 'S' || *s == 'A')
*value = TRUE;
// False, No, Disabled, Reset, Cleared, Deactivated
{
XrmDatabase homeDB, serverDB, applicationDB;
char filenamebuf[1024];
-
+
char *filename = &filenamebuf[0];
char *environment;
wxString classname = theApp->GetClassName();
char name[256];
(void) strcpy (name, "/usr/lib/X11/app-defaults/");
(void) strcat (name, (const char*) classname);
-
+
/* Get application defaults file, if any */
applicationDB = XrmGetFileDatabase (name);
(void) XrmMergeDatabases (applicationDB, &wxResourceDatabase);
-
+
/* Merge server defaults, created by xrdb, loaded as a property of the root
* window when the server initializes and loaded into the display
* structure on XOpenDisplay;
* if not defined, use .Xdefaults
*/
-
+
if (XResourceManagerString (display) != NULL)
{
serverDB = XrmGetStringDatabase (XResourceManagerString (display));
serverDB = XrmGetFileDatabase (filename);
}
XrmMergeDatabases (serverDB, &wxResourceDatabase);
-
+
/* Open XENVIRONMENT file, or if not defined, the .Xdefaults,
* and merge into existing database
*/
-
+
if ((environment = getenv ("XENVIRONMENT")) == NULL)
{
size_t len;
* Not yet used but may be useful.
*
*/
-void
+void
wxSetDefaultResources (const Widget w, const char **resourceSpec, const char *name)
{
int i;
- Display *dpy = XtDisplay (w); // Retrieve the display pointer
-
- XrmDatabase rdb = NULL; // A resource data base
-
+ Display *dpy = XtDisplay (w); // Retrieve the display pointer
+
+ XrmDatabase rdb = NULL; // A resource data base
+
// Create an empty resource database
rdb = XrmGetStringDatabase ("");
-
+
// Add the Component resources, prepending the name of the component
-
+
i = 0;
while (resourceSpec[i] != NULL)
{
char buf[1000];
-
+
sprintf (buf, "*%s%s", name, resourceSpec[i++]);
XrmPutLineResource (&rdb, buf);
}
-
+
// Merge them into the Xt database, with lowest precendence
-
+
if (rdb)
{
#if (XlibSpecificationRelease>=5)
#endif // wxUSE_RESOURCES
+// ----------------------------------------------------------------------------
+// busy cursor stuff
+// ----------------------------------------------------------------------------
+
static int wxBusyCursorCount = 0;
// Helper function
-static void
+static void
wxXSetBusyCursor (wxWindow * win, wxCursor * cursor)
{
Display *display = (Display*) win->GetXDisplay();
-
+
Window xwin = (Window) win->GetXWindow();
if (!xwin)
return;
XSetWindowAttributes attrs;
-
+
if (cursor)
{
attrs.cursor = (Cursor) cursor->GetXCursor(display);
}
if (xwin)
XChangeWindowAttributes (display, xwin, CWCursor, &attrs);
-
+
XFlush (display);
-
+
for(wxNode *node = win->GetChildren().First (); node; node = node->Next())
{
wxWindow *child = (wxWindow *) node->Data ();
{
if (wxBusyCursorCount == 0)
return;
-
+
wxBusyCursorCount--;
if (wxBusyCursorCount == 0)
{
bool wxIsBusy()
{
return (wxBusyCursorCount > 0);
-}
-
-const char* wxGetHomeDir( wxString *home )
-{
- *home = wxGetUserHome( wxString() );
- if (home->IsNull()) *home = "/";
- return *home;
-};
-
-char *wxGetUserHome (const wxString& user)
-{
-#ifdef VMS
- return(NULL);
-#else
- struct passwd *who = NULL;
-
- if (user == "") {
- register char *ptr;
-
- if ((ptr = getenv("HOME")) != NULL)
- return ptr;
- if ((ptr = getenv("USER")) != NULL ||
- (ptr = getenv("LOGNAME")) != NULL)
- {
- who = getpwnam( ptr );
- }
- // We now make sure the the user exists!
- if (who == NULL)
- who = getpwuid( getuid() );
- } else
- who = getpwnam ((const char*) user);
-
- return who ? who->pw_dir : (char*) NULL;
-#endif
- // ifdef VMS
}
-// Check whether this window wants to process messages, e.g. Stop button
-// in long calculations.
-bool wxCheckForInterrupt(wxWindow *wnd)
-{
- if(wnd){
- Display *dpy=(Display*) wnd->GetXDisplay();
- Window win=(Window) wnd->GetXWindow();
- XEvent event;
- XFlush(dpy);
- if(wnd->GetMainWidget()){
- XmUpdateDisplay((Widget)(wnd->GetMainWidget()));
- }
- while(XCheckMaskEvent(dpy,
- ButtonPressMask|ButtonReleaseMask|ButtonMotionMask|
- PointerMotionMask|KeyPressMask|KeyReleaseMask,
- &event)){
- if(event.xany.window==win)
- XtDispatchEvent(&event);
- // else
- // XBell(dpy,50);
- }
- return TRUE;//*** temporary?
- }
- else{
- wxMessageBox("wnd==NULL !!!");
- return FALSE;//*** temporary?
- }
-}
+// ----------------------------------------------------------------------------
+// display info
+// ----------------------------------------------------------------------------
void wxGetMousePosition( int* x, int* y )
{
XMotionEvent xev;
Window root, child;
XQueryPointer((Display*) wxGetDisplay(),
- DefaultRootWindow((Display*) wxGetDisplay()), &root, &child,
- &(xev.x_root), &(xev.y_root),
- &(xev.x), &(xev.y),
- &(xev.state));
+ DefaultRootWindow((Display*) wxGetDisplay()),
+ &root, &child,
+ &(xev.x_root), &(xev.y_root),
+ &(xev.x), &(xev.y),
+ &(xev.state));
*x = xev.x_root;
*y = xev.y_root;
};
// Return TRUE if we have a colour display
bool wxColourDisplay()
{
- Display *dpy = (Display*) wxGetDisplay();
-
- if (DefaultDepth (dpy, DefaultScreen (dpy)) < 2)
- return FALSE;
- else
- return TRUE;
+ return wxDisplayDepth() > 1;
}
// Returns depth of screen
int wxDisplayDepth()
{
Display *dpy = (Display*) wxGetDisplay();
+
return DefaultDepth (dpy, DefaultScreen (dpy));
}
void wxDisplaySize(int *width, int *height)
{
Display *dpy = (Display*) wxGetDisplay();
-
- *width = DisplayWidth (dpy, DefaultScreen (dpy));
- *height = DisplayHeight (dpy, DefaultScreen (dpy));
+
+ if ( width )
+ *width = DisplayWidth (dpy, DefaultScreen (dpy));
+ if ( height )
+ *height = DisplayHeight (dpy, DefaultScreen (dpy));
}
-/* Configurable display in Motif */
+// Configurable display in Motif
static WXDisplay *gs_currentDisplay = NULL;
static wxString gs_displayName;
{
if (gs_currentDisplay)
return gs_currentDisplay;
-
+
if (wxTheApp && wxTheApp->GetTopLevelWidget())
return XtDisplay ((Widget) wxTheApp->GetTopLevelWidget());
else if (wxTheApp)
bool wxSetDisplay(const wxString& display_name)
{
gs_displayName = display_name;
-
- if (display_name.IsNull() || display_name.IsEmpty())
+
+ if ( !display_name )
{
gs_currentDisplay = NULL;
+
return TRUE;
}
else
{
Cardinal argc = 0;
-
+
Display *display = XtOpenDisplay((XtAppContext) wxTheApp->GetAppContext(),
(const char*) display_name,
(const char*) wxTheApp->GetAppName(),
(const char*) wxTheApp->GetClassName(),
NULL,
-# if XtSpecificationRelease < 5
- 0, &argc, NULL);
-# else
- 0, (int *)&argc, NULL);
-# endif
-
+#if XtSpecificationRelease < 5
+ 0, &argc,
+#else
+ 0, (int *)&argc,
+#endif
+ NULL);
+
if (display)
{
gs_currentDisplay = (WXDisplay*) display;
return TRUE;
- } else
+ }
+ else
return FALSE;
}
+
return FALSE;
}
return gs_displayName;
}
+// ----------------------------------------------------------------------------
+// accelerators
+// ----------------------------------------------------------------------------
+
// Find the letter corresponding to the mnemonic, for Motif
char wxFindMnemonic (const char *s)
{
s++;
/*
Now we need to format it as X standard:
-
+
input output
-
+
F7 --> <Key>F7
Ctrl+N --> Ctrl<Key>N
Alt+k --> Meta<Key>k
Ctrl+Shift+A --> Ctrl Shift<Key>A
-
+
*/
-
+
wxBuffer[0] = '\0';
char *tmp = copystring (s);
s = tmp;
char *p = s;
-
+
while (1)
{
while (*p && *p != '+')
return text;
}
+// ----------------------------------------------------------------------------
+// keycode translations
+// ----------------------------------------------------------------------------
+
#include <X11/keysym.h>
+// FIXME what about tables??
+
int wxCharCodeXToWX(KeySym keySym)
{
int id;
- switch (keySym) {
- case XK_Shift_L:
- case XK_Shift_R:
- id = WXK_SHIFT; break;
- case XK_Control_L:
- case XK_Control_R:
- id = WXK_CONTROL; break;
- case XK_BackSpace:
- id = WXK_BACK; break;
- case XK_Delete:
- id = WXK_DELETE; break;
- case XK_Clear:
- id = WXK_CLEAR; break;
- case XK_Tab:
- id = WXK_TAB; break;
- case XK_numbersign:
- id = '#'; break;
- case XK_Return:
- id = WXK_RETURN; break;
- case XK_Escape:
- id = WXK_ESCAPE; break;
- case XK_Pause:
- case XK_Break:
- id = WXK_PAUSE; break;
- case XK_Num_Lock:
- id = WXK_NUMLOCK; break;
- case XK_Scroll_Lock:
- id = WXK_SCROLL; break;
-
- case XK_Home:
- id = WXK_HOME; break;
- case XK_End:
- id = WXK_END; break;
- case XK_Left:
- id = WXK_LEFT; break;
- case XK_Right:
- id = WXK_RIGHT; break;
- case XK_Up:
- id = WXK_UP; break;
- case XK_Down:
- id = WXK_DOWN; break;
- case XK_Next:
- id = WXK_NEXT; break;
- case XK_Prior:
- id = WXK_PRIOR; break;
- case XK_Menu:
- id = WXK_MENU; break;
- case XK_Select:
- id = WXK_SELECT; break;
- case XK_Cancel:
- id = WXK_CANCEL; break;
- case XK_Print:
- id = WXK_PRINT; break;
- case XK_Execute:
- id = WXK_EXECUTE; break;
- case XK_Insert:
- id = WXK_INSERT; break;
- case XK_Help:
- id = WXK_HELP; break;
-
- case XK_KP_Multiply:
- id = WXK_MULTIPLY; break;
- case XK_KP_Add:
- id = WXK_ADD; break;
- case XK_KP_Subtract:
- id = WXK_SUBTRACT; break;
- case XK_KP_Divide:
- id = WXK_DIVIDE; break;
- case XK_KP_Decimal:
- id = WXK_DECIMAL; break;
- case XK_KP_Equal:
- id = '='; break;
- case XK_KP_Space:
- id = ' '; break;
- case XK_KP_Tab:
- id = WXK_TAB; break;
- case XK_KP_Enter:
- id = WXK_RETURN; break;
- case XK_KP_0:
- id = WXK_NUMPAD0; break;
- case XK_KP_1:
- id = WXK_NUMPAD1; break;
- case XK_KP_2:
- id = WXK_NUMPAD2; break;
- case XK_KP_3:
- id = WXK_NUMPAD3; break;
- case XK_KP_4:
- id = WXK_NUMPAD4; break;
- case XK_KP_5:
- id = WXK_NUMPAD5; break;
- case XK_KP_6:
- id = WXK_NUMPAD6; break;
- case XK_KP_7:
- id = WXK_NUMPAD7; break;
- case XK_KP_8:
- id = WXK_NUMPAD8; break;
- case XK_KP_9:
- id = WXK_NUMPAD9; break;
- case XK_F1:
- id = WXK_F1; break;
- case XK_F2:
- id = WXK_F2; break;
- case XK_F3:
- id = WXK_F3; break;
- case XK_F4:
- id = WXK_F4; break;
- case XK_F5:
- id = WXK_F5; break;
- case XK_F6:
- id = WXK_F6; break;
- case XK_F7:
- id = WXK_F7; break;
- case XK_F8:
- id = WXK_F8; break;
- case XK_F9:
- id = WXK_F9; break;
- case XK_F10:
- id = WXK_F10; break;
- case XK_F11:
- id = WXK_F11; break;
- case XK_F12:
- id = WXK_F12; break;
- case XK_F13:
- id = WXK_F13; break;
- case XK_F14:
- id = WXK_F14; break;
- case XK_F15:
- id = WXK_F15; break;
- case XK_F16:
- id = WXK_F16; break;
- case XK_F17:
- id = WXK_F17; break;
- case XK_F18:
- id = WXK_F18; break;
- case XK_F19:
- id = WXK_F19; break;
- case XK_F20:
- id = WXK_F20; break;
- case XK_F21:
- id = WXK_F21; break;
- case XK_F22:
- id = WXK_F22; break;
- case XK_F23:
- id = WXK_F23; break;
- case XK_F24:
- id = WXK_F24; break;
- default:
- id = (keySym <= 255) ? (int)keySym : -1;
- } // switch
- return id;
+ switch (keySym)
+ {
+ case XK_Shift_L:
+ case XK_Shift_R:
+ id = WXK_SHIFT; break;
+ case XK_Control_L:
+ case XK_Control_R:
+ id = WXK_CONTROL; break;
+ case XK_BackSpace:
+ id = WXK_BACK; break;
+ case XK_Delete:
+ id = WXK_DELETE; break;
+ case XK_Clear:
+ id = WXK_CLEAR; break;
+ case XK_Tab:
+ id = WXK_TAB; break;
+ case XK_numbersign:
+ id = '#'; break;
+ case XK_Return:
+ id = WXK_RETURN; break;
+ case XK_Escape:
+ id = WXK_ESCAPE; break;
+ case XK_Pause:
+ case XK_Break:
+ id = WXK_PAUSE; break;
+ case XK_Num_Lock:
+ id = WXK_NUMLOCK; break;
+ case XK_Scroll_Lock:
+ id = WXK_SCROLL; break;
+
+ case XK_Home:
+ id = WXK_HOME; break;
+ case XK_End:
+ id = WXK_END; break;
+ case XK_Left:
+ id = WXK_LEFT; break;
+ case XK_Right:
+ id = WXK_RIGHT; break;
+ case XK_Up:
+ id = WXK_UP; break;
+ case XK_Down:
+ id = WXK_DOWN; break;
+ case XK_Next:
+ id = WXK_NEXT; break;
+ case XK_Prior:
+ id = WXK_PRIOR; break;
+ case XK_Menu:
+ id = WXK_MENU; break;
+ case XK_Select:
+ id = WXK_SELECT; break;
+ case XK_Cancel:
+ id = WXK_CANCEL; break;
+ case XK_Print:
+ id = WXK_PRINT; break;
+ case XK_Execute:
+ id = WXK_EXECUTE; break;
+ case XK_Insert:
+ id = WXK_INSERT; break;
+ case XK_Help:
+ id = WXK_HELP; break;
+
+ case XK_KP_Multiply:
+ id = WXK_MULTIPLY; break;
+ case XK_KP_Add:
+ id = WXK_ADD; break;
+ case XK_KP_Subtract:
+ id = WXK_SUBTRACT; break;
+ case XK_KP_Divide:
+ id = WXK_DIVIDE; break;
+ case XK_KP_Decimal:
+ id = WXK_DECIMAL; break;
+ case XK_KP_Equal:
+ id = '='; break;
+ case XK_KP_Space:
+ id = ' '; break;
+ case XK_KP_Tab:
+ id = WXK_TAB; break;
+ case XK_KP_Enter:
+ id = WXK_RETURN; break;
+ case XK_KP_0:
+ id = WXK_NUMPAD0; break;
+ case XK_KP_1:
+ id = WXK_NUMPAD1; break;
+ case XK_KP_2:
+ id = WXK_NUMPAD2; break;
+ case XK_KP_3:
+ id = WXK_NUMPAD3; break;
+ case XK_KP_4:
+ id = WXK_NUMPAD4; break;
+ case XK_KP_5:
+ id = WXK_NUMPAD5; break;
+ case XK_KP_6:
+ id = WXK_NUMPAD6; break;
+ case XK_KP_7:
+ id = WXK_NUMPAD7; break;
+ case XK_KP_8:
+ id = WXK_NUMPAD8; break;
+ case XK_KP_9:
+ id = WXK_NUMPAD9; break;
+ case XK_F1:
+ id = WXK_F1; break;
+ case XK_F2:
+ id = WXK_F2; break;
+ case XK_F3:
+ id = WXK_F3; break;
+ case XK_F4:
+ id = WXK_F4; break;
+ case XK_F5:
+ id = WXK_F5; break;
+ case XK_F6:
+ id = WXK_F6; break;
+ case XK_F7:
+ id = WXK_F7; break;
+ case XK_F8:
+ id = WXK_F8; break;
+ case XK_F9:
+ id = WXK_F9; break;
+ case XK_F10:
+ id = WXK_F10; break;
+ case XK_F11:
+ id = WXK_F11; break;
+ case XK_F12:
+ id = WXK_F12; break;
+ case XK_F13:
+ id = WXK_F13; break;
+ case XK_F14:
+ id = WXK_F14; break;
+ case XK_F15:
+ id = WXK_F15; break;
+ case XK_F16:
+ id = WXK_F16; break;
+ case XK_F17:
+ id = WXK_F17; break;
+ case XK_F18:
+ id = WXK_F18; break;
+ case XK_F19:
+ id = WXK_F19; break;
+ case XK_F20:
+ id = WXK_F20; break;
+ case XK_F21:
+ id = WXK_F21; break;
+ case XK_F22:
+ id = WXK_F22; break;
+ case XK_F23:
+ id = WXK_F23; break;
+ case XK_F24:
+ id = WXK_F24; break;
+ default:
+ id = (keySym <= 255) ? (int)keySym : -1;
+ }
+
+ return id;
}
KeySym wxCharCodeWXToX(int id)
{
KeySym keySym;
-
- switch (id) {
- case WXK_CANCEL: keySym = XK_Cancel; break;
- case WXK_BACK: keySym = XK_BackSpace; break;
- case WXK_TAB: keySym = XK_Tab; break;
- case WXK_CLEAR: keySym = XK_Clear; break;
- case WXK_RETURN: keySym = XK_Return; break;
- case WXK_SHIFT: keySym = XK_Shift_L; break;
- case WXK_CONTROL: keySym = XK_Control_L; break;
- case WXK_MENU : keySym = XK_Menu; break;
- case WXK_PAUSE: keySym = XK_Pause; break;
- case WXK_ESCAPE: keySym = XK_Escape; break;
- case WXK_SPACE: keySym = ' '; break;
- case WXK_PRIOR: keySym = XK_Prior; break;
- case WXK_NEXT : keySym = XK_Next; break;
- case WXK_END: keySym = XK_End; break;
- case WXK_HOME : keySym = XK_Home; break;
- case WXK_LEFT : keySym = XK_Left; break;
- case WXK_UP: keySym = XK_Up; break;
- case WXK_RIGHT: keySym = XK_Right; break;
- case WXK_DOWN : keySym = XK_Down; break;
- case WXK_SELECT: keySym = XK_Select; break;
- case WXK_PRINT: keySym = XK_Print; break;
- case WXK_EXECUTE: keySym = XK_Execute; break;
- case WXK_INSERT: keySym = XK_Insert; break;
- case WXK_DELETE: keySym = XK_Delete; break;
- case WXK_HELP : keySym = XK_Help; break;
- case WXK_NUMPAD0: keySym = XK_KP_0; break;
- case WXK_NUMPAD1: keySym = XK_KP_1; break;
- case WXK_NUMPAD2: keySym = XK_KP_2; break;
- case WXK_NUMPAD3: keySym = XK_KP_3; break;
- case WXK_NUMPAD4: keySym = XK_KP_4; break;
- case WXK_NUMPAD5: keySym = XK_KP_5; break;
- case WXK_NUMPAD6: keySym = XK_KP_6; break;
- case WXK_NUMPAD7: keySym = XK_KP_7; break;
- case WXK_NUMPAD8: keySym = XK_KP_8; break;
- case WXK_NUMPAD9: keySym = XK_KP_9; break;
- case WXK_MULTIPLY: keySym = XK_KP_Multiply; break;
- case WXK_ADD: keySym = XK_KP_Add; break;
- case WXK_SUBTRACT: keySym = XK_KP_Subtract; break;
- case WXK_DECIMAL: keySym = XK_KP_Decimal; break;
- case WXK_DIVIDE: keySym = XK_KP_Divide; break;
- case WXK_F1: keySym = XK_F1; break;
- case WXK_F2: keySym = XK_F2; break;
- case WXK_F3: keySym = XK_F3; break;
- case WXK_F4: keySym = XK_F4; break;
- case WXK_F5: keySym = XK_F5; break;
- case WXK_F6: keySym = XK_F6; break;
- case WXK_F7: keySym = XK_F7; break;
- case WXK_F8: keySym = XK_F8; break;
- case WXK_F9: keySym = XK_F9; break;
- case WXK_F10: keySym = XK_F10; break;
- case WXK_F11: keySym = XK_F11; break;
- case WXK_F12: keySym = XK_F12; break;
- case WXK_F13: keySym = XK_F13; break;
- case WXK_F14: keySym = XK_F14; break;
- case WXK_F15: keySym = XK_F15; break;
- case WXK_F16: keySym = XK_F16; break;
- case WXK_F17: keySym = XK_F17; break;
- case WXK_F18: keySym = XK_F18; break;
- case WXK_F19: keySym = XK_F19; break;
- case WXK_F20: keySym = XK_F20; break;
- case WXK_F21: keySym = XK_F21; break;
- case WXK_F22: keySym = XK_F22; break;
- case WXK_F23: keySym = XK_F23; break;
- case WXK_F24: keySym = XK_F24; break;
- case WXK_NUMLOCK: keySym = XK_Num_Lock; break;
- case WXK_SCROLL: keySym = XK_Scroll_Lock; break;
- default: keySym = id <= 255 ? (KeySym)id : 0;
- } // switch
- return keySym;
-}
-// Read $HOME for what it says is home, if not
-// read $USER or $LOGNAME for user name else determine
-// the Real User, then determine the Real home dir.
-static char * GetIniFile (char *dest, const char *filename)
-{
- char *home = NULL;
- if (filename && wxIsAbsolutePath(filename))
- {
- strcpy(dest, filename);
- }
- else if ((home = wxGetUserHome("")) != NULL)
- {
- strcpy(dest, home);
- if (dest[strlen(dest) - 1] != '/')
- strcat (dest, "/");
- if (filename == NULL)
- {
- if ((filename = getenv ("XENVIRONMENT")) == NULL)
- filename = ".Xdefaults";
- }
- else if (*filename != '.')
- strcat (dest, ".");
- strcat (dest, filename);
- } else
+ switch (id)
{
- dest[0] = '\0';
+ case WXK_CANCEL: keySym = XK_Cancel; break;
+ case WXK_BACK: keySym = XK_BackSpace; break;
+ case WXK_TAB: keySym = XK_Tab; break;
+ case WXK_CLEAR: keySym = XK_Clear; break;
+ case WXK_RETURN: keySym = XK_Return; break;
+ case WXK_SHIFT: keySym = XK_Shift_L; break;
+ case WXK_CONTROL: keySym = XK_Control_L; break;
+ case WXK_MENU : keySym = XK_Menu; break;
+ case WXK_PAUSE: keySym = XK_Pause; break;
+ case WXK_ESCAPE: keySym = XK_Escape; break;
+ case WXK_SPACE: keySym = ' '; break;
+ case WXK_PRIOR: keySym = XK_Prior; break;
+ case WXK_NEXT : keySym = XK_Next; break;
+ case WXK_END: keySym = XK_End; break;
+ case WXK_HOME : keySym = XK_Home; break;
+ case WXK_LEFT : keySym = XK_Left; break;
+ case WXK_UP: keySym = XK_Up; break;
+ case WXK_RIGHT: keySym = XK_Right; break;
+ case WXK_DOWN : keySym = XK_Down; break;
+ case WXK_SELECT: keySym = XK_Select; break;
+ case WXK_PRINT: keySym = XK_Print; break;
+ case WXK_EXECUTE: keySym = XK_Execute; break;
+ case WXK_INSERT: keySym = XK_Insert; break;
+ case WXK_DELETE: keySym = XK_Delete; break;
+ case WXK_HELP : keySym = XK_Help; break;
+ case WXK_NUMPAD0: keySym = XK_KP_0; break;
+ case WXK_NUMPAD1: keySym = XK_KP_1; break;
+ case WXK_NUMPAD2: keySym = XK_KP_2; break;
+ case WXK_NUMPAD3: keySym = XK_KP_3; break;
+ case WXK_NUMPAD4: keySym = XK_KP_4; break;
+ case WXK_NUMPAD5: keySym = XK_KP_5; break;
+ case WXK_NUMPAD6: keySym = XK_KP_6; break;
+ case WXK_NUMPAD7: keySym = XK_KP_7; break;
+ case WXK_NUMPAD8: keySym = XK_KP_8; break;
+ case WXK_NUMPAD9: keySym = XK_KP_9; break;
+ case WXK_MULTIPLY: keySym = XK_KP_Multiply; break;
+ case WXK_ADD: keySym = XK_KP_Add; break;
+ case WXK_SUBTRACT: keySym = XK_KP_Subtract; break;
+ case WXK_DECIMAL: keySym = XK_KP_Decimal; break;
+ case WXK_DIVIDE: keySym = XK_KP_Divide; break;
+ case WXK_F1: keySym = XK_F1; break;
+ case WXK_F2: keySym = XK_F2; break;
+ case WXK_F3: keySym = XK_F3; break;
+ case WXK_F4: keySym = XK_F4; break;
+ case WXK_F5: keySym = XK_F5; break;
+ case WXK_F6: keySym = XK_F6; break;
+ case WXK_F7: keySym = XK_F7; break;
+ case WXK_F8: keySym = XK_F8; break;
+ case WXK_F9: keySym = XK_F9; break;
+ case WXK_F10: keySym = XK_F10; break;
+ case WXK_F11: keySym = XK_F11; break;
+ case WXK_F12: keySym = XK_F12; break;
+ case WXK_F13: keySym = XK_F13; break;
+ case WXK_F14: keySym = XK_F14; break;
+ case WXK_F15: keySym = XK_F15; break;
+ case WXK_F16: keySym = XK_F16; break;
+ case WXK_F17: keySym = XK_F17; break;
+ case WXK_F18: keySym = XK_F18; break;
+ case WXK_F19: keySym = XK_F19; break;
+ case WXK_F20: keySym = XK_F20; break;
+ case WXK_F21: keySym = XK_F21; break;
+ case WXK_F22: keySym = XK_F22; break;
+ case WXK_F23: keySym = XK_F23; break;
+ case WXK_F24: keySym = XK_F24; break;
+ case WXK_NUMLOCK: keySym = XK_Num_Lock; break;
+ case WXK_SCROLL: keySym = XK_Scroll_Lock; break;
+ default: keySym = id <= 255 ? (KeySym)id : 0;
}
- return dest;
+
+ return keySym;
}
-/*
-* Some colour manipulation routines
-*/
+// ----------------------------------------------------------------------------
+// Some colour manipulation routines
+// ----------------------------------------------------------------------------
void wxHSVToXColor(wxHSV *hsv,XColor *rgb)
{
p = v * (wxMAX_RGB - s) / wxMAX_RGB;
q = v * (wxMAX_RGB - s * f / 60) / wxMAX_RGB;
t = v * (wxMAX_RGB - s * (60 - f) / 60) / wxMAX_RGB;
- switch (i)
+ switch (i)
{
case 0: r = v, g = t, b = p; break;
case 1: r = q, g = v, b = p; break;
if (maxv) s = (maxv - minv) * wxMAX_RGB / maxv;
else s = 0;
if (s == 0) h = 0;
- else
+ else
{
int rc, gc, bc, hex;
rc = (maxv - r) * wxMAX_RGB / (maxv - minv);
gc = (maxv - g) * wxMAX_RGB / (maxv - minv);
bc = (maxv - b) * wxMAX_RGB / (maxv - minv);
- if (r == maxv) { h = bc - gc, hex = 0; }
- else if (g == maxv) { h = rc - bc, hex = 2; }
+ if (r == maxv) { h = bc - gc, hex = 0; }
+ else if (g == maxv) { h = rc - bc, hex = 2; }
else if (b == maxv) { h = gc - rc, hex = 4; }
h = hex * 60 + (h * 60 / wxMAX_RGB);
if (h < 0) h += 360;
void wxAllocNearestColor(Display *d,Colormap cmp,XColor *xc)
{
int llp;
-
+
int screen = DefaultScreen(d);
int num_colors = DisplayCells(d,screen);
-
+
XColor *color_defs = new XColor[num_colors];
for(llp = 0;llp < num_colors;llp++) color_defs[llp].pixel = llp;
XQueryColors(d,cmp,color_defs,num_colors);
-
+
wxHSV hsv_defs, hsv;
wxXColorToHSV(&hsv,xc);
-
+
int diff, min_diff, pixel = 0;
-
+
for(llp = 0;llp < num_colors;llp++)
{
wxXColorToHSV(&hsv_defs,&color_defs[llp]);
if (min_diff > diff) { min_diff = diff; pixel = llp; }
if (min_diff == 0) break;
}
-
+
xc -> red = color_defs[pixel].red;
xc -> green = color_defs[pixel].green;
xc -> blue = color_defs[pixel].blue;
xc -> flags = DoRed | DoGreen | DoBlue;
if (!XAllocColor(d,cmp,xc))
cout << "wxAllocNearestColor : Warning : Cannot find nearest color !\n";
-
+
delete[] color_defs;
}
// Therefore SetBackgroundColour computes the foreground colour, and
// SetForegroundColour changes the foreground colour. The ordering is
// important.
-
+
XtVaSetValues ((Widget) widget,
XmNforeground, foregroundColour.AllocColour(XtDisplay((Widget) widget)),
NULL);
{
wxComputeColours (XtDisplay((Widget) widget), & backgroundColour,
(wxColour*) NULL);
-
+
XtVaSetValues ((Widget) widget,
XmNbackground, g_itemColors[wxBACK_INDEX].pixel,
XmNtopShadowColor, g_itemColors[wxTOPS_INDEX].pixel,
XmNbottomShadowColor, g_itemColors[wxBOTS_INDEX].pixel,
XmNforeground, g_itemColors[wxFORE_INDEX].pixel,
NULL);
-
+
if (changeArmColour)
XtVaSetValues ((Widget) widget,
XmNarmColor, g_itemColors[wxSELE_INDEX].pixel,
NULL);
}
-
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: threadpsx.cpp
+// Purpose: wxThread (Posix) Implementation
+// Author: Original from Wolfram Gloger/Guilhem Lavaux
+// Modified by:
+// Created: 04/22/98
+// RCS-ID: $Id$
+// Copyright: (c) Wolfram Gloger (1996, 1997)
+// Guilhem Lavaux (1998)
+// Vadim Zeitlin (1999)
+// Robert Roebling (1999)
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declaration
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "thread.h"
+#endif
+
+#include "wx/thread.h"
+
+#if !wxUSE_THREADS
+ #error This file needs wxUSE_THREADS
+#endif
+
+#include "wx/module.h"
+#include "wx/utils.h"
+#include "wx/log.h"
+#include "wx/intl.h"
+#include "wx/dynarray.h"
+
+#include <stdio.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <errno.h>
+#include <time.h>
+
+#ifdef HAVE_SCHED_H
+ #include <sched.h>
+#endif
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+enum thread_state
+{
+ STATE_NEW, // didn't start execution yet (=> RUNNING)
+ STATE_RUNNING,
+ STATE_PAUSED,
+ STATE_CANCELED,
+ STATE_EXITED
+};
+
+WX_DEFINE_ARRAY(wxThread *, wxArrayThread);
+
+// -----------------------------------------------------------------------------
+// global data
+// -----------------------------------------------------------------------------
+
+// we keep the list of all threads created by the application to be able to
+// terminate them on exit if there are some left - otherwise the process would
+// be left in memory
+static wxArrayThread gs_allThreads;
+
+// the id of the main thread
+static pthread_t gs_tidMain;
+
+// the key for the pointer to the associated wxThread object
+static pthread_key_t gs_keySelf;
+
+// this mutex must be acquired before any call to a GUI function
+static wxMutex *gs_mutexGui;
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+//--------------------------------------------------------------------
+// wxMutex (Posix implementation)
+//--------------------------------------------------------------------
+
+class wxMutexInternal
+{
+public:
+ pthread_mutex_t p_mutex;
+};
+
+wxMutex::wxMutex()
+{
+ p_internal = new wxMutexInternal;
+ pthread_mutex_init( &(p_internal->p_mutex), (const pthread_mutexattr_t*) NULL );
+ m_locked = 0;
+}
+
+wxMutex::~wxMutex()
+{
+ if (m_locked > 0)
+ wxLogDebug("Freeing a locked mutex (%d locks)", m_locked);
+
+ pthread_mutex_destroy( &(p_internal->p_mutex) );
+ delete p_internal;
+}
+
+wxMutexError wxMutex::Lock()
+{
+ int err = pthread_mutex_lock( &(p_internal->p_mutex) );
+ if (err == EDEADLK)
+ {
+ wxLogDebug("Locking this mutex would lead to deadlock!");
+
+ return wxMUTEX_DEAD_LOCK;
+ }
+
+ m_locked++;
+
+ return wxMUTEX_NO_ERROR;
+}
+
+wxMutexError wxMutex::TryLock()
+{
+ if (m_locked)
+ {
+ return wxMUTEX_BUSY;
+ }
+
+ int err = pthread_mutex_trylock( &(p_internal->p_mutex) );
+ switch (err)
+ {
+ case EBUSY: return wxMUTEX_BUSY;
+ }
+
+ m_locked++;
+
+ return wxMUTEX_NO_ERROR;
+}
+
+wxMutexError wxMutex::Unlock()
+{
+ if (m_locked > 0)
+ {
+ m_locked--;
+ }
+ else
+ {
+ wxLogDebug("Unlocking not locked mutex.");
+
+ return wxMUTEX_UNLOCKED;
+ }
+
+ pthread_mutex_unlock( &(p_internal->p_mutex) );
+
+ return wxMUTEX_NO_ERROR;
+}
+
+//--------------------------------------------------------------------
+// wxCondition (Posix implementation)
+//--------------------------------------------------------------------
+
+class wxConditionInternal
+{
+public:
+ pthread_cond_t p_condition;
+};
+
+wxCondition::wxCondition()
+{
+ p_internal = new wxConditionInternal;
+ pthread_cond_init( &(p_internal->p_condition), (const pthread_condattr_t *) NULL );
+}
+
+wxCondition::~wxCondition()
+{
+ pthread_cond_destroy( &(p_internal->p_condition) );
+
+ delete p_internal;
+}
+
+void wxCondition::Wait(wxMutex& mutex)
+{
+ pthread_cond_wait( &(p_internal->p_condition), &(mutex.p_internal->p_mutex) );
+}
+
+bool wxCondition::Wait(wxMutex& mutex, unsigned long sec, unsigned long nsec)
+{
+ struct timespec tspec;
+
+ tspec.tv_sec = time(0L)+sec;
+ tspec.tv_nsec = nsec;
+ return (pthread_cond_timedwait(&(p_internal->p_condition), &(mutex.p_internal->p_mutex), &tspec) != ETIMEDOUT);
+}
+
+void wxCondition::Signal()
+{
+ pthread_cond_signal( &(p_internal->p_condition) );
+}
+
+void wxCondition::Broadcast()
+{
+ pthread_cond_broadcast( &(p_internal->p_condition) );
+}
+
+//--------------------------------------------------------------------
+// wxThread (Posix implementation)
+//--------------------------------------------------------------------
+
+class wxThreadInternal
+{
+public:
+ wxThreadInternal();
+ ~wxThreadInternal();
+
+ // thread entry function
+ static void *PthreadStart(void *ptr);
+
+ // thread actions
+ // start the thread
+ wxThreadError Run();
+ // ask the thread to terminate
+ void Cancel();
+ // wake up threads waiting for our termination
+ void SignalExit();
+ // go to sleep until Resume() is called
+ void Pause();
+ // resume the thread
+ void Resume();
+
+ // accessors
+ // priority
+ int GetPriority() const { return m_prio; }
+ void SetPriority(int prio) { m_prio = prio; }
+ // state
+ thread_state GetState() const { return m_state; }
+ void SetState(thread_state state) { m_state = state; }
+ // id
+ pthread_t GetId() const { return thread_id; }
+ // "cancelled" flag
+ bool WasCancelled() const { return m_cancelled; }
+
+//private: -- should be!
+ pthread_t thread_id;
+
+private:
+ thread_state m_state; // see thread_state enum
+ int m_prio; // in wxWindows units: from 0 to 100
+
+ // set when the thread should terminate
+ bool m_cancelled;
+
+ // this (mutex, cond) pair is used to synchronize the main thread and this
+ // thread in several situations:
+ // 1. The thread function blocks until condition is signaled by Run() when
+ // it's initially created - this allows create thread in "suspended"
+ // state
+ // 2. The Delete() function blocks until the condition is signaled when the
+ // thread exits.
+ wxMutex m_mutex;
+ wxCondition m_cond;
+
+ // another (mutex, cond) pair for Pause()/Resume() usage
+ //
+ // VZ: it's possible that we might reuse the mutex and condition from above
+ // for this too, but as I'm not at all sure that it won't create subtle
+ // problems with race conditions between, say, Pause() and Delete() I
+ // prefer this may be a bit less efficient but much safer solution
+ wxMutex m_mutexSuspend;
+ wxCondition m_condSuspend;
+};
+
+void *wxThreadInternal::PthreadStart(void *ptr)
+{
+ wxThread *thread = (wxThread *)ptr;
+ wxThreadInternal *pthread = thread->p_internal;
+
+ if ( pthread_setspecific(gs_keySelf, thread) != 0 )
+ {
+ wxLogError(_("Can not start thread: error writing TLS."));
+
+ return (void *)-1;
+ }
+
+ // wait for the condition to be signaled from Run()
+ // mutex state: currently locked by the thread which created us
+ pthread->m_cond.Wait(pthread->m_mutex);
+
+ // mutex state: locked again on exit of Wait()
+
+ // call the main entry
+ void* status = thread->Entry();
+
+ // terminate the thread
+ thread->Exit(status);
+
+ wxFAIL_MSG("wxThread::Exit() can't return.");
+
+ return NULL;
+}
+
+wxThreadInternal::wxThreadInternal()
+{
+ m_state = STATE_NEW;
+ m_cancelled = FALSE;
+
+ // this mutex is locked during almost all thread lifetime - it will only be
+ // unlocked in the very end
+ m_mutex.Lock();
+
+ // this mutex is used in Pause()/Resume() and is also locked all the time
+ // unless the thread is paused
+ m_mutexSuspend.Lock();
+}
+
+wxThreadInternal::~wxThreadInternal()
+{
+ m_mutexSuspend.Unlock();
+
+ // note that m_mutex will be unlocked by the thread which waits for our
+ // termination
+}
+
+wxThreadError wxThreadInternal::Run()
+{
+ wxCHECK_MSG( GetState() == STATE_NEW, wxTHREAD_RUNNING,
+ "thread may only be started once after successful Create()" );
+
+ // the mutex was locked on Create(), so we will be able to lock it again
+ // only when the thread really starts executing and enters the wait -
+ // otherwise we might signal the condition before anybody is waiting for it
+ wxMutexLocker lock(m_mutex);
+ m_cond.Signal();
+
+ m_state = STATE_RUNNING;
+
+ return wxTHREAD_NO_ERROR;
+
+ // now the mutex is unlocked back - but just to allow Wait() function to
+ // terminate by relocking it, so the net result is that the worker thread
+ // starts executing and the mutex is still locked
+}
+
+void wxThreadInternal::Cancel()
+{
+ // if the thread we're waiting for is waiting for the GUI mutex, we will
+ // deadlock so make sure we release it temporarily
+ if ( wxThread::IsMain() )
+ wxMutexGuiLeave();
+
+ // nobody ever writes this variable so it's safe to not use any
+ // synchronization here
+ m_cancelled = TRUE;
+
+ // entering Wait() releases the mutex thus allowing SignalExit() to acquire
+ // it and to signal us its termination
+ m_cond.Wait(m_mutex);
+
+ // mutex is still in the locked state - relocked on exit from Wait(), so
+ // unlock it - we don't need it any more, the thread has already terminated
+ m_mutex.Unlock();
+
+ // reacquire GUI mutex
+ if ( wxThread::IsMain() )
+ wxMutexGuiEnter();
+}
+
+void wxThreadInternal::SignalExit()
+{
+ // as mutex is currently locked, this will block until some other thread
+ // (normally the same which created this one) unlocks it by entering Wait()
+ m_mutex.Lock();
+
+ // wake up all the threads waiting for our termination
+ m_cond.Broadcast();
+
+ // after this call mutex will be finally unlocked
+ m_mutex.Unlock();
+}
+
+void wxThreadInternal::Pause()
+{
+ wxCHECK_RET( m_state == STATE_PAUSED,
+ "thread must first be paused with wxThread::Pause()." );
+
+ // wait until the condition is signaled from Resume()
+ m_condSuspend.Wait(m_mutexSuspend);
+}
+
+void wxThreadInternal::Resume()
+{
+ wxCHECK_RET( m_state == STATE_PAUSED,
+ "can't resume thread which is not suspended." );
+
+ // we will be able to lock this mutex only when Pause() starts waiting
+ wxMutexLocker lock(m_mutexSuspend);
+ m_condSuspend.Signal();
+
+ SetState(STATE_RUNNING);
+}
+
+// -----------------------------------------------------------------------------
+// static functions
+// -----------------------------------------------------------------------------
+
+wxThread *wxThread::This()
+{
+ return (wxThread *)pthread_getspecific(gs_keySelf);
+}
+
+bool wxThread::IsMain()
+{
+ return (bool)pthread_equal(pthread_self(), gs_tidMain);
+}
+
+void wxThread::Yield()
+{
+ sched_yield();
+}
+
+void wxThread::Sleep(unsigned long milliseconds)
+{
+ wxUsleep(milliseconds);
+}
+
+// -----------------------------------------------------------------------------
+// creating thread
+// -----------------------------------------------------------------------------
+
+wxThread::wxThread()
+{
+ // add this thread to the global list of all threads
+ gs_allThreads.Add(this);
+
+ p_internal = new wxThreadInternal();
+}
+
+wxThreadError wxThread::Create()
+{
+ if (p_internal->GetState() != STATE_NEW)
+ return wxTHREAD_RUNNING;
+
+ // set up the thread attribute: right now, we only set thread priority
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+
+ int prio;
+ if ( pthread_attr_getschedpolicy(&attr, &prio) != 0 )
+ {
+ wxLogError(_("Can not retrieve thread scheduling policy."));
+ }
+
+ int min_prio = sched_get_priority_min(prio),
+ max_prio = sched_get_priority_max(prio);
+
+ if ( min_prio == -1 || max_prio == -1 )
+ {
+ wxLogError(_("Can not get priority range for scheduling policy %d."),
+ prio);
+ }
+ else
+ {
+ struct sched_param sp;
+ pthread_attr_getschedparam(&attr, &sp);
+ sp.sched_priority = min_prio +
+ (p_internal->GetPriority()*(max_prio-min_prio))/100;
+ pthread_attr_setschedparam(&attr, &sp);
+ }
+
+ // create the new OS thread object
+ int rc = pthread_create(&p_internal->thread_id, &attr,
+ wxThreadInternal::PthreadStart, (void *)this);
+ pthread_attr_destroy(&attr);
+
+ if ( rc != 0 )
+ {
+ p_internal->SetState(STATE_EXITED);
+ return wxTHREAD_NO_RESOURCE;
+ }
+
+ return wxTHREAD_NO_ERROR;
+}
+
+wxThreadError wxThread::Run()
+{
+ return p_internal->Run();
+}
+
+// -----------------------------------------------------------------------------
+// misc accessors
+// -----------------------------------------------------------------------------
+
+void wxThread::SetPriority(unsigned int prio)
+{
+ wxCHECK_RET( (WXTHREAD_MIN_PRIORITY <= prio) &&
+ (prio <= WXTHREAD_MAX_PRIORITY), "invalid thread priority" );
+
+ wxCriticalSectionLocker lock(m_critsect);
+
+ switch ( p_internal->GetState() )
+ {
+ case STATE_NEW:
+ // thread not yet started, priority will be set when it is
+ p_internal->SetPriority(prio);
+ break;
+
+ case STATE_RUNNING:
+ case STATE_PAUSED:
+ {
+ struct sched_param sparam;
+ sparam.sched_priority = prio;
+
+ if ( pthread_setschedparam(p_internal->GetId(),
+ SCHED_OTHER, &sparam) != 0 )
+ {
+ wxLogError(_("Failed to set thread priority %d."), prio);
+ }
+ }
+ break;
+
+ case STATE_EXITED:
+ default:
+ wxFAIL_MSG("impossible to set thread priority in this state");
+ }
+}
+
+unsigned int wxThread::GetPriority() const
+{
+ wxCriticalSectionLocker lock((wxCriticalSection &)m_critsect);
+
+ return p_internal->GetPriority();
+}
+
+unsigned long wxThread::GetID() const
+{
+ return (unsigned long)p_internal->thread_id;
+}
+
+// -----------------------------------------------------------------------------
+// pause/resume
+// -----------------------------------------------------------------------------
+
+wxThreadError wxThread::Pause()
+{
+ wxCriticalSectionLocker lock(m_critsect);
+
+ if ( p_internal->GetState() != STATE_RUNNING )
+ {
+ wxLogDebug("Can't pause thread which is not running.");
+
+ return wxTHREAD_NOT_RUNNING;
+ }
+
+ p_internal->SetState(STATE_PAUSED);
+
+ return wxTHREAD_NO_ERROR;
+}
+
+wxThreadError wxThread::Resume()
+{
+ wxCriticalSectionLocker lock(m_critsect);
+
+ if ( p_internal->GetState() == STATE_PAUSED )
+ {
+ p_internal->Resume();
+
+ return wxTHREAD_NO_ERROR;
+ }
+ else
+ {
+ wxLogDebug("Attempt to resume a thread which is not paused.");
+
+ return wxTHREAD_MISC_ERROR;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// exiting thread
+// -----------------------------------------------------------------------------
+
+wxThread::ExitCode wxThread::Delete()
+{
+ m_critsect.Enter();
+ thread_state state = p_internal->GetState();
+ m_critsect.Leave();
+
+ switch ( state )
+ {
+ case STATE_NEW:
+ case STATE_EXITED:
+ // nothing to do
+ break;
+
+ case STATE_PAUSED:
+ // resume the thread first
+ Resume();
+
+ // fall through
+
+ default:
+ // set the flag telling to the thread to stop and wait
+ p_internal->Cancel();
+ }
+
+ return NULL;
+}
+
+wxThreadError wxThread::Kill()
+{
+ switch ( p_internal->GetState() )
+ {
+ case STATE_NEW:
+ case STATE_EXITED:
+ return wxTHREAD_NOT_RUNNING;
+
+ default:
+ if ( pthread_cancel(p_internal->GetId()) != 0 )
+ {
+ wxLogError(_("Failed to terminate a thread."));
+
+ return wxTHREAD_MISC_ERROR;
+ }
+
+ return wxTHREAD_NO_ERROR;
+ }
+}
+
+void wxThread::Exit(void *status)
+{
+ // first call user-level clean up code
+ OnExit();
+
+ // next wake up the threads waiting for us (OTOH, this function won't return
+ // until someone waited for us!)
+ p_internal->SignalExit();
+
+ p_internal->SetState(STATE_EXITED);
+
+ // delete both C++ thread object and terminate the OS thread object
+ delete this;
+ pthread_exit(status);
+}
+
+// also test whether we were paused
+bool wxThread::TestDestroy()
+{
+ wxCriticalSectionLocker lock((wxCriticalSection&)m_critsect);
+
+ if ( p_internal->GetState() == STATE_PAUSED )
+ {
+ // leave the crit section or the other threads will stop too if they try
+ // to call any of (seemingly harmless) IsXXX() functions while we sleep
+ m_critsect.Leave();
+
+ p_internal->Pause();
+
+ // enter it back before it's finally left in lock object dtor
+ m_critsect.Enter();
+ }
+
+ return p_internal->WasCancelled();
+}
+
+wxThread::~wxThread()
+{
+ // remove this thread from the global array
+ gs_allThreads.Remove(this);
+}
+
+// -----------------------------------------------------------------------------
+// state tests
+// -----------------------------------------------------------------------------
+
+bool wxThread::IsRunning() const
+{
+ wxCriticalSectionLocker lock((wxCriticalSection &)m_critsect);
+
+ return p_internal->GetState() == STATE_RUNNING;
+}
+
+bool wxThread::IsAlive() const
+{
+ wxCriticalSectionLocker lock((wxCriticalSection&)m_critsect);
+
+ switch ( p_internal->GetState() )
+ {
+ case STATE_RUNNING:
+ case STATE_PAUSED:
+ return TRUE;
+
+ default:
+ return FALSE;
+ }
+}
+
+//--------------------------------------------------------------------
+// wxThreadModule
+//--------------------------------------------------------------------
+
+class wxThreadModule : public wxModule
+{
+public:
+ virtual bool OnInit();
+ virtual void OnExit();
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxThreadModule)
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule)
+
+bool wxThreadModule::OnInit()
+{
+ if ( pthread_key_create(&gs_keySelf, NULL /* dtor function */) != 0 )
+ {
+ wxLogError(_("Thread module initialization failed: "
+ "failed to create pthread key."));
+
+ return FALSE;
+ }
+
+ gs_mutexGui = new wxMutex();
+
+ //wxThreadGuiInit();
+
+ gs_tidMain = pthread_self();
+ gs_mutexGui->Lock();
+
+ return TRUE;
+}
+
+void wxThreadModule::OnExit()
+{
+ wxASSERT_MSG( wxThread::IsMain(), "only main thread can be here" );
+
+ // terminate any threads left
+ size_t count = gs_allThreads.GetCount();
+ if ( count != 0u )
+ wxLogDebug("Some threads were not terminated by the application.");
+
+ for ( size_t n = 0u; n < count; n++ )
+ {
+ gs_allThreads[n]->Delete();
+ }
+
+ // destroy GUI mutex
+ gs_mutexGui->Unlock();
+
+ //wxThreadGuiExit();
+
+ delete gs_mutexGui;
+
+ // and free TLD slot
+ (void)pthread_key_delete(gs_keySelf);
+}
+
+// ----------------------------------------------------------------------------
+// global functions
+// ----------------------------------------------------------------------------
+
+void wxMutexGuiEnter()
+{
+ gs_mutexGui->Lock();
+}
+
+void wxMutexGuiLeave()
+{
+ gs_mutexGui->Unlock();
+}
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: utilsunx.cpp
+// Purpose: generic Unix implementation of many wx functions
+// Author: Vadim Zeitlin
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling, Vadim Zeitlin
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+#include "wx/string.h"
+
+#include "wx/intl.h"
+#include "wx/log.h"
+
+#include "wx/utils.h"
+#include "wx/process.h"
+
+#include "wx/unix/execute.h"
+
+#include <stdarg.h>
+#include <dirent.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <pwd.h>
+#include <errno.h>
+#include <netdb.h>
+#include <signal.h>
+#include <fcntl.h> // for O_WRONLY and friends
+#include <time.h> // nanosleep() and/or usleep()
+
+#ifdef HAVE_UNAME
+ #include <sys/utsname.h> // for uname()
+#endif // HAVE_UNAME
+
+// ----------------------------------------------------------------------------
+// conditional compilation
+// ----------------------------------------------------------------------------
+
+// many versions of Unices have this function, but it is not defined in system
+// headers - please add your system here if it is the case for your OS.
+// SunOS < 5.6 (i.e. Solaris < 2.6) and DG-UX are like this.
+#if (defined(__SUN__) && !defined(__SunOs_5_6) && \
+ !defined(__SunOs_5_7) && !defined(__SUNPRO_CC)) || \
+ defined(__osf__)
+ extern "C"
+ {
+ void usleep(unsigned long usec);
+ };
+#endif // Unices without usleep()
+
+// many versions of Unices have this function, but it is not defined in system
+// headers - please add your system here if it is the case for your OS.
+// SunOS (and Solaris) and DG-UX are like this.
+#if defined(__SOLARIS__) || defined(__osf__)
+ extern "C"
+ {
+ pid_t wait4(pid_t pid, int *statusp, int options,
+ struct rusage *rusage);
+ }
+
+ #define wxWait4(pid, stat, flags, rusage) wait4(pid, stat, flags, rusage)
+#elif defined(__sgi) || defined(__HPUX__)
+ // no wait4() at all on these systems
+ // TODO verify whether wait3() really works in this situation
+ #define wxWait4(pid, stat, flags, rusage) wait3(stat, flags, rusage)
+#else
+ // other Unices: assume have wait4(), although it's not standard (but
+ // Linux and FreeBSD do have it)
+ #define wxWait4(pid, stat, flags, rusage) wait4(pid, stat, flags, rusage)
+#endif // wait4()
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// sleeping
+// ----------------------------------------------------------------------------
+
+void wxSleep(int nSecs)
+{
+ sleep(nSecs);
+}
+
+void wxUsleep(unsigned long milliseconds)
+{
+#if defined(HAVE_NANOSLEEP)
+ timespec tmReq;
+ tmReq.tv_sec = milliseconds / 1000;
+ tmReq.tv_nsec = (milliseconds % 1000) * 1000 * 1000;
+
+ // we're not interested in remaining time nor in return value
+ (void)nanosleep(&tmReq, (timespec *)NULL);
+#elif defined(HAVE_USLEEP)
+ // uncomment this if you feel brave or if you are sure that your version
+ // of Solaris has a safe usleep() function but please notice that usleep()
+ // is known to lead to crashes in MT programs in Solaris 2.[67] and is not
+ // documented as MT-Safe
+ #if defined(__SUN__) && defined(wxUSE_THREADS)
+ #error "usleep() cannot be used in MT programs under Solaris."
+ #endif // Sun
+
+ usleep(milliseconds * 1000); // usleep(3) wants microseconds
+#else // !sleep function
+ #error "usleep() or nanosleep() function required for wxUsleep"
+#endif // sleep function
+}
+
+// ----------------------------------------------------------------------------
+// process management
+// ----------------------------------------------------------------------------
+
+int wxKill(long pid, int sig)
+{
+ return kill(pid, sig);
+}
+
+long wxExecute( const wxString& command, bool sync, wxProcess *process )
+{
+ static const char *IFS = " \t\n";
+
+ wxCHECK_MSG( !command.IsEmpty(), 0, "can't exec empty command" );
+
+ int argc = 0;
+ char *argv[127];
+ char *tmp = new char[command.Len() + 1];
+ strcpy(tmp, command);
+
+ argv[argc++] = strtok(tmp, IFS);
+ while ((argv[argc++] = strtok((char *) NULL, IFS)) != NULL)
+ /* loop */ ;
+
+ long lRc = wxExecute(argv, sync, process);
+
+ delete [] tmp;
+
+ return lRc;
+}
+
+bool wxShell(const wxString& command)
+{
+ wxString cmd;
+ if ( !!command )
+ cmd.Printf("xterm -e %s", command.c_str());
+ else
+ cmd = command;
+
+ return wxExecute(cmd) != 0;
+}
+
+void wxHandleProcessTermination(wxEndProcessData *proc_data)
+{
+ int pid = (proc_data->pid > 0) ? proc_data->pid : -(proc_data->pid);
+
+ int status = 0;
+ wxWait4(pid, &status, 0, (rusage *) NULL);
+
+ if (proc_data->process)
+ proc_data->process->OnTerminate(proc_data->pid, status);
+
+ if (proc_data->pid > 0)
+ {
+ delete proc_data;
+ }
+ else
+ {
+ // wxExecute() will know about it
+ proc_data->exitcode = status;
+
+ proc_data->pid = 0;
+ }
+}
+
+long wxExecute( char **argv, bool sync, wxProcess *process )
+{
+ wxCHECK_MSG( *argv, 0, "can't exec empty command" );
+
+ int end_proc_detect[2];
+
+ // create pipes
+ if (pipe(end_proc_detect) == -1)
+ {
+ wxLogSysError( _("Pipe creation failed") );
+ return 0;
+ }
+
+ // fork the process
+#ifdef HAVE_VFORK
+ pid_t pid = vfork();
+#else
+ pid_t pid = fork();
+#endif
+ if (pid == -1)
+ {
+ wxLogSysError( _("Fork failed") );
+ return 0;
+ }
+ else if (pid == 0)
+ {
+ // we're in child
+ close(end_proc_detect[0]); // close reading side
+
+ // These three lines close the open file descriptors to to avoid any
+ // input/output which might block the process or irritate the user. If
+ // one wants proper IO for the subprocess, the "right thing to do is
+ // to start an xterm executing it.
+ if (sync == 0)
+ {
+ // leave stderr opened, it won't do any hurm
+ for ( int fd = 0; fd < FD_SETSIZE; fd++ )
+ {
+ if ( fd != end_proc_detect[1] && fd != STDERR_FILENO )
+ close(fd);
+ }
+ }
+
+#if 0
+ close(STDERR_FILENO);
+
+ // some programs complain about stderr not being open, so redirect
+ // them:
+ open("/dev/null", O_RDONLY); // stdin
+ open("/dev/null", O_WRONLY); // stdout
+ open("/dev/null", O_WRONLY); // stderr
+#endif
+
+#ifdef _AIX
+ execvp ((const char *)*argv, (const char **)argv);
+#else
+ execvp (*argv, argv);
+#endif
+
+ // there is no return after successful exec()
+ fprintf(stderr, _("Can't execute '%s'\n"), *argv);
+
+ _exit(-1);
+ }
+ else
+ {
+ // we're in parent
+ close(end_proc_detect[1]); // close writing side
+
+ wxEndProcessData *data = new wxEndProcessData;
+ data->tag = wxAddProcessCallback(data, end_proc_detect[0]);
+
+ if ( sync )
+ {
+ wxASSERT_MSG( !process, "wxProcess param ignored for sync exec" );
+ data->process = NULL;
+
+ // sync execution: indicate it by negating the pid
+ data->pid = -pid;
+
+ // it will be set to 0 from GTK_EndProcessDetector
+ while (data->pid != 0)
+ wxYield();
+
+ int exitcode = data->exitcode;
+
+ delete data;
+
+ return exitcode;
+ }
+ else
+ {
+ // async execution, nothing special to do - caller will be
+ // notified about the process terminationif process != NULL, data
+ // will be deleted in GTK_EndProcessDetector
+ data->process = process;
+ data->pid = pid;
+
+ return pid;
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+// file and directory functions
+// ----------------------------------------------------------------------------
+
+const char* wxGetHomeDir( wxString *home )
+{
+ *home = wxGetUserHome( wxString() );
+ if ( home->IsEmpty() )
+ *home = "/";
+
+ return home->c_str();
+}
+
+char *wxGetUserHome( const wxString &user )
+{
+ struct passwd *who = (struct passwd *) NULL;
+
+ if (user.IsNull() || (user== ""))
+ {
+ register char *ptr;
+
+ if ((ptr = getenv("HOME")) != NULL)
+ {
+ return ptr;
+ }
+ if ((ptr = getenv("USER")) != NULL || (ptr = getenv("LOGNAME")) != NULL)
+ {
+ who = getpwnam(ptr);
+ }
+
+ // We now make sure the the user exists!
+ if (who == NULL)
+ {
+ who = getpwuid(getuid());
+ }
+ }
+ else
+ {
+ who = getpwnam (user);
+ }
+
+ return who ? who->pw_dir : (char*)NULL;
+}
+
+// ----------------------------------------------------------------------------
+// id routines
+// ----------------------------------------------------------------------------
+
+bool wxGetHostName(char *buf, int sz)
+{
+ wxCHECK_MSG( buf, FALSE, "NULL pointer in wxGetHostName" );
+
+ *buf = '\0';
+
+ // we're using uname() which is POSIX instead of less standard sysinfo()
+#if defined(HAVE_UNAME)
+ utsname uts;
+ bool ok = uname(&uts) != -1;
+ if ( ok )
+ {
+ strncpy(buf, uts.nodename, sz - 1);
+ buf[sz] = '\0';
+ }
+#elif defined(HAVE_GETHOSTNAME)
+ bool ok = gethostname(buf, sz) != -1;
+#else
+ wxFAIL_MSG("don't know host name for this machibe");
+
+ bool ok = FALSE;
+#endif
+
+ if ( !ok )
+ {
+ wxLogSysError(_("Cannot get the hostname"));
+ }
+
+ return ok;
+}
+
+bool wxGetUserId(char *buf, int sz)
+{
+ struct passwd *who;
+
+ *buf = '\0';
+ if ((who = getpwuid(getuid ())) != NULL)
+ {
+ strncpy (buf, who->pw_name, sz - 1);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+bool wxGetUserName(char *buf, int sz)
+{
+ struct passwd *who;
+ char *comma;
+
+ *buf = '\0';
+ if ((who = getpwuid (getuid ())) != NULL) {
+ comma = strchr(who->pw_gecos, ',');
+ if (comma)
+ *comma = '\0'; // cut off non-name comment fields
+ strncpy (buf, who->pw_gecos, sz - 1);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+// ----------------------------------------------------------------------------
+// error and debug output routines (deprecated, use wxLog)
+// ----------------------------------------------------------------------------
+
+void wxDebugMsg( const char *format, ... )
+{
+ va_list ap;
+ va_start( ap, format );
+ vfprintf( stderr, format, ap );
+ fflush( stderr );
+ va_end(ap);
+}
+
+void wxError( const wxString &msg, const wxString &title )
+{
+ fprintf( stderr, _("Error ") );
+ if (!title.IsNull()) fprintf( stderr, "%s ", WXSTRINGCAST(title) );
+ if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) );
+ fprintf( stderr, ".\n" );
+}
+
+void wxFatalError( const wxString &msg, const wxString &title )
+{
+ fprintf( stderr, _("Error ") );
+ if (!title.IsNull()) fprintf( stderr, "%s ", WXSTRINGCAST(title) );
+ if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) );
+ fprintf( stderr, ".\n" );
+ exit(3); // the same exit code as for abort()
+}
+
+//------------------------------------------------------------------------
+// directory routines
+//------------------------------------------------------------------------
+
+bool wxDirExists( const wxString& dir )
+{
+ char buf[500];
+ strcpy( buf, WXSTRINGCAST(dir) );
+ struct stat sbuf;
+ return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE);
+}