]> git.saurik.com Git - wxWidgets.git/blobdiff - configure.in
HAVE_SCHED_H test added
[wxWidgets.git] / configure.in
index 905a8036fe1a367d03ad8871f94c356c298fc6eb..8fc21ef771de8e871598ce39ff0a6d54a5f5cb02 100644 (file)
@@ -449,14 +449,28 @@ AC_SUBST(GTK_JOYSTICK)
 
 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
@@ -1004,7 +1018,7 @@ dnl ----------------------------------------------------------------
 dnl Linux: test for libc5/glibc2: glibc2 has gettext() included
 dnl ----------------------------------------------------------------
 if test "$USE_LINUX" = 1; then
-       AC_CHECK_LIB(c,gettext,AC_DEFINE(wxHAVE_GLIBC2))
+  AC_CHECK_LIB(c,gettext,AC_DEFINE(wxHAVE_GLIBC2))
 fi
 
 dnl ----------------------------------------------------------------
@@ -1372,16 +1386,19 @@ dnl ----------------------------------------------------------------
 dnl thread support
 dnl ----------------------------------------------------------------
 
+dnl   defines UNIX_THREAD it contains the source file to use for threads. (GL)
+dnl   defines THREADS_LINK it contains the thread library to link with. (GL)
+dnl   defines wxUSE_THREADS if thread support is activated. (GL)
+
 THREADS_LINK=""
 UNIX_THREAD=""
 
 if test "$wxUSE_THREADS" = "1"; then
-
      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"
-       THREADS_LINK="-lpthread-0.7"
+       UNIX_THREAD="unix/threadpsx.cpp"
+       THREADS_LINK="pthread-0.7"
      ],[
        AC_CHECK_HEADER(sys/prctl.h, [
           UNIX_THREAD="gtk/threadsgi.cpp"
@@ -1391,8 +1408,8 @@ if test "$wxUSE_THREADS" = "1"; then
      dnl the case for pthread_setcanceltype.
 
      AC_CHECK_LIB(pthread, pthread_setcanceltype, [
-       UNIX_THREAD="gtk/threadpsx.cpp"
-       THREADS_LINK="-lpthread"
+       UNIX_THREAD="unix/threadpsx.cpp"
+       THREADS_LINK="pthread"
      ])
     ])
 
@@ -1400,38 +1417,52 @@ if test "$wxUSE_THREADS" = "1"; then
         dnl thread functions are in libc_r under FreeBSD
         AC_CHECK_LIB(c_r, pthread_create,
                     [
-                        UNIX_THREAD="gtk/threadpsx.cpp"
-                        THREADS_LINK="-lc_r"
+                        UNIX_THREAD="unix/threadpsx.cpp"
+                        THREADS_LINK="c_r"
                     ])
     fi
 
     if test "$THREADS_LINK" != ""; then
       AC_DEFINE(wxUSE_THREADS)
     fi
-
-    dnl -lposix4 seems to be required on Solaris
-
-    AC_CHECK_LIB(posix4, printf, [
-      THREADS_LINK="$THREADS_LINK -lposix4"
-    ])
-
-fi
-
-if test "$wxUSE_MOTIF" = "1"; then
-  UNIX_THREAD="motif/thread.cpp"
 fi
 
 if test -z "$UNIX_THREAD"; then
   wxUSE_THREADS=0
 fi
 
+dnl do other tests only if we are using threads
+if test "$wxUSE_THREADS" = "1"; then
+  THREADS_LINK2=""
+
+  AC_CHECK_HEADERS(sched.h)
+
+  AC_CHECK_LIB($THREADS_LINK, sched_yield,
+               AC_DEFINE(HAVE_SCHED_YIELD),
+               [AC_CHECK_LIB("posix4", sched_yield,
+                   [AC_DEFINE(HAVE_SCHED_YIELD) THREADS_LINK2="-lposix4"],
+                   AC_MSG_WARN(wxThread::Yield() will not work properly)
+                )]
+               )
+
+  AC_CHECK_LIB($THREADS_LINK, sched_get_priority_min,
+               AC_DEFINE(HAVE_THREAD_PRIORITY_FUNCTIONS),
+               [AC_CHECK_LIB("posix4", sched_get_priority_min,
+                   [AC_DEFINE(HAVE_THREAD_PRIORITY_FUNCTIONS) THREADS_LINK2="-lposix4"],
+                   AC_MSG_WARN(Setting thread priority will not work)
+                )]
+               )
+
+  AC_CHECK_LIB($THREADS_LINK, pthread_cancel,
+               AC_DEFINE(HAVE_PTHREAD_CANCEL),
+               AC_MSG_WARN(wxThread::Kill() will not work properly))
+
+  THREADS_LINK="-l$THREADS_LINK $THREADS_LINK2"
+fi
+
 AC_SUBST(UNIX_THREAD)
 AC_SUBST(THREADS_LINK)
 
-dnl   defines UNIX_THREAD it contains the source file to use for threads. (GL)
-dnl   defines THREADS_LINK it contains the thread library to link with. (GL)
-dnl   defines wxUSE_THREADS if thread support is activated. (GL)
-
 dnl ------------------------------------------------------------------------
 dnl compiler options for shared libs
 dnl ------------------------------------------------------------------------
@@ -1439,7 +1470,6 @@ dnl ------------------------------------------------------------------------
 PICFLAGS=
 CREATE_SHARED=
 case "${canonical}" in
-
   *-hp-hpux* )
     if test "$GCC" != "yes" ; then
       CXXFLAGS="${CXXFLAGS} +a1 -z -Aa -D_HPUX_SOURCE"
@@ -1563,3 +1593,4 @@ AC_CONFIG_HEADER(./include/wx/gtk/setup.h:./setup/setup.hin)
 AC_OUTPUT(./setup/substit ./wx-config:./wx-config.in,./setup/general/createall)
 
 AC_OVERRIDES_DONE
+