This patch accomplishes the following:
-- Auto-generates HAVE_LOCALE_H macro and adds it to jconfig.h (this is used by rdjpgcom.c.)
-- Reconciles the description and ordering of macros between config.h.in and jconfig.h.in, so the two files can be easily diffed.
-- Eliminates the use of the autoheader-generated config.h in the project and moves relevant internal-only macros into a new file, jconfigint.h.  This is to avoid "already defined" warnings in files that were including both config.h (to get the internal autotools package information or the INLINE definition) and jconfig.h.


git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.3.x@1258 632fc199-4ca6-4c93-a231-07263d6284db
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9e59a3e..aaa1a7d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -143,7 +143,7 @@
 message(STATUS "Install directory = ${CMAKE_INSTALL_PREFIX}")
 
 configure_file(win/jconfig.h.in jconfig.h)
-configure_file(win/config.h.in config.h)
+configure_file(win/jconfigint.h.in jconfigint.h)
 
 include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
 
diff --git a/cjpeg.c b/cjpeg.c
index 0c23fe7..7f03819 100644
--- a/cjpeg.c
+++ b/cjpeg.c
@@ -28,7 +28,7 @@
 
 #include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
 #include "jversion.h"		/* for version message */
-#include "config.h"
+#include "jconfigint.h"
 
 #ifdef USE_CCOMMAND		/* command-line reader for Macintosh */
 #ifdef __MWERKS__
diff --git a/configure.ac b/configure.ac
index a95a4c9..9fd2948 100644
--- a/configure.ac
+++ b/configure.ac
@@ -97,9 +97,9 @@
 
 # Checks for header files.
 AC_HEADER_STDC
-AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
+AC_CHECK_HEADERS([stddef.h stdlib.h locale.h string.h])
 AC_CHECK_HEADER([sys/types.h],
-  AC_DEFINE([NEED_SYS_TYPES_H], 1, [Define if you have sys/types.h]))
+  AC_DEFINE([NEED_SYS_TYPES_H], 1, [Define if you need to include <sys/types.h> to get size_t.]))
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
@@ -131,7 +131,8 @@
      exit(is_shifting_signed(-0x7F7E80B1L));
    }],
   [AC_MSG_RESULT(no)
-   AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED], 1, [Define if shift is unsigned])],
+   AC_DEFINE([RIGHT_SHIFT_IS_UNSIGNED], 1,
+     [Define if your (broken) compiler shifts signed values as if they were unsigned.])],
   [AC_MSG_RESULT(yes)],
   [AC_MSG_RESULT(Assuming that right shift is signed on target machine.)])
 
@@ -143,12 +144,12 @@
   [AC_MSG_RESULT(ok)],
   [AC_MSG_RESULT(short)
    AC_DEFINE([NEED_SHORT_EXTERNAL_NAMES], 1,
-     [Define if you need short function names])])
+     [Define if linker requires that the first 15 characters of global names be unique.])])
 
 # Checks for library functions.
 AC_CHECK_FUNCS([memset memcpy], [],
   [AC_DEFINE([NEED_BSD_STRINGS], 1,
-     [Define if you have BSD-like bzero and bcopy])])
+     [Define if you have BSD-like bzero and bcopy in <strings.h> rather than memset/memcpy in <string.h>.])])
 
 AC_MSG_CHECKING([libjpeg API version])
 AC_ARG_VAR(JPEG_LIB_VERSION, [libjpeg API version (62, 70, or 80)])
@@ -265,7 +266,7 @@
 # Check for non-broken inline under various spellings
 AC_MSG_CHECKING(for inline)
 ljt_cv_inline=""
