clean up build
authorAndreas Oberritter <obi@opendreambox.org>
Fri, 22 Oct 2010 16:10:02 +0000 (16:10 +0000)
committerAndreas Oberritter <obi@opendreambox.org>
Tue, 16 Nov 2010 16:09:12 +0000 (17:09 +0100)
* reduce use of TUXBOX macros
* fix compiler warnings by including Python.h from the command-line
* use libtool to build and link main/* and lib/*
* don't link libmad, libid3tag, libcrypt, libresolv, librt, ldl into e2
* fix make rules of actionids.h

25 files changed:
configure.ac
lib/Makefile.am
lib/actions/Makefile.am
lib/actions/action.h
lib/actions/parseactions.py
lib/base/Makefile.am
lib/base/console.h
lib/components/Makefile.am
lib/driver/Makefile.am
lib/dvb/Makefile.am
lib/dvb_ci/Makefile.am
lib/gdi/Makefile.am
lib/gui/Makefile.am
lib/mmi/Makefile.am
lib/nav/Makefile.am
lib/python/Makefile.am
lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am
lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am
lib/python/connections.h
lib/python/python.h
lib/service/Makefile.am
m4/ax_pthread.m4 [new file with mode: 0644]
m4/tuxbox.m4
main/Makefile.am
tools/Makefile.am

index 429a686..91de157 100644 (file)
@@ -1,7 +1,9 @@
 AC_INIT([enigma2],[2.8.0],[enigma2-devel@lists.elitedvb.net])
-AM_INIT_AUTOMAKE([dist-bzip2 no-define])
+AM_INIT_AUTOMAKE([dist-bzip2 no-define silent-rules])
+
+AC_USE_SYSTEM_EXTENSIONS
+AC_SYS_LARGEFILE
 
-TUXBOX_APPS
 TUXBOX_APPS_DIRECTORY
 
 AC_PROG_CC
@@ -25,25 +27,18 @@ AM_CONDITIONAL(HAVE_DDVDLIB, test "$have_ddvdlib" = "yes")
 
 AM_PATH_PYTHON
 AX_PYTHON_DEVEL
+AX_PTHREAD
 
 TUXBOX_APPS_DVB
 
-PKG_CHECK_MODULES(FREETYPE, freetype2)
-PKG_CHECK_MODULES(FRIBIDI, fribidi)
-PKG_CHECK_MODULES(GSTREAMER, gstreamer-0.10, HAVE_GSTREAMER="yes", HAVE_GSTREAMER="no")
-PKG_CHECK_MODULES(GSTREAMERPBUTILS, gstreamer-pbutils-0.10, HAVE_GSTSTREAMERPBUTILS="yes", HAVE_GSTSTREAMERPBUTILS="no")
-PKG_CHECK_MODULES(ID3TAG, id3tag)
-PKG_CHECK_MODULES(DVBSI, libdvbsi++)
-PKG_CHECK_MODULES(PNG, libpng)
+PKG_CHECK_MODULES(BASE, [freetype2 fribidi gstreamer-0.10 gstreamer-pbutils-0.10 libdvbsi++ libpng libxml-2.0 sigc++-1.2])
 PKG_CHECK_MODULES(LIBXINE, libxine, HAVE_LIBXINE="yes", HAVE_LIBXINE="no")
-PKG_CHECK_MODULES(XML2, libxml-2.0)
-PKG_CHECK_MODULES(MAD, mad)
-PKG_CHECK_MODULES(SIGC, sigc++-1.2)
-AC_CHECK_LIB(jpeg, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no")
-JPEG_LIBS="-ljpeg"
-AC_SUBST(JPEG_LIBS)
-
-AC_SUBST(LIBUNGIF_LIBS,"")
+
+AC_CHECK_LIB([dl], [dlopen], [LIBDL_LIBS="-ldl"])
+AC_SUBST(LIBDL_LIBS)
+AC_CHECK_LIB([jpeg], [jpeg_set_defaults])
+AC_CHECK_LIB([xmlccwrap], [exit])
+
 AC_CHECK_HEADERS(gif_lib.h,
        AC_CHECK_LIB(ungif,DGifOpen,
        [AC_DEFINE(HAVE_LIBUNGIF,1,[Define if you have libgif/libungif including devel headers])
@@ -51,27 +46,20 @@ AC_CHECK_HEADERS(gif_lib.h,
                [AC_CHECK_LIB(gif,DGifOpen,
                        [AC_DEFINE(HAVE_LIUNBGIF,1)
                        LIBUNGIF_LIBS="-lgif"])]))
-
-# ok, we are in trouble: XMLCCWRAP only defines C++ symbols. So let's just check if linking works,
-# and assume everything will be ok. Then just check for the "exit" symbol, which should be always there.
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
-TUXBOX_APPS_LIB_SYMBOL(XMLCCWRAP, xmlccwrap, exit)
-AC_LANG_RESTORE
+AC_SUBST(LIBUNGIF_LIBS)
 
 if test "$with_sdl" = "yes" ; then
        PKG_CHECK_MODULES(SDL, sdl)
-       AC_DEFINE_UNQUOTED([WITH_SDL],[1],[Define to 1 if you have libsdl])
+       AC_DEFINE([WITH_SDL],[1],[Define to 1 if you have libsdl])
 fi
 # allow 'if WITH_SDL' conditionals in Makefile.am
 AM_CONDITIONAL(WITH_SDL, test "$with_sdl" = "yes")
 
-CPPFLAGS="$CPPFLAGS "'-I$(top_srcdir)'
-CPPFLAGS="$CPPFLAGS -D_REENTRANT $PYTHON_CPPFLAGS $MD5SUM_CFLAGS $FREETYPE_CFLAGS $FRIBIDI_CFLAGS $ID3TAG_CFLAGS $MAD_CFLAGS $PLUGINS_CFLAGS $PNG_CFLAGS $SDL_CFLAGS $SIGC_CFLAGS $XMLTREE_CFLAGS $DVBSI_CFLAGS $GSTREAMER_CFLAGS $GSTREAMERPBUTILS_CFLAGS $LIBXINE_CFLAGS $LIBUNGIF_CFLAGS"
+CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
+CXXFLAGS="$CXXFLAGS $BASE_CFLAGS $LIBUNGIF_CFLAGS $LIBXINE_CFLAGS $PTHREAD_CFLAGS $SDL_CFLAGS -fno-rtti -fno-exceptions -Wall"
+LDFLAGS="$LDFLAGS $BASE_LDFLAGS $PYTHON_LDFLAGS $SDL_LDFLAGS $LIBUNGIF_LDFLAGS $LIBXINE_LDFLAGS"
+
 #CPPFLAGS="$CPPFLAGS -DMEMLEAK_CHECK"
-CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions -Wall"
-LDFLAGS="$LDFLAGS -pthread $PYTHON_LDFLAGS $SDL_LDFLAGS $GSTREAMER_LDFLAGS $GSTREAMERPBUTILS_LDFLAGS $LIBXINE_LDFLAGS $LIBUNGIF_LDFLAGS"
-#LDFLAGS="-rdynamic $LDFLAGS"
 
 TUXBOX_APPS_GETTEXT
 
index bd89aee..f561748 100644 (file)
@@ -1 +1,18 @@
 SUBDIRS = actions base components dvb dvb_ci gdi service driver nav gui python mmi
+
+noinst_LTLIBRARIES = libenigma.la
+
+libenigma_la_SOURCES =
+libenigma_la_LIBADD = \
+       $(top_builddir)/lib/actions/libenigma_actions.la \
+       $(top_builddir)/lib/base/libenigma_base.la \
+       $(top_builddir)/lib/components/libenigma_components.la \
+       $(top_builddir)/lib/driver/libenigma_driver.la \
+       $(top_builddir)/lib/mmi/libenigma_mmi.la \
+       $(top_builddir)/lib/dvb/libenigma_dvb.la \
+       $(top_builddir)/lib/dvb_ci/libenigma_dvb_ci.la \
+       $(top_builddir)/lib/gdi/libenigma_gdi.la \
+       $(top_builddir)/lib/gui/libenigma_gui.la \
+       $(top_builddir)/lib/python/libenigma_python.la \
+       $(top_builddir)/lib/nav/libenigma_nav.la \
+       $(top_builddir)/lib/service/libenigma_service.la
index 05a5088..45f0177 100644 (file)
@@ -1,15 +1,21 @@
 AM_CPPFLAGS = \
-       -I$(top_srcdir)/include
+       -I$(top_builddir) \
+       -I$(top_srcdir)/include \
+       -include Python.h
 
-noinst_LIBRARIES = libenigma_actions.a
+EXTRA_DIST = parseactions.py
 
-libenigma_actions_a_SOURCES = \
-       action.cpp 
+noinst_LTLIBRARIES = libenigma_actions.la
 
+libenigma_actions_la_SOURCES = \
+       action.cpp \
+       action.h
+
+BUILT_SOURCES = actionids.h
 CLEANFILES = actionids.h
 
 action.cpp: actionids.h
 
-actionids.h:
-        python ./parseactions.py include ../gui/*.h > actionids.h
-        python ./parseactions.py parse ../gui/*.h >> actionids.h
+actionids.h: $(top_srcdir)/lib/gui/*.h
+       $(PYTHON) $(srcdir)/parseactions.py include $(top_srcdir)/lib/gui/*.h > $@
+       $(PYTHON) $(srcdir)/parseactions.py parse $(top_srcdir)/lib/gui/*.h >> $@
index cbf5370..edcfac6 100644 (file)
@@ -3,10 +3,6 @@
 
 #include <lib/base/object.h>
 
-               /* avoid warnigs :) */
-#include <features.h>
-#undef _POSIX_C_SOURCE
-#define _POSIX_C_SOURCE 200112L
 #include <lib/python/python.h>
 #include <string>
 #include <map>
