Stop relying on uname and instead ask autoconf what platform

we are building for. This makes cross compiling things a lot
easier.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9990 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Pierre Ossman 2013-09-24 09:10:04 +00:00
parent 1029debb66
commit e1df29b852
8 changed files with 3502 additions and 155 deletions

View File

@ -66,7 +66,7 @@ clean:
done
distclean: clean
$(RM) config.*
$(RM) config.h config.log config.status
$(RM) fltk-config fltk.list makeinclude
$(RM) fltk.spec
$(RM) FL/Makefile
@ -90,7 +90,7 @@ fltk-config: configure configh.in fltk-config.in
touch config.h
chmod +x fltk-config
makeinclude: configure configh.in makeinclude.in
makeinclude: configure configh.in makeinclude.in config.guess config.sub
if test -f config.status; then \
./config.status --recheck; \
./config.status; \
@ -103,6 +103,11 @@ makeinclude: configure configh.in makeinclude.in
configure: configure.in
autoconf
config.guess config.sub:
-automake --add-missing 2> /dev/null
if [ ! -e config.sub ]; then echo NOTE: Using frozen copy of config.sub; cp misc/config.sub . ; fi
if [ ! -e config.guess ]; then echo NOTE: Using frozen copy of config.guess; cp misc/config.guess . ; fi
portable-dist:
epm -v -s fltk.xpm fltk

View File

@ -214,9 +214,12 @@ in my dev directory:
Configuring FLTK
------------------
Stay in your FLTK source-code directory. Type:
If you got FLTK via subversion then you need two extra steps. Otherwise skip
over this part. Stay in your FLTK source-code directory. Type the following
but ignore any errors from the second command:
autoconf
automake --add-missing
Now configure your FLTK installation:

View File

@ -91,9 +91,12 @@ dev directory:
2.3 Configuring FLTK
-----------------------
Stay in your FLTK source-code directory. Type:
If you got FLTK via subversion then you need two extra steps. Otherwise skip
over this part. Stay in your FLTK source-code directory. Type the following
but ignore any errors from the second command:
autoconf
automake --add-missing
Now configure your FLTK installation:

View File

@ -293,9 +293,12 @@ dev directory:
3.2 Configuring FLTK
-----------------------
Stay in your FLTK source-code directory. Type:
If you got FLTK via subversion then you need two extra steps. Otherwise skip
over this part. Stay in your FLTK source-code directory. Type the following
but ignore any errors from the second command:
autoconf
automake --add-missing
Now configure your FLTK installation:

View File

