+ GUI_TK_LINK="-lXm $XPM_LINK -lXmu -lXt -lX11 -ldl -lm"
+ GUI_TK_LIBRARY="$GUI_TK_LIBRARY $GUI_TK_LINK"
+ TOOLKIT=MOTIF
+
+ GUIOBJS=MOTIF_GUIOBJS
+ GUIHEADERS=MOTIF_HEADERS
+ COMMONOBJS=MOTIF_COMMONOBJS
+ GENERICOBJS=MOTIF_GENERICOBJS
+ UNIXOBJS=UNIXOBJS
+ GUIDIST=MOTIF_DIST
+fi
+
+dnl the name of the directory where the files for this toolkit live
+TOOLKIT_DIR=`echo ${TOOLKIT} | tr "A-Z" "a-z"`
+
+dnl the symbol which allows conditional compilation for the given toolkit
+TOOLKIT_DEF="-D__WX${TOOLKIT}__"
+
+dnl the name of the (libtool) library
+WX_LIBRARY="wx_${TOOLKIT_DIR}"
+
+dnl the name of the (libtool) library
+WX_LIBRARY_NAME="libwx_${TOOLKIT_DIR}.la"
+
+dnl the name of the static library
+WX_LIBRARY_NAME_STATIC="libwx_${TOOLKIT_DIR}.a"
+
+dnl the name of the shared library
+WX_LIBRARY_NAME_SHARED="libwx_${TOOLKIT_DIR}-${WX_RELEASE}.so.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
+
+dnl the name of the links to the shared library
+WX_LIBRARY_LINK1="libwx_${TOOLKIT_DIR}-${WX_RELEASE}.so.${WX_CURRENT}"
+WX_LIBRARY_LINK2="libwx_${TOOLKIT_DIR}-${WX_RELEASE}.so"
+WX_LIBRARY_LINK3="libwx_${TOOLKIT_DIR}.so"
+
+dnl shared library settings
+SHARED_LD=
+PIC_FLAG=
+WX_CREATE_LINKS=
+
+if test "$wxUSE_SHARED" = "yes"; then
+ dnl set target to shared
+ WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_SHARED}"
+
+case "${host}" in
+ *-hp-hpux* )
+ WX_LIBRARY_NAME_SHARED="libwx_${TOOLKIT_DIR}.sl"
+ SHARED_LD="${CXX} -b -o"
+ PIC_FLAG="+Z"
+ ;;
+ *-*-linux* )
+ SHARED_LD="${CC} -shared -o"
+ PIC_FLAG="-fPIC"
+ WX_CREATE_INSTALLED_LINKS="CREATE_INSTALLED_LINKS"
+ WX_CREATE_LINKS="CREATE_LINKS"
+ ;;
+ *-*-irix5* | *-*-irix6* )
+ SHARED_LD="${CXX} -shared -o"
+ WX_CREATE_INSTALLED_LINKS="CREATE_INSTALLED_LINKS"
+ WX_CREATE_LINKS="CREATE_LINKS"
+ ;;
+ *-*-solaris2* )
+ SHARED_LD="${CXX} -G -o"
+ PIC_FLAG="PIC"
+ WX_CREATE_INSTALLED_LINKS="CREATE_INSTALLED_LINKS"
+ WX_CREATE_LINKS="CREATE_LINKS"
+ ;;
+ *-*-sunos4* )
+ SHARED_LD="${CXX} -shared -o"
+ PIC_FLAG="-fPIC"
+ WX_CREATE_INSTALLED_LINKS="CREATE_INSTALLED_LINKS"
+ WX_CREATE_LINKS="CREATE_LINKS"
+ ;;
+ *-*-freebsd* | *-*-netbsd*)
+ SHARED_LD="${CXX} -shared -o"
+ PIC_FLAG="-fPIC"
+ WX_CREATE_INSTALLED_LINKS="CREATE_INSTALLED_LINKS"
+ WX_CREATE_LINKS="CREATE_LINKS"
+ ;;
+ *-*-osf* )
+ SHARED_LD="${CXX} -shared -o"
+ PIC_FLAG="-fPIC"
+ WX_CREATE_INSTALLED_LINKS="CREATE_INSTALLED_LINKS"
+ WX_CREATE_LINKS="CREATE_LINKS"
+ ;;
+ *-*-dgux5* )
+ SHARED_LD="${CXX} -shared -o"
+ PIC_FLAG="-fPIC"
+ WX_CREATE_INSTALLED_LINKS="CREATE_INSTALLED_LINKS"
+ WX_CREATE_LINKS="CREATE_LINKS"
+ ;;
+ *-*-sysv5* )
+ SHARED_LD="${CXX} -shared -o"
+ PIC_FLAG="-fPIC"
+ WX_CREATE_INSTALLED_LINKS="CREATE_INSTALLED_LINKS"
+ WX_CREATE_LINKS="CREATE_LINKS"
+ ;;
+ *-*-aix* )
+ SHARED_LD="/usr/lpp/xlC/bin/makeC++SharedLib -p 0 -o"
+ ;;
+ *-*-cygwin32* )
+ dnl only static for now
+ WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}"
+ ;;
+ *-*-mingw32* )
+ dnl only static for now
+ WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}"
+ ;;
+ *-pc-os2_emx )
+ ;;
+ *)
+ AC_MSG_ERROR(unknown system type ${host}.)
+esac
+
+else
+ dnl set target to static
+ WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}"
+fi
+
+dnl ------------------------------------------------------------------------
+dnl Check for headers
+dnl ------------------------------------------------------------------------
+
+dnl defines HAVE_STRINGS_H (where some string functions live on AIX for example)
+AC_CHECK_HEADERS(strings.h)
+dnl defines HAVE_UNISTD_H
+AC_CHECK_HEADERS(unistd.h)
+dnl defines HAVE_WCHAR_H
+AC_CHECK_HEADERS(wchar.h)
+dnl defines HAVE_WCSTR_H
+AC_CHECK_HEADERS(wcstr.h)
+dnl defines HAVE_FNMATCH_H
+AC_CHECK_HEADERS(fnmatch.h)
+dnl defines HAVE_X11_XKBLIB_H
+AC_CHECK_HEADERS(X11/XKBlib.h)
+
+dnl ---------------------------------------------------------------------------
+dnl Checks for typedefs
+dnl ---------------------------------------------------------------------------
+
+dnl defines mode_t if not already defined
+AC_TYPE_MODE_T
+dnl defines off_t if not already defined
+AC_TYPE_OFF_T
+dnl defines pid_t if not already defined
+AC_TYPE_PID_T
+dnl defines size_t if not already defined
+AC_TYPE_SIZE_T
+dnl defines uid_t and gid_t if not already defined
+AC_TYPE_UID_T
+
+dnl ---------------------------------------------------------------------------
+dnl Checks for structures
+dnl ---------------------------------------------------------------------------
+
+dnl ---------------------------------------------------------------------------
+dnl Checks for compiler characteristics
+dnl ---------------------------------------------------------------------------
+
+dnl defines const to be empty if c-compiler does not support const fully
+AC_C_CONST
+dnl defines inline to a sensible value for the c-compiler
+AC_C_INLINE
+
+dnl check the sizes of integral types (give some reasonable default values for
+dnl cross-compiling)
+dnl defines the size of certain types of variables in SIZEOF_<TYPE>
+AC_CHECK_SIZEOF(char, 1)
+AC_CHECK_SIZEOF(short, 2)
+AC_CHECK_SIZEOF(int *, 4)
+AC_CHECK_SIZEOF(int, 4)
+AC_CHECK_SIZEOF(long, 4)
+AC_CHECK_SIZEOF(long long, 0)
+
+dnl for bytesex stuff (don't use AC_C_BIGENDIAN to allow cross-compiling)
+WX_C_BIGENDIAN
+
+dnl check for iostream (as opposed to iostream.h) standard header
+WX_CPP_NEW_HEADERS(, AC_DEFINE(wxUSE_IOSTREAMH))
+
+dnl check whether C++ compiler supports bool built-in type
+WX_CPP_BOOL
+
+dnl check whether overloading on size_t/int parameter works
+WX_CPP_SIZE_T_IS_NOT_INT
+
+dnl check whether we should define _GNU_SOURCE
+WX_GNU_EXTENSIONS
+
+dnl ---------------------------------------------------------------------------
+dnl Check for functions
+dnl ---------------------------------------------------------------------------
+
+dnl check for wcslen
+AC_CHECK_LIB(c, wcslen, [
+ AC_DEFINE(HAVE_WCSLEN)
+ WCHAR_LINK=""
+ ], [
+ AC_CHECK_LIB(w, wcslen, [
+ AC_DEFINE(HAVE_WCSLEN)
+ WCHAR_LINK="-lw"
+ ])
+ ])
+
+dnl check for vprintf/vsprintf() which are GNU extensions
+AC_FUNC_VPRINTF
+
+dnl check for vsnprintf() - a safe version of vsprintf()
+AC_CHECK_FUNCS(vsnprintf,
+ AC_DEFINE(HAVE_VSNPRINTF),
+ AC_MSG_WARN(unsafe function sprintf will be used instead of snprintf)
+ )
+
+dnl check for vsscanf() - on some platforms (Linux, glibc 2.1.1) it's
+dnl available in the library but the prototype is missing, so we can't use
+dnl AC_CHECK_FUNCS here, do it manually
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+
+AC_CACHE_CHECK([for vsscanf], wx_cv_func_vsscanf,
+[
+ AC_TRY_COMPILE(
+ [
+ #include <stdio.h>
+ #include <stdarg.h>
+ ],
+ [
+ va_list ap;
+ vsscanf("", "", ap);
+ ], [
+ wx_cv_func_vsscanf=yes
+ AC_DEFINE(HAVE_VSSCANF)
+ ], [
+ wx_cv_func_vsscanf=no
+ ])
+])
+
+AC_LANG_RESTORE
+
+dnl check for vfork() (even if it's the same as fork() in modern Unices)
+AC_CHECK_FUNCS(vfork)
+
+POSIX4_LINK=
+AC_CHECK_FUNCS(nanosleep, AC_DEFINE(HAVE_NANOSLEEP), [
+ AC_CHECK_LIB(posix4, nanosleep, [
+ AC_DEFINE(HAVE_NANOSLEEP)
+ POSIX4_LINK="-lposix4"
+ ], [
+ AC_CHECK_FUNCS(usleep,
+ AC_DEFINE(HAVE_USLEEP),
+ AC_MSG_WARN([wxSleep() function will not work]))
+ ])
+])
+
+dnl check for uname (POSIX) and gethostname (BSD)
+AC_CHECK_FUNCS(uname gethostname, break)
+
+dnl check for inet_addr, inet_aton, ...
+AC_CHECK_FUNCS(inet_addr)
+AC_CHECK_FUNCS(inet_aton)
+AC_CHECK_LIB(resolv, inet_aton)
+
+dnl ===========================================================================
+dnl Now we have all the info we need - use it!
+dnl ===========================================================================
+
+dnl flush the cache
+AC_CACHE_SAVE
+
+dnl ---------------------------------------------------------------------------
+dnl thread support for Unix (always available under Win32)
+dnl ---------------------------------------------------------------------------
+
+if test "$USE_UNIX" = 1; then
+
+dnl the code below:
+dnl defines THREADS_OBJ which contains the object files to build
+dnl defines THREADS_LINK which contains the thread library to link with
+dnl defines wxUSE_THREADS=1 if thread support is activated
+
+THREADS_LINK=""
+THREADS_OBJ=""
+
+if test "$wxUSE_THREADS" = "yes" ; then
+ if test "$wxUSE_WINE" = 1 ; then
+ AC_MSG_WARN([Threads are not supported under WINE])
+ wxUSE_THREADS="no"
+ fi
+fi
+
+if test "$wxUSE_THREADS" = "yes" ; then
+ dnl find if POSIX threads are available
+
+ dnl standard lib name is pthread
+ dnl We no longer test for pthread-0.7 as it breaks compilation on some
+ dnl glibc2 systems, especially for static linkage.
+ AC_CHECK_LIB(pthread, pthread_create, [
+ THREADS_OBJ="threadpsx.lo"
+ THREADS_LINK="pthread"
+ ], [
+ dnl thread functions are in libc_r under FreeBSD
+ AC_CHECK_LIB(c_r, pthread_create, [
+ THREADS_OBJ="threadpsx.lo"
+ THREADS_LINK="c_r"
+ ], [
+ dnl VZ: SGI threads are not supported currently
+ AC_CHECK_HEADER(sys/prctl.h, [
+ THREADS_OBJ="threadsgi.lo"
+ ])
+ ])
+ ])
+
+ if test -z "$THREADS_OBJ" ; then
+ wxUSE_THREADS=no
+ AC_MSG_WARN(No thread support on this system)
+ fi
+fi
+
+dnl do other tests only if we are using threads
+if test "$wxUSE_THREADS" = "yes" ; then
+ dnl define autoconf macro to check for given function in both pthread and
+ dnl posix4 libraries
+ dnl usage: AC_FUNC_THREAD(FUNCTION_NAME)
+ dnl VZ: TODO
+ dnl AC_DEFUN(AC_FUNC_THREAD,
+ dnl [
+ dnl AC_CHECK_LIB($THREADS_LINK, $1,
+ dnl AC_DEFINE(HAVE_`'translit($1, `A-Z', 'a-z'),
+ dnl [AC_CHECK_LIB("posix4", $1,
+ dnl [AC_DEFINE(HAVE_`'translit($1, `A-Z', 'a-z'))
+ dnl POSIX4_LINK="-lposix4"
+ dnl ])
+ dnl ])
+ dnl ])
+
+ 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) POSIX4_LINK="-lposix4"],
+ AC_MSG_WARN(wxThread::Yield will not work properly)
+ )]
+ )
+
+ dnl VZ: we should be checking for all of the following functions instead:
+ dnl 1. pthread_attr_getschedpolicy
+ dnl 2. sched_get_priority_min and sched_get_priority_max
+ dnl 3. pthread_attr_getschedparam and pthread_attr_setschedparam
+ dnl but it seems that if the first one is there, the other ones are too (of
+ dnl course the proper solution would be to implement AC_FUNC_THREAD above
+ dnl and do test for them all - anyone?)
+ AC_CHECK_LIB($THREADS_LINK, pthread_attr_getschedpolicy,
+ AC_DEFINE(HAVE_THREAD_PRIORITY_FUNCTIONS),
+ [AC_CHECK_LIB("posix4", pthread_attr_getschedpolicy,
+ [AC_DEFINE(HAVE_THREAD_PRIORITY_FUNCTIONS) POSIX4_LINK="-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]))
+
+ AC_CACHE_CHECK([for pthread_cleanup_push/pop], wx_cv_func_pthread_cleanup_push,
+ [
+ AC_TRY_COMPILE([#include <pthread.h>],
+ [
+ pthread_cleanup_push(NULL, NULL);
+ pthread_cleanup_pop(0);
+ ], [
+ wx_cv_func_pthread_cleanup_push=yes
+ AC_DEFINE(HAVE_THREAD_CLEANUP_FUNCTIONS)
+ ], [
+ wx_cv_func_pthread_cleanup_push=no
+ ])
+ ])
+
+ THREADS_LINK="-l$THREADS_LINK"