index 2462a75..cad432a 100644 (file)
@@ -89,7 +89,7 @@ def do_file(f, mode):
 
                                                if mode == "include":
                                                        # hack hack hack!!
-                                                       print "#include <lib" + f[2:] + ">"
+                                                       print "#include <lib/" + '/'.join(f.split('/')[-2:]) + ">"
                                                else:
                                                        print "\t// " + f
 
index df6d2b8..5fd3eaf 100644 (file)
@@ -1,9 +1,11 @@
 AM_CPPFLAGS = \
-       -I$(top_srcdir)/include
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include \
+       -include Python.h
 
-noinst_LIBRARIES = libenigma_base.a
+noinst_LTLIBRARIES = libenigma_base.la
 
-libenigma_base_a_SOURCES = \
+libenigma_base_la_SOURCES = \
        buffer.cpp ebase.cpp eerror.cpp elock.cpp \
        init.cpp message.cpp thread.cpp \
        smartptr.cpp estring.cpp connection.cpp \
index e730b40..60540da 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef __LIB_BASE_CONSOLE_H__
 #define __LIB_BASE_CONSOLE_H__
 
-#include "Python.h"
 #include <string>
 #include <lib/base/ebase.h>
 #include <lib/python/connections.h>
index e6d21d7..960e101 100644 (file)
@@ -1,6 +1,8 @@
 AM_CPPFLAGS = \
