xref: /freebsd/share/mk/src.opts.mk (revision b29d6977f31adc2560a78f75c7b43d73fc10c93d)
15e84b765SWarner Losh# $FreeBSD$
25e84b765SWarner Losh#
35e84b765SWarner Losh# Option file for FreeBSD /usr/src builds.
45e84b765SWarner Losh#
55e84b765SWarner Losh# Users define WITH_FOO and WITHOUT_FOO on the command line or in /etc/src.conf
65e84b765SWarner Losh# and /etc/make.conf files. These translate in the build system to MK_FOO={yes,no}
75e84b765SWarner Losh# with sensible (usually) defaults.
85e84b765SWarner Losh#
95e84b765SWarner Losh# Makefiles must include bsd.opts.mk after defining specific MK_FOO options that
105e84b765SWarner Losh# are applicable for that Makefile (typically there are none, but sometimes there
115e84b765SWarner Losh# are exceptions). Recursive makes usually add MK_FOO=no for options that they wish
125e84b765SWarner Losh# to omit from that make.
135e84b765SWarner Losh#
141fc86460SWarner Losh# Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO
155e84b765SWarner Losh# variable.
165e84b765SWarner Losh#
17c6063d0dSWarner Losh# Makefiles may also assume that this file is included by src.opts.mk should it
185e84b765SWarner Losh# need variables defined there prior to the end of the Makefile where
195e84b765SWarner Losh# bsd.{subdir,lib.bin}.mk is traditionally included.
205e84b765SWarner Losh#
215e84b765SWarner Losh# The old-style YES_FOO and NO_FOO are being phased out. No new instances of them
225e84b765SWarner Losh# should be added. Old instances should be removed since they were just to
235e84b765SWarner Losh# bridge the gap between FreeBSD 4 and FreeBSD 5.
245e84b765SWarner Losh#
255e84b765SWarner Losh# Makefiles should never test WITH_FOO or WITHOUT_FOO directly (although an
265e84b765SWarner Losh# exception is made for _WITHOUT_SRCONF which turns off this mechanism
2722cac754SWarner Losh# completely inside bsd.*.mk files).
285e84b765SWarner Losh#
295e84b765SWarner Losh
305e84b765SWarner Losh.if !target(__<src.opts.mk>__)
315e84b765SWarner Losh__<src.opts.mk>__:
325e84b765SWarner Losh
33f9798cc7SWarner Losh.include <bsd.own.mk>
34f9798cc7SWarner Losh
355e84b765SWarner Losh#
365e84b765SWarner Losh# Define MK_* variables (which are either "yes" or "no") for users
375e84b765SWarner Losh# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
385e84b765SWarner Losh# make(1) environment.
395e84b765SWarner Losh# These should be tested with `== "no"' or `!= "no"' in makefiles.
405e84b765SWarner Losh# The NO_* variables should only be set by makefiles for variables
415e84b765SWarner Losh# that haven't been converted over.
425e84b765SWarner Losh#
435e84b765SWarner Losh
445e84b765SWarner Losh# These options are used by src the builds
455e84b765SWarner Losh
465e84b765SWarner Losh__DEFAULT_YES_OPTIONS = \
475e84b765SWarner Losh    ACCT \
485e84b765SWarner Losh    ACPI \
495e84b765SWarner Losh    AMD \
505e84b765SWarner Losh    APM \
515e84b765SWarner Losh    AT \
525e84b765SWarner Losh    ATM \
535e84b765SWarner Losh    AUDIT \
545e84b765SWarner Losh    AUTHPF \
555e84b765SWarner Losh    BINUTILS \
565e84b765SWarner Losh    BINUTILS_BOOTSTRAP \
575e84b765SWarner Losh    BLUETOOTH \
585e84b765SWarner Losh    BOOT \
595e84b765SWarner Losh    BSD_CPIO \
605e84b765SWarner Losh    BSNMP \
615e84b765SWarner Losh    BZIP2 \
625e84b765SWarner Losh    CALENDAR \
635e84b765SWarner Losh    CAPSICUM \
645e84b765SWarner Losh    CASPER \
655e84b765SWarner Losh    CDDL \
665e84b765SWarner Losh    CPP \
675e84b765SWarner Losh    CROSS_COMPILER \
685e84b765SWarner Losh    CRYPT \
695e84b765SWarner Losh    CTM \
7036716419SHans Petter Selasky    CUSE \
715e84b765SWarner Losh    CXX \
725e84b765SWarner Losh    DICT \
735e84b765SWarner Losh    DMAGENT \
745e84b765SWarner Losh    DYNAMICROOT \
755e84b765SWarner Losh    ED_CRYPTO \
7679a86dafSEnji Cooper    EE \
77968d62e1SEd Maste    ELFTOOLCHAIN_TOOLS \
785e84b765SWarner Losh    EXAMPLES \
795e84b765SWarner Losh    FDT \
805e84b765SWarner Losh    FLOPPY \
815e84b765SWarner Losh    FMTREE \
825e84b765SWarner Losh    FORTH \
835e84b765SWarner Losh    FP_LIBC \
845e84b765SWarner Losh    FREEBSD_UPDATE \
855e84b765SWarner Losh    GAMES \
865e84b765SWarner Losh    GCOV \
875e84b765SWarner Losh    GDB \
885e84b765SWarner Losh    GNU \
895e84b765SWarner Losh    GNU_GREP_COMPAT \
905e84b765SWarner Losh    GPIO \
915e84b765SWarner Losh    GPL_DTC \
925e84b765SWarner Losh    GROFF \
935e84b765SWarner Losh    HTML \
94f8080a99SWarner Losh    HYPERV \
955e84b765SWarner Losh    ICONV \
965e84b765SWarner Losh    INET \
975e84b765SWarner Losh    INET6 \
985e84b765SWarner Losh    IPFILTER \
995e84b765SWarner Losh    IPFW \
100*b29d6977SEnji Cooper    ISCSI \
1015e84b765SWarner Losh    JAIL \
1025e84b765SWarner Losh    KDUMP \
1035e84b765SWarner Losh    KVM \
1045e84b765SWarner Losh    LDNS \
1055e84b765SWarner Losh    LDNS_UTILS \
1065e84b765SWarner Losh    LEGACY_CONSOLE \
1075e84b765SWarner Losh    LIB32 \
1085e84b765SWarner Losh    LIBPTHREAD \
1095e84b765SWarner Losh    LIBTHR \
1105e84b765SWarner Losh    LOCALES \
1115e84b765SWarner Losh    LOCATE \
1125e84b765SWarner Losh    LPR \
1135e84b765SWarner Losh    LS_COLORS \
1145e84b765SWarner Losh    LZMA_SUPPORT \
1155e84b765SWarner Losh    MAIL \
1165e84b765SWarner Losh    MAILWRAPPER \
1175e84b765SWarner Losh    MAKE \
1185e84b765SWarner Losh    NDIS \
1195e84b765SWarner Losh    NETCAT \
1205e84b765SWarner Losh    NETGRAPH \
1215e84b765SWarner Losh    NLS_CATALOGS \
1225e84b765SWarner Losh    NS_CACHING \
1235e84b765SWarner Losh    NTP \
1245e84b765SWarner Losh    OPENSSL \
1255e84b765SWarner Losh    PAM \
1265e84b765SWarner Losh    PC_SYSINSTALL \
1275e84b765SWarner Losh    PF \
1285e84b765SWarner Losh    PKGBOOTSTRAP \
1295e84b765SWarner Losh    PMC \
1305e84b765SWarner Losh    PORTSNAP \
1315e84b765SWarner Losh    PPP \
1325e84b765SWarner Losh    QUOTAS \
1335e84b765SWarner Losh    RCMDS \
1345e84b765SWarner Losh    RCS \
1355e84b765SWarner Losh    RESCUE \
1365e84b765SWarner Losh    ROUTED \
1375e84b765SWarner Losh    SENDMAIL \
1385e84b765SWarner Losh    SETUID_LOGIN \
1395e84b765SWarner Losh    SHAREDOCS \
1405e84b765SWarner Losh    SOURCELESS \
1415e84b765SWarner Losh    SOURCELESS_HOST \
1425e84b765SWarner Losh    SOURCELESS_UCODE \
1435e84b765SWarner Losh    SVNLITE \
1445e84b765SWarner Losh    SYSCALL_COMPAT \
1455e84b765SWarner Losh    SYSCONS \
1465e84b765SWarner Losh    SYSINSTALL \
1475e84b765SWarner Losh    TCSH \
1485e84b765SWarner Losh    TELNET \
149b85bd43aSJulio Merino    TESTS \
1505e84b765SWarner Losh    TEXTPROC \
1515e84b765SWarner Losh    UNBOUND \
1525e84b765SWarner Losh    USB \
1535e84b765SWarner Losh    UTMPX \
1545e84b765SWarner Losh    VI \
155824a9093SEd Maste    VT \
1565e84b765SWarner Losh    WIRELESS \
1575e84b765SWarner Losh    WPA_SUPPLICANT_EAPOL \
1585e84b765SWarner Losh    ZFS \
1595e84b765SWarner Losh    ZONEINFO
1605e84b765SWarner Losh
1615e84b765SWarner Losh__DEFAULT_NO_OPTIONS = \
1625e84b765SWarner Losh    BSD_GREP \
1635e84b765SWarner Losh    CLANG_EXTRAS \
1645e84b765SWarner Losh    EISA \
165f510ecf0SWarner Losh    FMAKE \
1665e84b765SWarner Losh    HESIOD \
1675e84b765SWarner Losh    LLDB \
1685e84b765SWarner Losh    NAND \
1695e84b765SWarner Losh    OFED \
1705e84b765SWarner Losh    OPENLDAP \
1715e84b765SWarner Losh    OPENSSH_NONE_CIPHER \
1725e84b765SWarner Losh    SHARED_TOOLCHAIN \
1735e84b765SWarner Losh    SORT_THREADS \
174289ee3b6SWarner Losh    SVN
1755e84b765SWarner Losh
1765e84b765SWarner Losh#
1775e84b765SWarner Losh# Default behaviour of some options depends on the architecture.  Unfortunately
1785e84b765SWarner Losh# this means that we have to test TARGET_ARCH (the buildworld case) as well
1795e84b765SWarner Losh# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
1805e84b765SWarner Losh# used at all in bsd.*.mk, but we have to make an exception here if we want
1815e84b765SWarner Losh# to allow defaults for some things like clang to vary by target architecture.
1825e84b765SWarner Losh# Additional, per-target behavior should be rarely added only after much
1835e84b765SWarner Losh# gnashing of teeth and grinding of gears.
1845e84b765SWarner Losh#
1855e84b765SWarner Losh.if defined(TARGET_ARCH)
1865e84b765SWarner Losh__T=${TARGET_ARCH}
1875e84b765SWarner Losh.else
1885e84b765SWarner Losh__T=${MACHINE_ARCH}
1895e84b765SWarner Losh.endif
1905e84b765SWarner Losh.if defined(TARGET)
1915e84b765SWarner Losh__TT=${TARGET}
1925e84b765SWarner Losh.else
1935e84b765SWarner Losh__TT=${MACHINE}
1945e84b765SWarner Losh.endif
1950104753bSDimitry Andric
1960104753bSDimitry Andric.include <bsd.compiler.mk>
1970104753bSDimitry Andric.if !${COMPILER_FEATURES:Mc++11}
1980104753bSDimitry Andric# If the compiler is not C++11 capable, disable clang and use gcc instead.
1999e88096eSWarner Losh__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
2000104753bSDimitry Andric__DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
2010104753bSDimitry Andric.elif ${__T} == "amd64" || ${__T} == "i386"
2020104753bSDimitry Andric# On x86, clang is enabled, and will be installed as the default cc.
2030104753bSDimitry Andric__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
2040104753bSDimitry Andric__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
2050104753bSDimitry Andric.elif ${__TT} == "arm" && ${__T:Marm*eb*} == ""
2060104753bSDimitry Andric# On little-endian arm, clang is enabled, and it is installed as the default
2070104753bSDimitry Andric# cc, but since gcc is unable to build the full clang, disable it by default.
2080104753bSDimitry Andric__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC
2090104753bSDimitry Andric__DEFAULT_NO_OPTIONS+=CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX
2100104753bSDimitry Andric.elif ${__T:Mpowerpc*}
2110104753bSDimitry Andric# On powerpc, clang is enabled, but gcc is installed as the default cc.
2120104753bSDimitry Andric__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX
2130104753bSDimitry Andric__DEFAULT_NO_OPTIONS+=CLANG_BOOTSTRAP CLANG_IS_CC
2140104753bSDimitry Andric.else
2150104753bSDimitry Andric# Everything else disables clang, and uses gcc instead.
2160104753bSDimitry Andric__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
2170104753bSDimitry Andric__DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
2185e84b765SWarner Losh.endif
2195e84b765SWarner Losh
2205e84b765SWarner Losh.include <bsd.mkopt.mk>
2215e84b765SWarner Losh
2225e84b765SWarner Losh#
2235e84b765SWarner Losh# MK_* options that default to "yes" if the compiler is a C++11 compiler.
2245e84b765SWarner Losh#
2255e84b765SWarner Losh.for var in \
2265e84b765SWarner Losh    LIBCPLUSPLUS
2275e84b765SWarner Losh.if !defined(MK_${var})
2285e84b765SWarner Losh.if ${COMPILER_FEATURES:Mc++11}
2295e84b765SWarner Losh.if defined(WITHOUT_${var})
2305e84b765SWarner LoshMK_${var}:=	no
2315e84b765SWarner Losh.else
2325e84b765SWarner LoshMK_${var}:=	yes
2335e84b765SWarner Losh.endif
2345e84b765SWarner Losh.else
2355e84b765SWarner Losh.if defined(WITH_${var})
2365e84b765SWarner LoshMK_${var}:=	yes
2375e84b765SWarner Losh.else
2385e84b765SWarner LoshMK_${var}:=	no
2395e84b765SWarner Losh.endif
2405e84b765SWarner Losh.endif
2415e84b765SWarner Losh.endif
2425e84b765SWarner Losh.endfor
2435e84b765SWarner Losh
2445e84b765SWarner Losh#
2455e84b765SWarner Losh# Force some options off if their dependencies are off.
2465e84b765SWarner Losh# Order is somewhat important.
2475e84b765SWarner Losh#
2485e84b765SWarner Losh.if ${MK_LIBPTHREAD} == "no"
2495e84b765SWarner LoshMK_LIBTHR:=	no
2505e84b765SWarner Losh.endif
2515e84b765SWarner Losh
2525e84b765SWarner Losh.if ${MK_LDNS} == "no"
2535e84b765SWarner LoshMK_LDNS_UTILS:=	no
2545e84b765SWarner LoshMK_UNBOUND:= no
2555e84b765SWarner Losh.endif
2565e84b765SWarner Losh
2575e84b765SWarner Losh.if ${MK_SOURCELESS} == "no"
2585e84b765SWarner LoshMK_SOURCELESS_HOST:=	no
2595e84b765SWarner LoshMK_SOURCELESS_UCODE:= no
2605e84b765SWarner Losh.endif
2615e84b765SWarner Losh
2625e84b765SWarner Losh.if ${MK_CDDL} == "no"
2635e84b765SWarner LoshMK_ZFS:=	no
2645e84b765SWarner LoshMK_CTF:=	no
2655e84b765SWarner Losh.endif
2665e84b765SWarner Losh
2675e84b765SWarner Losh.if ${MK_CRYPT} == "no"
2685e84b765SWarner LoshMK_OPENSSL:=	no
2695e84b765SWarner LoshMK_OPENSSH:=	no
2705e84b765SWarner LoshMK_KERBEROS:=	no
2715e84b765SWarner Losh.endif
2725e84b765SWarner Losh
2735e84b765SWarner Losh.if ${MK_CXX} == "no"
2745e84b765SWarner LoshMK_CLANG:=	no
2755e84b765SWarner LoshMK_GROFF:=	no
2769e88096eSWarner LoshMK_GNUCXX:=	no
2775e84b765SWarner Losh.endif
2785e84b765SWarner Losh
2795e84b765SWarner Losh.if ${MK_MAIL} == "no"
2805e84b765SWarner LoshMK_MAILWRAPPER:= no
2815e84b765SWarner LoshMK_SENDMAIL:=	no
2825e84b765SWarner LoshMK_DMAGENT:=	no
2835e84b765SWarner Losh.endif
2845e84b765SWarner Losh
2855e84b765SWarner Losh.if ${MK_NETGRAPH} == "no"
2865e84b765SWarner LoshMK_ATM:=	no
2875e84b765SWarner LoshMK_BLUETOOTH:=	no
2885e84b765SWarner Losh.endif
2895e84b765SWarner Losh
2905e84b765SWarner Losh.if ${MK_OPENSSL} == "no"
2915e84b765SWarner LoshMK_OPENSSH:=	no
2925e84b765SWarner LoshMK_KERBEROS:=	no
2935e84b765SWarner Losh.endif
2945e84b765SWarner Losh
2955e84b765SWarner Losh.if ${MK_PF} == "no"
2965e84b765SWarner LoshMK_AUTHPF:=	no
2975e84b765SWarner Losh.endif
2985e84b765SWarner Losh
2995e84b765SWarner Losh.if ${MK_TEXTPROC} == "no"
3005e84b765SWarner LoshMK_GROFF:=	no
3015e84b765SWarner Losh.endif
3025e84b765SWarner Losh
3035e84b765SWarner Losh.if ${MK_CROSS_COMPILER} == "no"
3045e84b765SWarner LoshMK_BINUTILS_BOOTSTRAP:= no
3055e84b765SWarner LoshMK_CLANG_BOOTSTRAP:= no
3065e84b765SWarner LoshMK_GCC_BOOTSTRAP:= no
3075e84b765SWarner Losh.endif
3085e84b765SWarner Losh
3095e84b765SWarner Losh.if ${MK_TOOLCHAIN} == "no"
3105e84b765SWarner LoshMK_BINUTILS:=	no
3115e84b765SWarner LoshMK_CLANG:=	no
3125e84b765SWarner LoshMK_GCC:=	no
3135e84b765SWarner LoshMK_GDB:=	no
314590461a4SWarner LoshMK_INCLUDES:=	no
3155e84b765SWarner Losh.endif
3165e84b765SWarner Losh
3175e84b765SWarner Losh.if ${MK_CLANG} == "no"
3185e84b765SWarner LoshMK_CLANG_EXTRAS:= no
3195e84b765SWarner LoshMK_CLANG_FULL:= no
3205e84b765SWarner Losh.endif
3215e84b765SWarner Losh
3225e84b765SWarner Losh#
3235e84b765SWarner Losh# Set defaults for the MK_*_SUPPORT variables.
3245e84b765SWarner Losh#
3255e84b765SWarner Losh
3265e84b765SWarner Losh#
3275e84b765SWarner Losh# MK_*_SUPPORT options which default to "yes" unless their corresponding
3285e84b765SWarner Losh# MK_* variable is set to "no".
3295e84b765SWarner Losh#
3305e84b765SWarner Losh.for var in \
3315e84b765SWarner Losh    BZIP2 \
3325e84b765SWarner Losh    GNU \
3335e84b765SWarner Losh    INET \
3345e84b765SWarner Losh    INET6 \
3355e84b765SWarner Losh    KERBEROS \
3365e84b765SWarner Losh    KVM \
3375e84b765SWarner Losh    NETGRAPH \
3385e84b765SWarner Losh    PAM \
339b55e8e6eSWarner Losh    TESTS \
3405e84b765SWarner Losh    WIRELESS
3415e84b765SWarner Losh.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
3425e84b765SWarner LoshMK_${var}_SUPPORT:= no
3435e84b765SWarner Losh.else
3445e84b765SWarner LoshMK_${var}_SUPPORT:= yes
3455e84b765SWarner Losh.endif
3465e84b765SWarner Losh.endfor
3475e84b765SWarner Losh
3485e84b765SWarner Losh#
3495e84b765SWarner Losh# MK_* options whose default value depends on another option.
3505e84b765SWarner Losh#
3515e84b765SWarner Losh.for vv in \
3525e84b765SWarner Losh    GSSAPI/KERBEROS \
3535e84b765SWarner Losh    MAN_UTILS/MAN
3545e84b765SWarner Losh.if defined(WITH_${vv:H})
3555e84b765SWarner LoshMK_${vv:H}:=	yes
3565e84b765SWarner Losh.elif defined(WITHOUT_${vv:H})
3575e84b765SWarner LoshMK_${vv:H}:=	no
3585e84b765SWarner Losh.else
3595e84b765SWarner LoshMK_${vv:H}:=	${MK_${vv:T}}
3605e84b765SWarner Losh.endif
3615e84b765SWarner Losh.endfor
3625e84b765SWarner Losh
3635e84b765SWarner Losh.if !${COMPILER_FEATURES:Mc++11}
3645e84b765SWarner LoshMK_LLDB:=	no
3655e84b765SWarner Losh.endif
3665e84b765SWarner Losh
367ff2cf368SBaptiste Daroussin# gcc 4.8 and newer supports libc++, so suppress gnuc++ in that case.
368ff2cf368SBaptiste Daroussin# while in theory we could build it with that, we don't want to do
369ff2cf368SBaptiste Daroussin# that since it creates too much confusion for too little gain.
370ff2cf368SBaptiste Daroussin.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800
371ff2cf368SBaptiste DaroussinMK_GNUCXX:=no
372ff2cf368SBaptiste DaroussinMK_GCC:=no
3735e84b765SWarner Losh.endif
374ff2cf368SBaptiste Daroussin
375ff2cf368SBaptiste Daroussin.endif #  !target(__<src.opts.mk>__)
376