]> git.saurik.com Git - wxWidgets.git/blobdiff - configure.in
wxPython doc updates
[wxWidgets.git] / configure.in
index a8fe1bca06a923b1e01da6df899cf72ada7e172b..8128b0c3ea3524621a9d68dd04749dcb0ec649e7 100644 (file)
@@ -223,51 +223,6 @@ AC_DEFUN(WX_CPP_BOOL,
   fi
 ])
 
-dnl ---------------------------------------------------------------------------
-dnl WX_CPP_SIZE_T_IS_NOT_INT checks whether size_t and int are different types,
-dnl i.e. whether we may overload operator[] on its argument type
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN(WX_CPP_SIZE_T_IS_NOT_INT,
-[
-  AC_CACHE_CHECK([if size_t and int are different types], wx_cv_cpp_sizet_not_int,
-  [
-    AC_LANG_SAVE
-    AC_LANG_CPLUSPLUS
-
-    AC_TRY_RUN([
-        #include <stdlib.h>
-
-        class S
-        {
-        public:
-          S(char *s) { m_s = s; }
-
-          char operator[](size_t n) const { return m_s[n]; }
-          char operator[](int n) const { return m_s[n]; }
-
-        private:
-          char *m_s;
-        };
-
-        int main()
-        {
-            S s("dummy");
-            size_t n1 = 2;
-            int n2 = 3;
-
-            return s[n1] == s[n2];
-        }
-      ],
-      AC_DEFINE(wxUSE_SIZE_T_STRING_OPERATOR) wx_cv_cpp_sizet_not_int=yes,
-      wx_cv_cpp_sizet_not_int=no,
-      wx_cv_cpp_sizet_not_int=no
-    )
-
-    AC_LANG_RESTORE
-  ])
-])
-
 dnl ---------------------------------------------------------------------------
 dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling
 dnl ---------------------------------------------------------------------------
@@ -931,13 +886,13 @@ if test "$wxUSE_GUI" = "no"; then
   DEFAULT_wxUSE_FS_ZIP=no
   DEFAULT_wxUSE_BUSYINFO=no
   DEFAULT_wxUSE_ZIPSTREAM=no
-  DEFAULT_wxUSE_VALIDATORS=yes
+  DEFAULT_wxUSE_VALIDATORS=no
   DEFAULT_wxUSE_ACCEL=no
   DEFAULT_wxUSE_CARET=no
   DEFAULT_wxUSE_BMPBUTTON=no
   DEFAULT_wxUSE_CHECKBOX=no
   DEFAULT_wxUSE_CHECKLST=no
-  DEFAULT_wxUSE_CHOICE=yes
+  DEFAULT_wxUSE_CHOICE=no
   DEFAULT_wxUSE_COMBOBOX=no
   DEFAULT_wxUSE_GAUGE=no
   DEFAULT_wxUSE_GRID=no
@@ -956,7 +911,7 @@ if test "$wxUSE_GUI" = "no"; then
   DEFAULT_wxUSE_STATBMP=no
   DEFAULT_wxUSE_STATBOX=no
   DEFAULT_wxUSE_STATLINE=no
-  DEFAULT_wxUSE_STATUSBAR=yes
+  DEFAULT_wxUSE_STATUSBAR=no
   DEFAULT_wxUSE_TABDIALOG=no
   DEFAULT_wxUSE_TOOLBAR=no
   DEFAULT_wxUSE_TREECTRL=no
@@ -1397,7 +1352,16 @@ dnl Define search path for includes and libraries: all headers and libs will be
 dnl looked for in all directories of this path
 dnl ---------------------------------------------------------------------------
 
+dnl notice that /usr/include should not be in this list, otherwise it breaks
+dnl compilation on Solaris/gcc because standard headers are included instead
+dnl of the gcc ones (correction: it *is* needed for broken AIX compiler - but
+dnl do put it last!)
+dnl
+dnl Also try to put all directories which may contain X11R6 before those which
+dnl may contain X11R5/4 - we want to use R6 on machines which have both!
 SEARCH_INCLUDE="\
+    /usr/local/include        \
+                              \
     /usr/Motif-1.2/include    \
     /usr/Motif-2.1/include    \
                               \
@@ -1408,16 +1372,15 @@ SEARCH_INCLUDE="\
                               \
     /usr/Motif1.2/include     \
     /usr/dt/include           \
+    /usr/openwin/include      \
+                              \
     /usr/include/Xm           \
                               \
     /usr/X11R6/include        \
+    /usr/X11R6.4/include      \
     /usr/X11R5/include        \
     /usr/X11R4/include        \
                               \
-    /usr/X11R6/lib            \
-    /usr/X11R5/lib            \
-    /usr/X11R4/lib            \
-                              \
     /usr/include/X11R6        \
     /usr/include/X11R5        \
     /usr/include/X11R4        \
@@ -1439,9 +1402,6 @@ SEARCH_INCLUDE="\
     /usr/x386/include         \
     /usr/XFree86/include/X11  \
                               \
-    /usr/include              \
-    /usr/local/include        \
-                              \
     /usr/include/gtk          \
     /usr/local/include/gtk    \
     /usr/include/glib         \
@@ -1459,9 +1419,9 @@ SEARCH_INCLUDE="\
     /usr/local/x11r5/include  \
     /usr/lpp/Xamples/include  \
                               \
-    /usr/openwin/include      \
     /usr/openwin/share/include \
-    "
+                               \
+    /usr/include"
 
 SEARCH_LIB="`echo "$SEARCH_INCLUDE" | sed s/include/lib/g` "
 
@@ -1603,18 +1563,30 @@ if test "$wxUSE_WINE" = 1; then
 fi
 
 if test "$wxUSE_MOTIF" = 1; then
-    dnl find the X11 include and library files
-    dnl   defines x_includes and x_libraries
-    AC_PATH_XTRA
-
-    if test "$no_x" = "yes"; then
-      AC_MSG_ERROR(X11 libraries not found, aborting)
+    AC_MSG_CHECKING(for X11 headers)
+    WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, X11/Intrinsic.h)
+    if test "$ac_find_includes" != "" ; then
+        AC_MSG_RESULT(found $ac_find_includes)
+    else
+        AC_MSG_RESULT(no)
+        AC_MSG_ERROR(please set CFLAGS to contain the location of Xm/Xm.h)
     fi
 
-    TOOLKIT_INCLUDE="$X_CFLAGS"
-    GUI_TK_LIBRARY="$X_LIBS"
+    AC_MSG_CHECKING(for X11 libraries)
+    WX_PATH_FIND_LIBRARIES($SEARCH_LIB, X11)
+    if test "$ac_find_libraries" != "" ; then
+        WX_INCLUDE_PATH_EXIST($ac_find_includes, $TOOLKIT_INCLUDE)
+        WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY)
 
-    AC_MSG_CHECKING(for Motif/Lesstif includes)
+        GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
+        TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE $ac_path_to_include"
+        AC_MSG_RESULT(found at $ac_find_libraries)
+    else
+        AC_MSG_RESULT(no)
+        AC_MSG_ERROR(please set LDFLAGS to contain the location of libXm)
+    fi
+
+    AC_MSG_CHECKING(for Motif/Lesstif headers)
     WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, Xm/Xm.h)
     if test "$ac_find_includes" != "" ; then
         AC_MSG_RESULT(found $ac_find_includes)
@@ -1629,7 +1601,7 @@ if test "$wxUSE_MOTIF" = 1; then
         WX_INCLUDE_PATH_EXIST($ac_find_includes, $TOOLKIT_INCLUDE)
         WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY)
 
-        CHECK_LINK="$GUI_TK_LIBRARY $ac_path_to_link"
+        GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
         TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE $ac_path_to_include"
         AC_MSG_RESULT(found at $ac_find_libraries)
     else
@@ -1641,7 +1613,7 @@ if test "$wxUSE_MOTIF" = 1; then
     WX_PATH_FIND_LIBRARIES($SEARCH_LIB,Xt)
     if test "$ac_find_libraries" != "" ; then
         WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
-        CHECK_LINK="$GUI_TK_LIBRARY $ac_path_to_link"
+        GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
         AC_MSG_RESULT(found at $ac_find_libraries)
     else
         AC_MSG_RESULT(no)
