Diff of /configure.ac [d12821] .. [20e829] Maximize Restore

  Switch to side-by-side view

--- a/configure.ac
+++ b/configure.ac
@@ -1,84 +1,93 @@
 AC_PREREQ(2.59)
 AC_INIT(pd,0.43.0)
 AC_CONFIG_SRCDIR(src/m_pd.c)
+AC_CONFIG_AUX_DIR([m4/config])
+AM_INIT_AUTOMAKE
+AC_CONFIG_MACRO_DIR([m4/generated])
+
 AC_CANONICAL_HOST
-AM_INIT_AUTOMAKE(1.9)
+
+# you will need to install iPhone XCode on Mac OS X to use this:
+PD_CHECK_IPHONE(IPHONEOS=yes, IPHONEOS=no, AC_MSG_ERROR([iPhoneOS SDK not available]))
+PD_CHECK_ANDROID(ANDROID=yes, ANDROID=no , AC_MSG_ERROR([Android SDK not available]))
 
 case $host in
-powerpc-apple-darwin* | i*86*-apple-darwin*)
-		MACOSX=yes
-		portaudio=yes
-		portmidi=yes
-		CFLAGS="$CFLAGS -fast -funroll-loops -fomit-frame-pointer"
-		INCLUDES="$INCLUDES -I/sw/include"
-		LDFLAGS="$LDFLAGS -L/sw/lib"
-		;;
-arm*darwin*)
-        # you will need to install iPhone XCode on Mac OS X to use this:
-		IPHONEOS=yes
-        IPHONE_BASE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin
-        CC=$IPHONE_BASE/gcc
-        CPP=$IPHONE_BASE/cpp
-		CFLAGS="$CFLAGS -miphoneos-version-min=3.0 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk -arch armv6 -fast -funroll-loops -fomit-frame-pointer"
-		INCLUDES="$INCLUDES -I/sw/include"
-		LDFLAGS="$LDFLAGS -arch armv6 -L/sw/lib"
-        # workaround for rpl_malloc/rpl_realloc bug in autoconf when cross-compiling
-        ac_cv_func_malloc_0_nonnull=yes
-        ac_cv_func_realloc_0_nonnull=yes
-		;;
-arm-linux)
-        ANDROID=yes
-        ANDROID_PATH=/home/hans/Documents/android/android-ndk-1.6_r1
-        ANDROID_GCC_PATH=$ANDROID_PATH/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin
-        TARGET_PLATFORM=android-4
-        TARGET_ARCH_ABI=arm
-        SYSROOT=$ANDROID_PATH/build/platforms/$TARGET_PLATFORM/arch-$TARGET_ARCH_ABI
-        CC=$ANDROID_GCC_PATH/arm-eabi-gcc
-        CPP=$ANDROID_GCC_PATH/arm-eabi-cpp
-        LD=$ANDROID_GCC_PATH/arm-eabi-ld
-        CPPFLAGS=-I$SYSROOT/usr/include
-        # TODO the API needs to be set, its currently disabled
-        CONFIG_MACROS="-DANDROID -D__linux__ -DHAVE_UNISTD_H -DHAVE_LIBDL -D__BSD_VISIBLE=1"
-		CFLAGS="$CONFIG_MACROS -I$SYSROOT/usr/include -march=armv5te -mtune=xscale -msoft-float -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -mthumb -O2 -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64"
-        TARGET_LIBGCC=`$CC -print-libgcc-file-name`
-        LDFLAGS="-nostdlib -Wl,--no-undefined -Wl,-rpath-link=$SYSROOT/usr/lib $TARGET_LIBGCC"
-        # workaround for rpl_malloc/rpl_realloc bug in autoconf when cross-compiling
-        ac_cv_func_malloc_0_nonnull=yes
-        ac_cv_func_realloc_0_nonnull=yes
-		;;
-*linux*)
-		LINUX=yes
-		portaudio=yes
-		CFLAGS="$CFLAGS -O6 -funroll-loops -fomit-frame-pointer"
-		;;
+*darwin*)
+	if test "x${IPHONEOS}" = "xno"; then
+	 portaudio=yes
+	 portmidi=yes
+	 MACOSX=yes
+
+	 EXTERNAL_CFLAGS="-fPIC"
+	 EXTERNAL_EXTENSION=d_fat
+	else
+	 portaudio=no
+
+	 EXTERNAL_CFLAGS=
+	 EXTERNAL_EXTENSION=pd_darwin
+	fi
+
+	CFLAGS="$CFLAGS -fast -funroll-loops -fomit-frame-pointer"
+	INCLUDES="$INCLUDES -I/sw/include"
+	LDFLAGS="$LDFLAGS -L/sw/lib"
+	EXTERNAL_LDFLAGS="-bundle -undefined dynamic_lookup"
+	;;
+*linux*|GNU|GNU/kFreeBSD)
+# GNU and GNU/kFreeBSD are for Debian, were they are treated very similar to linux
+	if test "x${host}" = "xGNU"; then
+	 HURD=yes
+	fi
+	if test "x${ANDROID}" = "xno"; then
+	 LINUX=yes
+	 portaudio=yes
+	 CFLAGS="$CFLAGS -O6 -funroll-loops -fomit-frame-pointer"
+	fi
+	EXTERNAL_CFLAGS="-fPIC"
+	EXTERNAL_LDFLAGS="-Wl,--export-dynamic -shared -fPIC"
+	EXTERNAL_EXTENSION=pd_linux
+	;;
 *mingw*)
