]> git.saurik.com Git - wxWidgets.git/blobdiff - configure.in
Blob support fixes - still does not work, but getting there
[wxWidgets.git] / configure.in
index dc9e74345ebee81fe82c36d21d706d5f8aadfd2f..a21dfdb684d34fe7843b48318061e3b78289f1fa 100644 (file)
@@ -448,27 +448,39 @@ AC_CANONICAL_SYSTEM
 dnl When making releases do:
 dnl
 dnl WX_RELEASE_NUMBER += 1
-dnl WX_INTERFACE_AGE += 1
-dnl WX_BINARY_AGE += 1
 dnl
-dnl if any functions have been added, do:
+dnl ..and update WX_CURRENT, WX_RELEASE and WX_AGE according to the
+dnl following rules:
 dnl
-dnl WX_INTERFACE_AGE = 0
+dnl    If any changes have been made to the public interface, that is if any
+dnl    exported class, method, global or global type has been added, removed
+dnl    or changed in any way, then do:  WX_CURRENT += 1
+dnl
+dnl    If source changes have been made that *do not* alter the public
+dnl    interface then do:  WX_REVISION += 1
+dnl    If WX_CURRENT was incremented (as above) instead do:  WX_REVISION = 0
+dnl
+dnl    If any public interface was added, do:  WX_AGE += 1
+dnl    If any public interface was removed (or altered in a way effectively
+dnl    removing the previous definition), instead do:  WX_AGE = 0
+dnl
+dnl When the major or minor version numbers are incremented, all the above
+dnl variables should be reset to 0.
+dnl
+dnl The resulting library name will be of the form:
+dnl   libwx_$(TOOLKIT)-$(WX_RELEASE).so.$(WX_CURRENT).$(WX_REVISION).$(WX_AGE)
 
 WX_MAJOR_VERSION_NUMBER=2
 WX_MINOR_VERSION_NUMBER=3
 WX_RELEASE_NUMBER=0
 
-WX_INTERFACE_AGE=0
-WX_BINARY_AGE=0
-
 WX_VERSION=$WX_MAJOR_VERSION_NUMBER.$WX_MINOR_VERSION_NUMBER.$WX_RELEASE_NUMBER
-
-dnl wxWindows shared library versioning
 WX_RELEASE=$WX_MAJOR_VERSION_NUMBER.$WX_MINOR_VERSION_NUMBER
-WX_CURRENT=`expr $WX_RELEASE_NUMBER - $WX_INTERFACE_AGE`
-WX_REVISION=$WX_INTERFACE_AGE
-WX_AGE=`expr $WX_BINARY_AGE - $WX_INTERFACE_AGE`
+
+WX_CURRENT=0
+WX_REVISION=0
+WX_AGE=0
+
 
 dnl ------------------------------------------------------------------------
 dnl Check platform (host system)
@@ -1964,12 +1976,6 @@ else
     dnl distribute only wxBase sources/headers
     GUIDIST="BASE_DIST"
     DISTDIR="wxBase"
-
-    dnl Apple MAC OS X specific extras
-    if test "$USE_UNIX" = 1 ; then
-       ALL_OBJECTS="${ALL_OBJECTS} dl_macosx.o"
-       ALL_DEPFILES="${ALL_DEPFILES} dl_macosx.d"
-    fi
 fi
 
 dnl the name of the (libtool) library
@@ -2096,8 +2102,8 @@ if test "$wxUSE_SHARED" = "yes"; then
         fi
       ;;
       *-*-darwin* )
-        SHARED_LD="libtool -dynamic -o"
-        PIC_FLAG="-fPIC"
+        SHARED_LD="${CXX} -dynamiclib -o"
+        PIC_FLAG="-dynamic -fPIC"
         if test "$wxUSE_OPENGL" = "yes"; then
             WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS CREATE_INSTALLED_LINKS_GL"
             WX_ALL="CREATE_LINKS CREATE_LINKS_GL"
@@ -2105,6 +2111,16 @@ if test "$wxUSE_SHARED" = "yes"; then
             WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
             WX_ALL="CREATE_LINKS"
         fi
+       dnl the name of the shared library
+       WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}-${WX_RELEASE}.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}.dylib"
+       WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}.dylib"
+       dnl the name of the links to the shared library
+       WX_LIBRARY_LINK1="lib${WX_LIBRARY}-${WX_RELEASE}.${WX_CURRENT}.dylib"
+       WX_LIBRARY_LINK2="lib${WX_LIBRARY}-${WX_RELEASE}.dylib"
+       WX_LIBRARY_LINK3="lib${WX_LIBRARY}.dylib"
+       WX_LIBRARY_LINK1_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.${WX_CURRENT}.dylib"
+       WX_LIBRARY_LINK2_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib"
+       WX_LIBRARY_LINK3_GL="lib${WX_LIBRARY}_gl.dylib"
       ;;
       *-*-osf* )
         SHARED_LD="${CXX} -shared -o"
@@ -2333,6 +2349,11 @@ dnl end...
 dnl if we fail to find vsnprintf, also try for _vsnprintf as that is what
 dnl we'll find under MSW if it exists.
 
+dnl final note: AC_TRY_COMPILE will only be executed if there is nothing in
+dnl the cache so we have to do AC_DEFINE(HAVE_VSNPRINTF) below and not inside
+dnl it or the symbol wouldn't be defined for the 2nd and subsequent configure
+dnl runs
+
 dnl check for vsnprintf() - a safe version of vsprintf()
 AC_CACHE_CHECK([for vsnprintf], wx_cv_func_vsnprintf,
 [
@@ -2355,7 +2376,6 @@ AC_CACHE_CHECK([for vsnprintf], wx_cv_func_vsnprintf,
                     vsnprintf(s, 42, fmt, argp);
                     va_end(argp);
                  ], [
-                    AC_DEFINE(HAVE_VSNPRINTF)
                     wx_cv_func_vsnprintf=yes
                  ], [
                     AC_TRY_COMPILE([
@@ -2377,15 +2397,19 @@ AC_CACHE_CHECK([for vsnprintf], wx_cv_func_vsnprintf,
                                       _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
                                    ])
                  ])
 ])
 
+if test "$wx_cv_func_vsnprintf" = yes; then
+    AC_DEFINE(HAVE_VSNPRINTF)
+else
+    AC_MSG_WARN(unsafe function sprintf will be used instead of snprintf)
+fi
+
 dnl check for vsscanf()
 AC_CACHE_CHECK([for vsscanf], wx_cv_func_vsscanf,
 [
@@ -2406,13 +2430,16 @@ AC_CACHE_CHECK([for vsscanf], wx_cv_func_vsscanf,
                     vsscanf("42", fmt, argp);
                     va_end(argp);
                 ], [
-                    AC_DEFINE(HAVE_VSSCANF)
                     wx_cv_func_vsscanf=yes
                 ], [
                     wx_cv_func_vsscanf=no
                 ])
 ])
 
+if test "$wx_cv_func_vsscanf" = yes; then
+    AC_DEFINE(HAVE_VSSCANF)
+fi
+
 AC_LANG_RESTORE
 
 dnl the following tests are for Unix(like) systems only
@@ -2578,6 +2605,8 @@ if test "$wxUSE_THREADS" = "yes" ; then
     dnl AIX calls the library libpthreads - thanks IBM!
     if test "$USE_AIX" = 1; then
         THREADS_LIB=pthreads
+    elif test "$USE_MAC" = 1; then
+        THREADS_LIB=cc_dynamic
     else
         THREADS_LIB=pthread
     fi
@@ -2681,12 +2710,66 @@ if test "$wxUSE_THREADS" = "yes" ; then
                     pthread_cleanup_pop(0);
                  ], [
                     wx_cv_func_pthread_cleanup_push=yes
-                    AC_DEFINE(HAVE_THREAD_CLEANUP_FUNCTIONS)
                  ], [
                     wx_cv_func_pthread_cleanup_push=no
                  ])
   ])
 
