aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2005-06-09 12:10:38 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2005-06-09 12:10:38 +0000
commit58de3b0981c7e3f7b06eaeb0aa74511651782902 (patch)
tree0e26b05e4bd1fa2943c29a05ed9844d0a3a0f880
parent9ed78bfa0ae3b18f2eef5746e80fac089f1e32b1 (diff)
added support for mingw-xcompiler
svn path=/trunk/externals/zexy/; revision=3137
-rw-r--r--src/configure.ac168
1 files changed, 131 insertions, 37 deletions
diff --git a/src/configure.ac b/src/configure.ac
index 6e4461c..c94c1dc 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -1,18 +1,8 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(zexy.c)
-dnl for now i can test ICC only on linux
-dnl LATER we might want to use it for other platforms (namely:windoze) too
+LIBNAME=zexy
-if test `uname -s` = Linux;
-then
- AC_ARG_ENABLE(icc, [ --enable-icc enable ICC-support])
- if test "$enable_icc" = "yes"; then
- CC=icc
- LD=icc
- fi
-fi
-
dnl Checks for programs.
AC_PROG_CC
@@ -23,15 +13,20 @@ AC_SUBST(DFLAGS)
AC_SUBST(LFLAGS)
AC_SUBST(EXT)
AC_SUBST(LD)
+AC_SUBST(STRIP)
AC_SUBST(STRIPFLAGS)
AC_SUBST(ZEXY_VERSION)
AC_SUBST(REFERENCEPATH)
AC_SUBST(PDLIBDIR)
AC_SUBST(INCLUDES)
AC_SUBST(SOURCES)
+AC_SUBST(LIBNAME)
+
AC_ARG_WITH(pdversion, [ --with-pdversion=<ver> enforce a certain pd-version (e.g. 0.37)])
+AC_ARG_WITH(version, [ --with-version=<ver> enforce a certain zexy-version (e.g. 2.0)])
+AC_ARG_WITH(extension, [ --with-extension=<ext> enforce a certain extension for the dynamic library (e.g. dll)])
AC_ARG_ENABLE(lpt, [ --enable-lpt enable parallelport-support])
AC_ARG_ENABLE(icc, [ --enable-icc enable ICC-support])
if test `uname -s` = Darwin;
@@ -39,6 +34,46 @@ then
AC_ARG_ENABLE(bundle, [ --enable-bundleloader use bundle_loader (default: autodetect)])
fi
+dnl Checks for libraries.
+dnl Replace `main' with a function in -lc:
+AC_CHECK_LIB(c, main)
+AC_CHECK_LIB(crtdll, fclose)
+
+dnl Replace `main' with a function in -lm:
+AC_CHECK_LIB(m, main)
+dnl Replace `main' with a function in -lpthread:
+dnl AC_CHECK_LIB(pthread, main)
+dnl Replace `main' with a function in -lstk:
+dnl AC_CHECK_LIB(stk, main, STK=yes)
+
+
+dnl for now i can test ICC only on linux
+dnl LATER we might want to use it for other platforms (namely:windoze) too
+
+if test `uname -s` = Linux;
+then
+ AC_ARG_ENABLE(icc, [ --enable-icc enable ICC-support])
+ if test "$enable_icc" = "yes"; then
+ CC=icc
+ LD=icc
+ fi
+fi
+
+if test $includedir
+then
+ for id in $includedir
+ do
+ if test -d $id; then INCLUDES="-I$id $INCLUDES"; fi
+ done
+fi
+if test $libdir
+then
+ for id in $libdir
+ do
+ if test -d $id; then LIBS="-L$id $LIBS"; fi
+ done
+fi
+
if test $includedir
then
for id in $includedir
@@ -50,15 +85,7 @@ then
done
fi
-dnl Checks for libraries.
-dnl Replace `main' with a function in -lc:
-AC_CHECK_LIB(c, main)
-dnl Replace `main' with a function in -lm:
-AC_CHECK_LIB(m, main)
-dnl Replace `main' with a function in -lpthread:
-dnl AC_CHECK_LIB(pthread, main)
-dnl Replace `main' with a function in -lstk:
-dnl AC_CHECK_LIB(stk, main, STK=yes)
+AC_CHECK_LIB(pd, nullfn)
dnl Checks for header files.
AC_HEADER_STDC
@@ -71,8 +98,45 @@ dnl Checks for library functions.
AC_FUNC_MMAP
AC_CHECK_FUNCS(select socket strerror)
-dnl ifwe don't have $LD set, we set it to "ld"
-LD=${LD:-ld}
+dnl check for "-mms-bitfields" cflag
+dnl why is there no generic compiler-check for a given flag ?
+dnl it would make things so easy: AC_CHECK_FLAG([-mms-bitfields],,)
+AC_MSG_CHECKING("ms-bitfields")
+cat > conftest.c << EOF
+int main(){
+ return 0;
+}
+EOF
+if ${CC} ${INCLUDES} ${DFLAGS} -o conftest.o conftest.c ${CFLAGS} -mms-bitfields > /dev/null 2>&1
+then
+ echo "yes"
+ CFLAGS="${CFLAGS} -mms-bitfields"
+else
+ echo "no"
+fi
+
+
+
+dnl if we don't have $LD set, we set it to $(CC)
+LD=${LD:=$CC}
+dnl if we don't have $STRIP set, we set it to ${host}-strip or strip
+if test "x$STRIP" = "x"
+then
+ if test "x$host" != "x"
+ then
+ STRIP=${host}-strip
+ if $(which ${host}-strip > /dev/null)
+ then
+ :
+ else
+ STRIP="echo fake strip"
+ fi
+ else
+ STRIP=strip
+ fi
+fi
+dnl STRIP=${STRIP:=strip}
+
DFLAGS="-DZEXY_LIBRARY"
@@ -82,9 +146,12 @@ AC_MSG_CHECKING("pd\>=0.37")
if test "$with_pdversion" != ""
then
-echo -n "($with_pdversion)... "
+ echo -n "($with_pdversion)... "
PD_VERSION="$with_pdversion"
else
+ if test "x$cross_compiling" = "xno"
+ then
+
cat > conftest.c << EOF
#include <stdio.h>
#include "m_pd.h"
@@ -93,11 +160,16 @@ int main(){
return 0;
}
EOF
- if $CC $INCLUDES -o conftest.o conftest.c > /dev/null 2>&1
- then
- PD_VERSION=`./conftest.o`
+ if $CC $INCLUDES -o conftest.o conftest.c > /dev/null 2>&1
+ then
+ PD_VERSION=`./conftest.o`
+ else
+ PD_VERSION=""
+ fi
else
- PD_VERSION=""
+ dnl we are cross-compiling...
+ echo -n "(X)..."
+ PD_VERSION="0.38"
fi
fi
@@ -115,6 +187,14 @@ fi
dnl check for zexy-version (but why...)
AC_MSG_CHECKING("zexy-version")
+
+if test "$with_version" != ""
+then
+ echo -n "($with_version)...forced "
+ ZEXY_VERSION="$with_version"
+else
+ if test "x$cross_compiling" = "xno"
+ then
cat > conftest.c << EOF
#include <stdio.h>
#include "zexy.h"
@@ -124,20 +204,26 @@ int main(){
}
EOF
-if $CC $INCLUDES $DFLAGS -o conftest.o conftest.c > /dev/null 2>&1
-then
- ZEXY_VERSION=`./conftest.o`
- echo "$ZEXY_VERSION"
-else
- ZEXY_VERSION="X"
- echo "(unknown)"
+ if $CC $INCLUDES $DFLAGS -o conftest.o conftest.c > /dev/null 2>&1
+ then
+ ZEXY_VERSION=`./conftest.o`
+ echo "$ZEXY_VERSION"
+ else
+ ZEXY_VERSION="X"
+ echo "(unknown)"
+ fi
+ else
+ ZEXY_VERSION="X"
+ echo "(X)"
+ fi
fi
-
dnl
dnl OK, checks which machines are here now
+dnl this needs some rethinking when cross-compiling (?)
dnl
+
if test `uname -s` = Linux;
then
LFLAGS="-export_dynamic -shared"
@@ -196,12 +282,14 @@ if test `uname | sed -e 's/^MINGW.*/NT/'` = NT;
then
LD=gcc
INCLUDES="-I@prefix@/src"
- DFLAGS="-DMSW -DNT"
+dnl mingw should (does?) define __WIN32__ which is now used
+dnl DFLAGS="-DMSW -DNT"
LFLAGS="-shared @prefix@/bin/pd.dll"
EXT=dll
else
PDLIBDIR="/lib/pd"
- LIBS="-lc -lm"
+dnl this is handled by AC_CHECK_LIB above
+dnl LIBS="-lc -lm"
fi
if test `uname -s` = IRIX64;
then
@@ -236,6 +324,12 @@ then
fi
fi
+
+if test "x$with_extension" != "x"
+then
+ EXT=$with_extension
+fi
+
dnl check for LPT
AC_MSG_CHECKING("parallel-port")
if test "$enable_lpt" != "no"