@@ -1653,7 +1625,7 @@ if test "$wxUSE_MOTIF" = 1; then
     WX_PATH_FIND_LIBRARIES($SEARCH_LIB,Xpm)
     if test "$ac_find_libraries" != "" ; then
         WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
-        CHECK_LINK="$GUI_TK_LIBRARY $ac_path_to_link"
+        GUI_TK_LIBRARY="$GUI_TK_LIBRARY $ac_path_to_link"
         XPM_LINK="-lXpm "
         AC_DEFINE(wxHAVE_LIB_XPM)
         AC_MSG_RESULT(found at $ac_find_libraries)
@@ -1662,7 +1634,7 @@ if test "$wxUSE_MOTIF" = 1; then
         AC_MSG_WARN(library will be compiled without support for images in XPM format)
     fi
 
-    GUI_TK_LINK="-lXm $XPM_LINK -lXmu -lXt -lX11 -lm"
+    GUI_TK_LINK="-lXm $XPM_LINK -lXmu -lXext -lXt -lX11 -lm"
     GUI_TK_LIBRARY="$GUI_TK_LIBRARY $GUI_TK_LINK"
     TOOLKIT=MOTIF
 
@@ -1723,14 +1695,16 @@ WX_ALL=
 WX_ALL_INSTALLED=
 
 if test "$wxUSE_SHARED" = "yes"; then
-    dnl set target to shared
-    WX_TARGET_LIBRARY="${WX_LIBRARY_NAME_SHARED}"
-
     case "${host}" in
       *-hp-hpux* )
+        if test "$GCC" = yes ; then
+            SHARED_LD="${CC} -shared -o"
+            PIC_FLAG="-fPIC"
+        else
+            SHARED_LD="${CXX} -b -o"
+            PIC_FLAG="+Z"
+        fi
         WX_LIBRARY_NAME_SHARED="libwx_${TOOLKIT_DIR}.sl"
-        SHARED_LD="${CXX} -b -o"
-        PIC_FLAG="+Z"
         WX_ALL=${WX_LIBRARY_NAME_SHARED}
       ;;
       *-*-linux* )
@@ -1755,7 +1729,7 @@ if test "$wxUSE_SHARED" = "yes"; then
             PIC_FLAG="-fPIC"
         else
             SHARED_LD="${CXX} -G -o"
-            PIC_FLAG="PIC"
+            PIC_FLAG="-KPIC"
         fi
         WX_ALL_INSTALLED="CREATE_INSTALLED_LINKS"
         WX_ALL="CREATE_LINKS"
@@ -1810,6 +1784,10 @@ if test "$wxUSE_SHARED" = "yes"; then
         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}"
@@ -1883,9 +1861,6 @@ 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
 
@@ -1976,10 +1951,32 @@ AC_CHECK_FUNCS(uname gethostname, break)
 dnl check for MT-safe version of strtok
 AC_CHECK_FUNCS(strtok_r)
 
-dnl check for inet_addr, inet_aton, ...
-AC_CHECK_FUNCS(inet_addr)
-AC_CHECK_FUNCS(inet_aton)
-AC_CHECK_LIB(resolv, inet_aton)
+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
@@ -2114,6 +2111,23 @@ if test "$wxUSE_THREADS" = "yes"; then
   CXXFLAGS="${CXXFLAGS} -D_REENTRANT"
 
   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS thread"
+else
+  dnl on some systems, _REENTRANT should bedefined 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
+    dnl and now try with C++
+    unset ac_cv_func_strtok_r
+    AC_LANG_SAVE
+    AC_LANG_CPLUSPLUS
+    AC_CHECK_FUNCS(strtok_r)
+    AC_LANG_RESTORE
+
+    if test "$ac_cv_func_strtok_r" != "yes"; then
+      ac_cv_func_strtok_r=yes
+      CFLAGS="${CFLAGS} -D_REENTRANT"
+      CXXFLAGS="${CXXFLAGS} -D_REENTRANT"
+    fi
+  fi
 fi
 
 if test "$WXGTK12" = 1 ; then