-		WINDOWS=yes
-		MINGW=yes
+	WINDOWS=yes
+	MINGW=yes
 # ASIO doesn't build yet with the autotools setup. We need to figure out how
 #        to make the final linking phase use g++
 #		asio=yes
-		portaudio=yes
-		CFLAGS="$CFLAGS -mcpu=i586 -mtune=pentium3 -O6 -funroll-loops -fomit-frame-pointer"
+	portaudio=yes
+	CFLAGS="$CFLAGS -mcpu=i586 -mtune=pentium3 -O6 -funroll-loops -fomit-frame-pointer"
 # ASIO is a C++ library, so if its included, then use g++ to build
-		CC=g++
-		;;
+	CC=g++
+	EXTERNAL_CFLAGS="-mms-bitfields"
+	EXTERNAL_LDFLAGS="-s -shared -Wl,--enable-auto-import -lpd"
+	EXTERNAL_EXTENSION=dll
+	;;
 *cygwin*)
-		WINDOWS=yes
-		CYGWIN=yes
-		portaudio=yes
-		CFLAGS="$CFLAGS -mcpu=i586 -mtune=pentium3 -O6 -funroll-loops -fomit-frame-pointer"
-		;;
+	WINDOWS=yes
+	CYGWIN=yes
+	portaudio=yes
+	CFLAGS="$CFLAGS -mcpu=i586 -mtune=pentium3 -O6 -funroll-loops -fomit-frame-pointer"
+	EXTERNAL_CFLAGS=
+	EXTERNAL_LDFLAGS="-Wl,--export-dynamic -shared -lpd"
+	EXTERNAL_EXTENSION=dll
+	;;
 esac
+
+PD_CHECK_UNIVERSAL(ARCH, universal=yes, universal=no)
+AM_CONDITIONAL(UNIVERSAL, test x$universal = xyes)
+if test "x${universal}" = "xyes"; then
+ CFLAGS="${CFLAGS} ${ARCH_CFLAGS}"
+ LDFLAGS="${LDFLAGS} ${ARCH_LDFLAGS}"
+fi
+
 AM_CONDITIONAL(ANDROID, test x$ANDROID = xyes)
 AM_CONDITIONAL(IPHONEOS, test x$IPHONEOS = xyes)
 AM_CONDITIONAL(LINUX, test x$LINUX = xyes)
