]> git.saurik.com Git - wxWidgets.git/blobdiff - configure.in
added -cpp-precomp compilation problems
[wxWidgets.git] / configure.in
index 96a60b2c39f3e50c9cbeb50ca32c8513ac2e3196..13cf15da31303f4998dabc0cf91df3f5d468e725 100644 (file)
@@ -184,10 +184,10 @@ AC_DEFUN(WX_CPP_NEW_HEADERS,
 
     AC_CHECK_HEADERS(iostream)
 
-    if test "x$HAVE_IOSTREAM" = x ; then
-      ifelse([$2], , :, [$2])
-    else
+    if test "$ac_cv_header_iostream" = "yes" ; then
       ifelse([$1], , :, [$1])
+    else
+      ifelse([$2], , :, [$2])
     fi
 
     AC_LANG_RESTORE
@@ -216,7 +216,6 @@ AC_DEFUN(WX_CPP_BOOL,
         return 0;
       ],
       [
-        AC_DEFINE(HAVE_BOOL)
         wx_cv_cpp_bool=yes
       ],
       [
@@ -294,7 +293,7 @@ dnl   possible arguments are 'yes', 'no', or 'sys'
 dnl usage: WX_ARG_SYS_WITH(option, helpmessage, variable-name)
 AC_DEFUN(WX_ARG_SYS_WITH,
         [
-          AC_MSG_CHECKING("for --with-$1")
+          AC_MSG_CHECKING([for --with-$1])
           no_cache=0
           AC_ARG_WITH($1, $2,
                       [
@@ -339,7 +338,7 @@ dnl this macro checks for a command line argument and caches the result
 dnl usage: WX_ARG_WITH(option, helpmessage, variable-name)
 AC_DEFUN(WX_ARG_WITH,
         [
-          AC_MSG_CHECKING("for --with-$1")
+          AC_MSG_CHECKING([for --with-$1])
           no_cache=0
           AC_ARG_WITH($1, $2,
                       [
@@ -376,7 +375,7 @@ dnl like WX_ARG_WITH but uses AC_ARG_ENABLE instead of AC_ARG_WITH
 dnl usage: WX_ARG_ENABLE(option, helpmessage, variable-name)
 AC_DEFUN(WX_ARG_ENABLE,
         [
-          AC_MSG_CHECKING("for --enable-$1")
+          AC_MSG_CHECKING([for --enable-$1])
           no_cache=0
           AC_ARG_ENABLE($1, $2,
                         [
@@ -472,7 +471,7 @@ 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_RELEASE_NUMBER=1
 
 WX_VERSION=$WX_MAJOR_VERSION_NUMBER.$WX_MINOR_VERSION_NUMBER.$WX_RELEASE_NUMBER
 WX_RELEASE=$WX_MAJOR_VERSION_NUMBER.$WX_MINOR_VERSION_NUMBER
@@ -745,6 +744,7 @@ if test $DEBUG_CONFIGURE = 1; then
   DEFAULT_wxUSE_OPENGL=no
 
   DEFAULT_wxUSE_ON_FATAL_EXCEPTION=no
+  DEFAULT_wxUSE_SNGLINST_CHECKER=no
   DEFAULT_wxUSE_STD_IOSTREAM=no
   DEFAULT_wxUSE_FILE=no
   DEFAULT_wxUSE_TEXTFILE=no
@@ -870,6 +870,7 @@ else
   DEFAULT_wxUSE_OPENGL=no
 
   DEFAULT_wxUSE_ON_FATAL_EXCEPTION=yes
+  DEFAULT_wxUSE_SNGLINST_CHECKER=yes
   DEFAULT_wxUSE_STD_IOSTREAM=no
   DEFAULT_wxUSE_FILE=yes
   DEFAULT_wxUSE_TEXTFILE=yes
@@ -1087,6 +1088,7 @@ WX_ARG_ENABLE(fs_zip,        [  --enable-fs_zip         use virtual ZIP filesyst
 WX_ARG_ENABLE(zipstream,     [  --enable-zipstream      use wxZipInputStream], wxUSE_ZIPSTREAM)
 
 WX_ARG_ENABLE(catch_segvs,   [  --enable-catch_segvs    catch signals and pass them to wxApp::OnFatalException], wxUSE_ON_FATAL_EXCEPTION)
+WX_ARG_ENABLE(snglinst,      [  --enable-snglinst       use wxSingleInstanceChecker class], wxUSE_SNGLINST_CHECKER)
 
 dnl ---------------------------------------------------------------------------
 dnl "big" options (i.e. those which change a lot of things throughout the library)
@@ -1350,7 +1352,7 @@ for toolkit in `echo $ALL_TOOLKITS`; do
       echo "$var=$value" >> ${wx_arg_cache_file}
     fi
     if test "$value" = 1; then
-      AC_MSG_RESULT(`echo $toolkit | tr [[A-Z]] [[a-z]]`)
+      AC_MSG_RESULT([`echo $toolkit | tr [[A-Z]] [[a-z]]`])
     fi
   fi
 done
@@ -1434,7 +1436,7 @@ dnl   defines STRIP as strip or nothing if not found
 AC_CHECK_PROG(STRIP, strip, strip, true)
 
 dnl check if VPATH works
-AC_MSG_CHECKING("make for VPATH support")
+AC_MSG_CHECKING([make for VPATH support])
 dnl create Makefile
 cat - << EOF > confMake
 check : file
@@ -1454,7 +1456,7 @@ if test "$RESULT" = 0; then
   AC_MSG_RESULT(yes)
 else
   AC_MSG_RESULT(no)
-  AC_MSG_ERROR(
+  AC_MSG_ERROR([
 You need a make-utility that is able to use the variable
 VPATH correctly.
 If your version of make does not support VPATH correctly,
@@ -1464,7 +1466,7 @@ export MAKE=gmake; ./configure  for sh-type shells
 setenv MAKE gmake; ./configure  for csh-type shells
 Also please do remember to use gmake in this case every time
 you are trying to compile.
-)
+])
 fi
 
 dnl YACC checks
@@ -2127,15 +2129,15 @@ if test "$wxUSE_SHARED" = "yes"; then
             WX_ALL="CREATE_LINKS"
         fi
        dnl add the resources target
-       WX_ALL="${WX_ALL} ./lib/lib${WX_LIBRARY}-${WX_RELEASE}.${WX_CURRENT}.r"
+       WX_ALL="${WX_ALL} ./lib/lib${WX_LIBRARY}-${WX_RELEASE}.r"
        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"
+       WX_LIBRARY_NAME_SHARED="lib${WX_LIBRARY}-${WX_RELEASE}.dylib.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
+       WX_LIBRARY_NAME_SHARED_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib.${WX_CURRENT}.${WX_REVISION}.${WX_AGE}"
        dnl the name of the links to the shared library
-       WX_LIBRARY_LINK1="lib${WX_LIBRARY}-${WX_RELEASE}.${WX_CURRENT}.dylib"
+       WX_LIBRARY_LINK1="lib${WX_LIBRARY}-${WX_RELEASE}.dylib.${WX_CURRENT}"
        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_LINK1_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib.${WX_CURRENT}"
        WX_LIBRARY_LINK2_GL="lib${WX_LIBRARY}_gl-${WX_RELEASE}.dylib"
        WX_LIBRARY_LINK3_GL="lib${WX_LIBRARY}_gl.dylib"
       ;;
@@ -2234,10 +2236,10 @@ dnl ------------------------------------------------------------------------
 
 dnl defines HAVE_STRINGS_H (where some string functions live on AIX for example)
 AC_CHECK_HEADERS(strings.h)
+dnl defines HAVE_STDLIB_H
+AC_CHECK_HEADERS(stdlib.h)
 dnl defines HAVE_UNISTD_H
 AC_CHECK_HEADERS(unistd.h)
-dnl defines HAVE_FCNTL_H
-AC_CHECK_HEADERS(fcntl.h)
 dnl defines HAVE_WCHAR_H
 AC_CHECK_HEADERS(wchar.h)
 dnl defines HAVE_WCSTR_H
@@ -2276,17 +2278,76 @@ AC_CACHE_CHECK([for wchar_t], wx_cv_type_wchar_t,
 [
     AC_TRY_COMPILE([#include <wchar.h>],
         [
-           wchar_t wc, *ws;
-           wc = L'a';
-           ws = L"Hello, world!";
+            wchar_t wc, *ws;
+            wc = L'a';
+            ws = L"Hello, world!";
         ],
-       wx_cv_type_wchar_t=yes,
-       wx_cv_type_wchar_t=no)
+        wx_cv_type_wchar_t=yes,
+        AC_TRY_COMPILE([#include <stdlib.h>],
+            [
+                wchar_t wc, *ws;
+                wc = L'a';
+                ws = L"Hello, world!";
+            ],
+        wx_cv_type_wchar_t=yes,
+        wx_cv_type_wchar_t=no)
+    )
 ])
-if test "$wx_cv_type_wchar_t" = yes ; then
+
+if test "$wx_cv_type_wchar_t" = "yes"; then
     AC_DEFINE(wxUSE_WCHAR_T)
 fi
 
+dnl check what exactly size_t is on this machine - this is necessary to avoid
+dnl ambiguos overloads in several places, notably wx/string.h and wx/array.h
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+AC_CACHE_CHECK([if size_t is unsigned int],
+    wx_cv_size_t_is_uint,
+    dnl an obvious check like AC_TRY_COMPILE[struct Foo { ... };] doesn't work
+    dnl with egcs (at least) up to 1.1.1 as it allows you to compile duplicate
+    dnl methods in a local class (i.e. class inside a function) declaration
+    dnl without any objections!!
+    dnl
+    dnl hence the hack below: we must have Foo at global scope!
+    AC_TRY_COMPILE([#include <stddef.h>],
+        [
+            return 0; }
+
+            struct Foo { void foo(size_t); void foo(unsigned int); };
+
+            int bar() {
+        ],
+        wx_cv_size_t_is_uint=no,
+        wx_cv_size_t_is_uint=yes
+    )
+)
+
+if test "$wx_cv_size_t_is_uint" = "yes"; then
+    AC_DEFINE(wxSIZE_T_IS_UINT)
+else
+    AC_CACHE_CHECK([if size_t is unsigned long],
+        wx_cv_size_t_is_ulong,
+        AC_TRY_COMPILE([#include <stddef.h>],
+            [
+                return 0; }
+
+                struct Foo { void foo(size_t); void foo(unsigned long); };
+
+                int bar() {
+            ],
+            wx_cv_size_t_is_ulong=no,
+            wx_cv_size_t_is_ulong=yes
+        )
+    )
+
+    if test "$wx_cv_size_t_is_ulong" = "yes"; then
+        AC_DEFINE(wxSIZE_T_IS_ULONG)
+    fi
+fi
+
+AC_LANG_RESTORE
+
 dnl ---------------------------------------------------------------------------
 dnl Checks for structures
 dnl ---------------------------------------------------------------------------
@@ -2335,11 +2396,17 @@ AC_CHECK_SIZEOF(long long, 0)
 
 dnl we have to do it ourselves because SGI/Irix's stdio.h does not include
 dnl wchar_t an AC_CHECK_SIZEOF only includes stdio.h
+dnl Mac OS X does not provide wchar.h and wchar_t is defined by stdlib.h (GD)
 AC_CACHE_CHECK([size of wchar_t], wx_cv_sizeof_wchar_t,
 [
     AC_TRY_RUN(
         [
-           #include <wchar.h>
+           #ifdef HAVE_WCHAR_H
+           #  include <wchar.h>
+           #endif
+           #ifdef HAVE_STDLIB_H
+           #  include <stdlib.h>
+           #endif
            #include <stdio.h>
            int main()
            {
@@ -2495,8 +2562,6 @@ 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
 if test "$TOOLKIT" != "MSW"; then
 
@@ -2509,9 +2574,9 @@ AC_CACHE_CHECK([if iconv() takes char**], wx_cv_iconv_takes_char,
     AC_TRY_COMPILE([#include <iconv.h>],
     [
         char **inbuf, **outbuf;
-       iconv_t cd;
-       size_t insz, outsz;
-       iconv(cd, inbuf, &insz, outbuf, &outsz);
+        iconv_t cd;
+        size_t insz, outsz;
+        iconv(cd, inbuf, &insz, outbuf, &outsz);
     ],
     wx_cv_iconv_takes_char=yes,
     wx_cv_iconv_takes_char=no)
@@ -2559,10 +2624,21 @@ fi
 dnl check for vfork() (even if it's the same as fork() in modern Unices)
 AC_CHECK_FUNCS(vfork)
 
+dnl check for fcntl() or at least flock() needed by Unix implementation of
+dnl wxSingleInstanceChecker
+if test "$wxUSE_SNGLINST_CHECKER" = "yes"; then
+    AC_CHECK_FUNCS(fcntl flock, break)
+
+    if test "$ac_cv_func_fcntl" != "yes" -a "$ac_cv_func_flock" != "yes"; then
+        AC_MSG_WARN(wxSingleInstanceChecker not available)
+        wxUSE_SNGLINST_CHECKER=no
+    fi
+fi
+
 dnl check for timegm() used by datetime.cpp
 AC_CHECK_FUNCS(timegm)
 
-dnl look for a functiopn to modify the environment
+dnl look for a function to modify the environment
 AC_CHECK_FUNCS(putenv setenv, break)
 
 HAVE_SOME_SLEEP_FUNC=0
@@ -2593,9 +2669,9 @@ if test "$HAVE_SOME_SLEEP_FUNC" != 1; then
                 ],
                 [
                     AC_CHECK_FUNCS(usleep,
-                       AC_DEFINE(HAVE_USLEEP),
-                   )
-                    AC_MSG_WARN([wxSleep() function will not work])
+                        AC_DEFINE(HAVE_USLEEP),
+                        AC_MSG_WARN([wxSleep() function will not work])
+                    )
                 ]
             )
         ]
@@ -2682,8 +2758,6 @@ 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
@@ -2700,15 +2774,9 @@ if test "$wxUSE_THREADS" = "yes" ; then
                 THREADS_OBJ="threadpsx.lo"
                 THREADS_LINK="c_r"
             ], [
-                dnl thread functions are in libcc_dynamic under Mac OS X/Darwin
-                AC_CHECK_LIB(cc_dynamic, pthread_create, [
-                    THREADS_OBJ="threadpsx.lo"
-                    THREADS_LINK="cc_dynamic"
-                ], [
-                    dnl VZ: SGI threads are not supported currently
-                    AC_CHECK_HEADER(sys/prctl.h, [
-                        THREADS_OBJ="threadsgi.lo"
-                    ])
+                dnl VZ: SGI threads are not supported currently
+                AC_CHECK_HEADER(sys/prctl.h, [
+                    THREADS_OBJ="threadsgi.lo"
                 ])
             ])
         ])
@@ -2731,7 +2799,7 @@ if test "$wxUSE_THREADS" = "yes" ; then
   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_CHECK_LIB([posix4], $1,
   dnl                [AC_DEFINE(HAVE_`'translit($1, `A-Z', 'a-z'))
   dnl                 POSIX4_LINK="-lposix4"
   dnl             ])
@@ -2742,7 +2810,7 @@ if test "$wxUSE_THREADS" = "yes" ; then
 
   AC_CHECK_LIB($THREADS_LINK, sched_yield,
                AC_DEFINE(HAVE_SCHED_YIELD),
-               [AC_CHECK_LIB("posix4", 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)
                 )]
@@ -2759,7 +2827,7 @@ if test "$wxUSE_THREADS" = "yes" ; then
                  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,
+                       AC_CHECK_LIB([posix4], sched_get_priority_max,
                          [
                             HAVE_PRIOR_FUNCS=1
                             POSIX4_LINK="-lposix4"
@@ -2836,7 +2904,7 @@ if test "$wxUSE_THREADS" = "yes" ; then
             ]
         )
     ])
-    if test "$wx_cv_type_pthread_rec_mutex_init"="yes"; then
+    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
@@ -3054,7 +3122,7 @@ fi
 TIFF_INCLUDE=
 if test "$wxUSE_LIBTIFF" = "yes" -o "$wxUSE_LIBTIFF" = "sys" ; then
   AC_DEFINE(wxUSE_LIBTIFF)
-  if test "$wxUSE_LIBTIFF" = "yes" ; then  
+  if test "$wxUSE_LIBTIFF" = "yes" ; then
     TIFF_INCLUDE="-I\${top_srcdir}/src/tiff"
   else
     TIFF_LINK=
@@ -3167,6 +3235,10 @@ if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes"; then
   AC_DEFINE(wxUSE_ON_FATAL_EXCEPTION)
 fi
 
+if test "$wxUSE_SNGLINST_CHECKER" = "yes"; then
+  AC_DEFINE(wxUSE_SNGLINST_CHECKER)
+fi
+
 if test "$wxUSE_BUSYINFO" = "yes"; then
   AC_DEFINE(wxUSE_BUSYINFO)
 fi
@@ -3299,13 +3371,16 @@ if test "$wxUSE_TIMEDATE" = "yes"; then
                 ],
                 [
                     wx_cv_struct_tm_has_gmtoff=yes
-                    AC_DEFINE(WX_GMTOFF_IN_TM)
                 ],
                 wx_cv_struct_tm_has_gmtoff=no
             )
         ])
     fi
 
+    if test "$wx_cv_struct_tm_has_gmtoff" = "yes"; then
+        AC_DEFINE(WX_GMTOFF_IN_TM)
+    fi
+
     dnl check for gettimeofday (SVr4, BSD 4.3) and ftime (V7, BSD 4.3) for the
     dnl function to be used for high resolution timers
     AC_CHECK_FUNCS(gettimeofday ftime, break)
@@ -3685,9 +3760,6 @@ if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then
 
         AC_CHECK_HEADERS(ole2.h)
 
-       dnl for some reason this test always fails here??
-        dnl if test "x$HAVE_OLE2_H" != x ; then
-       dnl this one does the right thing though
         if test "$ac_cv_header_ole2_h" = "yes" ; then
             if test "$GCC" = yes ; then
                 ALL_OBJECTS="$ALL_OBJECTS \$(OLEOBJS)"
@@ -3854,7 +3926,14 @@ if test "$wxUSE_TABDIALOG" = "yes"; then
 fi
 
 if test "$wxUSE_TOGGLEBTN" = "yes"; then
-  AC_DEFINE(wxUSE_TOGGLEBTN)
+    if test "$wxUSE_MAC" = 1; then
+        AC_MSG_WARN([Toggle button is not yet supported under Mac OS X])
+        wxUSE_TOGGLEBTN=no
+    fi
+
+    if test "$wxUSE_TOGGLEBTN" = "yes"; then
+        AC_DEFINE(wxUSE_TOGGLEBTN)
+    fi
 fi
 
 if test "$wxUSE_TOOLBAR_SIMPLE" = "yes"; then
@@ -4177,12 +4256,12 @@ if test -d include; then
     if test -d include/wx; then
         if test -d include/wx/${TOOLKIT_DIR}; then
             if test -f include/wx/${TOOLKIT_DIR}/setup.h; then
-                mv -f include/wx/${TOOLKIT_DIR}/setup.h setup.h 
+                mv -f include/wx/${TOOLKIT_DIR}/setup.h setup.h
             fi
         fi
     fi
 fi
-            
+
 AC_CONFIG_HEADER(setup.h:setup.h.in)
 
 dnl some more GUI only things
@@ -4194,6 +4273,10 @@ if test "$wxUSE_GUI" = "yes"; then
     wx_cv_program_ext=$PROGRAM_EXT
     wx_cv_target_library=$WX_TARGET_LIBRARY
     wx_cv_target_libtype=$WX_TARGET_LIBRARY_TYPE
+    dnl we need to export them because passing them through cache won't
+    dnl work when cache=/dev/null (which is default for autoconf 2.50)
+    export wx_cv_path_samplesubdirs wx_cv_path_ifs wx_cv_program_ext \
+           wx_cv_target_library wx_cv_target_libtype
     AC_CONFIG_SUBDIRS(demos samples utils contrib)
 fi
 dnl from wxUSE_GUI
@@ -4209,13 +4292,18 @@ AC_OUTPUT([
             Makefile
           ],
           [
-            chmod +x wx-config
-            mv wx-config wx${TOOLKIT_NAME}-config
-            ${LN_S} wx${TOOLKIT_NAME}-config wx-config
-            
+            dnl don't move the file on itself - this happens when we run
+            dnl config.status which, as configure, executes these commands
+            dnl but, unlike it, doesn't create wx-config (which already
+            if test ! -f wx${TOOLKIT_NAME}-config; then
+                chmod +x wx-config
+                mv wx-config wx${TOOLKIT_NAME}-config
+                ${LN_S} wx${TOOLKIT_NAME}-config wx-config
+            fi
+
             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
@@ -4249,7 +4337,7 @@ AC_OUTPUT([
             if test -f setup.h; then
                 cp -fp setup.h include/wx/${TOOLKIT_DIR}/setup.h
             fi
-            
+
           ],
           [
             TOOLKIT_DIR="${TOOLKIT_DIR}"
@@ -4258,3 +4346,4 @@ AC_OUTPUT([
           ]
          )
 
+dnl vi: set et ts=4 sw=4 list: