+ 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_NAME}"
+
+ dnl the sources, their dependenices and the headers
+ ALL_OBJECTS="\$(GUIOBJS) \$(COMMONOBJS) \$(GENERICOBJS) \$(UNIXOBJS) \$(HTMLOBJS) \$(OGLOBJS)"
+
+ dnl ODBC objects are Unix only
+ if test "$TOOLKIT" != "MSW"; then
+ if test "$wxUSE_ODBC" = "yes" ; then
+ ALL_OBJECTS="${ALL_OBJECTS} \$(IODBCOBJS)"
+ fi
+ fi
+
+ if test "$wxUSE_LIBJPEG" = "yes" ; then
+ ALL_OBJECTS="${ALL_OBJECTS} \$(JPEGOBJS)"
+ fi
+ if test "$wxUSE_LIBTIFF" = "yes" ; then
+ ALL_OBJECTS="${ALL_OBJECTS} \$(TIFFOBJS)"
+ fi
+ if test "$wxUSE_LIBPNG" = "yes" ; then
+ ALL_OBJECTS="${ALL_OBJECTS} \$(PNGOBJS)"
+ fi
+ if test "$wxUSE_ZLIB" = "yes" ; then
+ ALL_OBJECTS="${ALL_OBJECTS} \$(ZLIBOBJS)"
+ fi
+ ALL_DEPFILES="\$(GUIDEPS) \$(COMMONDEPS) \$(GENERICDEPS) \$(UNIXDEPS) \$(HTMLDEPS) \$(OGLDEPS)"
+
+ PORT_FILES="src/\$(TOOLKITDIR)/files.lst"
+ RPM_FILES="src/\$(TOOLKITDIR)/rpmfiles.lst"
+ RPM_SPEC="wx\$(TOOLKIT).spec"
+
+ dnl distribute samples/demos/utils with GUI versions
+ GUIDIST="${GUIDIST} SAMPLES_DIST DEMOS_DIST UTILS_DIST MISC_DIST"
+ DISTDIR="wx\$(TOOLKIT)"
+else
+ USE_GUI=0
+
+ dnl this may be (almost) unneccesary for wxBase now we use TOOLKIT_NAME
+ TOOLKIT_DIR="base"
+
+ dnl the base name of the library and wxXXX-config files
+ if test "$wxUSE_DEBUG_FLAG" = "yes"; then
+ TOOLKIT_NAME="${TOOLKIT_DIR}d"
+ else
+ TOOLKIT_NAME="${TOOLKIT_DIR}"
+ fi
+
+ TOOLKIT_DEF="-D__WXBASE__"
+
+ dnl the sources, their dependenices and the headers
+ ALL_OBJECTS="\$(BASE_OBJS) \${BASE_UNIX_OBJS}"
+ ALL_DEPFILES="\${BASE_DEPS} \${BASE_UNIX_DEPS}"
+
+ if test "$wxUSE_ZLIB" = "yes" ; then
+ ALL_OBJECTS="${ALL_OBJECTS} \$(ZLIBOBJS)"
+ fi
+
+ dnl building wxBase only
+ WX_LIBRARY="wx_${TOOLKIT_NAME}"
+
+ PORT_FILES="src/files.lst"
+ RPM_FILES="src/rpmfiles.lst"
+ RPM_SPEC="wxBase.spec"
+
+ dnl distribute only wxBase sources/headers
+ GUIDIST="BASE_DIST"
+ DISTDIR="wxBase"
+fi
+
+dnl the name of the (libtool) library
+WX_LIBRARY_NAME="lib${WX_LIBRARY}.la"
+WX_LIBRARY_NAME_GL="lib${WX_LIBRARY}_gl.la"
+
+dnl the name of the static library
+WX_LIBRARY_NAME_STATIC="lib${WX_LIBRARY}.a"
+WX_LIBRARY_NAME_STATIC_GL="lib${WX_LIBRARY}_gl.a"
+
+dnl the name of the shared library
+WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}-${WX_RELEASE}.so.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
+WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY}_gl-${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"
+WX_LIBRARY_LINK1_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.so.${WX_CURRENT}"
+WX_LIBRARY_LINK2_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.so"
+WX_LIBRARY_LINK3_GL="lib${WX_LIBRARY}_gl.so"
+
+dnl shared library settings
+SHARED_LD=
+PIC_FLAG=
+WX_ALL=
+WX_ALL_INSTALLED=
+BURNT_LIBRARY_NAME=
+WX_TARGET_LIBRARY_SONAME=
+
+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
+ dnl no idea why it wants it, but it does
+ LDFLAGS="-L/usr/lib"
+
+ SHARED_LD="${CXX} -b -o"
+ PIC_FLAG="+Z"
+ fi
+ WX_LIBRARY_NAME_SHARED="libwx_${TOOLKIT_NAME}.sl"
+ WX_LIBRARY_NAME_SHARED_GL="libwx_${TOOLKIT_NAME}_gl.sl"
+ if test "$wxUSE_OPENGL" = "yes"; then
+ WX_ALL_INSTALLED="preinstall_gl"
+ WX_ALL="${WX_LIBRARY_NAME_SHARED} ${WX_LIBRARY_NAME_SHARED_GL}"
+ else
+ WX_ALL="${WX_LIBRARY_NAME_SHARED}"
+ fi
+ ;;
+
+ dnl in fact, these settings are for any platform using gcc
+ *-*-linux* )
+ SHARED_LD="${CC} -shared -o"
+ PIC_FLAG="-fPIC"
+ if test "$wxUSE_BURNT_NAME" = "yes" ; then
+ BURNT_LIBRARY_NAME="-Wl,-soname,${WX_LIBRARY_LINK1}"
+ BURNT_LIBRARY_NAME_GL="-Wl,-soname,${WX_LIBRARY_LINK1_GL}"
+ dnl substitute this in makelib.env for the contrib libs
+ WX_TARGET_LIBRARY_SONAME="-Wl,-soname,\$(TARGETLIB_LINK1)"
+ fi
+ if test "$wxUSE_OPENGL" = "yes"; then
+ WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS CREATE_INSTALLED_LINKS_GL"
+ WX_ALL="CREATE_LINKS CREATE_LINKS_GL"
+ else
+ WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
+ WX_ALL="CREATE_LINKS"
+ fi
+ ;;
+ *-*-irix5* | *-*-irix6* )
+ if test "$GCC" = yes ; then
+ SHARED_LD="${CC} -shared -o"
+ PIC_FLAG="-fPIC"
+ else
+ SHARED_LD="${CXX} -shared -o"
+ fi
+ if test "$wxUSE_OPENGL" = "yes"; then
+ WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS CREATE_INSTALLED_LINKS_GL"
+ WX_ALL="CREATE_LINKS CREATE_LINKS_GL"
+ else
+ WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
+ WX_ALL="CREATE_LINKS"
+ fi
+ ;;
+ *-*-solaris2* )
+ if test "$GCC" = yes ; then
+ SHARED_LD="${CC} -shared -o"
+ PIC_FLAG="-fPIC"
+
+ dnl newer versions of gcc need -isystem to compile X headers on
+ dnl Solaris (which use old style C syntax)
+ CPPFLAGS="$CPPFLAGS -isystem /usr/openwin/include"
+ else
+ SHARED_LD="${CXX} -G -o"
+ PIC_FLAG="-KPIC"
+ fi
+ if test "$wxUSE_OPENGL" = "yes"; then
+ WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS CREATE_INSTALLED_LINKS_GL"
+ WX_ALL="CREATE_LINKS CREATE_LINKS_GL"
+ else
+ WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
+ WX_ALL="CREATE_LINKS"
+ fi
+ ;;
+ *-*-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"
+ if test "$wxUSE_OPENGL" = "yes"; then
+ WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS CREATE_INSTALLED_LINKS_GL"
+ WX_ALL="CREATE_LINKS CREATE_LINKS_GL"
+ else
+ WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
+ WX_ALL="CREATE_LINKS"
+ fi
+ ;;
+ *-*-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_TARGET_LIBRARY_GL="${WX_LIBRARY_NAME_STATIC_GL}"
+ if test "$wxUSE_OPENGL" = "yes"; then
+ WX_ALL_INSTALLED="preinstall_gl"
+ WX_ALL="${WX_LIBRARY_NAME_STATIC} ${WX_LIBRARY_NAME_STATIC_GL}"
+ else
+ WX_ALL="${WX_LIBRARY_NAME_STATIC}"
+ fi
+ ;;
+ *-*-mingw32* )
+ dnl only static for now
+ WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}"
+ WX_TARGET_LIBRARY_GL="${WX_LIBRARY_NAME_STATIC_GL}"
+ if test "$wxUSE_OPENGL" = "yes"; then
+ WX_ALL_INSTALLED="preinstall_gl"
+ WX_ALL="${WX_LIBRARY_NAME_STATIC} ${WX_LIBRARY_NAME_STATIC_GL}"
+ else
+ WX_ALL="${WX_LIBRARY_NAME_STATIC}"
+ fi
+ ;;
+ *-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}"
+ WX_TARGET_LIBRARY_GL="${WX_LIBRARY_NAME_SHARED_GL}"
+ fi
+ dnl do not alter the LIBRARY_TYPE strings "so" and "a", they are magic
+ WX_TARGET_LIBRARY_TYPE="so"
+else
+ dnl set target to static
+ WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_STATIC}"
+ WX_TARGET_LIBRARY_GL="${WX_LIBRARY_NAME_STATIC_GL}"
+
+ if test "$wxUSE_OPENGL" = "yes"; then
+ WX_ALL_INSTALLED="preinstall_gl"
+ WX_ALL="${WX_LIBRARY_NAME_STATIC} ${WX_LIBRARY_NAME_STATIC_GL}"
+ else
+ WX_ALL="${WX_LIBRARY_NAME_STATIC}"
+ fi
+
+ dnl give static wxBase build a working install target
+ if test "$wxUSE_GUI" = "no"; then
+ dnl we're here because WX_ALL_INSTALLED is empty, but play safe anyway
+ WX_ALL_INSTALLED="${WX_ALL_INSTALLED} preinstall"
+ fi
+
+ WX_TARGET_LIBRARY_TYPE="a"
+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_ICONV_H (Unix98 encoding conversion routines)
+AC_CHECK_HEADERS(iconv.h)
+dnl defines HAVE_LANGINFO_H (GNU libc locale parameters)
+AC_CHECK_HEADERS(langinfo.h)
+
+if test "$wxUSE_GUI" = "yes"; then
+ if test "$wxUSE_UNIX" = "yes"; then
+ dnl defines HAVE_X11_XKBLIB_H
+ AC_CHECK_HEADERS(X11/XKBlib.h)
+ fi
+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
+ ],
+ [
+ wx_cv_struct_pw_gecos=no
+ ]
+ )
+ ]
+)
+
+if test "$wx_cv_struct_pw_gecos" = "yes"; then
+ AC_DEFINE(HAVE_PW_GECOS)
+fi
+
+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(wchar_t, 4)
+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
+
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+
+dnl check for vsscanf() and vsnprintf() - on some platforms (Linux, glibc
+dnl 2.1.1 for the first one, HP-UX for the second) it's available in the
+dnl library but the prototype is missing, so we can't use AC_CHECK_FUNCS here,
+dnl do it manually
+
+dnl we use AC_TRY_COMPILE() here instead of AC_TRY_RUN() to make the checks
+dnl work for cross-compilation, but AC_TRY_COMPILE() normally only compiles
+dnl one function while we need at least 2 - hence the ugly hack below. To
+dnl understand why it works, remember that AC_TRY_COMPILE() just prepends
+dnl "int main() {" in the beginning of the code and "; return 0; }" at the
+dnl end...
+
+dnl check for vsnprintf() - a safe version of vsprintf()
+AC_CACHE_CHECK([for vsnprintf], wx_cv_func_vsnprintf,
+[
+ AC_TRY_COMPILE([
+ #include <stdio.h>
+ #include <stdarg.h>
+ ], [
+ int wx_test_vsnprintf(const char *, ...);
+
+ wx_test_vsnprintf("%s");
+ return 0;
+ }
+
+ int wx_test_vsnprintf(const char *fmt, ...)
+ {
+ char *s;
+
+ va_list argp;
+ va_start(argp, fmt);
+ vsnprintf(s, 42, fmt, argp);
+ va_end(argp);
+ ], [
+ AC_DEFINE(HAVE_VSNPRINTF)
+ wx_cv_func_vsnprintf=yes
+ ], [
+ AC_MSG_WARN(unsafe function sprintf will be used instead of snprintf)
+ wx_cv_func_vsnprintf=no
+ ])
+])
+
+dnl check for vsscanf()
+AC_CACHE_CHECK([for vsscanf], wx_cv_func_vsscanf,
+[
+ AC_TRY_COMPILE([
+ #include <stdio.h>
+ #include <stdarg.h>
+ ], [
+ int wx_test_vsscanf(const char *, ...);
+
+ wx_test_vsscanf("%d");
+ return 0;
+ }
+
+ int wx_test_vsscanf(const char *fmt, ...)
+ {
+ va_list argp;
+ va_start(argp, fmt);
+ vsscanf("42", fmt, argp);
+ va_end(argp);
+ ], [
+ AC_DEFINE(HAVE_VSSCANF)
+ wx_cv_func_vsscanf=yes
+ ], [
+ wx_cv_func_vsscanf=no
+ ])
+])
+
+AC_LANG_RESTORE
+
+dnl the following tests are for Unix(like) systems only
+if test "$TOOLKIT" != "MSW"; then
+
+dnl check for POSIX signals if we need them
+if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes" -a "$wxUSE_UNIX" = "yes"; then
+ AC_CHECK_FUNCS(sigaction)
+
+ if test "$ac_cv_func_sigaction" = "no"; then
+ AC_MSG_WARN([No POSIX signal functions on this system, wxApp::OnFatalException will not be called])
+ wxUSE_ON_FATAL_EXCEPTION=no
+ fi
+
+ if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes"; then
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+
+ AC_CACHE_CHECK([for sa_handler type], wx_cv_type_sa_handler,
+ [
+ AC_TRY_COMPILE([#include <signal.h>],
+ [
+ extern void testSigHandler(int);
+
+ struct sigaction sa;
+ sa.sa_handler = testSigHandler;
+ ], [
+ wx_cv_type_sa_handler=int
+ ], [
+ wx_cv_type_sa_handler=void
+ ])
+ ])
+
+ AC_LANG_RESTORE
+
+ AC_DEFINE_UNQUOTED(wxTYPE_SA_HANDLER, $wx_cv_type_sa_handler)
+ fi
+fi
+
+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 (on DEC Alpha, it's ok for C compiler
+dnl but not for C++ one - hence change language)
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+
+AC_CHECK_FUNCS(strtok_r)
+
+AC_LANG_RESTORE
+
+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 if !MSW
+
+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 ---------------------------------------------------------------------------
+
+dnl under MSW we always have thread support
+if test "$TOOLKIT" != "MSW"; 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 AIX calls the library libpthreads - thanks IBM!
+ if test "$wxUSE_AIX" = 1; then
+ THREADS_LIB=pthreads
+ else
+ THREADS_LIB=pthread
+ fi
+
+ 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($THREADS_LIB, pthread_create, [
+ THREADS_OBJ="threadpsx.lo"
+ THREADS_LINK=$THREADS_LIB
+ ], [
+ 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 to be able to set the thread priority, we need to have all of the
+ dnl following functions:
+ dnl 1. pthread_attr_getschedpolicy
+ dnl 2. sched_get_priority_min and sched_get_priority_max
+ dnl (this one can be in either libpthread or libposix4 (under Solaris))
+ dnl 3. pthread_attr_getschedparam and pthread_attr_setschedparam
+ HAVE_PRIOR_FUNCS=0
+ AC_CHECK_LIB($THREADS_LINK, pthread_attr_getschedpolicy,
+ AC_CHECK_LIB($THREADS_LINK, pthread_attr_setschedparam,
+ AC_CHECK_LIB($THREADS_LINK, sched_get_priority_max,
+ HAVE_PRIOR_FUNCS=1,
+ AC_CHECK_LIB("posix4", sched_get_priority_max,
+ [
+ HAVE_PRIOR_FUNCS=1
+ POSIX4_LINK="-lposix4"
+ ],
+ )
+ )
+ )
+ )
+
+ if test "$HAVE_PRIOR_FUNCS" = 1; then
+ AC_DEFINE(HAVE_THREAD_PRIORITY_FUNCTIONS)
+ else
+ AC_MSG_WARN(Setting thread priority will not work)
+ fi
+
+ 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 !MSW
+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 "$WXGTK20" = 1 ; then
+ AC_DEFINE_UNQUOTED(__WXGTK20__,$WXGTK20)
+ WXGTK12=1
+fi
+
+if test "$WXGTK12" = 1 ; then
+ AC_DEFINE_UNQUOTED(__WXGTK12__,$WXGTK12)
+fi
+
+if test "$WXGTK127" = 1 ; then
+ AC_DEFINE_UNQUOTED(__WXGTK127__,$WXGTK127)
+fi
+
+if test "$WXWINE" = 1 ; then
+ TOOLKIT_DEF="${TOOLKIT_DEF} -D__WXWINE__"
+fi
+
+if test "$wxUSE_CYGWIN" = 1 ; then
+ TOOLKIT_DEF="${TOOLKIT_DEF} -D__WIN95__"
+fi
+
+WXDEBUG=
+
+if test "$wxUSE_DEBUG_INFO" = "yes" ; then
+ WXDEBUG="-g"
+ wxUSE_OPTIMISE=no
+fi
+
+if test "$wxUSE_DEBUG_GDB" = "yes" ; then
+ wxUSE_DEBUG_INFO=yes
+ WXDEBUG="-ggdb"
+fi
+
+if test "$wxUSE_DEBUG_FLAG" = "yes" ; then
+ AC_DEFINE(WXDEBUG)
+ WXDEBUG_DEFINE="-D__WXDEBUG__"
+else
+ if test "$wxUSE_GTK" = 1 ; then
+ WXDEBUG_DEFINE="-DGTK_NO_CHECK_CASTS"
+ fi
+fi
+
+if test "$wxUSE_MEM_TRACING" = "yes" ; then
+ AC_DEFINE(wxUSE_MEMORY_TRACING)
+ AC_DEFINE(wxUSE_GLOBAL_MEMORY_OPERATORS)
+ AC_DEFINE(wxUSE_DEBUG_NEW_ALWAYS)
+ SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS memcheck"
+fi
+
+if test "$wxUSE_DMALLOC" = "yes" ; then
+ DMALLOC_LINK="-ldmalloc"
+fi
+
+PROFILE=
+if test "$wxUSE_PROFILE" = "yes" ; then
+ PROFILE="-pg"
+fi
+
+DEP_INFO_FLAGS=
+CODE_GEN_FLAGS=
+if test "$GCC" = yes ; then
+ if test "$wxUSE_NO_RTTI" = "yes" ; then
+ CODE_GEN_FLAGS="$CODE_GEN_FLAGS -fno-rtti"
+ fi
+ if test "$wxUSE_NO_EXCEPTIONS" = "yes" ; then
+ CODE_GEN_FLAGS="$CODE_GEN_FLAGS -fno-exceptions"
+ fi
+ if test "$wxUSE_PERMISSIVE" = "yes" ; then
+ CODE_GEN_FLAGS="$CODE_GEN_FLAGS -fpermissive"
+ fi
+ if test "$wxUSE_NO_DEPS" = "no" ; then
+ DEP_INFO_FLAGS="-MMD"
+ fi
+fi
+
+
+CXXFLAGS=`echo "${CXXFLAGS}" | sed "s/\-O.//g" `
+CFLAGS=`echo "${CFLAGS}" | sed "s/\-O.//g" `
+if test "$wxUSE_OPTIMISE" = "no" ; then
+ OPTIMISE=
+else
+ if test "$GCC" = yes ; then
+ OPTIMISE="-O2"
+ case "${host}" in
+ i586-*-*|i686-*-* )
+ OPTIMISE="${OPTIMISE} "
+ ;;
+ esac
+ else
+ OPTIMISE="-O"
+ fi
+fi
+
+dnl ---------------------------------------------------------------------------
+dnl Optional libraries
+dnl ---------------------------------------------------------------------------
+
+ZLIB_INCLUDE=
+if test "$wxUSE_ZLIB" = "yes" -o "$wxUSE_ZLIB" = "sys" ; then
+ AC_DEFINE(wxUSE_ZLIB)
+ if test "$wxUSE_ZLIB" = "yes" ; then
+ ZLIB_INCLUDE="-I\${top_srcdir}/src/zlib"
+ else
+ ZLIB_LINK=
+ AC_CHECK_HEADER(zlib.h, AC_CHECK_LIB(z, deflate, ZLIB_LINK="-lz"))
+ if test "x$ZLIB_LINK" = "x" ; then
+ AC_MSG_ERROR(system zlib compression library not found! Use --with-zlib=yes to use built-in zlib)
+ fi
+ fi
+fi
+
+PNG_INCLUDE=
+if test "$wxUSE_LIBPNG" = "yes" -o "$wxUSE_LIBPNG" = "sys" ; then
+ AC_DEFINE(wxUSE_LIBPNG)
+ dnl for the check below to have a chance to succeed, we must already have
+ dnl libz somewhere
+ if test "$wxUSE_LIBPNG" = "sys" -a "$wxUSE_ZLIB" != "sys" ; then
+ AC_MSG_WARN([--with-libpng=sys doesn't work without --with-zlib=sys, will compile the built-in libpng instead])
+ wxUSE_LIBPNG=yes
+ fi
+
+ if test "$wxUSE_LIBPNG" = "yes" ; then
+ PNG_INCLUDE="-I\${top_srcdir}/src/png"
+ else
+ PNG_LINK=
+ AC_CHECK_HEADER(png.h,
+ AC_CHECK_LIB(png, png_check_sig,
+ PNG_LINK="-lpng",
+ ,
+ [-lz -lm])
+ )
+ if test "x$PNG_LINK" = "x" ; then
+ AC_MSG_ERROR(system png library not found! Use --with-libpng=yes to use the built-in libpng)
+ fi
+ fi
+
+ SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS png"
+fi
+
+JPEG_INCLUDE=
+if test "$wxUSE_LIBJPEG" = "yes" -o "$wxUSE_LIBJPEG" = "sys" ; then
+ AC_DEFINE(wxUSE_LIBJPEG)
+ if test "$wxUSE_LIBJPEG" = "yes" ; then
+ JPEG_INCLUDE="-I\${top_srcdir}/src/jpeg"
+ else
+ JPEG_LINK=
+ AC_CHECK_HEADER(jpeglib.h, AC_CHECK_LIB(jpeg, jpeg_read_header, JPEG_LINK="-ljpeg"))
+ if test "x$JPEG_LINK" = "x" ; then
+ AC_MSG_ERROR(system jpeg library not found! Use --with-libjpeg=yes to use the built-in one)
+ fi
+ fi
+fi
+
+TIFF_INCLUDE=
+if test "$wxUSE_LIBTIFF" = "yes" -o "$wxUSE_LIBTIFF" = "sys" ; then
+ AC_DEFINE(wxUSE_LIBTIFF)
+ if test "$wxUSE_LIBTIFF" = "yes" ; then
+ TIFF_INCLUDE="-I\${top_srcdir}/src/tiff"
+ else
+ TIFF_LINK=
+ AC_CHECK_HEADER(tiffio.h, AC_CHECK_LIB(tiff, TIFFError,
+ TIFF_LINK="-ltiff",
+ ,
+ -lm))
+ if test "x$TIFF_LINK" = "x" ; then
+ AC_MSG_ERROR(system tiff library not found! Use --with-libtiff=yes to use the built-in one)
+ fi
+ fi
+fi
+
+if test "$wxUSE_OPENGL" = "yes"; then
+ AC_CHECK_HEADER(GL/gl.h, [
+ AC_DEFINE(wxUSE_OPENGL)
+ AC_DEFINE(wxUSE_GLCANVAS)
+ AC_CHECK_LIB(GL, glFlush, [
+ OPENGL_LINK="-lGL -lGLU"
+ ],[
+ AC_CHECK_LIB(MesaGL, glFlush, [
+ OPENGL_LINK="-lMesaGL -lMesaGLU"
+ ],)
+ ],)
+ ],wxUSE_OPENGL=0)
+fi
+
+dnl ---------------------------------------------------------------------------
+dnl the library may be built without GUI classes at all
+dnl ---------------------------------------------------------------------------
+
+if test "$wxUSE_GUI" = "yes"; then
+ AC_DEFINE(wxUSE_GUI)
+
+ dnl the things we always pull in the GUI version of the library:
+ dnl 1. basic things like wxApp, wxWindow, wxControl, wxFrame, wxDialog (the
+ dnl library really can't be built without those)
+ dnl 2. basic controls: wxButton, wxStaticText, wxTextCtrl (these are used in
+ dnl almost any program and the first 2 are needed to show a message box
+ dnl which want to be always able to do)
+ dnl 3. GDI stuff: icon, cursors and all that. Although it would be very nice
+ dnl to compile without them (if the app doesn't do any drawing, it doesn't
+ dnl need the dcs, pens, brushes, ...), this just can't be done now
+ dnl 4. menu stuff: wxMenu, wxMenuBar, wxMenuItem
+ dnl 5. misc stuff: timers, settings, message box
+else
+ AC_DEFINE(wxUSE_NOGUI)
+fi
+
+dnl ---------------------------------------------------------------------------
+dnl Unix/Windows
+dnl ---------------------------------------------------------------------------
+
+if test "$wxUSE_UNIX" = "yes"; then
+ AC_DEFINE(wxUSE_UNIX)
+fi
+
+dnl ---------------------------------------------------------------------------
+dnl Register non-GUI class options for makefiles and setup.h
+dnl ---------------------------------------------------------------------------