-       -I$(top_srcdir)/include
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include \
+       -include Python.h
 
-noinst_LIBRARIES = libenigma_components.a
+noinst_LTLIBRARIES = libenigma_components.la
 
-libenigma_components_a_SOURCES = scan.cpp file_eraser.cpp
+libenigma_components_la_SOURCES = scan.cpp file_eraser.cpp
index 244c132..4b8fc08 100644 (file)
@@ -1,7 +1,9 @@
 AM_CPPFLAGS = \
-       -I$(top_srcdir)/include
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include \
+       -include Python.h
 
-noinst_LIBRARIES = libenigma_driver.a
+noinst_LTLIBRARIES = libenigma_driver.la
 
-libenigma_driver_a_SOURCES = \
+libenigma_driver_la_SOURCES = \
        rc.cpp rcinput.cpp rcconsole.cpp avswitch.cpp rfmod.cpp etimezone.cpp misc_options.cpp
index ee81c21..cef7140 100644 (file)
@@ -1,11 +1,13 @@
 SUBDIRS = lowlevel
 
 AM_CPPFLAGS = \
-       -I$(top_srcdir)/include
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include \
+       -include Python.h
 
-noinst_LIBRARIES = libenigma_dvb.a
+noinst_LTLIBRARIES = libenigma_dvb.la
 
-libenigma_dvb_a_SOURCES = dvb.cpp demux.cpp frontend.cpp esection.cpp db.cpp \
+libenigma_dvb_la_SOURCES = dvb.cpp demux.cpp frontend.cpp esection.cpp db.cpp \
        sec.cpp scan.cpp crc32.cpp pmt.cpp decoder.cpp eit.cpp rotor_calc.cpp \
        epgcache.cpp dvbtime.cpp metaparser.cpp volume.cpp tstools.cpp pvrparse.cpp \
        pesparse.cpp teletext.cpp radiotext.cpp subtitle.cpp
index e98636e..153f8c0 100644 (file)
@@ -1,9 +1,11 @@
 AM_CPPFLAGS = \
-       -I$(top_srcdir)/include
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include \
+       -include Python.h
 
-noinst_LIBRARIES = libenigma_dvb_ci.a
+noinst_LTLIBRARIES = libenigma_dvb_ci.la
 
