+ USE_GUI=0
+
+ dnl the sources, their dependenices and the headers
+ ALL_OBJECTS="\$(BASE_OBJS)"
+ ALL_DEPFILES="\${BASE_DEPS}"
+ ALL_HEADERS="\${BASE_HEADERS}"
+
+ dnl building wxBase only
+ WX_LIBRARY="wxbase"
+fi
+
+dnl the name of the (libtool) library
+WX_LIBRARY_NAME="lib${WX_LIBRARY}.la"
+
+dnl the name of the static library
+WX_LIBRARY_NAME_STATIC="lib${WX_LIBRARY}.a"
+
+dnl the name of the shared library
+WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}-${WX_RELEASE}.so.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
+
+dnl the name of the links to the shared library
+WX_LIBRARY_LINK1="lib${WX_LIBRARY}-${WX_RELEASE}.so.${WX_CURRENT}"
+WX_LIBRARY_LINK2="lib${WX_LIBRARY}-${WX_RELEASE}.so"
+WX_LIBRARY_LINK3="lib${WX_LIBRARY}.so"
+
+dnl shared library settings
+SHARED_LD=
+PIC_FLAG=
+WX_ALL=
+WX_ALL_INSTALLED=
+BURNT_LIBRARY_NAME=
+
+dnl --- the marker for quick search, leave it here: SHARED_LIB_SETUP ---
+
+if test "$wxUSE_SHARED" = "yes"; then
+ case "${host}" in
+ *-hp-hpux* )
+ if test "$GCC" = yes ; then
+ SHARED_LD="${CC} -shared -fPIC -o"
+ PIC_FLAG="-fPIC"
+ else
+ SHARED_LD="${CXX} -b -o"
+ PIC_FLAG="+Z"
+ fi
+ WX_LIBRARY_NAME_SHARED="libwx_${TOOLKIT_DIR}.sl"
+ WX_ALL=${WX_LIBRARY_NAME_SHARED}
+ ;;
+
+ dnl in fact, these settings are for any platform using gcc
+ *-*-linux* )
+ SHARED_LD="${CC} -shared -o"
+ PIC_FLAG="-fPIC"
+ WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
+ WX_ALL="CREATE_LINKS"
+ dnl BURNT_LIBRARY_NAME="-Wl,-soname -Wl,${WX_LIBRARY_NAME_SHARED}"
+ ;;
+ *-*-irix5* | *-*-irix6* )
+ if test "$GCC" = yes ; then
+ SHARED_LD="${CC} -shared -o"
+ PIC_FLAG="-fPIC"
+ else
+ SHARED_LD="${CXX} -shared -o"
+ fi
+ WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
+ WX_ALL="CREATE_LINKS"
+ ;;
+ *-*-solaris2* )
+ if test "$GCC" = yes ; then
+ SHARED_LD="${CC} -shared -o"
+ PIC_FLAG="-fPIC"
+ else
+ SHARED_LD="${CXX} -G -o"
+ PIC_FLAG="-KPIC"
+ fi
+ WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
+ WX_ALL="CREATE_LINKS"
+ ;;
+ *-*-sunos4* )
+ SHARED_LD="${CC} -shared -o"
+ PIC_FLAG="-fPIC"
+ WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
+ WX_ALL="CREATE_LINKS"
+ ;;
+ *-*-freebsd* | *-*-netbsd*)
+ SHARED_LD="${CC} -shared -o"
+ PIC_FLAG="-fPIC"
+ WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
+ WX_ALL="CREATE_LINKS"
+ ;;
+ *-*-osf* )
+ SHARED_LD="${CXX} -shared -o"
+ PIC_FLAG="-fPIC"
+ WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
+ WX_ALL="CREATE_LINKS"
+ ;;
+ *-*-dgux5* )
+ SHARED_LD="${CXX} -shared -o"
+ PIC_FLAG="-fPIC"
+ WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
+ WX_ALL="CREATE_LINKS"
+ ;;
+ *-*-sysv5* )
+ SHARED_LD="${CC} -shared -o"
+ PIC_FLAG="-fPIC"
+ WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
+ WX_ALL="CREATE_LINKS"
+ ;;
+ *-*-aix* )
+ SHARED_LD="/usr/lpp/xlC/bin/makeC++SharedLib -p 0 -o"
+ WX_ALL=${WX_LIBRARY_NAME_SHARED}
+ ;;
+ *-*-cygwin32* )
+ dnl only static for now
+ WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}"
+ WX_ALL="${WX_LIBRARY_NAME_STATIC}"
+ ;;
+ *-*-mingw32* )
+ dnl only static for now
+ WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}"
+ WX_ALL="${WX_LIBRARY_NAME_STATIC}"
+ ;;
+ *-pc-os2_emx )
+ dnl only static for now
+ WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}"
+ WX_ALL="${WX_LIBRARY_NAME_STATIC}"
+ ;;
+ *-*-beos* )
+ dnl can't use gcc under BeOS for shared library creation because it
+ dnl complains about missing 'main'
+ SHARED_LD="${LD} -shared -o"
+ PIC_FLAG="-fPIC"
+ WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
+ WX_ALL="CREATE_LINKS"
+ ;;
+ *)
+ AC_MSG_ERROR(unknown system type ${host}.)
+ esac
+
+ dnl set target to shared if not explicitly chose static before
+ if test "x$WX_TARGET_LIBRARY" = "x"; then
+ WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_SHARED}"
+ fi
+else
+ dnl set target to static
+ WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}"
+ WX_ALL="${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)
+
+if test "$wxUSE_GUI" = "yes"; then
+ dnl defines HAVE_X11_XKBLIB_H
+ AC_CHECK_HEADERS(X11/XKBlib.h)
+fi
+
+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 does passwd struct has the pw_gecos field?
+AC_CACHE_CHECK([for pw_gecos in struct passwd], wx_cv_struct_pw_gecos,
+ [
+ AC_TRY_COMPILE([#include <pwd.h>],
+ [
+ char *p;
+ struct passwd *pw;
+ p = pw->pw_gecos;
+ ],
+ [
+ wx_cv_struct_pw_gecos=yes
+ AC_DEFINE(HAVE_PW_GECOS)
+ ],
+ [
+ wx_cv_struct_pw_gecos=no
+ ]
+ )
+ ]
+)
+
+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 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_RUN(
+ [
+ #include <stdio.h>
+ #include <stdarg.h>
+
+ int try_vsscanf(const char *format, ...)
+ {
+ va_list ap;
+ va_start(ap, format);
+
+ vsscanf("17", format, ap);
+
+ va_end(ap);
+ }
+
+ int main()
+ {
+ int i;
+ try_vsscanf("%d", &i);
+ return i == 17 ? 0 : 1;
+ }
+ ], [
+ AC_DEFINE(HAVE_VSSCANF)
+ wx_cv_func_vsscanf=yes
+ ],
+ wx_cv_func_vsscanf=no,
+ wx_cv_func_vsscanf=no
+ )
+])
+
+AC_LANG_RESTORE
+
+if test "$USE_UNIX" = 1; then
+
+dnl check for vfork() (even if it's the same as fork() in modern Unices)
+AC_CHECK_FUNCS(vfork)
+
+dnl check for timegm() used by datetime.cpp
+AC_CHECK_FUNCS(timegm)
+
+HAVE_SOME_SLEEP_FUNC=0
+if test "$USE_BEOS" = 1; then
+ dnl BeOS has its own (wonder where did they get it from) sleep() function
+ dnl in unistd.h
+ AC_DEFINE(HAVE_SLEEP)
+ HAVE_SOME_SLEEP_FUNC=1
+fi
+
+if test "$HAVE_SOME_SLEEP_FUNC" != 1; then
+ dnl try nanosleep() in libc and libposix4, if this fails - usleep()
+ 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_MSG_WARN([wxSleep() function will not work])
+ ]
+ )
+ ]
+ )
+fi
+
+dnl check for uname (POSIX) and gethostname (BSD)
+AC_CHECK_FUNCS(uname gethostname, break)
+
+dnl check for MT-safe version of strtok
+AC_CHECK_FUNCS(strtok_r)
+
+dnl check for inet_addr and inet_aton (these may live either in libc, or in
+dnl libnsl or libresolv)
+INET_LINK=
+AC_CHECK_FUNCS(inet_addr,
+ AC_DEFINE(HAVE_INET_ADDR),
+ [
+ AC_CHECK_LIB(nsl, inet_addr,
+ INET_LINK="nsl",
+ AC_CHECK_LIB(resolv, inet_addr,
+ INET_LINK="resolv"
+ )
+ )
+ ]
+)
+
+AC_CHECK_FUNCS(inet_aton,
+ AC_DEFINE(HAVE_INET_ATON),
+ [
+ dnl only check it in the same lib
+ AC_CHECK_LIB($INET_LINK, inet_aton, AC_DEFINE(HAVE_INET_ATON))
+ ])
+
+if test "x$INET_LINK" != "x"; then
+ AC_DEFINE(HAVE_INET_ADDR)
+ INET_LINK="-l$INET_LINK"
+fi
+
+fi
+dnl Unix
+
+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"
+ elif test "$USE_BEOS" = 1; then
+ AC_MSG_WARN([BeOS threads are not yet supported])
+ 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
+ AC_CHECK_FUNCS(thr_setconcurrency)
+
+ 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"
+fi
+
+dnl from if USE_UNIX
+fi
+
+if test "$wxUSE_THREADS" = "yes"; then
+ AC_DEFINE(wxUSE_THREADS)
+
+ dnl must define _REENTRANT for multithreaded code
+ CFLAGS="${CFLAGS} -D_REENTRANT"
+ CXXFLAGS="${CXXFLAGS} -D_REENTRANT"
+
+ SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS thread"
+else
+ dnl on some systems, _REENTRANT should be defined if we want to use any _r()
+ dnl functions - add tests for other functions here as well
+ if test "$ac_cv_func_strtok_r" = "yes"; then
+ AC_MSG_CHECKING(if -D_REENTRANT is needed)
+ if test "$NEEDS_D_REENTRANT_FOR_R_FUNCS" = 1; then
+ CFLAGS="${CFLAGS} -D_REENTRANT"
+ CXXFLAGS="${CXXFLAGS} -D_REENTRANT"
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+ fi
+fi
+
+if test "$WXGTK13" = 1 ; then
+ AC_DEFINE_UNQUOTED(__WXGTK13__,$WXGTK13)
+ WXGTK12=1
+fi