+  if test "$wx_cv_func_pthread_cleanup_push" = "yes"; then
+      AC_DEFINE(HAVE_THREAD_CLEANUP_FUNCTIONS)
+  fi
+
+  dnl mutexattr_t initialization is done in quite different ways on different
+  dnl platforms, so check for a few things:
+  dnl
+  dnl HAVE_MUTEX_RECURSIVE means that we can create recursive mutexes
+  dnl HAVE_MUTEXATTR_SETTYPE means that we do it using
+  dnl pthread_mutexattr_settype(PTHREAD_MUTEX_RECURSIVE) and if it is not
+  dnl defined, we do it by directly assigned
+  dnl PTHREAD_MUTEX_RECURSIVE_MUTEX_INITIALIZER_NP to attr
+
+#ifdef HAVE_PTHREAD_MUTEXATTR_T
+#elif defined(HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
+
+  AC_CACHE_CHECK([for pthread_mutexattr_t], wx_cv_type_pthread_mutexattr_t,
+  [
+    AC_TRY_COMPILE([#include <pthread.h>],
+        [
+           pthread_mutexattr_t attr;
+           pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+        ], [
+           wx_cv_type_pthread_mutexattr_t=yes
+        ], [
+           wx_cv_type_pthread_mutexattr_t=no
+        ]
+    )
+  ])
+
+  if test "$wx_cv_type_pthread_mutexattr_t" = "yes"; then
+    AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_T)
+  else
+    dnl don't despair, there may be another way to do it
+    AC_CACHE_CHECK([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER],
+                   wx_cv_type_pthread_rec_mutex_init,
+    [
+        AC_TRY_COMPILE([#include <pthread.h>],
+            [
+                pthread_mutex_t attr = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+            ], [
+                wx_cv_type_pthread_rec_mutex_init=yes
+            ], [
+                wx_cv_type_pthread_rec_mutex_init=no
+            ]
+        )
+    ])
+    if test "$wx_cv_type_pthread_rec_mutex_init"="yes"; then
+      AC_DEFINE(HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
+    else
+      dnl this may break code working elsewhere, so at least warn about it
+      AC_MSG_WARN([wxMutex won't be recursive on this platform])
+    fi
+  fi
+
   THREADS_LINK="-l$THREADS_LINK"
 
   dnl building MT programs under Solaris with the native compiler requires -mt
@@ -2704,9 +2787,11 @@ 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"
+  dnl must define _REENTRANT for multithreaded code except for Mac OS X
+  if test "$wxUSE_MAC" = "0"; then
+    CFLAGS="${CFLAGS} -D_REENTRANT"
+    CXXFLAGS="${CXXFLAGS} -D_REENTRANT"
+  fi
 
   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS thread"
 else
@@ -2742,8 +2827,9 @@ if test "$WXWINE" = 1 ; then
 fi
 
 if test "$wxUSE_MAC" = 1 ; then
-  TOOLKIT_DEF="${TOOLKIT_DEF} -D__UNIX__ -DTARGET_CARBON"
-  TOOLKIT_INCLUDE="${TOOLKIT_INCLUDE}"
+  TOOLKIT_DEF="${TOOLKIT_DEF} -D__UNIX__ -D__POWERPC__ -DTARGET_CARBON"
+  CFLAGS="${CFLAGS} -fno-common -fpascal-strings"
+  CPPFLAGS="${CPPFLAGS} -fno-common -fpascal-strings"
 fi
 
 if test "$wxUSE_CYGWIN" = 1 ; then
@@ -3506,6 +3592,11 @@ if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then
         wxUSE_DRAG_AND_DROP=no
     fi
 
+    if test "$wxUSE_MAC" = 1; then
+        AC_MSG_WARN([Drag and drop is not yet supported under Mac OS X])
+        wxUSE_DRAG_AND_DROP=no
+    fi
+
     if test "$USE_WIN32" = 1; then
         dnl check for ole headers and disable DnD if not present (earlier
         dnl versions of mingw32 don't have them)
@@ -3820,12 +3911,9 @@ dnl all additional libraries (except wxWindows itself) we link with
 dnl
 dnl note that we always link with -lm except for Mac OS X
 dnl extended.c uses floor() and is always linked in
+EXTRA_LIBS="$LIBS $POSIX4_LINK $INET_LINK $WCHAR_LINK $THREADS_LINK $DMALLOC_LINK $DL_LINK $ZLIB_LINK -lm"
 if test "$USE_MAC" = 1 ; then
-    EXTRA_LIBS="$LIBS $POSIX4_LINK $INET_LINK $WCHAR_LINK $THREADS_LINK $DMALLOC_LINK $DL_LINK $ZLIB_LINK -framework System"
-    CFLAGS="${CFLAGS} -fpascal-strings"
-    CPPFLAGS="${CPPFLAGS} -fpascal-strings"
-else
-    EXTRA_LIBS="$LIBS $POSIX4_LINK $INET_LINK $WCHAR_LINK $THREADS_LINK $DMALLOC_LINK $DL_LINK $ZLIB_LINK -lm"
+    EXTRA_LIBS="$EXTRA_LIBS -framework Carbon -framework System"
 fi
 if test "$wxUSE_GUI" = "yes"; then
     EXTRA_LIBS="$GUILIBS $PNG_LINK $JPEG_LINK $TIFF_LINK $FREETYPE_LINK $EXTRA_LIBS"
@@ -4030,7 +4118,7 @@ AC_OUTPUT([
             
             dnl the debian build process wants setup.h in the lib subdir so we
             dnl can pretend wxWin is already installed, so we *copy* it there
-            
+         
             if test ! -d lib; then
               mkdir lib
             fi
@@ -4047,7 +4135,7 @@ AC_OUTPUT([
               mkdir lib/wx/include/wx/${TOOLKIT_NAME}
             fi
             if test -f setup.h; then
-                cp -f setup.h lib/wx/include/wx/${TOOLKIT_NAME}/setup.h
+                cp -fp setup.h lib/wx/include/wx/${TOOLKIT_NAME}/setup.h
             fi
 
             dnl *move* setup.h to its final place
@@ -4062,7 +4150,7 @@ AC_OUTPUT([
               mkdir include/wx/${TOOLKIT_DIR}
             fi
             if test -f setup.h; then
-                mv -f setup.h include/wx/${TOOLKIT_DIR}/setup.h
+                cp -fp setup.h include/wx/${TOOLKIT_DIR}/setup.h
             fi
             
           ],