-libenigma_dvb_ci_a_SOURCES = dvbci.cpp dvbci_session.cpp dvbci_resmgr.cpp \
+libenigma_dvb_ci_la_SOURCES = dvbci.cpp dvbci_session.cpp dvbci_resmgr.cpp \
                                                                                                                 dvbci_appmgr.cpp dvbci_camgr.cpp \
                                                                                                                 dvbci_datetimemgr.cpp dvbci_mmi.cpp \
                                                                                                                 dvbci_ui.cpp
index 192a96f..192990b 100644 (file)
@@ -1,15 +1,15 @@
 AM_CPPFLAGS = \
-       -I$(top_srcdir)/include -I$(top_srcdir)/lib/gdi/ati
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include \
+       -include Python.h
 
-noinst_LIBRARIES = libenigma_gdi.a
+noinst_LTLIBRARIES = libenigma_gdi.la
 
-libenigma_gdi_a_SOURCES = \
+libenigma_gdi_la_SOURCES = \
        region.cpp grc.cpp epng.cpp erect.cpp fb.cpp font.cpp font_arabic.cpp gfbdc.cpp  \
        glcddc.cpp gpixmap.cpp lcd.cpp gfont.cpp accel.cpp picload.cpp picexif.cpp \
        compositing.cpp bcm.cpp
 
 if WITH_SDL
-libenigma_gdi_a_SOURCES += sdl.cpp
+libenigma_gdi_la_SOURCES += sdl.cpp
 endif
-
-#      ati/2dablt.cpp ati/2dcore.cpp ati/ati_core.cpp ati/test.cpp ati/2dutil.cpp
index 8293b2e..290eaab 100644 (file)
@@ -1,10 +1,11 @@
 AM_CPPFLAGS = \
+       -I$(top_srcdir) \
        -I$(top_srcdir)/include \
-       -I$(top_srcdir)/src
+       -include Python.h
 
-noinst_LIBRARIES = libenigma_gui.a
+noinst_LTLIBRARIES = libenigma_gui.la
 
-libenigma_gui_a_SOURCES = \
+libenigma_gui_la_SOURCES = \
        ebutton.cpp elabel.cpp eslider.cpp ewidget.cpp ewidgetdesktop.cpp  \
        ewindow.cpp ewindowstyle.cpp elistbox.cpp elistboxcontent.cpp \
        epixmap.cpp ewindowstyleskinned.cpp einput.cpp einputstring.cpp einputnumber.cpp \
index 4a514fc..f72d158 100644 (file)
@@ -1,6 +1,8 @@
 AM_CPPFLAGS = \
-       -I$(top_srcdir)/include
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include \
+       -include Python.h
 
-noinst_LIBRARIES = libenigma_mmi.a
+noinst_LTLIBRARIES = libenigma_mmi.la
 
-libenigma_mmi_a_SOURCES = mmi_ui.cpp
+libenigma_mmi_la_SOURCES = mmi_ui.cpp
index 28adfe6..9346869 100644 (file)
@@ -1,9 +1,11 @@
 AM_CPPFLAGS = \
-       -I$(top_srcdir)/include
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include \
+       -include Python.h
 
-noinst_LIBRARIES = libenigma_nav.a
+noinst_LTLIBRARIES = libenigma_nav.la
 
-libenigma_nav_a_SOURCES = \
+libenigma_nav_la_SOURCES = \
        core.cpp pcore.cpp
 
 
index 72191ed..03dcedb 100644 (file)
@@ -1,12 +1,13 @@
 AM_CPPFLAGS = \
+       -I$(top_srcdir) \
        -I$(top_srcdir)/include \
-       -I$(top_srcdir)/src
+       -include Python.h
 
 SUBDIRS = Components Tools Screens Plugins
 
-noinst_LIBRARIES = libenigma_python.a
+noinst_LTLIBRARIES = libenigma_python.la
 
-libenigma_python_a_SOURCES = \
+libenigma_python_la_SOURCES = \
        python.cpp enigma_python_wrap.cxx connections.cpp
 
 enigma_python_wrap.cxx: enigma_python.i
index fdd9c3e..e79688b 100644 (file)
@@ -1,3 +1,7 @@
+CPPFLAGS += \
+       -I$(top_srcdir) \
+       -include Python.h
+
 OBJS = servicedvd.cpp
 
 -include $(OBJS:.cpp=.d)
index 8e80e18..914371e 100644 (file)
@@ -1,3 +1,7 @@
+CPPFLAGS += \
+       -I$(top_srcdir) \
+       -include Python.h
+
 OBJS = socket_mmi.cpp
 
 -include $(OBJS:.cpp=.d)
index ad76198..b4cd1c7 100644 (file)
@@ -3,11 +3,6 @@
 
 #include <libsig_comp.h>
 
-               /* avoid warnigs :) */
-#include <features.h>
-#undef _POSIX_C_SOURCE
-#define _POSIX_C_SOURCE 200112L
-
 #include <lib/python/python.h>
 
 class PSignal
index 18fdac7..f5b6e4d 100644 (file)
@@ -4,7 +4,6 @@
        #define __lib_python_python_class_h
 #endif
 
-#include <Python.h>
 #include <string>
 #include <lib/base/object.h>
 
index 52d7af2..c4dabeb 100644 (file)
@@ -1,9 +1,11 @@
 AM_CPPFLAGS = \
-       -I$(top_srcdir)/include
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include \
+       -include Python.h
 
-noinst_LIBRARIES = libenigma_service.a
+noinst_LTLIBRARIES = libenigma_service.la
 
-libenigma_service_a_SOURCES = \
+libenigma_service_la_SOURCES = \
        listboxservice.cpp service.cpp servicemp3.cpp servicedvb.cpp servicefs.cpp \
        event.cpp servicedvbrecord.cpp
        
diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4
new file mode 100644 (file)
index 0000000..2152a80
--- /dev/null
@@ -0,0 +1,283 @@
+# ===========================================================================
+#        http://www.gnu.org/software/autoconf-archive/ax_pthread.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+#
+# DESCRIPTION
+#
+#   This macro figures out how to build C programs using POSIX threads. It
+#   sets the PTHREAD_LIBS output variable to the threads library and linker
+#   flags, and the PTHREAD_CFLAGS output variable to any special C compiler
+#   flags that are needed. (The user can also force certain compiler
+#   flags/libs to be tested by setting these environment variables.)
+#
+#   Also sets PTHREAD_CC to any special C compiler that is needed for
+#   multi-threaded programs (defaults to the value of CC otherwise). (This
+#   is necessary on AIX to use the special cc_r compiler alias.)
+#
+#   NOTE: You are assumed to not only compile your program with these flags,
+#   but also link it with them as well. e.g. you should link with
+#   $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
+#
+#   If you are only building threads programs, you may wish to use these
+#   variables in your default LIBS, CFLAGS, and CC:
+#
+#     LIBS="$PTHREAD_LIBS $LIBS"
+#     CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+#     CC="$PTHREAD_CC"
+#
+#   In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
+#   has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
+#   (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+#
+#   ACTION-IF-FOUND is a list of shell commands to run if a threads library
+#   is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
+#   is not found. If ACTION-IF-FOUND is not specified, the default action
+#   will define HAVE_PTHREAD.
+#
+#   Please let the authors know if this macro fails on any platform, or if
+#   you have any other suggestions or comments. This macro was based on work
+#   by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
+#   from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
+#   Alejandro Forero Cuervo to the autoconf macro repository. We are also
+#   grateful for the helpful feedback of numerous users.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
+#
+#   This program is free software: you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation, either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+#serial 11
+
+AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
+AC_DEFUN([AX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_SAVE
+AC_LANG_C
+ax_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+        AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes)
+        AC_MSG_RESULT($ax_pthread_ok)
+        if test x"$ax_pthread_ok" = xno; then
+                PTHREAD_LIBS=""
+                PTHREAD_CFLAGS=""
+        fi
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try.  Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important.  Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+#       other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+#      doesn't hurt to check since this sometimes defines pthreads too;
+#      also defines -D_REENTRANT)
+#      ... -mt is also the pthreads flag for HP/aCC
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case "${host_cpu}-${host_os}" in
+        *solaris*)
+
+        # On Solaris (at least, for some versions), libc contains stubbed
+        # (non-functional) versions of the pthreads routines, so link-based
+        # tests will erroneously succeed.  (We need to link with -pthreads/-mt/
+        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
+        # a function called by this macro, so we could check for that, but
+        # who knows whether they'll stub that too in a future libc.)  So,
+        # we'll just look for -pthreads and -lpthread first:
+
+        ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
+        ;;
+
+       *-darwin*)
+       ax_pthread_flags="-pthread $ax_pthread_flags"
+       ;;
+esac
+
+if test x"$ax_pthread_ok" = xno; then
+for flag in $ax_pthread_flags; do
+
+        case $flag in
+                none)
+                AC_MSG_CHECKING([whether pthreads work without any flags])
+                ;;
+
+                -*)
+                AC_MSG_CHECKING([whether pthreads work with $flag])
+                PTHREAD_CFLAGS="$flag"
+                ;;
+
+               pthread-config)
+               AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no)
+               if test x"$ax_pthread_config" = xno; then continue; fi
+               PTHREAD_CFLAGS="`pthread-config --cflags`"
+               PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+               ;;
+
+                *)
+                AC_MSG_CHECKING([for the pthreads library -l$flag])
+                PTHREAD_LIBS="-l$flag"
+                ;;
+        esac
+
+        save_LIBS="$LIBS"
+        save_CFLAGS="$CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Check for various functions.  We must include pthread.h,
+        # since some functions may be macros.  (On the Sequent, we
+        # need a special flag -Kthread to make this header compile.)
+        # We check for pthread_join because it is in -lpthread on IRIX
+        # while pthread_create is in libc.  We check for pthread_attr_init
+        # due to DEC craziness with -lpthreads.  We check for
+        # pthread_cleanup_push because it is one of the few pthread
+        # functions on Solaris that doesn't have a non-functional libc stub.
+        # We try pthread_create on general principles.
+        AC_TRY_LINK([#include <pthread.h>
+                    static void routine(void* a) {a=0;}
+                    static void* start_routine(void* a) {return a;}],
+                    [pthread_t th; pthread_attr_t attr;
+                     pthread_create(&th,0,start_routine,0);
+                     pthread_join(th, 0);
+                     pthread_attr_init(&attr);
+                     pthread_cleanup_push(routine, 0);
+                     pthread_cleanup_pop(0); ],
+                    [ax_pthread_ok=yes])
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        AC_MSG_RESULT($ax_pthread_ok)
+        if test "x$ax_pthread_ok" = xyes; then
+                break;
+        fi
+
+        PTHREAD_LIBS=""
+        PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$ax_pthread_ok" = xyes; then
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+       AC_MSG_CHECKING([for joinable pthread attribute])
+       attr_name=unknown
+       for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+           AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
+                        [attr_name=$attr; break])
+       done
+        AC_MSG_RESULT($attr_name)
+        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+            AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
+                               [Define to necessary symbol if this constant
+                                uses a non-standard name on your system.])
+        fi
+
+        AC_MSG_CHECKING([if more special flags are required for pthreads])
+        flag=no
+        case "${host_cpu}-${host_os}" in
+            *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
+            *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
+        esac
+        AC_MSG_RESULT(${flag})
+        if test "x$flag" != xno; then
+            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+        fi
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        # More AIX lossage: must compile with xlc_r or cc_r
+       if test x"$GCC" != xyes; then
+          AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
+        else
+          PTHREAD_CC=$CC
+       fi
+else
+        PTHREAD_CC="$CC"
+fi
+
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_CC)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$ax_pthread_ok" = xyes; then
+        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
+        :
+else
+        ax_pthread_ok=no
+        $2
+fi
+AC_LANG_RESTORE
+])dnl AX_PTHREAD
index 1232fda..168157a 100644 (file)
@@ -1,74 +1,3 @@
-AC_DEFUN([TUXBOX_APPS],[
-
-INSTALL="$INSTALL -p"
-
-AC_USE_SYSTEM_EXTENSIONS
-AC_SYS_LARGEFILE
-
-AC_ARG_WITH(target,
-       [  --with-target=TARGET    target for compilation [[native,cdk]]],
-       [TARGET="$withval"],[TARGET="native"])
-
-AC_ARG_WITH(targetprefix,
-       [  --with-targetprefix=PATH  prefix relative to target root (only applicable in cdk mode)],
-       [targetprefix="$withval"],[targetprefix="NONE"])
-
-AC_ARG_WITH(debug,
-       [  --without-debug         disable debugging code],
-       [DEBUG="$withval"],[DEBUG="yes"])
-
-if test "$DEBUG" = "yes"; then
-       DEBUG_CFLAGS="-g3 -ggdb"
-       AC_DEFINE(DEBUG,1,[Enable debug messages])
-fi
-
-AC_MSG_CHECKING(target)
-
-if test "$TARGET" = "native"; then
-       AC_MSG_RESULT(native)
-
-       if test "$CFLAGS" = "" -a "$CXXFLAGS" = ""; then
-               CFLAGS="-Wall -O2 -pipe $DEBUG_CFLAGS"
-               CXXFLAGS="-Wall -O2 -pipe $DEBUG_CFLAGS"
-       fi
-       if test "$prefix" = "NONE"; then
-               prefix=/usr/local
-       fi
-       targetprefix=$prefix
-elif test "$TARGET" = "cdk"; then
-       AC_MSG_RESULT(cdk)
-
-       if test "$CC" = "" -a "$CXX" = ""; then
-               CC=powerpc-tuxbox-linux-gnu-gcc CXX=powerpc-tuxbox-linux-gnu-g++
-       fi
-       if test "$CFLAGS" = "" -a "$CXXFLAGS" = ""; then
-               CFLAGS="-Wall -Os -mcpu=823 -pipe $DEBUG_CFLAGS"
-               CXXFLAGS="-Wall -Os -mcpu=823 -pipe $DEBUG_CFLAGS"
-       fi
-       if test "$prefix" = "NONE"; then
-               AC_MSG_ERROR(invalid prefix, you need to specify one in cdk mode)
-       fi
-       if test "$targetprefix" = "NONE"; then
-               targetprefix=""
-       fi
-       if test "$host_alias" = ""; then
-               cross_compiling=yes
-               host_alias=powerpc-tuxbox-linux-gnu
-       fi
-else
-       AC_MSG_RESULT(none)
-       AC_MSG_ERROR([invalid target $TARGET, choose on from native,cdk]);
-fi
-
-AC_CANONICAL_BUILD
-AC_CANONICAL_HOST
-
-check_path () {
-       return $(perl -e "if(\"$1\"=~m#^/usr/(local/)?bin#){print \"0\"}else{print \"1\";}")
-}
-
-])
-
 AC_DEFUN([TUXBOX_APPS_DIRECTORY_ONE],[
 AC_ARG_WITH($1,[  $6$7 [[PREFIX$4$5]]],[
        _$2=$withval
@@ -92,22 +21,6 @@ AC_DEFINE_UNQUOTED($2,"$_$2",$7)
 ])
 
 AC_DEFUN([TUXBOX_APPS_DIRECTORY],[
-AC_REQUIRE([TUXBOX_APPS])
-
-if test "$TARGET" = "cdk"; then
-       datadir="\${prefix}/share"
-       tuxboxdatadir="\${prefix}/share/tuxbox"
-       zoneinfodir="\${datadir}/zoneinfo"
-       sysconfdir="\${prefix}/etc"
-       localstatedir="\${prefix}/var"
-       localedir="\${prefix}/var"
-       libdir="\${prefix}/lib"
-       targetdatadir="\${targetprefix}/share"
-       targetsysconfdir="\${targetprefix}/etc"
-       targetlocalstatedir="\${targetprefix}/var"
-       targetlibdir="\${targetprefix}/lib"
-fi
-
 TUXBOX_APPS_DIRECTORY_ONE(configdir,CONFIGDIR,sysconfdir,/etc,,
        [--with-configdir=PATH   ],[where to find the config files])
 
@@ -165,52 +78,6 @@ else
 fi
 ])
 
-AC_DEFUN([_TUXBOX_APPS_LIB_CONFIG],[
-AC_PATH_PROG($1_CONFIG,$2,no)
-if test "$$1_CONFIG" != "no"; then
-       if test "$TARGET" = "cdk" && check_path "$$1_CONFIG"; then
-               AC_MSG_$3([could not find a suitable version of $2]);
-       else
-               $1_CFLAGS=$($$1_CONFIG --cflags)
-               $1_LIBS=$($$1_CONFIG --libs)
-       fi
-fi
-
-AC_SUBST($1_CFLAGS)
-AC_SUBST($1_LIBS)
-])
-
-AC_DEFUN([TUXBOX_APPS_LIB_CONFIG],[
-_TUXBOX_APPS_LIB_CONFIG($1,$2,ERROR)
-if test "$$1_CONFIG" = "no"; then
-       AC_MSG_ERROR([could not find $2]);
-fi
-])
-
-AC_DEFUN([TUXBOX_APPS_LIB_CONFIG_CHECK],[
-_TUXBOX_APPS_LIB_CONFIG($1,$2,WARN)
-])
-
-AC_DEFUN([_TUXBOX_APPS_LIB_SYMBOL],[
-AC_CHECK_LIB($2,$3,HAVE_$1="yes",HAVE_$1="no")
-if test "$HAVE_$1" = "yes"; then
-       $1_LIBS=-l$2
-fi
-
-AC_SUBST($1_LIBS)
-])
-
-AC_DEFUN([TUXBOX_APPS_LIB_SYMBOL],[
-_TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,ERROR)
-if test "$HAVE_$1" = "no"; then
-       AC_MSG_ERROR([could not find $2]);
-fi
-])
-
-AC_DEFUN([TUXBOX_APPS_LIB_CONFIG_SYMBOL],[
-_TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,WARN)
-])
-
 AC_DEFUN([TUXBOX_APPS_GETTEXT],[
 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
        [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
@@ -301,25 +168,3 @@ AC_SUBST(UPDATEPOFILES)
 AC_SUBST(DUMMYPOFILES)
 AC_SUBST(CATALOGS)
 ])
-
-dnl backward compatiblity
-AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
-[AH_VERBATIM([_GNU_SOURCE],
-[/* Enable GNU extensions on systems that have them.  */
-#ifndef _GNU_SOURCE
-# undef _GNU_SOURCE
-#endif])dnl
-AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
-AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
-AC_DEFINE([_GNU_SOURCE])
-])
-
-AC_DEFUN([AC_PROG_EGREP],
-[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
-   [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
-    then ac_cv_prog_egrep='grep -E'
-    else ac_cv_prog_egrep='egrep'
-    fi])
- EGREP=$ac_cv_prog_egrep
- AC_SUBST([EGREP])
-])
index fa889c0..4eebe99 100644 (file)
@@ -1,5 +1,7 @@
 AM_CPPFLAGS = \
-       -I$(top_srcdir)/include
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/include \
+       -include Python.h
 
 bin_PROGRAMS = enigma2
 
@@ -39,38 +41,11 @@ version.h: entries
                fi; \
        fi;
 
-enigma2_LDADD_WHOLE = \
-       $(top_builddir)/lib/actions/libenigma_actions.a \
-       $(top_builddir)/lib/base/libenigma_base.a \
-       $(top_builddir)/lib/components/libenigma_components.a \
-       $(top_builddir)/lib/driver/libenigma_driver.a \
-       $(top_builddir)/lib/mmi/libenigma_mmi.a \
-       $(top_builddir)/lib/dvb/libenigma_dvb.a \
-       $(top_builddir)/lib/dvb_ci/libenigma_dvb_ci.a \
-       $(top_builddir)/lib/gdi/libenigma_gdi.a \
-       $(top_builddir)/lib/gui/libenigma_gui.a \
-       $(top_builddir)/lib/python/libenigma_python.a \
-       $(top_builddir)/lib/nav/libenigma_nav.a \
-       $(top_builddir)/lib/service/libenigma_service.a
-
 enigma2_LDADD = \
-       @FREETYPE_LIBS@ \
-       @ID3TAG_LIBS@ \
-       @MAD_LIBS@ \
-       @PNG_LIBS@ \
-       @SDL_LIBS@ \
-       @SIGC_LIBS@ \
-       @DVBSI_LIBS@ \
-       @FRIBIDI_LIBS@ \
-       @GSTREAMER_LIBS@ \
-       @GSTREAMERPBUTILS_LIBS@ \
-       @JPEG_LIBS@ \
+       $(top_builddir)/lib/libenigma.la \
+       @BASE_LIBS@ \
        @LIBUNGIF_LIBS@ \
-       @XML2_LIBS@ \
-       @XMLCCWRAP_LIBS@ \
-       -ldl -lpthread -lcrypt -lresolv -lrt
-
-enigma2$(EXEEXT): $(enigma2_OBJECTS) $(enigma2_DEPENDENCIES) $(enigma2_LDADD_WHOLE)
-#      @rm -f enigma2$(EXEEXT)
-       $(CXXLINK) $(enigma2_LDFLAGS) $(enigma2_OBJECTS) -Wl,--export-dynamic -Wl,--whole-archive $(enigma2_LDADD_WHOLE) -Wl,--no-whole-archive $(enigma2_LDADD) $(LIBS)
-#      g++ -o enigma2$(EXEEXT) $(enigma2_LDFLAGS) $(enigma2_OBJECTS) -Wl,--export-dynamic -Wl,--whole-archive $(enigma2_LDADD_WHOLE) -Wl,--no-whole-archive $(enigma2_LDADD) $(LIBS)
+       @LIBXINE_LIBS@ \
+       @PTHREAD_LIBS@ \
+       @SDL_LIBS@ \
+       @LIBS@
index 4e1e8ef..a012187 100644 (file)
@@ -1,4 +1,4 @@
 lib_LTLIBRARIES = libopen.la
 
 libopen_la_SOURCES = libopen.c
-libopen_la_LIBADD = -ldl
+libopen_la_LIBADD = @LIBDL_LIBS@