dnl these options use AC_ARG_WITH and not WX_ARG_WITH on purpose - we cache
dnl these values manually
for toolkit in `echo $ALL_TOOLKITS`; do
- LINE=`grep "wxUSE_$toolkit" ${wx_arg_cache_file}`
- if test "x$LINE" != x ; then
+ LINE=`grep "wxUSE_$toolkit=" ${wx_arg_cache_file}`
+ if test "x$LINE" != "x" ; then
has_toolkit_in_cache=1
eval "DEFAULT_$LINE"
eval "CACHE_$toolkit=1"
AC_ARG_WITH(x11, [ --with-x11 use X11], [wxUSE_X11="$withval" wxUSE_UNIVERSAL="yes" CACHE_X11=1 TOOLKIT_GIVEN=1])
WX_ARG_ENABLE(nanox, [ --enable-nanox use NanoX], wxUSE_NANOX)
-AC_ARG_ENABLE(gtk2, [ --enable-gtk2 use GTK+ 2.0 if available (EXPERIMENTAL)],wxUSE_GTK2="yes",wxUSE_GTK2="no")
+WX_ARG_ENABLE(gtk2, [ --enable-gtk2 use GTK+ 2.0 if available (EXPERIMENTAL)], wxUSE_GTK2)
WX_ARG_SYS_WITH(libpng, [ --with-libpng use libpng (PNG image format)], wxUSE_LIBPNG)
WX_ARG_SYS_WITH(libjpeg, [ --with-libjpeg use libjpeg (JPEG file format)], wxUSE_LIBJPEG)
1)
;;
0)
- AC_MSG_ERROR(Please specify a toolkit - cannot determine the default for ${host})
+ AC_MSG_ERROR(Please specify a toolkit -- cannot determine the default for ${host})
;;
*)
- AC_MSG_ERROR(Please specify at most one toolkit (may be some are cached?))
+ AC_MSG_ERROR(Please specify at most one toolkit (maybe some are cached in configarg.cache?))
esac
dnl cache the wxUSE_<TOOLKIT> values too
AC_CHECK_HEADERS(wcstr.h)
fi
-dnl checking for wctype.h is useless as we need wcslen(), not just wchar_t and
-dnl this function is never provided by it
-dnl AC_CHECK_HEADERS(wctype.h)
-
dnl defines HAVE_FNMATCH_H
AC_CHECK_HEADERS(fnmatch.h)
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)
+ AC_MSG_RESULT(found in $ac_find_includes)
+ WX_INCLUDE_PATH_EXIST($ac_find_includes, $TOOLKIT_INCLUDE)
+ TOOLKIT_INCLUDE="$TOOLKIT_INCLUDE$ac_path_to_include"
else
AC_TRY_COMPILE(
[
AC_MSG_CHECKING(for Motif/Lesstif library)
WX_PATH_FIND_LIBRARIES($SEARCH_LIB, Xm)
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_RESULT(found at $ac_find_libraries)
+ WX_LINK_PATH_EXIST($ac_find_libraries, $GUI_TK_LIBRARY)
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
- dnl it might happen that we found headers in one of the standard
- dnl paths but the libs are elsewhere - we do need to try to
- dnl compile a sample program then here
+ dnl it might happen that we found headers in one of the
+ dnl standard paths but the libs are elsewhere - we do need to
+ dnl try to compile a sample program then here
+ save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $TOOLKIT_INCLUDE"
+
AC_TRY_COMPILE(
[
#include <Xm/Xm.h>
AC_MSG_ERROR(please set LDFLAGS to contain the location of libXm)
]
)
+
+ CFLAGS=$save_CFLAGS
fi
fi
if test "$ac_find_libraries" != "" ; then
WX_LINK_PATH_EXIST($ac_find_libraries,$GUI_TK_LIBRARY)
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)
else
+ save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $TOOLKIT_INCLUDE"
+
AC_TRY_COMPILE(
[
#include <X11/xpm.h>
AC_MSG_WARN(library will be compiled without support for images in XPM format)
]
)
+
+ CFLAGS=$save_CFLAGS
fi
AC_MSG_CHECKING([if we need -lXp and/or -lSM -lICE])
if test "$libs_found" = "0"; then
save_LIBS="$LIBS"
LIBS="$GUI_TK_LIBRARY -lXm${xpm_link} ${libp} -lXmu -lXext -lXt${libsm_ice} -lX11"
+ save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $TOOLKIT_INCLUDE"
+
AC_TRY_LINK(
[
#include <Xm/Xm.h>
libs_found=1
], []
)
+
LIBS="$save_LIBS"
+ CFLAGS=$save_CFLAGS
fi
done
fi
dnl ---------------------------------------------------------------------------
dnl don't check for wchar_t functions if we haven't got wchar_t itself
-WCHAR_OK=0
if test "$wx_cv_sizeof_wchar_t" != "0"; then
- dnl check for wcslen
+ AC_DEFINE(wxUSE_WCHAR_T)
+
+ dnl check for wcslen in all possible places
+ WCSLEN_FOUND=0
WCHAR_LINK=
- AC_CHECK_FUNCS(wcslen, [
- AC_DEFINE(HAVE_WCSLEN)
- WCHAR_OK=1
- ])
+ AC_CHECK_FUNCS(wcslen, WCSLEN_FOUND=1)
- if test "$WCHAR_OK" = 0; then
+ if test "$WCSLEN_FOUND" = 0; then
if test "$TOOLKIT" = "MSW"; then
- AC_CHECK_LIB(msvcrt, wcslen, [
- AC_DEFINE(HAVE_WCSLEN)
- WCHAR_OK=1
- ])
+ AC_CHECK_LIB(msvcrt, wcslen, WCHAR_OK=1)
else
AC_CHECK_LIB(w, wcslen, [
- AC_DEFINE(HAVE_WCSLEN)
WCHAR_LINK=" -lw"
- WCHAR_OK=1
+ WCSLEN_FOUND=1
])
fi
fi
-fi
-dnl we need at least the definition of wchar_t itself and wcslen() to compile
-dnl with wchar_t support -- turn it off if we don't have this
-if test "$WCHAR_OK" = 1; then
- AC_DEFINE(wxUSE_WCHAR_T)
+ if test "$WCSLEN_FOUND" = 1; then
+ AC_DEFINE(HAVE_WCSLEN)
+ fi
- dnl also try to use wcsrtombs instead of wcstombs which is buggy in old GNU
+ dnl try to use wcsrtombs instead of wcstombs which is buggy in old GNU
dnl libc versions if possible
AC_CHECK_FUNCS(wcsrtombs)
else
- dnl use built-in wcslen for Darwin (what about other BSD based systems?)
- if test "$USE_DARWIN" = 1; then
- AC_DEFINE(wxUSE_WCHAR_T)
- else
- AC_MSG_WARN([Wide character support is unavailable])
- fi
+ AC_MSG_WARN([Wide character support is unavailable])
fi
-dnl check for vprintf/vsprintf() which are GNU extensions
-AC_FUNC_VPRINTF
-
-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. We can't use AC_TRY_COMPILE(), either, because it doesn't
-dnl check if the symbol is available at linking time
-
-dnl we use AC_TRY_LINK() here instead of AC_TRY_RUN() to make the checks
-dnl work for cross-compilation, but AC_TRY_LINK() 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_LINK() just prepends
-dnl "int main() {" in the beginning of the code and "; return 0; }" at the
-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_LINK 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 *printf() functions sometimes are available in the library but not
+dnl prototyped -- if this is the case, we can't use them from C++ code, but to
+dnl detect this we have to use C++ compiler for testing
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
-dnl check for vsnprintf() - a safe version of vsprintf()
-AC_CACHE_CHECK([for vsnprintf], wx_cv_func_vsnprintf,
-[
- AC_TRY_LINK([
- #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);
- ], [
- wx_cv_func_vsnprintf=yes
- ], [
- AC_TRY_LINK([
- #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);
- ], [
- wx_cv_func_vsnprintf=yes
- ], [
- wx_cv_func_vsnprintf=no
- ])
- ])
-])
+dnl check for vsnprintf() -- a safe version of vsprintf())
+AC_CHECK_FUNCS(vsnprintf)
-if test "$wx_cv_func_vsnprintf" = yes; then
- AC_DEFINE(HAVE_VSNPRINTF)
-else
- AC_MSG_WARN(unsafe function vsprintf will be used instead of vsnprintf)
+if test "$wxUSE_UNICODE" = yes; then
+ dnl also look if we have wide char IO functions
+ AC_CHECK_FUNCS(fputwc wprintf vswprintf)
fi
-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);
- ], [
- wx_cv_func_vsscanf=yes
- ], [
- wx_cv_func_vsscanf=no
- ])
-])
+AC_LANG_RESTORE
+
-if test "$wx_cv_func_vsscanf" = yes; then
- AC_DEFINE(HAVE_VSSCANF)
-fi
dnl the following tests are for Unix(like) systems only
if test "$TOOLKIT" != "MSW"; then
if test "$ac_cv_header_ole2_h" = "yes" ; then
if test "$GCC" = yes ; then
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+
+ AC_MSG_CHECKING([if g++ requires -fvtable-thunks])
+ AC_TRY_COMPILE([#include <windows.h>
+ #include <ole2.h>],
+ [],
+ [AC_MSG_RESULT(no)],
+ [AC_MSG_RESULT(yes)
+ CODE_GEN_FLAGS_CXX="$CODE_GEN_FLAGS_CXX -fvtable-thunks"])
+ AC_LANG_RESTORE
ALL_OBJECTS="$ALL_OBJECTS \$(OLEOBJS)"
- CODE_GEN_FLAGS_CXX="$CODE_GEN_FLAGS_CXX -fvtable-thunks"
LIBS=" -lrpcrt4 -loleaut32 -lole32 -luuid$LIBS"
AC_DEFINE(wxUSE_OLE)