AC_CANONICAL_BUILD
AC_CANONICAL_HOST
+dnl notice that if --host was given but --build was not, cross_compiling is
+dnl only set to "maybe" and not "yes" and will be either set to "yes" later or
+dnl configure will exit with error in AC_PROG_CC so don't test for = "yes" here
+if test "$cross_compiling" != "no"; then
+ HOST_PREFIX="${host_alias}-"
+ HOST_SUFFIX="-$host_alias"
+else
+ HOST_PREFIX=
+ HOST_SUFFIX=
+fi
dnl When making releases do:
dnl
PROGRAM_EXT=
SAMPLES_RPATH_FLAG=
-SAMPLES_RPATH_POSTLINK=
+DYLIB_RPATH_INSTALL=
+DYLIB_RPATH_POSTLINK=
DEFAULT_STD_FLAG=yes
WX_ARG_ENABLE(omf, [ --enable-omf use OMF object format], wxUSE_OMF)
fi
-dnl --enablle-debug is equivalent to both --enable-debug_flag and
+dnl --enable-debug is equivalent to both --enable-debug_flag and
dnl --enable-debug_info
if test "$wxUSE_DEBUG" = "yes"; then
DEFAULT_wxUSE_DEBUG_FLAG=yes
dnl
dnl this magic incantation is needed to prevent AC_PROG_CC from setting the
dnl default CFLAGS (something like "-g -O2") -- we don't need this as we add
-dnl -g and -O flags ourselves below
+dnl (if not already present in C*FLAGS) the -g and -O flags ourselves below
CFLAGS=${CFLAGS:=}
AC_BAKEFILE_PROG_CC
;;
*-*-darwin* )
- install_name_tool=`which install_name_tool`
+ install_name_tool=`which ${HOST_PREFIX}install_name_tool`
if test "$install_name_tool" -a -x "$install_name_tool"; then
- SAMPLES_RPATH_POSTLINK="\$(wx_top_builddir)/change-install-names \$(LIBDIRNAME) \$(prefix) \$@"
+ DYLIB_RPATH_POSTLINK="${HOST_PREFIX}install_name_tool -id \$@ \$@"
cat <<EOF >change-install-names
#!/bin/sh
libnames=\`cd \${1} ; ls -1 | grep '\.[[0-9]][[0-9]]*\.dylib\$'\`
-inst_cmd="install_name_tool "
for i in \${libnames} ; do
- inst_cmd="\${inst_cmd} -change \${2}/lib/\${i} \${1}/\${i}"
+ ${HOST_PREFIX}install_name_tool -id \${1}/\${i} \${1}/\${i}
+ for dep in \${libnames} ; do
+ ${HOST_PREFIX}install_name_tool -change \${2}/\${dep} \${1}/\${dep} \${1}/\${i}
+ done
done
-\${inst_cmd} \${3}
EOF
chmod +x change-install-names
+ DYLIB_RPATH_INSTALL="\$(wx_top_builddir)/change-install-names \${libdir} \$(wx_top_builddir)/lib"
fi
dnl the HEADER_PAD_OPTION is required by some wx samples to avoid the error:
if test $wxUSE_RPATH = "no"; then
SAMPLES_RPATH_FLAG=''
- SAMPLES_RPATH_POSTLINK=''
+ DYLIB_PATH_POSTLINK=''
WXCONFIG_RPATH=''
fi
WX_VERSION_TAG=`echo WX${lib_unicode_suffix}${lib_debug_suffix}${WX_LIB_FLAVOUR}_${WX_RELEASE} | tr '[[a-z]]' '[[A-Z]]'`
-TOOLCHAIN_NAME="${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffix}${lib_debug_suffix}${WX_LIB_FLAVOUR}-${WX_RELEASE}"
+TOOLCHAIN_NAME="${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffix}${lib_debug_suffix}${WX_LIB_FLAVOUR}-${WX_RELEASE}${HOST_SUFFIX}"
-TOOLCHAIN_FULLNAME="${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}-${WX_CHARTYPE}-${WX_DEBUGTYPE}${config_linkage_component}-${WX_RELEASE}${WX_FLAVOUR}"
-
-if test "$cross_compiling" = "yes"; then
- HOST_SUFFIX="-$host_alias"
- TOOLCHAIN_NAME="$TOOLCHAIN_NAME$HOST_SUFFIX"
- TOOLCHAIN_FULLNAME="${host_alias}-$TOOLCHAIN_FULLNAME"
-fi
+TOOLCHAIN_FULLNAME="${HOST_PREFIX}${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}-${WX_CHARTYPE}-${WX_DEBUGTYPE}${config_linkage_component}-${WX_RELEASE}${WX_FLAVOUR}"
dnl library link name
dnl These just save us from exporting lib_{unicode,debug,flavour}_suffix.
dnl DEBUG_CFLAGS contains debugging options (supposed to be the same for C and C++
dnl compilers: we'd need a separate DEBUG_CXXFLAGS if this is ever not the case)
DEBUG_CFLAGS=
-if test "$wxUSE_DEBUG_INFO" = "yes" ; then
+if `echo $CXXFLAGS $CFLAGS | grep " -g" >/dev/null`; then
+ dnl the CXXFLAGS or the CFLAGS variable already contains the -g flag
+ dnl (e.g. it was specified by the user before running configure); since
+ dnl later they will be merged with DEBUG_CFLAGS, don't set the -g option
+ dnl in DEBUG_CFLAGS to avoid (possibly different) flag duplicates
+ AC_MSG_WARN([CXXFLAGS/CFLAGS already contains -g flag; ignoring the --enable-debug_info option])
+elif test "$wxUSE_DEBUG_INFO" = "yes" ; then
DEBUG_CFLAGS="-g"
fi
dnl C/C++ compiler option for optimization (supposed to be the same for both)
OPTIMISE_CFLAGS=
-if test "$wxUSE_OPTIMISE" = "no" ; then
- if test "$GCC" = yes ; then
- dnl use -O0 because compiling with it is faster than compiling with no
- dnl optimization options at all (at least with g++ 3.2)
- OPTIMISE_CFLAGS="-O0"
- fi
+if `echo $CXXFLAGS $CFLAGS | grep " -O" >/dev/null`; then
+ dnl the CXXFLAGS or the CFLAGS variable already contains -O optimization flag
+ dnl (e.g. it was specified by the user before running configure); since
+ dnl later they will be merged with OPTIMISE_CFLAGS, don't set the -O option
+ dnl in OPTIMISE_CFLAGS to avoid (possibly different) flag duplicates
+ AC_MSG_WARN([CXXFLAGS/CFLAGS already contains -O flag; ignoring the --disable-optimise option])
else
- if test "$GCC" = yes ; then
- case "${host}" in
- *-pc-os2_emx | *-pc-os2-emx )
- dnl Not all of the supported gcc versions understand
- dnl -fstrict-aliasing and none actually needs it (yet).
- OPTIMISE_CFLAGS="-O2"
- ;;
- *)
- dnl Switch on optimisation but keep strict-aliasing off for
- dnl now (see -fstrict-aliasing in the gcc manual). When it is
- dnl switched back on consider using -Wstrict-aliasing=2.
- OPTIMISE_CFLAGS="-O2 -fno-strict-aliasing"
- ;;
- esac
+ if test "$wxUSE_OPTIMISE" = "no" ; then
+ if test "$GCC" = yes ; then
+ dnl use -O0 because compiling with it is faster than compiling with no
+ dnl optimization options at all (at least with g++ 3.2)
+ OPTIMISE_CFLAGS="-O0"
+ fi
else
- OPTIMISE_CFLAGS="-O"
+ if test "$GCC" = yes ; then
+ case "${host}" in
+ *-pc-os2_emx | *-pc-os2-emx )
+ dnl Not all of the supported gcc versions understand
+ dnl -fstrict-aliasing and none actually needs it (yet).
+ OPTIMISE_CFLAGS="-O2"
+ ;;
+ *)
+ dnl Switch on optimisation but keep strict-aliasing off for
+ dnl now (see -fstrict-aliasing in the gcc manual). When it is
+ dnl switched back on consider using -Wstrict-aliasing=2.
+ OPTIMISE_CFLAGS="-O2 -fno-strict-aliasing"
+ ;;
+ esac
+ else
+ OPTIMISE_CFLAGS="-O"
+ fi
fi
fi
fi
if test "$wxUSE_DATETIME" = "yes"; then
- dnl check for strptime and for its declaration as some systems lack it
- AC_CHECK_FUNC(strptime)
- if test "$ac_cv_func_strptime" = "yes"; then
- AC_CACHE_CHECK([for strptime declaration], wx_cv_func_strptime_decl,
- [
- AC_LANG_PUSH(C++)
- AC_TRY_COMPILE(
- [
- #include <time.h>
- ],
- [
- struct tm t;
- strptime("foo", "bar", &t);
- ],
- wx_cv_func_strptime_decl=yes,
- wx_cv_func_strptime_decl=no
- )
- AC_LANG_POP()
- ]
- )
- fi
- if test "$wx_cv_func_strptime_decl" = "yes"; then
- AC_DEFINE(HAVE_STRPTIME_DECL)
- else
- wx_strptime_decl="extern char *strptime(const char *, const char *, struct tm *);"
- fi
- if test "$ac_cv_func_strptime" = "yes"; then
- dnl strptime() behaviour doesn't conform to POSIX under Mac OS X <
- dnl 10.5 and possibly other BSD variants, check that strptime() we
- dnl have fails to parse format when the string doesn't match it instea
- dnl of just stopping immediately and returning non-NULL
- AC_CACHE_CHECK([whether strptime() fails on invalid strings],
- wx_cv_func_strptime_ok,
- [AC_RUN_IFELSE(
- [
- #include <stdlib.h>
- #include <time.h>
- #include "confdefs.h"
-
- $wx_strptime_decl
-
- int main()
- {
- struct tm t;
- return !!strptime("", "%x", &t);
- }
- ],
- wx_cv_func_strptime_ok=yes,
- wx_cv_func_strptime_ok=no,
- dnl be pessimistic when cross-compiling
- wx_cv_func_strptime_ok=no
- )]
- )
-
- if test "$wx_cv_func_strptime_ok" = "yes"; then
- AC_DEFINE(HAVE_STRPTIME)
- fi
- fi
-
dnl check for timezone variable
dnl doesn't exist under Darwin / Mac OS X which uses tm_gmtoff instead
AC_CACHE_CHECK(for timezone variable in <time.h>,
dnl get the string with OS info - used by wxGetOsDescription() on MacOS X
dnl ---------------------------------------------------------------------------
-if test "$cross_compiling" = "yes"; then
+if test "$cross_compiling" != "no"; then
dnl Use best guess from host as we can't use uname when cross compiling
OSINFO="\"$host\""
else
dnl TODO some samples are never built so far: mfc (requires VC++)
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS artprov controls dialogs drawing \
- erase event exec font image minimal mobile \
- mobile/wxedit mobile/styles render \
+ erase event exec font image minimal render \
shaped svg taborder vscroll widgets wrapsizer"
if test "$wxUSE_MONOLITHIC" != "yes"; then
fi
AC_SUBST(TOOLKIT_LOWERCASE)
AC_SUBST(TOOLKIT_VERSION)
+AC_SUBST(DYLIB_RPATH_INSTALL)
+AC_SUBST(DYLIB_RPATH_POSTLINK)
AC_SUBST(SAMPLES_RPATH_FLAG)
-AC_SUBST(SAMPLES_RPATH_POSTLINK)
AC_SUBST(HEADER_PAD_OPTION)
AC_SUBST(HOST_SUFFIX)
AC_SUBST(CPPUNIT_CFLAGS)