[devel] Made PNG_BUILD_DLL safe: it can be set whenever a DLL is being built.

Removed the include of sys/types.h - apparently unnecessary now on the
  platforms on which it happened (all but Mac OS and RISC OS).
Moved the Mac OS test into pngpriv.h (the only place it is used.)
This commit is contained in:
Glenn Randers-Pehrson 2010-03-14 09:15:49 -05:00
parent 2bc7abfaca
commit d00bbb29b8
9 changed files with 102 additions and 122 deletions

View File

@ -119,6 +119,10 @@ version 1.5.0beta14 [March 14, 2010]
to join tokens in the output and rewrite *.dfn to use this.
Eliminated scripts/*.def in favor of libpng.def; updated projects/visualc71
and removed scripts/makefile.cygwin.
Made PNG_BUILD_DLL safe: it can be set whenever a DLL is being built.
Removed the include of sys/types.h - apparently unnecessary now on the
platforms on which it happened (all but Mac OS and RISC OS).
Moved the Mac OS test into pngpriv.h (the only place it is used.)
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -2596,6 +2596,10 @@ version 1.5.0beta14 [March 14, 2010]
to join tokens in the output and rewrite *.dfn to use this.
Eliminated scripts/*.def in favor of libpng.def; updated projects/visualc71
and removed scripts/makefile.cygwin.
Made PNG_BUILD_DLL safe: it can be set whenever a DLL is being built.
Removed the include of sys/types.h - apparently unnecessary now on the
platforms on which it happened (all but Mac OS and RISC OS).
Moved the Mac OS test into pngpriv.h (the only place it is used.)
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -123,10 +123,8 @@ set(pngtest_sources
)
# SOME NEEDED DEFINITIONS
add_definitions(-DPNG_CONFIGURE_LIBPNG)
if(MSVC)
add_definitions(-DPNG_NO_MODULEDEF -D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
endif(MSVC)
if(PNG_SHARED OR NOT MSVC)
@ -148,7 +146,7 @@ if(PNG_NO_STDIO)
endif()
if(PNG_DEBUG)
add_definitions(-DPNG_DEBUG)
add_definitions(-DPNG_DEBUG=1)
endif()
if(NOT M_LIBRARY AND NOT WIN32)

View File

@ -246,7 +246,7 @@
* the magic flag PNG_USE_DLL to turn on the special processing before
* it includes png.h.
*
* Two additional macros are used to make this happen:
* Four additional macros are used to make this happen:
*
* PNG_IMPEXP The magic (if any) to cause a symbol to be exported from
* the build or imported if PNG_USE_DLL is set - compiler
@ -254,6 +254,13 @@
*
* PNG_EXPORT_TYPE(type) A macro that pre or appends PNG_IMPEXP to
* 'type', compiler specific.
*
* PNG_DLL_EXPORT Set to the magic to use during a libpng build to
* make a symbol exported from the DLL.
*
* PNG_DLL_IMPORT Set to the magic to force the libpng symbols to come
* from a DLL - used to define PNG_IMPEXP when
* PNG_USE_DLL is set.
*/
/* System specific discovery.
@ -272,17 +279,14 @@
# define PNGCAPI __cdecl
# endif
/* Use dllexport and give the option of forcing DLL linking. */
# ifdef DLL_EXPORT /* set by libtool */
# ifndef PNG_IMPEXP
# define PNG_IMPEXP __declspec(dllexport)
# endif
# endif
# ifndef PNG_DLL_IMPORT
/* Always set this because we don't know what will happen when
* the application is compiled.
/* Provide the appropriate defaults for exporting a symbol from
* the DLL and forcing import. Always set these - the choice to
* use them is made below.
*/
# ifndef PNG_DLL_EXPORT
# define PNG_DLL_EXPORT __declspec(dllexport)
# endif
# ifndef PNG_DLL_IMPORT
# define PNG_DLL_IMPORT __declspec(dllimport)
# endif
@ -312,9 +316,6 @@
# endif /* compiler/api */
/* NOTE: PNGCBAPI always defaults to PNGCAPI. */
# if defined(DLL_EXPORT) || defined(_WINDLL) || defined(_DLL) ||\
defined(__DLL__)
/* Building a DLL; check the compiler. */
# if (defined(_MSC_VER) && _MSC_VER < 800) ||\
(defined(__BORLANDC__) && __BORLANDC__ < 0x500)
/* older Borland and MSC
@ -324,18 +325,13 @@
# ifndef PNG_EXPORT_TYPE
# define PNG_EXPORT_TYPE(type) type PNG_IMPEXP
# endif
# ifndef PNG_IMPEXP
# define PNG_IMPEXP __export
# endif
# define PNG_DLL_EXPORT __export
# else /* newer compiler */
# ifndef PNG_IMPEXP
# define PNG_IMPEXP __declspec(dllexport)
# endif
# define PNG_DLL_EXPORT __declspec(dllexport)
# ifndef PNG_DLL_IMPORT
# define PNG_DLL_IMPORT __declspec(dllimport)
# endif
# endif /* compiler */
# endif /* building DLL */
# else /* !Cygwin && !Windows/x86 */
# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
@ -359,9 +355,31 @@
# define PNGAPI PNGCAPI
#endif
/* The default for PNG_IMPEXP depends on whether the library is
* being built or used.
*/
#ifndef PNG_IMPEXP
# ifdef PNGLIB_BUILD
/* Building the library */
# if (defined(DLL_EXPORT)/*from libtool*/ ||\
defined(_WINDLL) || defined(_DLL) || defined(__DLL__) ||\
defined(PNG_BUILD_DLL)) && defined(PNG_DLL_EXPORT)
/* Building a DLL. */
# define PNG_IMPEXP PNG_DLL_EXPORT
# endif /* DLL */
# else
/* Using the library */
# if defined(PNG_USE_DLL) && defined(PNG_DLL_IMPORT)
/* This forces use of a DLL, disallowing static linking */
# define PNG_IMPEXP PNG_DLL_IMPORT
# endif
# endif
# ifndef PNG_IMPEXP
# define PNG_IMPEXP
# endif
#endif
#ifndef PNG_EXPORT_TYPE
# define PNG_EXPORT_TYPE(type) PNG_IMPEXP type
#endif
@ -470,13 +488,6 @@
# define PNG_STDIO_SUPPORTED
#endif
#ifdef PNG_BUILD_DLL
# if !defined(PNG_CONSOLE_IO_SUPPORTED) && !defined(PNG_NO_CONSOLE_IO)
# define PNG_NO_CONSOLE_IO
# endif
#endif
#ifdef PNG_NO_STDIO
# ifndef PNG_NO_CONSOLE_IO
# define PNG_NO_CONSOLE_IO
@ -494,22 +505,6 @@
# define PNG_CONSOLE_IO_SUPPORTED
#endif
/* Try to determine if we are compiling on a Mac. Note that testing for
* just __MWERKS__ is not good enough, because the Codewarrior is now used
* on non-Mac platforms.
*/
#ifndef MACOS
# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
# define MACOS
# endif
#endif
/* Enough people need this for various reasons to include it here */
#if !defined(MACOS) && !defined(RISCOS)
#include <sys/types.h>
#endif
/* PNG_SETJMP_NOT_SUPPORTED and PNG_NO_SETJMP_SUPPORTED are deprecated. */
#if !defined(PNG_NO_SETJMP) && \
!defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED)

View File

@ -57,7 +57,8 @@
*/
#ifdef PNG_FLOATING_POINT_SUPPORTED
# ifdef MACOS
# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
/* We need to check that <math.h> hasn't already been included earlier
* as it seems it doesn't agree with <fp.h>, yet we should really use
* <fp.h> if possible.

View File

@ -44,9 +44,9 @@ CFG=libpng - Win32 DLL Release
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
# ADD BASE CPP /nologo /MD /W3 /O2 /D "NDEBUG" /FD /c
# SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_BUILD_DLL" /D "ZLIB_DLL" /FD /c
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "NDEBUG" /D "ZLIB_DLL" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
MTL=midl.exe
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@ -75,9 +75,9 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "_DEBUG" /FD /GZ /c
# SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D PNG_DEBUG=1 /D "PNG_BUILD_DLL" /D "ZLIB_DLL" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "_DEBUG" /D "DEBUG" /D PNG_DEBUG=1 /D "ZLIB_DLL" /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu
MTL=midl.exe
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
@ -106,9 +106,9 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
# ADD BASE CPP /nologo /MD /W3 /O2 /D "NDEBUG" /FD /c
# SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_BUILD_DLL" /D "ZLIB_DLL" /D PNGAPI=__stdcall /D "PNG_NO_MODULEDEF" /D "PNG_LIBPNG_SPECIALBUILD" /FD /c
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "NDEBUG" /D "ZLIB_DLL" /D PNGAPI=__stdcall /D "PNG_NO_MODULEDEF" /D "PNG_LIBPNG_SPECIALBUILD" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
MTL=midl.exe
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@ -142,9 +142,9 @@ PostBuild_Cmds=echo Deleting $(targetname) import library and export file (No
# PROP Intermediate_Dir "Win32_LIB_Release"
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
# ADD BASE CPP /nologo /MD /W3 /O2 /D "NDEBUG" /FD /c
# SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /FD /c
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "NDEBUG" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
RSC=rc.exe
# ADD BASE RSC /l 0x409 /d "PNG_NO_PEDANTIC_WARNINGS" /d "NDEBUG"
@ -169,9 +169,9 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Win32_LIB_Debug"
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "_DEBUG" /FD /GZ /c
# SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D PNG_DEBUG=1 /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "_DEBUG" /D "DEBUG" /D PNG_DEBUG=1 /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu
RSC=rc.exe
# ADD BASE RSC /l 0x409 /d "PNG_NO_PEDANTIC_WARNINGS" /d "_DEBUG"
@ -241,7 +241,7 @@ SOURCE=..\..\pngtrans.c
# End Source File
# Begin Source File
SOURCE=..\..\scripts\pngwin.def
SOURCE=..\..\libpng.def
!IF "$(CFG)" == "libpng - Win32 DLL Release"

View File

@ -43,9 +43,9 @@ RSC=rc.exe
# PROP Intermediate_Dir "Win32_DLL_Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
# ADD BASE CPP /nologo /W3 /O2 /D "NDEBUG" /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_DLL" /D "PNG_NO_STDIO" /FD /c
# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\zlib" /D "NDEBUG" /D "PNG_NO_STDIO" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
@ -75,9 +75,9 @@ PostBuild_Cmds=set path=$(outdir);..\..\..\zlib\projects\visualc6\Win32_DLL_Rele
# PROP Intermediate_Dir "Win32_DLL_Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "_DEBUG" /FD /GZ /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_DLL" /D "PNG_NO_STDIO" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\zlib" /D "_DEBUG" /D "PNG_NO_STDIO" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
@ -107,9 +107,9 @@ PostBuild_Cmds=set path=$(outdir);..\..\..\zlib\projects\visualc6\Win32_DLL_Debu
# PROP Intermediate_Dir "Win32_LIB_Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
# ADD BASE CPP /nologo /W3 /O2 /D "NDEBUG" /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /FD /c
# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\zlib" /D "NDEBUG" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
@ -139,9 +139,9 @@ PostBuild_Cmds=$(outdir)\pngtest.exe ..\..\pngtest.png
# PROP Intermediate_Dir "Win32_LIB_Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "_DEBUG" /FD /GZ /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\zlib" /D "_DEBUG" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"

View File

@ -58,18 +58,18 @@
</Configuration>
<Configuration
Name="DLL Debug|Win32"
OutputDirectory=".\Win32_DLL_Debug"
IntermediateDirectory=".\Win32_DLL_Debug"
OutputDirectory="Win32_DLL_Debug"
IntermediateDirectory="Win32_DLL_Debug"
ConfigurationType="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..;..\..\..\zlib"
PreprocessorDefinitions="WIN32;_DEBUG;DEBUG;PNG_DEBUG=1;PNG_BUILD_DLL;ZLIB_DLL;_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="PNG_DEBUG=1;ZLIB_DLL;_CRT_SECURE_NO_WARNINGS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="png.h"
PrecompiledHeaderThrough="pngpriv.h"
WarningLevel="3"
DebugInformationFormat="4"
CompileAs="0"/>
@ -89,7 +89,7 @@
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG,PNG_DEBUG=1"
PreprocessorDefinitions="PNG_DEBUG=1"
Culture="1033"
AdditionalIncludeDirectories="..\..;..\..\..\zlib;$(IntDir)"/>
<Tool
@ -136,7 +136,6 @@
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
AdditionalOptions="/d PNG_NO_PEDANTIC_WARNINGS /d PNG_LIBPNG_DLLFNAME_POSTFIX=&quot;&quot;&quot;&quot;VB&quot;&quot;&quot;&quot; /d PNG_LIBPNG_SPECIALBUILD=&quot;&quot;&quot;&quot;__stdcall calling convention used for exported functions&quot;&quot;&quot;&quot;"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
AdditionalIncludeDirectories="..\..;..\..\..\zlib;$(IntDir)"/>
@ -153,26 +152,26 @@
</Configuration>
<Configuration
Name="LIB Release|Win32"
OutputDirectory=".\Win32_LIB_Release"
IntermediateDirectory=".\Win32_LIB_Release"
OutputDirectory="Win32_LIB_Release"
IntermediateDirectory="Win32_LIB_Release"
ConfigurationType="4">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..;..\..\..\zlib"
PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="png.h"
PrecompiledHeaderThrough="pngpriv.h"
WarningLevel="3"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/libpng.lib"/>
OutputFile="$(OutDir)\libpng.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
@ -194,18 +193,18 @@
</Configuration>
<Configuration
Name="LIB Debug|Win32"
OutputDirectory=".\Win32_LIB_Debug"
IntermediateDirectory=".\Win32_LIB_Debug"
OutputDirectory="Win32_LIB_Debug"
IntermediateDirectory="Win32_LIB_Debug"
ConfigurationType="4">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..;..\..\..\zlib"
PreprocessorDefinitions="WIN32;_DEBUG;DEBUG;PNG_DEBUG=1;_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="PNG_DEBUG=1;_CRT_SECURE_NO_WARNINGS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="png.h"
PrecompiledHeaderThrough="pngpriv.h"
WarningLevel="3"
DebugInformationFormat="4"
CompileAs="0"/>
@ -213,7 +212,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/libpngd.lib"/>
OutputFile="$(OutDir)\libpngd.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
@ -333,27 +332,6 @@
<File
RelativePath="..\..\pngtrans.c">
</File>
<File
RelativePath="..\..\scripts\pngwin.def">
<FileConfiguration
Name="DLL VB|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCustomBuildTool"/>
</FileConfiguration>
<FileConfiguration
Name="LIB Release|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCustomBuildTool"/>
</FileConfiguration>
<FileConfiguration
Name="LIB Debug|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCustomBuildTool"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\pngwio.c">
</File>
@ -400,7 +378,7 @@
</File>
</Filter>
<File
RelativePath=".\PRJ0041.mak">
RelativePath="PRJ0041.mak">
<FileConfiguration
Name="DLL Release|Win32">
<Tool

View File

@ -2,7 +2,7 @@ The xcode project has not been entirely updated to libpng-1.4.0.
It needs to *not* depend on pnggccrd.c or pngvcrd.c
It needs to PNG_NO_PEDANTIC_WARNINGS in the CFLAGS while building
It needs to define PNG_NO_PEDANTIC_WARNINGS in the CFLAGS while building
the library, but not while building an application.
If an updated version is not received, this project will