@ -24,15 +24,20 @@ AC_PREREQ(2.50)
dnl Required file in package...
AC_INIT(src/Fl.cxx)
AC_CANONICAL_HOST
dnl So --with-archflags option is used during "checking size of long"
if test `uname` = Darwin; then
if test "x$with_archflags" != x ; then
CFLAGS="$CFLAGS $with_archflags"
fi
USEMMFILES="Yes"
else
USEMMFILES="No"
fi
case $host_os in
darwin*)
if test "x$with_archflags" != x ; then
CFLAGS="$CFLAGS $with_archflags"
fi
USEMMFILES="Yes"
;;
*)
USEMMFILES="No"
;;
esac
AC_SUBST(USEMMFILES)
dnl FLTK library versions...
@ -46,18 +51,6 @@ AC_SUBST(FL_MINOR_VERSION)
AC_SUBST(FL_PATCH_VERSION)
AC_SUBST(FL_API_VERSION)
dnl Get the operating system and version number...
uname=`uname`
uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'`
if test "x$uname" = xIRIX64; then
uname="IRIX"
fi
if test "x$uname" = x; then
# Older MinGW doesn't provide any output when uname is run, even with "-s".
# Current MinGW (as of Jan. 2011) however does, so this is not necessary anymore...
uname="MINGW"
fi
dnl Do not automatically add "-g" to compiler options...
ARCHFLAGS="${ARCHFLAGS:=}"
CFLAGS="${CFLAGS:=}"
@ -70,21 +63,11 @@ OPTIM="${OPTIM:=}"
AC_SUBST(ARCHFLAGS)
AC_SUBST(OPTIM)
dnl in case of cross-compiling mingw32 under linux we must change uname for Win32 GUI
dnl run ./configure --host=i686-pc-ming32 try use X11 without change uname
if test "x$cross_compiling" != xno ; then
case $host_alias in
*mingw*)
uname=MINGW
;;
esac
fi
dnl OS-specific pre-tests...
dnl uname_GUI equals $uname unless we target Cygwin in combination with X11.
uname_GUI=$uname
case $uname in
CYGWIN*)
dnl host_os_gui equals $host_os unless we target Cygwin in combination with X11.
host_os_gui=$host_os
case $host_os in
cygwin*)
# Handle Cygwin option *first*, before all other tests.
AC_ARG_ENABLE(cygwin, [ --enable-cygwin use the Cygwin libraries [(default=no)]])
AC_ARG_ENABLE(x11, [ --enable-x11 use Cygwin with X11 [(default=no)]])
@ -100,7 +83,7 @@ case $uname in
else
# we target Cygwin in combination with X11
if test x$enable_x11 = xyes; then
uname_GUI="X11$uname"
host_os_gui="X11$host_os"
fi
fi
;;
@ -211,8 +194,8 @@ if test x$enable_shared = xyes; then
SHAREDSUFFIX=""
FLUID="fluid-shared"
case $uname in
Darwin*)
case $host_os in
darwin*)
DSONAME="libfltk.$FL_API_VERSION.dylib"
FLDSONAME="libfltk_forms.$FL_API_VERSION.dylib"
GLDSONAME="libfltk_gl.$FL_API_VERSION.dylib"
@ -221,7 +204,7 @@ if test x$enable_shared = xyes; then
DSOCOMMAND="\$(CXX) \$(ARCHFLAGS) \$(DSOFLAGS) -dynamiclib -lc -o"
;;
SunOS* | UNIX_S*)
solaris*)
DSONAME="libfltk.so.$FL_API_VERSION"
FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
@ -232,7 +215,7 @@ if test x$enable_shared = xyes; then
DSOLINK="-R$libdir"
fi
;;
HP-UX*)
hpux*)
DSONAME="libfltk.sl.$FL_API_VERSION"
FLDSONAME="libfltk_forms.sl.$FL_API_VERSION"
GLDSONAME="libfltk_gl.sl.$FL_API_VERSION"
@ -243,7 +226,7 @@ if test x$enable_shared = xyes; then
DSOLINK="-Wl,-rpath,$libdir"
fi
;;
IRIX*)
irix*)
DSONAME="libfltk.so.$FL_API_VERSION"
FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
@ -254,7 +237,7 @@ if test x$enable_shared = xyes; then
DSOLINK="-Wl,-rpath,$libdir"
fi
;;
OSF1*)
osf*)
DSONAME="libfltk.so.$FL_API_VERSION"
FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
@ -265,7 +248,7 @@ if test x$enable_shared = xyes; then
DSOLINK="-Wl,-rpath,$libdir"
fi
;;
Linux* | *BSD*)
linux* | *bsd*)
DSONAME="libfltk.so.$FL_API_VERSION"
FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
@ -276,7 +259,7 @@ if test x$enable_shared = xyes; then
DSOLINK="-Wl,-rpath,$libdir"
fi
;;
AIX*)
aix*)
DSONAME="libfltk_s.a"
FLDSONAME="libfltk_forms_s.a"
GLDSONAME="libfltk_gl_s.a"
@ -285,7 +268,7 @@ if test x$enable_shared = xyes; then
DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-bexpall,-bM:SRE,-bnoentry -o"
SHAREDSUFFIX="_s"
;;
CYGWIN* | MINGW*)
cygwin* | mingw*)
PICFLAG=0
if test x$enable_cygwin != xyes; then
DSONAME="mgwfltknox-$FL_API_VERSION.dll"
@ -364,8 +347,8 @@ AC_ARG_WITH(archflags, [ --with-archflags="flags"
use custom architecture flags
(possible Mac OS X values include -arch i386, -arch x86_64, -arch ppc)],
ARCHFLAGS="$withval")
case $uname in
Darwin*)
case $host_os in
darwin*)
# QD is not supported anymore since 1.3
AC_DEFINE(__APPLE_QUARTZ__)
;;
@ -375,8 +358,8 @@ dnl Find commands...
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
case $uname in
OSF1*)
case $host_os in
osf*)
INSTALL="`pwd`/install-sh -c"
;;
esac
@ -418,10 +401,6 @@ dnl this will only be used to compile resources for Windows .exe files
AC_PATH_TOOL(RC,windres)
dnl Architecture checks...
if test "$uname" != Darwin; then
AC_C_BIGENDIAN
fi
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
@ -435,7 +414,12 @@ else
AC_DEFINE(U32,unsigned long)
fi
fi
if test "$uname" != Darwin; then
case $host_os in
darwin*)
;;
*)
AC_C_BIGENDIAN
if test $ac_cv_sizeof_int -eq 8; then
AC_DEFINE(U64,unsigned)
else
@ -443,7 +427,8 @@ if test "$uname" != Darwin; then
AC_DEFINE(U64,unsigned long)
fi
fi
fi
;;
esac
dnl Does the C++ compiler support the bool type?
AC_CACHE_CHECK(whether the compiler recognizes bool as a built-in type,
@ -494,57 +479,40 @@ if test "$ac_cv_cxx_scandir_posix" = yes; then
AC_DEFINE(HAVE_SCANDIR)
AC_DEFINE(HAVE_SCANDIR_POSIX)
else
AC_CHECK_FUNC(scandir,
if test "x$uname" = xSunOS -o "x$uname" = xQNX; then
AC_MSG_WARN(Not using $uname scandir emulation function.)
else
AC_DEFINE(HAVE_SCANDIR)
fi)
AC_CHECK_FUNC(scandir,[
case $host_os in
solaris* | *qnx*)
AC_MSG_WARN(Not using $host_os scandir emulation function.)
;;
*)
AC_DEFINE(HAVE_SCANDIR)
;;
esac])
fi
AC_CHECK_FUNC(vsnprintf,[
case "$uname" in
HP-UX*)
if test "$uversion" = "1020"; then
AC_MSG_WARN(Not using built-in vsnprintf function because you are running HP-UX 10.20.)
else
AC_DEFINE(HAVE_VSNPRINTF)
fi
;;
OSF1*)
if test "$uversion" = "40"; then
AC_MSG_WARN(Not using built-in vsnprintf function because you are running Tru64 4.0.)
else
AC_DEFINE(HAVE_VSNPRINTF)
fi
;;
case $host_os in
hpux1020)
AC_MSG_WARN(Not using built-in vsnprintf function because you are running HP-UX 10.20.)
;;
osf4)
AC_MSG_WARN(Not using built-in vsnprintf function because you are running Tru64 4.0.)
;;
*)
AC_DEFINE(HAVE_VSNPRINTF)
;;
;;
esac])
AC_CHECK_FUNC(snprintf,[
case "$uname" in
HP-UX*)
if test "$uversion" = "1020"; then
AC_MSG_WARN(Not using built-in snprintf function because you are running HP-UX 10.20.)
else
AC_DEFINE(HAVE_SNPRINTF)
fi
;;
OSF1*)
if test "$uversion" = "40"; then
AC_MSG_WARN(Not using built-in snprintf function because you are running Tru64 4.0.)
else
AC_DEFINE(HAVE_SNPRINTF)
fi
;;
case $host_os in
hpux1020)
AC_MSG_WARN(Not using built-in snprintf function because you are running HP-UX 10.20.)
;;
osf4)
AC_MSG_WARN(Not using built-in snprintf function because you are running Tru64 4.0.)
;;
*)
AC_DEFINE(HAVE_SNPRINTF)
;;
;;
esac])
AC_CHECK_HEADER(strings.h, AC_DEFINE(HAVE_STRINGS_H))
AC_CHECK_FUNCS(strcasecmp strlcat strlcpy)
@ -594,13 +562,13 @@ AC_CHECK_HEADER(dlfcn.h, AC_DEFINE(HAVE_DLFCN_H))
dnl Check for audio libraries...
AUDIOLIBS=""
case $uname in
CYGWIN* | MINGW*)
case $host_os in
cygwin* | mingw*)
dnl Cygwin environment...
AUDIOLIBS="-lwinmm"
;;
Darwin*)
darwin*)
AUDIOLIBS="-framework CoreAudio"
;;
@ -760,11 +728,11 @@ dnl Test whether we want to check for pthreads. We must not do it on Windows
dnl unless we run under Cygwin with --enable-cygwin, since we always use
dnl native threads on Windows (even if libpthread is available)
check_pthread=yes
case $uname in
MINGW*)
case $host_os in
mingw*)
check_pthread=no
;;
CYGWIN*)
cygwin*)
if test "x$enable_cygwin" != xyes; then
check_pthread=no
fi
@ -794,9 +762,11 @@ if test "x$enable_threads" != xno -a x$check_pthread = xyes; then
# Solaris requires -D_POSIX_PTHREAD_SEMANTICS to
# be POSIX-compliant... :(
if test $uname = SunOS; then
PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS"
fi
case $host_os in
solaris*)
PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS"
;;
esac
break
fi
done
@ -815,8 +785,8 @@ AC_ARG_WITH(links, [ --with-links make header links for common missp
INSTALL_DESKTOP=""
UNINSTALL_DESKTOP=""
case $uname_GUI in
CYGWIN* | MINGW*)
case $host_os_gui in
cygwin* | mingw*)
dnl Cygwin environment, using windows GDI ...
# Recent versions of Cygwin are seriously broken and the size
# checks don't work because the shell puts out \r\n instead of
@ -860,7 +830,7 @@ case $uname_GUI in
fi
;;
Darwin*)
darwin*)
# MacOS X uses Cocoa for graphics.
LIBS="$LIBS -framework Cocoa"
@ -1024,8 +994,8 @@ case $uname_GUI in
# Make symlinks since UNIX/Linux is case sensitive,
# but Cygwin in general not.
case $uname in
CYGWIN*)
case $host_os in
cygwin*)
HLINKS="#"
;;
*)
@ -1053,14 +1023,14 @@ AC_SUBST(INSTALL_DESKTOP)
AC_SUBST(UNINSTALL_DESKTOP)
dnl Figure out the appropriate formatted man page extension...
case "$uname" in
*BSD* | Darwin*)
case "$host_os" in
*bsd* | darwin*)
# *BSD
CAT1EXT=0
CAT3EXT=0
CAT6EXT=0
;;
IRIX*)
irix*)
# SGI IRIX
CAT1EXT=z
CAT3EXT=z
@ -1080,12 +1050,12 @@ AC_SUBST(CAT6EXT)
dnl Fix "mandir" variable...
if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then
case "$uname" in
*BSD* | Darwin* | Linux*)
case "$host_os" in
*bsd* | darwin* | linux*)
# *BSD, Darwin, and Linux
mandir="\${prefix}/share/man"
;;
IRIX*)
irix*)
# SGI IRIX
mandir="\${prefix}/share/catman"
;;
@ -1101,9 +1071,15 @@ if test "$exec_prefix" = NONE; then
exec_prefix="\${prefix}"
fi
if test "$uname" = "IRIX" -a $uversion -ge 62 -a "$libdir" = "\${exec_prefix}/lib" -a "$exec_prefix" = "\${prefix}" -a "$prefix" = "/usr"; then
libdir="/usr/lib32"
fi
case $host_os in
irix[1-5]*)
;;
irix*)
if test "$libdir" = "\${exec_prefix}/lib" -a "$exec_prefix" = "\${prefix}" -a "$prefix" = "/usr"; then
libdir="/usr/lib32"
fi
;;
esac
dnl Define the command used to update the dependencies (this option
dnl mainly for FLTK core developers - not necessary for users)
@ -1123,9 +1099,13 @@ if test -n "$GCC"; then
# We know that Carbon is deprecated on OS X 10.4. To avoid hundreds of warnings
# we will temporarily disable 'deprecated' warnings on OS X.
if test "$uname" = "Darwin" -a $uversion -ge 800; then
OPTIM="-Wno-deprecated-declarations $OPTIM"
fi
case $host_os in
darwin[1-7])
;;
darwin*)
OPTIM="-Wno-deprecated-declarations $OPTIM"
;;
esac
# Set the default compiler optimizations...
if test -z "$DEBUGFLAG"; then
@ -1182,20 +1162,22 @@ if test -n "$GCC"; then
# Unlike the other compiler/optimization settings, this one is placed
# in CFLAGS and CXXFLAGS so that fltk-config will provide the option
# to clients - otherwise client apps will not compile properly...
if test "$uname" = SunOS; then
AC_MSG_CHECKING(if GCC supports -fpermissive)
case $host_os in
solaris*)
AC_MSG_CHECKING(if GCC supports -fpermissive)
OLDCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fpermissive"
AC_TRY_COMPILE(,,
CXXFLAGS="$CXXFLAGS -fpermissive"
AC_MSG_RESULT(yes),
CFLAGS="$OLDCFLAGS"
AC_MSG_RESULT(no))
fi
OLDCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fpermissive"
AC_TRY_COMPILE(,,
CXXFLAGS="$CXXFLAGS -fpermissive"
AC_MSG_RESULT(yes),
CFLAGS="$OLDCFLAGS"
AC_MSG_RESULT(no))
;;
esac
else
case "$uname" in
IRIX*)
case "$host_os" in
irix*)
# Running some flavor of IRIX; see which version and
# set things up according...
if test "$uversion" -ge 62; then
@ -1224,7 +1206,7 @@ else
fi
fi
;;
HP-UX*)
hpux*)
# Running HP-UX; these options should work for the HP compilers.
if test -z "$DEBUGFLAG"; then
if test "x$with_optim" != x; then
@ -1251,7 +1233,7 @@ else
fi
fi
;;
SunOS*)
solaris*)
# Solaris
if test -z "$DEBUGFLAG"; then
if test "x$with_optim" != x; then
@ -1265,7 +1247,7 @@ else
OPTIM="-KPIC $OPTIM"
fi
;;
AIX*)
aix*)
if test -z "$DEBUGFLAG"; then
if test "x$with_optim" != x; then
OPTIM="$with_optim $OPTIM"
@ -1288,15 +1270,17 @@ fi
OPTIM="$DEBUGFLAG $OPTIM"
dnl Take archflags away from CFLAGS (makefiles use ARCHFLAGS explicitly)
if test `uname` = Darwin; then
if test "x$with_archflags" != x ; then
CFLAGS="`echo $CFLAGS | sed -e "s/$with_archflags//g"`"
fi
fi
case $host_os in
darwin*)
if test "x$with_archflags" != x ; then
CFLAGS="`echo $CFLAGS | sed -e "s/$with_archflags//g"`"
fi
;;
esac
dnl Define the FLTK documentation directory...
case $uname in
MINGW*)
case $host_os in
mingw*)
# Determine the path where MSys has /usr installed
msyspath=`mount | grep '\/usr ' | cut -d ' ' -f -1 | sed -e 's/\\\/\// g'`
# Then substitute that in the WIN32 path instead of /usr
@ -1323,11 +1307,11 @@ echo ""
echo "Configuration Summary"
echo "-------------------------------------------------------------------------"
case $uname_GUI in
CYGWIN* | MINGW*)
case $host_os_gui in
cygwin* | mingw*)
graphics="GDI"
;;
Darwin*)
darwin*)
graphics="Quartz"
;;
*)
@ -1352,8 +1336,8 @@ echo " exec_prefix=$exec_prefix"
echo " includedir=$includedir"
echo " libdir=$libdir"
echo " mandir=$mandir"
case $uname in
MINGW*)
case $host_os in
mingw*)
echo " MSys docpath=$msyspath/local/share/doc/fltk"
;;
esac

View File

@ -61,6 +61,9 @@ sed -e '1,$s/@VERSION@/'$version'/' \
echo Creating configure script...
autoconf -f
echo Creating config.guess and config.sub \(ignore any other errors\)...
automake --add-missing --copy
echo Cleaning developer files...
rm -rf OpenGL autom4te* bc5 config forms glut images packages themes
rm -f makesrcdist

1558
misc/config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

1788
misc/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff