From: pabs3 Date: Sun, 7 Jun 2009 10:41:14 +0000 (+0000) Subject: Add some changes to make ETL more suitable for Fedora: X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=2fde73ebec7ee1bcb147abc19d16b1bc0deb17bf;p=synfig.git Add some changes to make ETL more suitable for Fedora: Generate etl_profile.h in a less hacky way. Move the tests needed for generating etl_profile.h into the main configuration file. Move the etl_profile.h header to an arch-specific dir to prepare for multi-arch. Use less generic defines in the etl_profile.h header and prefix private defines with a double underscore. git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2377 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/ETL/trunk/ETL.pbproj/etl_profile.h b/ETL/trunk/ETL.pbproj/etl_profile.h index e63e0fe..8d1b845 100644 --- a/ETL/trunk/ETL.pbproj/etl_profile.h +++ b/ETL/trunk/ETL.pbproj/etl_profile.h @@ -8,32 +8,32 @@ /* define if target is big endian */ #define WORDS_BIGENDIAN -#ifndef HAVE_GETTIMEOFDAY -#define HAVE_GETTIMEOFDAY +#ifndef __ETL_HAS_GETTIMEOFDAY +#define __ETL_HAS_GETTIMEOFDAY #endif -#ifndef HAVE_PTHREAD_H -#define HAVE_PTHREAD_H +#ifndef __ETL_HAS_PTHREAD_H +#define __ETL_HAS_PTHREAD_H #endif -#ifndef HAVE_SCHED_H -#define HAVE_SCHED_H +#ifndef __ETL_HAS_SCHED_H +#define __ETL_HAS_SCHED_H #endif -#ifndef HAVE_PTHREAD_CREATE -#define HAVE_PTHREAD_CREATE +#ifndef __ETL_HAS_PTHREAD_CREATE +#define __ETL_HAS_PTHREAD_CREATE #endif -#ifndef HAVE_VASPRINTF -#define HAVE_VASPRINTF +#ifndef __ETL_HAS_VASPRINTF +#define __ETL_HAS_VASPRINTF #endif -#ifndef HAVE_VSNPRINTF -#define HAVE_VSNPRINTF +#ifndef __ETL_HAS_VSNPRINTF +#define __ETL_HAS_VSNPRINTF #endif -#ifndef HAVE_VSPRINTF -#define HAVE_VSPRINTF +#ifndef __ETL_HAS_VSPRINTF +#define __ETL_HAS_VSPRINTF #endif #endif // __VETL_CONFIG_H diff --git a/ETL/trunk/ETL.pc.in b/ETL/trunk/ETL.pc.in index 93c32bf..4417485 100644 --- a/ETL/trunk/ETL.pc.in +++ b/ETL/trunk/ETL.pc.in @@ -8,4 +8,4 @@ Description: @PACKAGE_NAME@ Requires: Version: @VERSION@ Libs: @LIBS@ -Cflags: -I${includedir} +Cflags: -I${includedir} -I${libdir}/ETL/include diff --git a/ETL/trunk/ETL/Makefile.am b/ETL/trunk/ETL/Makefile.am index b08fdcf..5dea615 100644 --- a/ETL/trunk/ETL/Makefile.am +++ b/ETL/trunk/ETL/Makefile.am @@ -3,9 +3,10 @@ MAINTAINERCLEANFILES = \ Makefile.in -CLEANFILES = \ - $(top_builddir)/ETL/etl_profile.h +etlconfigdir = $(libdir)/ETL/include + +etlconfig_DATA = $(builddir)/etl_profile.h etldir = $(includedir)/ETL @@ -55,7 +56,6 @@ etl_HEADERS = \ _trivial.h \ _fixed.h \ etl_config.h \ - $(top_builddir)/ETL/etl_profile.h \ _fastangle_tables.h \ bezier \ _bezier.h \ @@ -77,10 +77,6 @@ etl_HEADERS = \ _mutex_pthreads_simple.h -$(top_builddir)/ETL/etl_profile.h:$(top_builddir)/ETL/etl_profile_.h - sed "s/PACKAGE/ETL/g;" < $(top_builddir)/ETL/etl_profile_.h > $(top_builddir)/ETL/etl_profile.h - - # FIXME: figure out why this is in SVN, but isn't installed EXTRA_DIST = \ _bit_rotate.h diff --git a/ETL/trunk/ETL/_mutex_pthreads.h b/ETL/trunk/ETL/_mutex_pthreads.h index aed6766..8720617 100644 --- a/ETL/trunk/ETL/_mutex_pthreads.h +++ b/ETL/trunk/ETL/_mutex_pthreads.h @@ -33,7 +33,7 @@ #include -#ifdef HAVE_SCHED_H +#ifdef __ETL_HAS_SCHED_H # include #endif diff --git a/ETL/trunk/ETL/_stringf.h b/ETL/trunk/ETL/_stringf.h index 3d0c020..22939a2 100644 --- a/ETL/trunk/ETL/_stringf.h +++ b/ETL/trunk/ETL/_stringf.h @@ -53,6 +53,13 @@ #define POPEN_BINARY_WRITE_TYPE "w" #endif +#ifdef __ETL_HAS__VSNPRINTF +#ifndef __ETL_HAS_VSNPRINTF +#define vnsprintf _vnsprintf +#define __ETL_HAS_VSNPRINTF +#endif +#endif + /* === T Y P E D E F S ===================================================== */ _ETL_BEGIN_CDECLS @@ -66,13 +73,13 @@ _ETL_BEGIN_CDECLS // Prefer prototypes from glibc headers, since defining them ourselves // works around glibc security mechanisms -#ifdef HAVE_VASPRINTF // This is the preferred method +#ifdef __ETL_HAS_VASPRINTF // This is the preferred method #ifndef __GLIBC__ extern int vasprintf(char **,const char *,va_list)ETL_NO_THROW; #endif #else -# ifdef HAVE_VSNPRINTF // This is the secondary method +# ifdef __ETL_HAS_VSNPRINTF // This is the secondary method #ifndef __GLIBC__ extern int vsnprintf(char *,size_t,const char*,va_list)ETL_NO_THROW; #endif @@ -80,13 +87,13 @@ _ETL_BEGIN_CDECLS #endif -#ifdef HAVE_VSSCANF +#ifdef __ETL_HAS_VSSCANF #ifndef __GLIBC__ extern int vsscanf(const char *,const char *,va_list)ETL_NO_THROW; #endif #else #define ETL_NO_VSTRSCANF -#ifdef HAVE_SSCANF +#ifdef __ETL_HAS_SSCANF #ifndef __GLIBC__ extern int sscanf(const char *buf, const char *format, ...)ETL_NO_THROW; #endif @@ -104,7 +111,7 @@ _ETL_BEGIN_NAMESPACE inline std::string vstrprintf(const char *format, va_list args) { -#ifdef HAVE_VASPRINTF // This is the preferred method (and safest) +#ifdef __ETL_HAS_VASPRINTF // This is the preferred method (and safest) char *buffer; std::string ret; int i=vasprintf(&buffer,format,args); @@ -115,7 +122,7 @@ vstrprintf(const char *format, va_list args) } return ret; #else -#ifdef HAVE_VSNPRINTF // This is the secondary method (Safe, but bulky) +#ifdef __ETL_HAS_VSNPRINTF // This is the secondary method (Safe, but bulky) #warning etl::vstrprintf() has a maximum size of ETL_STRPRINTF_MAX_LENGTH in this configuration. #ifdef ETL_THREAD_SAFE char buffer[ETL_STRPRINTF_MAX_LENGTH]; @@ -164,7 +171,7 @@ strscanf(const std::string &data, const char*format, ...) } #else -#if defined (HAVE_SSCANF) && defined (__GNUC__) +#if defined (__ETL_HAS_SSCANF) && defined (__GNUC__) #define strscanf(data,format,...) sscanf(data.c_str(),format,__VA_ARGS__) #endif #endif diff --git a/ETL/trunk/ETL/_thread.h b/ETL/trunk/ETL/_thread.h index 8f70be8..cb64933 100644 --- a/ETL/trunk/ETL/_thread.h +++ b/ETL/trunk/ETL/_thread.h @@ -31,21 +31,21 @@ #define __USE_GNU -#ifdef HAVE_PTHREAD_H +#ifdef __ETL_HAS_PTHREAD_H # include #endif -#ifdef HAVE_SCHED_H +#ifdef __ETL_HAS_SCHED_H # include #endif -#ifdef HAVE_CREATETHREAD +#ifdef __ETL_HAS_CREATETHREAD # include #endif /* === M A C R O S ========================================================= */ -#if ( defined (HAVE_PTHREAD_CREATE) || defined (HAVE_CLONE) || defined (HAVE_CREATETHREAD) ) && !defined (NO_THREADS) +#if ( defined (__ETL_HAS_PTHREAD_CREATE) || defined (__ETL_HAS_CLONE) || defined (__ETL_HAS_CREATETHREAD) ) && !defined (NO_THREADS) # define CALLISTO_THREADS #endif @@ -53,7 +53,7 @@ /* === C L A S S E S & S T R U C T S ======================================= */ -#if defined(CALLISTO_THREADS) && defined(HAVE_PTHREAD_CREATE) +#if defined(CALLISTO_THREADS) && defined(__ETL_HAS_PTHREAD_CREATE) static inline void Yield(void) { sched_yield(); @@ -68,7 +68,7 @@ inline void Yield(void) { } #ifdef CALLISTO_THREADS -#ifdef HAVE_PTHREAD_CREATE +#ifdef __ETL_HAS_PTHREAD_CREATE class Thread { @@ -207,7 +207,7 @@ public: } }; -#ifdef HAVE_PTHREAD_RW_LOCK_INIT +#ifdef __ETL_HAS_PTHREAD_RW_LOCK_INIT class ReadWriteLock { pthread_rwlock_t rwlock; @@ -290,8 +290,8 @@ public: }; */ -#else // if defined HAVE_PTHREAD -#ifdef HAVE_CREATETHREAD +#else // if defined __ETL_HAS_PTHREAD_CREATE +#ifdef __ETL_HAS_CREATETHREAD #ifdef THREAD_ENTRYPOINT @@ -448,8 +448,8 @@ public: }; -#endif // if defined HAVE_CREATETHREAD -#endif // if defined HAVE_PTHREAD_CREATE +#endif // if defined __ETL_HAS_CREATETHREAD +#endif // if defined __ETL_HAS_PTHREAD_CREATE #endif // if defined CALLISTO_THREADS diff --git a/ETL/trunk/ETL/clock b/ETL/trunk/ETL/clock index 2457b6c..73ec6ea 100644 --- a/ETL/trunk/ETL/clock +++ b/ETL/trunk/ETL/clock @@ -29,7 +29,7 @@ #include "etl_config.h" -#ifdef HAVE_GETTIMEOFDAY +#ifdef __ETL_HAS_GETTIMEOFDAY #include "_clock_gettimeofday.h" #ifndef ETL_CLOCK_DEFAULT_DESC_CLASS #define ETL_CLOCK_DEFAULT_DESC_CLASS _ETL::clock_desc_gettimeofday diff --git a/ETL/trunk/ETL/etl_profile.h.in b/ETL/trunk/ETL/etl_profile.h.in new file mode 100644 index 0000000..e5b59b5 --- /dev/null +++ b/ETL/trunk/ETL/etl_profile.h.in @@ -0,0 +1,42 @@ +/* + * + * ETL platform-specific configuration header + * + * Built platform: @build@ + * Host platform: @host@ + * + */ + +#ifndef __ETL_PROFILE_H__ +#define __ETL_PROFILE_H__ + +// Public ETL definitions + +#define ETL_NAME "@PACKAGE_NAME@" +#define ETL_TARNAME "@PACKAGE_TARNAME@" +#define ETL_VERSION "@PACKAGE_VERSION@" + +// Private ETL definitions + +// Libraries +@D_LIBPTHREAD@ __ETL_HAS_LIBPTHREAD + +// Headers +@D_PTHREAD_H@ __ETL_HAS_PTHREAD_H +@D_SCHED_H@ __ETL_HAS_SCHED_H + +// Functions +@D_PTHREAD_CREATE@ __ETL_HAS_PTHREAD_CREATE +@D_PTHREAD_RWLOCK_INIT@ __ETL_HAS_PTHREAD_RWLOCK_INIT +@D_SCHED_YIELD@ __ETL_HAS_SCHED_YIELD +@D_CREATETHREAD@ __ETL_HAS_CREATETHREAD +@D_QUERYPERFORMANCECOUNTER@ __ETL_HAS_QUERYPERFORMANCECOUNTER +@D_GETTIMEOFDAY@ __ETL_HAS_GETTIMEOFDAY +@D_SSCANF@ __ETL_HAS_SSCANF +@D_VSSCANF@ __ETL_HAS_VSSCANF +@D_VSPRINTF@ __ETL_HAS_VSPRINTF +@D_VASPRINTF@ __ETL_HAS_VASPRINTF +@D_VSNPRINTF@ __ETL_HAS_VSNPRINTF +@D__VSNPRINTF@ __ETL_HAS__VSNPRINTF + +#endif // __ETL_PROFILE_H__ diff --git a/ETL/trunk/ETL/handle b/ETL/trunk/ETL/handle index 76508bc..d5ef74a 100644 --- a/ETL/trunk/ETL/handle +++ b/ETL/trunk/ETL/handle @@ -33,12 +33,12 @@ // include the next line in an attempt to increase stability // it seems to make things much *less* stable on MS Windows #ifndef _WIN32 -#ifdef HAVE_LIBPTHREAD -#define ETL_LOCK_REFCOUNTS +#ifdef __ETL_HAS_LIBPTHREAD +#define __ETL_LOCK_REFCOUNTS #endif #endif -#ifdef ETL_LOCK_REFCOUNTS +#ifdef __ETL_LOCK_REFCOUNTS # include "mutex" #endif diff --git a/ETL/trunk/ETL/mutex b/ETL/trunk/ETL/mutex index f4d1263..03fa734 100644 --- a/ETL/trunk/ETL/mutex +++ b/ETL/trunk/ETL/mutex @@ -29,7 +29,7 @@ #include "etl_config.h" -#ifdef HAVE_LIBPTHREAD +#ifdef __ETL_HAS_LIBPTHREAD # include "_mutex_pthreads_simple.h" #else #ifdef _WIN32 diff --git a/ETL/trunk/Makefile.am b/ETL/trunk/Makefile.am index 48447b7..40d9abf 100644 --- a/ETL/trunk/Makefile.am +++ b/ETL/trunk/Makefile.am @@ -21,7 +21,6 @@ MAINTAINERCLEANFILES = \ config.status \ .doc_stamp \ .DS_Store \ - include/etl_profile.h.in \ doxygen.cfg @@ -46,7 +45,6 @@ EXTRA_DIST = \ config/depcomp \ m4/cxx_macros.m4 \ ETL.pbproj/project.pbxproj \ - ETL.pbproj/etl_profile.h \ ETL.pbproj/frameworkfix.cpp \ ETL-config.in \ m4/ETL.m4 \ diff --git a/ETL/trunk/configure.ac b/ETL/trunk/configure.ac index 63f5e96..fff4a6a 100644 --- a/ETL/trunk/configure.ac +++ b/ETL/trunk/configure.ac @@ -6,7 +6,7 @@ AC_INIT([Extended Template Library],[0.04.12],[http://synfig.org/Bugs],[ETL]) AC_REVISION AC_CONFIG_AUX_DIR(config) -AC_CONFIG_HEADERS([ETL/etl_profile_.h]) +AC_CONFIG_HEADERS([config.h]) AC_CANONICAL_HOST AC_CANONICAL_TARGET @@ -41,27 +41,41 @@ AC_WIN32_QUIRKS # -- L I B R A R I E S ---------------------------------------- -# -- H E A D E R S -------------------------------------------- +AC_CHECK_LIB([user32], [main]) +AC_CHECK_LIB([kernel32], [CreateMutex]) +AC_CHECK_LIB([pthread], [pthread_mutex_init], , [HAVE_LIBPTHREAD=no]) -AH_TOP([ -// We want to be autoconf/autoheader friendly, so -// if the developer has already included an -// autoheader-generated configuration script, -// we can assume that the user knew what they -// were doing and let them use their own config.h. -//#ifndef PACKAGE_TARNAME -]) +if test x$HAVE_LIBPTHREAD = xno ; then + D_LIBPTHREAD="#undef" +else + D_LIBPTHREAD="#define" +fi -AH_BOTTOM([ -//#endif // ifndef PACKAGE_TARNAME -]) +# -- H E A D E R S -------------------------------------------- +AC_HEADER_STDC +AC_CHECK_HEADERS([pthread.h], [D_PTHREAD_H="#define"], [D_PTHREAD_H="#undef"]) +AC_CHECK_HEADERS([sched.h], [D_SCHED_H="#define"], [D_SCHED_H="#undef"]) +AC_CHECK_HEADERS([sys/time.h]) +AC_CHECK_HEADERS([unistd.h]) +AC_CHECK_HEADERS([windows.h]) # -- T Y P E S & S T R U C T S -------------------------------- # -- F U N C T I O N S ---------------------------------------- -ETL_DEPS +AC_CHECK_FUNCS([pthread_create], [D_PTHREAD_CREATE="#define"], [D_PTHREAD_CREATE="#undef"]) +AC_CHECK_FUNCS([pthread_rwlock_init], [D_PTHREAD_RWLOCK_INIT="#define"], [D_PTHREAD_RWLOCK_INIT="#undef"]) +AC_CHECK_FUNCS([sched_yield], [D_SCHED_YIELD="#define"], [D_SCHED_YIELD="#undef"]) +AC_CHECK_FUNCS([CreateThread], [D_CREATETHREAD="#define"], [D_CREATETHREAD="#undef"]) +AC_CHECK_FUNCS([QueryPerformanceCounter], [D_QUERYPERFORMANCECOUNTER="#define"], [D_QUERYPERFORMANCECOUNTER="#undef"]) +AC_CHECK_FUNCS([gettimeofday], [D_GETTIMEOFDAY="#define"], [D_GETTIMEOFDAY="#undef"]) +AC_CHECK_FUNCS([sscanf], [D_SSCANF="#define"], [D_SSCANF="#undef"]) +AC_CHECK_FUNCS([vsscanf], [D_VSSCANF="#define"], [D_VSSCANF="#undef"]) +AC_CHECK_FUNCS([vsprintf], [D_VSPRINTF="#define"], [D_VSPRINTF="#undef"]) +AC_CHECK_FUNCS([vasprintf], [D_VASPRINTF="#define"], [D_VASPRINTF="#undef"]) +AC_CHECK_FUNCS([vsnprintf], [D_VSNPRINTF="#define"], [D_VSNPRINTF="#undef"]) +AC_CHECK_FUNCS([_vsnprintf], [D__VSNPRINTF="#define"], [D__VSNPRINTF="#undef"]) # -- O U T P U T ---------------------------------------------- @@ -69,7 +83,29 @@ AC_SUBST(CFLAGS) AC_SUBST(CPPFLAGS) AC_SUBST(LDFLAGS) +# Libraries +AC_SUBST(D_LIBPTHREAD) + +# Headers +AC_SUBST(D_PTHREAD_H) +AC_SUBST(D_SCHED_H) + +# Functions +AC_SUBST(D_PTHREAD_CREATE) +AC_SUBST(D_PTHREAD_RWLOCK_INIT) +AC_SUBST(D_SCHED_YIELD) +AC_SUBST(D_CREATETHREAD) +AC_SUBST(D_QUERYPERFORMANCECOUNTER) +AC_SUBST(D_GETTIMEOFDAY) +AC_SUBST(D_SSCANF) +AC_SUBST(D_VSSCANF) +AC_SUBST(D_VSPRINTF) +AC_SUBST(D_VASPRINTF) +AC_SUBST(D_VSNPRINTF) +AC_SUBST(D__VSNPRINTF) + AC_CONFIG_FILES([ETL-config +ETL/etl_profile.h Makefile ETL/Makefile test/Makefile diff --git a/ETL/trunk/m4/ETL.m4 b/ETL/trunk/m4/ETL.m4 index c2dc7a4..08ae7ba 100644 --- a/ETL/trunk/m4/ETL.m4 +++ b/ETL/trunk/m4/ETL.m4 @@ -5,38 +5,6 @@ # By Robert B. Quattlebaum Jr. # -AC_DEFUN([ETL_DEPS], -[ - AC_CHECK_LIB(user32, main) - AC_CHECK_LIB([kernel32], [CreateMutex]) - AC_CHECK_LIB([pthread], [pthread_mutex_init]) - - AC_HEADER_STDC - - AC_CHECK_HEADERS(pthread.h) - AC_CHECK_HEADERS(sched.h) - AC_CHECK_HEADERS(sys/time.h) - AC_CHECK_HEADERS(unistd.h) - AC_CHECK_HEADERS(windows.h) - AC_CHECK_FUNCS([pthread_create]) - AC_CHECK_FUNCS([pthread_rwlock_init]) - AC_CHECK_FUNCS([sched_yield]) - AC_CHECK_FUNCS([CreateThread]) - AC_CHECK_FUNCS([QueryPerformanceCounter]) - - AC_CHECK_FUNCS([gettimeofday]) - AC_CHECK_FUNCS([sscanf]) - AC_CHECK_FUNCS([vsscanf]) - AC_CHECK_FUNCS([vsprintf]) - AC_CHECK_FUNCS([vasprintf]) - AC_CHECK_FUNCS([vsnprintf],[],[ - AC_CHECK_FUNC([_vsnprintf],[ - AC_DEFINE(vsnprintf,_vsnprintf,[define if the vsnprintf function is mangled]) - AC_DEFINE(HAVE_VSNPRINTF,1) - ]) - ]) -]) - AC_DEFUN([USING_ETL], [ AC_ARG_WITH(ETL-includes,