### Additional options to configure
+AC_ARG_ENABLE([amalgamation],
+ [AC_HELP_STRING([--enable-amalgamation], [enable generation of one single file with all source code in it, helps compiler optimizations.])],
+ [if test "x${enableval}" = "xyes"; then
+ do_amalgamation="yes"
+ else
+ do_amalgamation="no"
+ fi
+ ],
+ [do_amalgamation="no"]
+)
+AM_CONDITIONAL(EET_AMALGAMATION, test "x${do_amalgamation}" = "xyes")
+
# Old eet file format support
old_eet_file_format="yes"
echo " Cipher support.....: ${have_cipher}"
echo " Signature..........: ${have_signature}"
echo
+echo " Amalgamation.........: ${do_amalgamation}"
echo " Documentation........: ${build_doc}"
echo " Tests................: ${enable_tests}"
echo " Coverage.............: ${enable_coverage}"
lib_LTLIBRARIES = libeet.la
-libeet_la_SOURCES = \
+base_sources = \
eet_lib.c \
eet_data.c \
eet_image.c \
eet_node.c \
eet_utils.c
+if EET_AMALGAMATION
+eet_sources_used = eet_amalgamation.c
+BUILT_SOURCES = eet_amalgamation.c
+
+eet_amalgamation.c: $(base_sources) Makefile
+ -rm -f eet_amalgamation.c
+
+ @echo "#ifdef HAVE_CONFIG_H" >> eet_amalgamation.c
+ @echo "# include \"config.h\"" >> eet_amalgamation.c
+ @echo "#endif" >> eet_amalgamation.c
+
+ @echo "#ifdef HAVE_ALLOCA_H" >> eet_amalgamation.c
+ @echo "# include <alloca.h>" >> eet_amalgamation.c
+ @echo "#elif defined __GNUC__" >> eet_amalgamation.c
+ @echo "# define alloca __builtin_alloca" >> eet_amalgamation.c
+ @echo "#elif defined _AIX" >> eet_amalgamation.c
+ @echo "# define alloca __alloca" >> eet_amalgamation.c
+ @echo "#elif defined _MSC_VER" >> eet_amalgamation.c
+ @echo "# include <malloc.h>" >> eet_amalgamation.c
+ @echo "# define alloca _alloca" >> eet_amalgamation.c
+ @echo "#else" >> eet_amalgamation.c
+ @echo "# include <stddef.h>" >> eet_amalgamation.c
+ @echo "# ifdef __cplusplus" >> eet_amalgamation.c
+ @echo "#extern \"C\"" >> eet_amalgamation.c
+ @echo "# endif" >> eet_amalgamation.c
+ @echo "#void *alloca (size_t);" >> eet_amalgamation.c
+ @echo "#endif" >> eet_amalgamation.c
+
+ @echo "#include <stdio.h>" >> eet_amalgamation.c
+ @echo "#include <string.h>" >> eet_amalgamation.c
+ @echo "#include <math.h>" >> eet_amalgamation.c
+ @echo "#include <ctype.h>" >> eet_amalgamation.c
+ @echo "#include <limits.h>" >> eet_amalgamation.c
+ @echo "#include <sys/types.h>" >> eet_amalgamation.c
+ @echo "#include <sys/stat.h>" >> eet_amalgamation.c
+ @echo "#include <sys/mman.h>" >> eet_amalgamation.c
+ @echo "#include <setjmp.h>" >> eet_amalgamation.c
+ @echo "#include <errno.h>" >> eet_amalgamation.c
+ @echo "#include <time.h>" >> eet_amalgamation.c
+ @echo "#include <fnmatch.h>" >> eet_amalgamation.c
+ @echo "#include <fcntl.h>" >> eet_amalgamation.c
+
+ @echo "#ifdef _WIN32" >> eet_amalgamation.c
+ @echo "# include <winsock2.h>" >> eet_amalgamation.c
+ @echo "#endif" >> eet_amalgamation.c
+
+ @echo "#ifndef _MSC_VER" >> eet_amalgamation.c
+ @echo "# include <unistd.h>" >> eet_amalgamation.c
+ @echo "#endif" >> eet_amalgamation.c
+
+ @echo "#ifdef HAVE_NETINET_IN_H" >> eet_amalgamation.c
+ @echo "# include <netinet/in.h>" >> eet_amalgamation.c
+ @echo "#endif" >> eet_amalgamation.c
+
+ @echo "#ifdef HAVE_GNUTLS" >> eet_amalgamation.c
+ @echo "# include <gnutls/gnutls.h>" >> eet_amalgamation.c
+ @echo "# include <gcrypt.h>" >> eet_amalgamation.c
+ @echo "#endif" >> eet_amalgamation.c
+
+ @echo "#ifdef HAVE_OPENSSL" >> eet_amalgamation.c
+ @echo "# include <openssl/err.h>" >> eet_amalgamation.c
+ @echo "# include <openssl/evp.h>" >> eet_amalgamation.c
+ @echo "# include <openssl/sha.h>" >> eet_amalgamation.c
+ @echo "#endif" >> eet_amalgamation.c
+
+ @echo "#ifdef HAVE_SIGNATURE" >> eet_amalgamation.c
+ @echo "# ifdef HAVE_GNUTLS" >> eet_amalgamation.c
+ @echo "# include <gnutls/gnutls.h>" >> eet_amalgamation.c
+ @echo "# include <gnutls/x509.h>" >> eet_amalgamation.c
+ @echo "# else" >> eet_amalgamation.c
+ @echo "# include <openssl/rsa.h>" >> eet_amalgamation.c
+ @echo "# include <openssl/objects.h>" >> eet_amalgamation.c
+ @echo "# include <openssl/err.h>" >> eet_amalgamation.c
+ @echo "# include <openssl/ssl.h>" >> eet_amalgamation.c
+ @echo "# include <openssl/dh.h>" >> eet_amalgamation.c
+ @echo "# include <openssl/dsa.h>" >> eet_amalgamation.c
+ @echo "# include <openssl/evp.h>" >> eet_amalgamation.c
+ @echo "# include <openssl/x509.h>" >> eet_amalgamation.c
+ @echo "# include <openssl/pem.h>" >> eet_amalgamation.c
+ @echo "# endif" >> eet_amalgamation.c
+ @echo "#endif" >> eet_amalgamation.c
+
+ @echo "#ifdef HAVE_CIPHER" >> eet_amalgamation.c
+ @echo "# ifdef HAVE_GNUTLS" >> eet_amalgamation.c
+ @echo "# include <gnutls/x509..h>" >> eet_amalgamation.c
+ @echo "# include <gcrypt.h>" >> eet_amalgamation.c
+ @echo "# else" >> eet_amalgamation.c
+ @echo "# include <openssl/evp.h>" >> eet_amalgamation.c
+ @echo "# include <openssl/hmac.h>" >> eet_amalgamation.c
+ @echo "# include <openssl/rand.h>" >> eet_amalgamation.c
+ @echo "# endif" >> eet_amalgamation.c
+ @echo "#endif" >> eet_amalgamation.c
+
+ @echo "#include <zlib.h>" >> eet_amalgamation.c
+ @echo "#include <jpeglib.h>" >> eet_amalgamation.c
+
+ @echo "#ifdef HAVE_EVIL" >> eet_amalgamation.c
+ @echo "# include <Evil.h>" >> eet_amalgamation.c
+ @echo "#endif" >> eet_amalgamation.c
+
+ @echo "#include <Eet.h>" >> eet_amalgamation.c
+
+ @echo "#include \"Eet_private.h\"" >> eet_amalgamation.c
+ @echo "#include \"Eet.h\"" >> eet_amalgamation.c
+
+ @for f in $(base_sources); do \
+ if [ `expr substr $$f 1 1` != '/' ]; then \
+ file="$(srcdir)/$$f" ; \
+ else \
+ file="$$f" ; \
+ fi ; \
+ echo "/* file: $$file */" >> eet_amalgamation.c; \
+ grep -v -e '^# *include \+.\(config\|\|Evil\|Eina\|stdio\|string\|math\|ctype\|limits\|types\|stat\|mman\|setjmp\|errno\|time\|fnmatch\|fcntl\|winsowk2\|unistd\|in\|gnutls\|gcrypt\|x509\|rsa\|objects\|err\|ssl\|dh\|dsa\|evp\|pem\|sha\|hmac\|rand\|zlib\|jpeglib\|Eet_private\|Eet\)[.]h.*' $$file >> eet_amalgamation.c; \
+ done
+ @echo "eet_amalgamation.c generated"
+
+else
+eet_sources_used = $(base_sources)
+endif
+
+libeet_la_SOURCES = $(eet_sources_used)
libeet_la_CFLAGS = @EET_CFLAGS@ @DEBUG_CFLAGS@
libeet_la_LIBADD = @GNUTLS_LIBS@ @OPENSSL_LIBS@ @EFL_COVERAGE_LIBS@ @EET_LIBS@ @EINA_LIBS@ @EVIL_LIBS@ -lz -ljpeg -lm
libeet_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
EXTRA_DIST = Eet_private.h
clean-local:
- @rm -rf *.gcno
+ @rm -rf *.gcno eet_amalgamation.c
#endif
#if HAVE___ATTRIBUTE__
-#define __UNUSED__ __attribute__((unused))
+# define __UNUSED__ __attribute__((unused))
#else
-#define __UNUSED__
+# define __UNUSED__
#endif
#include <stdio.h>
{ eet_data_get_hash, eet_data_put_hash }
};
-static int words_bigendian = -1;
+static int _eet_data_words_bigendian = -1;
/*---*/
((((short)(x) & 0x00ff ) << 8) |\
(((short)(x) & 0xff00 ) >> 8))
+#ifdef CONV8
+# undef CONV8
+#endif
+#ifdef CONV16
+# undef CONV16
+#endif
+#ifdef CONV32
+# undef CONV32
+#endif
+#ifdef CONV64
+# undef CONV64
+#endif
+
#define CONV8(x)
-#define CONV16(x) {if (words_bigendian) SWAP16(x);}
-#define CONV32(x) {if (words_bigendian) SWAP32(x);}
-#define CONV64(x) {if (words_bigendian) SWAP64(x);}
+#define CONV16(x) {if (_eet_data_words_bigendian) SWAP16(x);}
+#define CONV32(x) {if (_eet_data_words_bigendian) SWAP32(x);}
+#define CONV64(x) {if (_eet_data_words_bigendian) SWAP64(x);}
#define IS_SIMPLE_TYPE(Type) (Type > EET_T_UNKNOW && Type < EET_T_LAST)
int csize, size;
Eet_Node *n;
- if (words_bigendian == -1)
+ if (_eet_data_words_bigendian == -1)
{
unsigned long int v;
v = htonl(0x12345678);
- if (v == 0x12345678) words_bigendian = 1;
- else words_bigendian = 0;
+ if (v == 0x12345678) _eet_data_words_bigendian = 1;
+ else _eet_data_words_bigendian = 0;
}
if (node == NULL) return NULL;
int size, i, dump;
Eet_Data_Chunk chnk;
- if (words_bigendian == -1)
+ if (_eet_data_words_bigendian == -1)
{
unsigned long int v;
v = htonl(0x12345678);
- if (v == 0x12345678) words_bigendian = 1;
- else words_bigendian = 0;
+ if (v == 0x12345678) _eet_data_words_bigendian = 1;
+ else _eet_data_words_bigendian = 0;
}
if (edd)
_eet_data_dump_string_escape(dumpdata, dumpfunc, name);
dumpfunc(dumpdata, "\" ");
+#ifdef EET_T_TYPE
+# undef EET_T_TYPE
+#endif
+
#define EET_T_TYPE(Eet_Type, Type) \
case Eet_Type: \
{ \
int csize;
int i;
- if (words_bigendian == -1)
+ if (_eet_data_words_bigendian == -1)
{
unsigned long int v;
v = htonl(0x12345678);
- if (v == 0x12345678) words_bigendian = 1;
- else words_bigendian = 0;
+ if (v == 0x12345678) _eet_data_words_bigendian = 1;
+ else _eet_data_words_bigendian = 0;
}
ds = eet_data_stream_new();
/*---*/
-static int words_bigendian = -1;
+static int _eet_image_words_bigendian = -1;
/*---*/
((((short)(x) & 0x00ff ) << 8) |\
(((short)(x) & 0xff00 ) >> 8))
+#ifdef CONV8
+# undef CONV8
+#endif
+#ifdef CONV16
+# undef CONV16
+#endif
+#ifdef CONV32
+# undef CONV32
+#endif
+#ifdef CONV64
+# undef CONV64
+#endif
+
#define CONV8(x)
-#define CONV16(x) {if (words_bigendian) SWAP16(x);}
-#define CONV32(x) {if (words_bigendian) SWAP32(x);}
-#define CONV64(x) {if (words_bigendian) SWAP64(x);}
+#define CONV16(x) {if (_eet_image_words_bigendian) SWAP16(x);}
+#define CONV32(x) {if (_eet_image_words_bigendian) SWAP32(x);}
+#define CONV64(x) {if (_eet_image_words_bigendian) SWAP64(x);}
/*---*/
static void *
eet_data_image_lossless_convert(int *size, const void *data, unsigned int w, unsigned int h, int alpha)
{
- if (words_bigendian == -1)
+ if (_eet_image_words_bigendian == -1)
{
unsigned long int v;
v = htonl(0x12345678);
- if (v == 0x12345678) words_bigendian = 1;
- else words_bigendian = 0;
+ if (v == 0x12345678) _eet_image_words_bigendian = 1;
+ else _eet_image_words_bigendian = 0;
}
{
unsigned char *d;
memcpy(d + 32, data, w * h * 4);
- if (words_bigendian)
+ if (_eet_image_words_bigendian)
{
unsigned int i;
static void *
eet_data_image_lossless_compressed_convert(int *size, const void *data, unsigned int w, unsigned int h, int alpha, int compression)
{
- if (words_bigendian == -1)
+ if (_eet_image_words_bigendian == -1)
{
unsigned long int v;
v = htonl(0x12345678);
- if (v == 0x12345678) words_bigendian = 1;
- else words_bigendian = 0;
+ if (v == 0x12345678) _eet_image_words_bigendian = 1;
+ else _eet_image_words_bigendian = 0;
}
{
header[4] = compression;
memcpy(d + 32, data, w * h * 4);
- if (words_bigendian)
+ if (_eet_image_words_bigendian)
{
unsigned int i;
(void) alpha; /* unused */
- if (words_bigendian == -1)
+ if (_eet_image_words_bigendian == -1)
{
unsigned long int v;
v = htonl(0x12345678);
- if (v == 0x12345678) words_bigendian = 1;
- else words_bigendian = 0;
+ if (v == 0x12345678) _eet_image_words_bigendian = 1;
+ else _eet_image_words_bigendian = 0;
}
{
header[0] = 0xbeeff00d;
header[1] = sz1;
header[2] = sz2;
- if (words_bigendian)
+ if (_eet_image_words_bigendian)
{
int i;
if (deciphered_d) free(deciphered_d);
}
- if (words_bigendian == -1)
+ if (_eet_image_words_bigendian == -1)
{
unsigned long int v;
v = htonl(0x12345678);
- if (v == 0x12345678) words_bigendian = 1;
- else words_bigendian = 0;
+ if (v == 0x12345678) _eet_image_words_bigendian = 1;
+ else _eet_image_words_bigendian = 0;
}
if (size < 32) return 0;
memcpy(header, data, 32);
- if (words_bigendian)
+ if (_eet_image_words_bigendian)
{
int i;
}
/* Fix swapiness. */
- if (words_bigendian)
+ if (_eet_image_words_bigendian)
{
unsigned int x;
int sz1, sz2;
memcpy(header, data, 32);
- if (words_bigendian)
+ if (_eet_image_words_bigendian)
{
int i;
eet_node_dump_string_escape(dumpdata, dumpfunc, n->name);
dumpfunc(dumpdata, "\" ");
+#ifdef EET_T_TYPE
+# undef EET_T_TYPE
+#endif
+
#define EET_T_TYPE(Eet_Type, Type) \
case Eet_Type: \
{ \