+AM_CONDITIONAL(HURD, test x$HURD = xyes)
 AM_CONDITIONAL(MACOSX, test x$MACOSX = xyes)
 AM_CONDITIONAL(WINDOWS, test x$WINDOWS = xyes)
 AM_CONDITIONAL(CYGWIN, test x$MINGW = xyes)
 AM_CONDITIONAL(MINGW, test x$MINGW = xyes)
 
 # Configure libtool
-AC_CONFIG_MACRO_DIR([m4])
 AC_LIBTOOL_DLOPEN
 AC_LIBTOOL_WIN32_DLL
 AC_PROG_LIBTOOL
@@ -96,6 +105,10 @@
 AC_SUBST(EXTERNTARGET)
 AC_SUBST(INCLUDES)
 
+AC_SUBST(EXTERNAL_EXTENSION)
+AC_SUBST(EXTERNAL_CFLAGS)
+AC_SUBST(EXTERNAL_LDFLAGS)
+
 dnl Checks for libraries.
 AC_CHECK_LIB([dl], [dlopen])
 AC_CHECK_LIBM
@@ -103,11 +116,12 @@
 # src/Makefile.am under pd_LDFLAGS as well
 
 # Checking for `pthread_create' function in -pthread (MinGW uses unusual names)
+## CHECK whether this can be replaced by AX_PTHREAD
 AC_CHECK_LIB([pthread], [pthread_create],LIBS="-lpthread $LIBS",
     AC_CHECK_LIB([pthreadGC2], [pthread_create], LIBS="-lpthreadGC2 $LIBS",
         AC_CHECK_LIB([pthreadGC1], [pthread_create], LIBS="-lpthreadGC1 $LIBS",
             AC_CHECK_LIB([pthreadGC], [pthread_create], LIBS="-lpthreadGC $LIBS",
-         echo "WARNING! pthreads required"))))
+         AC_MSG_WARN([pthreads required])))))
 
 AC_HEADER_STDC
 
@@ -117,32 +131,26 @@
 AM_CONDITIONAL(OSS, test x$oss = xyes)
 
 AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [coreaudio=yes], [coreaudio=no])
+
 dnl portaudio/CoreAudio doesn't work with iPhone
 test x$IPHONEOS = xyes && coreaudio=no
+
 AM_CONDITIONAL(COREAUDIO, test x$coreaudio = xyes)
 
 dnl TODO implement debug and static
-AC_ARG_ENABLE(static,   [  --enable-static         link statically],
-    static=$enableval)
-
-AC_ARG_ENABLE([debug],
-	[AS_HELP_STRING([--enable-debug], [use debugging support])], 
-		[debug=$enableval])
-if test x$debug = xyes; then
-    CFLAGS="$CFLAGS -g"
-fi
-
-AC_ARG_ENABLE([universal],
-	[AS_HELP_STRING([--enable-universal],
-		[build universal binary on Mac OS X])], 
-    [universal=$enableval], [universal=no])
-AM_CONDITIONAL(UNIVERSAL, test x$universal = xyes)
-if test x$universal = xyes; then
-   CFLAGS="$CFLAGS -fast -ffast-math -arch ppc7400 -arch i386 -arch ppc64 -arch x86_64 \
-             -mmacosx-version-min=10.5"
-   LDFLAGS="$LDFLAGS -arch ppc7400 -arch i386 -arch ppc64 -arch x86_64 -mmacosx-version-min=10.5"
-fi
-
+#AC_ARG_ENABLE(static,   [  --enable-static         link statically],
+#    static=$enableval)
+
+#AC_ARG_ENABLE([debug],
+#	[AS_HELP_STRING([--enable-debug], [use debugging support])], 
+#		[debug=$enableval])
+#if test x$debug = xyes; then
+#    CFLAGS="$CFLAGS -g"
+#fi
+
+dnl ALSA
+dnl shouldn't we use AM_PATH_ALSA from /usr/share/aclocal/alsa.m4
+dnl alternatively we could use pkg-config
 AC_ARG_ENABLE([alsa],
 	[AS_HELP_STRING([--disable-alsa],
 		[do not use ALSA audio driver])],
@@ -151,6 +159,7 @@
     AC_CHECK_LIB(asound,snd_pcm_info,LIBS="$LIBS -lasound",alsa=no)])
 AM_CONDITIONAL(ALSA, test x$alsa = xyes)
 
