Don't compile commands if disabled

Rather than wrapping whole files in "ifndef OPENSSL_NO_xxx" we handle
the changes in build.info

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/11250)
This commit is contained in:
Rich Salz 2020-03-04 16:52:22 -05:00 committed by Bernd Edlinger
parent fa4d3fe46d
commit 1ae56f2f43
15 changed files with 332 additions and 366 deletions

View File

@ -13,15 +13,40 @@ ENDIF
$OPENSSLSRC=\ $OPENSSLSRC=\
openssl.c progs.c \ openssl.c progs.c \
asn1pars.c ca.c ciphers.c cms.c crl.c crl2p7.c dgst.c \ asn1pars.c ca.c ciphers.c cms.c crl.c crl2p7.c dgst.c \
ec.c ecparam.c enc.c engine.c errstr.c \ enc.c errstr.c \
genpkey.c kdf.c mac.c nseq.c ocsp.c passwd.c pkcs12.c pkcs7.c \ genpkey.c kdf.c mac.c nseq.c passwd.c pkcs7.c \
pkcs8.c pkey.c pkeyparam.c pkeyutl.c prime.c rand.c req.c \ pkcs8.c pkey.c pkeyparam.c pkeyutl.c prime.c rand.c req.c \
s_client.c s_server.c s_time.c sess_id.c smime.c speed.c \ s_client.c s_server.c s_time.c sess_id.c smime.c speed.c \
spkac.c srp.c ts.c verify.c version.c x509.c rehash.c storeutl.c \ spkac.c verify.c version.c x509.c rehash.c storeutl.c \
list.c info.c provider.c fipsinstall.c list.c info.c provider.c fipsinstall.c
IF[{- !$disabled{'des'} -}]
$OPENSSLSRC=$OPENSSLSRC pkcs12.c
ENDIF
IF[{- !$disabled{'ec'} -}]
$OPENSSLSRC=$OPENSSLSRC ec.c ecparam.c
ENDIF
IF[{- !$disabled{'ocsp'} -}]
$OPENSSLSRC=$OPENSSLSRC ocsp.c
ENDIF
IF[{- !$disabled{'srp'} -}]
$OPENSSLSRC=$OPENSSLSRC srp.c
ENDIF
IF[{- !$disabled{'ts'} -}]
$OPENSSLSRC=$OPENSSLSRC ts.c
ENDIF
IF[{- !$disabled{'deprecated-3.0'} -}] IF[{- !$disabled{'deprecated-3.0'} -}]
$OPENSSLSRC=$OPENSSLSRC \ IF[{- !$disabled{'dh'} -}]
dhparam.c dsa.c dsaparam.c gendsa.c rsa.c rsautl.c genrsa.c $OPENSSLSRC=$OPENSSLSRC dhparam.c
ENDIF
IF[{- !$disabled{'dsa'} -}]
$OPENSSLSRC=$OPENSSLSRC dsa.c dsaparam.c gendsa.c
ENDIF
IF[{- !$disabled{'engine'} -}]
$OPENSSLSRC=$OPENSSLSRC engine.c
ENDIF
IF[{- !$disabled{'rsa'} -}]
$OPENSSLSRC=$OPENSSLSRC rsa.c rsautl.c genrsa.c
ENDIF
ENDIF ENDIF
IF[{- !$disabled{'cmp'} -}] IF[{- !$disabled{'cmp'} -}]
$OPENSSLSRC=$OPENSSLSRC cmp_mock_srv.c $OPENSSLSRC=$OPENSSLSRC cmp_mock_srv.c

View File

@ -11,9 +11,6 @@
#define OPENSSL_SUPPRESS_DEPRECATED #define OPENSSL_SUPPRESS_DEPRECATED
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
#ifdef OPENSSL_NO_DH
NON_EMPTY_TRANSLATION_UNIT
#else
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -397,4 +394,3 @@ static int dh_cb(int p, int n, BN_GENCB *cb)
(void)BIO_flush(BN_GENCB_get_arg(cb)); (void)BIO_flush(BN_GENCB_get_arg(cb));
return 1; return 1;
} }
#endif

View File

@ -11,9 +11,6 @@
#define OPENSSL_SUPPRESS_DEPRECATED #define OPENSSL_SUPPRESS_DEPRECATED
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
#ifdef OPENSSL_NO_DSA
NON_EMPTY_TRANSLATION_UNIT
#else
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -278,4 +275,3 @@ int dsa_main(int argc, char **argv)
OPENSSL_free(passout); OPENSSL_free(passout);
return ret; return ret;
} }
#endif

View File

@ -11,9 +11,6 @@
#define OPENSSL_SUPPRESS_DEPRECATED #define OPENSSL_SUPPRESS_DEPRECATED
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
#ifdef OPENSSL_NO_DSA
NON_EMPTY_TRANSLATION_UNIT
#else
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -286,4 +283,3 @@ static int dsa_cb(int p, int n, BN_GENCB *cb)
(void)BIO_flush(BN_GENCB_get_arg(cb)); (void)BIO_flush(BN_GENCB_get_arg(cb));
return 1; return 1;
} }
#endif

View File

@ -8,9 +8,6 @@
*/ */
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
#ifdef OPENSSL_NO_EC
NON_EMPTY_TRANSLATION_UNIT
#else
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -291,4 +288,3 @@ int ec_main(int argc, char **argv)
OPENSSL_free(passout); OPENSSL_free(passout);
return ret; return ret;
} }
#endif

View File

@ -9,9 +9,6 @@
*/ */
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
#ifdef OPENSSL_NO_EC
NON_EMPTY_TRANSLATION_UNIT
#else
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -473,5 +470,3 @@ int ecparam_main(int argc, char **argv)
BIO_free_all(out); BIO_free_all(out);
return ret; return ret;
} }
#endif

View File

@ -8,9 +8,6 @@
*/ */
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
#ifdef OPENSSL_NO_ENGINE
NON_EMPTY_TRANSLATION_UNIT
#else
#include "apps.h" #include "apps.h"
#include "progs.h" #include "progs.h"
@ -491,4 +488,3 @@ int engine_main(int argc, char **argv)
BIO_free_all(out); BIO_free_all(out);
return ret; return ret;
} }
#endif

View File

@ -11,9 +11,6 @@
#define OPENSSL_SUPPRESS_DEPRECATED #define OPENSSL_SUPPRESS_DEPRECATED
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
#ifdef OPENSSL_NO_DSA
NON_EMPTY_TRANSLATION_UNIT
#else
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -162,4 +159,3 @@ int gendsa_main(int argc, char **argv)
OPENSSL_free(passout); OPENSSL_free(passout);
return ret; return ret;
} }
#endif

View File

@ -11,9 +11,6 @@
#define OPENSSL_SUPPRESS_DEPRECATED #define OPENSSL_SUPPRESS_DEPRECATED
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
#ifdef OPENSSL_NO_RSA
NON_EMPTY_TRANSLATION_UNIT
#else
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -227,4 +224,3 @@ static int genrsa_cb(int p, int n, BN_GENCB *cb)
(void)BIO_flush(BN_GENCB_get_arg(cb)); (void)BIO_flush(BN_GENCB_get_arg(cb));
return 1; return 1;
} }
#endif

View File

@ -9,12 +9,9 @@
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
#ifdef OPENSSL_NO_OCSP
NON_EMPTY_TRANSLATION_UNIT
#else
#ifdef OPENSSL_SYS_VMS #ifdef OPENSSL_SYS_VMS
# define _XOPEN_SOURCE_EXTENDED/* So fd_set and friends get properly defined /* So fd_set and friends get properly defined on OpenVMS */
* on OpenVMS */ # define _XOPEN_SOURCE_EXTENDED
#endif #endif
#include <stdio.h> #include <stdio.h>
@ -1572,5 +1569,3 @@ OCSP_RESPONSE *process_responder(OCSP_REQUEST *req,
return resp; return resp;
} }
#endif #endif
#endif

View File

@ -8,9 +8,6 @@
*/ */
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
#if defined(OPENSSL_NO_DES)
NON_EMPTY_TRANSLATION_UNIT
#else
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -1008,5 +1005,3 @@ static int set_pbe(int *ppbe, const char *str)
} }
return 1; return 1;
} }
#endif

View File

@ -11,9 +11,6 @@
#define OPENSSL_SUPPRESS_DEPRECATED #define OPENSSL_SUPPRESS_DEPRECATED
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
#ifdef OPENSSL_NO_RSA
NON_EMPTY_TRANSLATION_UNIT
#else
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -71,9 +68,9 @@ const OPTIONS rsa_options[] = {
{"pvk-strong", OPT_PVK_STRONG, '-', "Enable 'Strong' PVK encoding level (default)"}, {"pvk-strong", OPT_PVK_STRONG, '-', "Enable 'Strong' PVK encoding level (default)"},
{"pvk-weak", OPT_PVK_WEAK, '-', "Enable 'Weak' PVK encoding level"}, {"pvk-weak", OPT_PVK_WEAK, '-', "Enable 'Weak' PVK encoding level"},
{"pvk-none", OPT_PVK_NONE, '-', "Don't enforce PVK encoding"}, {"pvk-none", OPT_PVK_NONE, '-', "Don't enforce PVK encoding"},
# endif
OPT_PROV_OPTIONS, OPT_PROV_OPTIONS,
#endif
{NULL} {NULL}
}; };
@ -329,4 +326,3 @@ int rsa_main(int argc, char **argv)
OPENSSL_free(passout); OPENSSL_free(passout);
return ret; return ret;
} }
#endif

View File

@ -11,9 +11,6 @@
#define OPENSSL_SUPPRESS_DEPRECATED #define OPENSSL_SUPPRESS_DEPRECATED
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
#ifdef OPENSSL_NO_RSA
NON_EMPTY_TRANSLATION_UNIT
#else
#include "apps.h" #include "apps.h"
#include "progs.h" #include "progs.h"
@ -293,4 +290,3 @@ int rsautl_main(int argc, char **argv)
OPENSSL_free(passin); OPENSSL_free(passin);
return ret; return ret;
} }
#endif

View File

@ -12,9 +12,6 @@
*/ */
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
#ifdef OPENSSL_NO_SRP
NON_EMPTY_TRANSLATION_UNIT
#else
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -625,4 +622,3 @@ int srp_main(int argc, char **argv)
release_engine(e); release_engine(e);
return ret; return ret;
} }
#endif

View File

@ -8,9 +8,6 @@
*/ */
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
#ifdef OPENSSL_NO_TS
NON_EMPTY_TRANSLATION_UNIT
#else
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -1013,4 +1010,3 @@ static int verify_cb(int ok, X509_STORE_CTX *ctx)
{ {
return ok; return ok;
} }
#endif /* ndef OPENSSL_NO_TS */