@@ -2276,11 +2290,6 @@ if test "$wxUSE_APPLE_IEEE" = "yes"; then
   AC_DEFINE(wxUSE_APPLE_IEEE)
 fi
 
-if test "$wxUSE_TIMEDATE" = "yes"; then
-  AC_DEFINE(wxUSE_TIMEDATE)
-  SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS typetest"
-fi
-
 if test "$wxUSE_WAVE" = "yes"; then
   AC_DEFINE(wxUSE_WAVE)
 fi
@@ -2343,12 +2352,6 @@ if test "$wxUSE_LONGLONG" = "yes"; then
   AC_DEFINE(wxUSE_LONGLONG)
 fi
 
-if test "$wxUSE_SOCKETS" = "yes" ; then
-    AC_DEFINE(wxUSE_SOCKETS)
-    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS wxsocket"
-    INCLUDE_SUBDIRS="$INCLUDE_SUBDIRS protocol"
-fi
-
 if test "$wxUSE_DIALUP_MANAGER" = "yes" ; then
   AC_DEFINE(wxUSE_DIALUP_MANAGER)
 fi
@@ -2361,32 +2364,100 @@ if test "$wxUSE_SERIAL" = "yes" ; then
   AC_DEFINE(wxUSE_SERIAL)
 fi
 
+dnl ------------------------------------------------------------------------
+dnl time/date functions
+dnl ------------------------------------------------------------------------
+
+if test "$wxUSE_TIMEDATE" = "yes"; then
+    AC_CHECK_FUNCS(gettimeofday localtime ftime)
+
+    if test "$ac_cv_func_gettimeofday" = "yes"; then
+        AC_CACHE_CHECK([whether gettimeofday takes two arguments],
+                       wx_cv_func_gettimeofday_has_2_args,
+        [
+            dnl on some _really_ old systems it takes only 1 argument
+            AC_LANG_SAVE
+            AC_LANG_CPLUSPLUS
+
+            AC_TRY_COMPILE(
+                [
+                    #include <sys/time.h>
+                    #include <unistd.h>
+                ],
+                [
+                    struct timeval tv;
+                    struct timezone tz;
+                    gettimeofday(&tv, &tz);
+                ],
+                wx_cv_func_gettimeofday_has_2_args=yes,
+                AC_TRY_COMPILE(
+                    [
+                        #include <sys/time.h>
+                        #include <unistd.h>
+                    ],
+                    [
+                        struct timeval tv;
+                        gettimeofday(&tv);
+                    ],
+                    wx_cv_func_gettimeofday_has_2_args=no,
+                    wx_cv_func_gettimeofday_has_2_args=unknown
+                )
+            )
+            AC_LANG_RESTORE
+        ])
+
+        if test "$wx_cv_func_gettimeofday_has_2_args" != "yes"; then
+            AC_DEFINE(WX_GETTIMEOFDAY_NO_TZ)
+        fi
+    fi
+
+    AC_DEFINE(wxUSE_TIMEDATE)
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS typetest"
+fi
+
 dnl ------------------------------------------------------------------------
 dnl wxSocket
 dnl ------------------------------------------------------------------------
 
 if test "$wxUSE_SOCKETS" = "yes"; then