+dnl ASIO
 AC_ARG_ENABLE([asio],
 	[AS_HELP_STRING([--enable-asio],
 		[do not use ASIO audio driver])],
@@ -159,23 +168,28 @@
     AC_CHECK_FILE([asio/ASIOSDK2/common/asio.h],[asio=yes],[asio=no])])
 AM_CONDITIONAL(ASIO, test x$asio = xyes)
 
+dnl JACK
+dnl shouldn't we use pkg-config?
 dnl TODO support jack xrun
 AC_ARG_ENABLE([jack],
 	[AS_HELP_STRING([--enable-jack],
 		[use JACK audio server])],
 	[jack=$enableval])
 AS_IF([test x$jack = xyes], [
+    AC_CHECK_LIB(rt,shm_open,LIBS="$LIBS -lrt")
     AC_CHECK_LIB(jack,jack_set_xrun_callback,LIBS="$LIBS -ljack";jack=xrun)
     AC_CHECK_LIB(jack,jack_set_error_function,LIBS="$LIBS -ljack";jack=yes,
 		jack=no)])
 AM_CONDITIONAL(JACK, test x$jack = xyes)
 
+dnl portaudio
 AC_ARG_ENABLE([portaudio],
 		[AS_HELP_STRING([--disable-portaudio],
 			[do not use portaudio])],
     	[portaudio=$enableval])	
 AM_CONDITIONAL(PORTAUDIO, test x$portaudio = xyes)
 
+dnl portmidi
 AC_ARG_ENABLE([portmidi],
 	[AS_HELP_STRING([--enable-portmidi],
 		[use portmidi])],
@@ -190,7 +204,7 @@
     [fftw=$enableval])
 if test x$fftw = xyes; then
     AC_CHECK_LIB(fftw, fftw_one, [LIBS="$LIBS -lfftw"],
-        [echo "fftw package not found - using built-in FFT"; fftw=no])
+        [AC_MSG_NOTICE([fftw package not found - using built-in FFT]); fftw=no])
 fi
 AM_CONDITIONAL(FFTW, test x$fftw = xyes)
 
@@ -215,7 +229,7 @@
 
 # check for programs
 AC_CHECK_PROG(HAVE_MSGFMT, [msgfmt], yes, no)
-test x$HAVE_MSGFMT = xyes || echo "WARNING: Install GNU gettext with msgfmt if you want localizations to be compiled!"
+test x$HAVE_MSGFMT = xyes || AC_MSG_WARN([Install GNU gettext with msgfmt if you want localizations to be compiled!])
 AM_CONDITIONAL(MSGFMT, test x$HAVE_MSGFMT = xyes)
 
 # Specify what files are to be created.
@@ -226,7 +240,20 @@
                 portmidi/Makefile
                 tcl/Makefile
                 po/Makefile
-                src/Makefile])
+                src/Makefile
+                extra/Makefile
+		extra/bonk~/GNUmakefile
+		extra/choice/GNUmakefile
+		extra/expr~/GNUmakefile
+		extra/fiddle~/GNUmakefile
+		extra/loop~/GNUmakefile
+		extra/lrshift~/GNUmakefile
+		extra/pd~/GNUmakefile
+		extra/pique/GNUmakefile
+		extra/sigmund~/GNUmakefile
+		extra/stdout/GNUmakefile
+                pd.pc
+                ])
 
 AC_OUTPUT
 
@@ -238,3 +265,4 @@
 ASIO SDK not found! You need to download asiosdk2.2.zip from: 
     http://www.steinberg.net/en/company/3rd_party_developer.html)])])
 
+