-AC_TRY_COMPILE(, [} __attribute__((always_inline)) int foo() { return 0; }
+AC_TRY_COMPILE(, [} inline __attribute__((always_inline)) int foo() { return 0; }
 int bar() { return foo();], ljt_cv_inline="inline __attribute__((always_inline))",
 AC_TRY_COMPILE(, [} __inline__ int foo() { return 0; }
 int bar() { return foo();], ljt_cv_inline="__inline__",
@@ -484,7 +485,7 @@
 AC_SUBST(RPM_CONFIG_ARGS)
 AC_SUBST(DEBARCH)
 AC_SUBST(BUILD)
-AC_DEFINE_UNQUOTED([BUILD], "$BUILD", [Build number])
+AC_DEFINE_UNQUOTED([BUILD], "$BUILD", [libjpeg-turbo build number])
 
 # jconfig.h is the file we use, but we have another before that to
 # fool autoheader. the reason is that we include this header in our
@@ -492,6 +493,7 @@
 # jconfig.h is a minimal version that allows this package to be built
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_HEADERS([jconfig.h])
+AC_CONFIG_HEADERS([jconfigint.h])
 AC_CONFIG_FILES([pkgscripts/libjpeg-turbo.spec.tmpl:release/libjpeg-turbo.spec.in])
 AC_CONFIG_FILES([pkgscripts/makecygwinpkg.tmpl:release/makecygwinpkg.in])
 AC_CONFIG_FILES([pkgscripts/makedpkg.tmpl:release/makedpkg.in])
diff --git a/djpeg.c b/djpeg.c
index 589c580..c1abb13 100644
--- a/djpeg.c
+++ b/djpeg.c
@@ -27,7 +27,7 @@
 
 #include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
 #include "jversion.h"		/* for version message */
-#include "config.h"
+#include "jconfigint.h"
 
 #include <ctype.h>		/* to declare isprint() */
 
diff --git a/jccolor.c b/jccolor.c
index 94b4184..8318485 100644
--- a/jccolor.c
+++ b/jccolor.c
@@ -15,7 +15,7 @@
 #include "jinclude.h"
 #include "jpeglib.h"
 #include "jsimd.h"
-#include "config.h"
+#include "jconfigint.h"
 
 
 /* Private subobject */
diff --git a/jconfig.h.in b/jconfig.h.in
index 6b80ce2..78023c1 100644
--- a/jconfig.h.in
+++ b/jconfig.h.in
@@ -12,10 +12,10 @@
 /* Support arithmetic decoding */
 #undef D_ARITH_CODING_SUPPORTED
 
-/* Support in-memory source/destination managers */
-#undef MEM_SRCDST_SUPPORTED
+/* Define to 1 if you have the <locale.h> header file. */
+#undef HAVE_LOCALE_H
 
-/* Compiler supports function prototypes. */
+/* Define if your compiler supports prototypes */
 #undef HAVE_PROTOTYPES
 
 /* Define to 1 if you have the <stddef.h> header file. */
@@ -24,25 +24,31 @@
 /* Define to 1 if you have the <stdlib.h> header file. */
 #undef HAVE_STDLIB_H
 
-/* Compiler supports 'unsigned char'. */
+/* Define to 1 if the system has the type `unsigned char'. */
 #undef HAVE_UNSIGNED_CHAR
 
-/* Compiler supports 'unsigned short'. */
+/* Define to 1 if the system has the type `unsigned short'. */
 #undef HAVE_UNSIGNED_SHORT
 
-/* Compiler does not support pointers to unspecified structures. */
+/* Compiler does not support pointers to undefined structures. */
 #undef INCOMPLETE_TYPES_BROKEN
 
-/* Compiler has <strings.h> rather than standard <string.h>. */
+/* Support in-memory source/destination managers */
+#undef MEM_SRCDST_SUPPORTED
+
+/* Define if you have BSD-like bzero and bcopy in <strings.h> rather than
+   memset/memcpy in <string.h>. */
 #undef NEED_BSD_STRINGS
 
-/* Linker requires that global names be unique in first 15 characters. */
+/* Define if linker requires that the first 15 characters of global names be
+   unique. */
 #undef NEED_SHORT_EXTERNAL_NAMES
 
-/* Need to include <sys/types.h> in order to obtain size_t. */
+/* Define if you need to include <sys/types.h> to get size_t. */
 #undef NEED_SYS_TYPES_H
 
-/* Broken compiler shifts signed values as an unsigned shift. */
+/* Define if your (broken) compiler shifts signed values as if they were
+   unsigned. */
 #undef RIGHT_SHIFT_IS_UNSIGNED
 
 /* Use accelerated SIMD routines. */
diff --git a/jconfigint.h.in b/jconfigint.h.in
new file mode 100644
index 0000000..8f216eb
--- /dev/null
+++ b/jconfigint.h.in
@@ -0,0 +1,11 @@
+/* libjpeg-turbo build number */
+#undef BUILD
+
+/* How to obtain function inlining. */
+#undef INLINE
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Version number of package */
+#undef VERSION
diff --git a/jdcolor.c b/jdcolor.c
index ccf9047..458adda 100644
--- a/jdcolor.c
+++ b/jdcolor.c
@@ -16,7 +16,7 @@
 #include "jinclude.h"
 #include "jpeglib.h"
 #include "jsimd.h"
-#include "config.h"
+#include "jconfigint.h"
 
 
 /* Private subobject */
diff --git a/jdmerge.c b/jdmerge.c
index 9830be2..cb1aa0a 100644
--- a/jdmerge.c
+++ b/jdmerge.c
@@ -39,7 +39,7 @@
 #include "jinclude.h"
 #include "jpeglib.h"
 #include "jsimd.h"
-#include "config.h"
+#include "jconfigint.h"
 
 #ifdef UPSAMPLE_MERGING_SUPPORTED
 
diff --git a/jpegtran.c b/jpegtran.c
index 54c8ece..5bfab48 100644
--- a/jpegtran.c
+++ b/jpegtran.c
@@ -16,7 +16,7 @@
 #include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
 #include "transupp.h"		/* Support routines for jpegtran */
 #include "jversion.h"		/* for version message */
-#include "config.h"
+#include "jconfigint.h"
 
 #ifdef USE_CCOMMAND		/* command-line reader for Macintosh */
 #ifdef __MWERKS__
@@ -375,7 +375,7 @@
   jvirt_barray_ptr * dst_coef_arrays;
   int file_index;
   /* We assume all-in-memory processing and can therefore use only a
-   * single file pointer for sequential input and output operation. 
+   * single file pointer for sequential input and output operation.
    */
   FILE * fp;
 
diff --git a/win/config.h.in b/win/jconfigint.h.in
similarity index 100%
rename from win/config.h.in
rename to win/jconfigint.h.in