+    dnl under Solaris, socket functions live in -lsocket
+    AC_CHECK_FUNC(socket,,
+        AC_CHECK_LIB(socket, socket,
+            INET_LINK="$INET_LINK -lsocket",
+            [
+                AC_MSG_WARN([socket library not found - sockets will be disabled])
+                wxUSE_SOCKETS=no
+            ]
+        )
+    )
+fi
+
+if test "$wxUSE_SOCKETS" = "yes" ; then
     AC_LANG_SAVE
     AC_LANG_CPLUSPLUS
     dnl determine the type of third argument for getsockname
     AC_MSG_CHECKING(the type of the third argument of getsockname)
     AC_TRY_COMPILE(
         [#include <sys/socket.h>],
-        [socklen_t len; getsockname(0, NULL, &len);],
+        [socklen_t len; getsockname(0, 0, &len);],
         AC_DEFINE(SOCKLEN_T, socklen_t) AC_MSG_RESULT(socklen_t),
            AC_TRY_COMPILE(
             [#include <sys/socket.h>],
-            [size_t len; getsockname(0, NULL, &len);],
+            [size_t len; getsockname(0, 0, &len);],
             AC_DEFINE(SOCKLEN_T, size_t) AC_MSG_RESULT(size_t),
             AC_TRY_COMPILE(
                 [#include <sys/socket.h>],
-                [int len; getsockname(0, NULL, &len);],
+                [int len; getsockname(0, 0, &len);],
                 AC_DEFINE(SOCKLEN_T, int) AC_MSG_RESULT(int),
-            AC_MSG_RESULT(unknown)
-        )
+                AC_MSG_RESULT(unknown)
+            )
         )
     )
     AC_LANG_RESTORE
+
+    AC_DEFINE(wxUSE_SOCKETS)
+    SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS wxsocket"
+    INCLUDE_SUBDIRS="$INCLUDE_SUBDIRS protocol"
 fi
 
 dnl ---------------------------------------------------------------------------
@@ -2823,7 +2894,7 @@ dnl ---------------------------------------------------------------------------
 GUILIBS="$GUI_TK_LIBRARY $OPENGL_LINK $LIBPNG_LINK $ZLIB_LINK $TOOLKIT_LINK"
 
 dnl all additional libraries (except wxWindows itself) we link with
-EXTRA_LIBS="$LIBS $POSIX4_LINK $WCHAR_LINK $THREADS_LINK $DMALLOC_LINK $DL_LINK"
+EXTRA_LIBS="$LIBS $POSIX4_LINK $INET_LINK $WCHAR_LINK $THREADS_LINK $DMALLOC_LINK $DL_LINK"
 if test "$wxUSE_GUI" = "yes"; then
     EXTRA_LIBS="$EXTRA_LIBS $GUILIBS"
 fi
@@ -2845,9 +2916,8 @@ if test "$GXX" = yes ; then
 fi
 EXTRA_CFLAGS="$WXDEBUG $WXODBCFLAG $PROFILE $OPTIMISE $INCLUDES"
 
-CPPFLAGS="-I\${top_srcdir}/include $CPPFLAGS"
-CFLAGS="$CFLAGS $EXTRA_CFLAGS"
-CXXFLAGS="$CXXFLAGS $EXTRA_CFLAGS $CXXWARNINGS"
+CFLAGS=`echo $CFLAGS $EXTRA_CFLAGS | sed 's/ \\+/ /g'`
+CXXFLAGS=`echo $CXXFLAGS $EXTRA_CFLAGS $CXXWARNINGS | sed 's/ \+/ /g'`
 
 if test "$wxUSE_GUI" = "yes"; then
     dnl TODO add checks that these samples will really compile (i.e. all the
@@ -2973,17 +3043,18 @@ AC_OUTPUT([
             samples/listctrl/Makefile
             samples/mdi/Makefile
             samples/minifram/Makefile
-           samples/minimal/Makefile
+            samples/minimal/Makefile
             samples/nettest/Makefile
             samples/newgrid/Makefile
             samples/notebook/Makefile
             samples/png/Makefile
             samples/printing/Makefile
-           samples/proplist/Makefile
+            samples/proplist/Makefile
             samples/richedit/Makefile
             samples/resource/Makefile
             samples/sashtest/Makefile
             samples/scroll/Makefile
+            samples/scrollsub/Makefile
             samples/splitter/Makefile
             samples/text/Makefile
             samples/thread/Makefile
@@ -3022,10 +3093,11 @@ AC_OUTPUT([
             if test ! -d include/wx/${TOOLKIT_DIR}; then
               mkdir include/wx/${TOOLKIT_DIR}
             fi
-            cp -f setup.h include/wx/${TOOLKIT_DIR}/setup.h
+            if test -f setup.h; then
+                mv -f setup.h include/wx/${TOOLKIT_DIR}/setup.h
+            fi
           ],
           [
-            LN_S="${ac_cv_prog_LN_S}"
             TOOLKIT_DIR="${TOOLKIT_DIR}"
           ]
          )