|
|
f8089b |
# in projects where [ $mb_use_custom_cfgdefs = yes ],
|
|
|
f8089b |
# cfgdefs.sh is invoked from within ./configure via
|
|
|
f8089b |
# . $mb_project_dir/project/cfgdefs.sh
|
|
|
f8089b |
|
|
|
f8089b |
# a successful return from cfgdefs.sh will be followed
|
|
|
f8089b |
# by a second invocation of the config_copy() function,
|
|
|
f8089b |
# reflecting any changes to common config variables
|
|
|
f8089b |
# made by cfgdefs.sh.
|
|
|
f8089b |
|
|
|
f8089b |
# finally, cfgdefs.sh may update the contents of the
|
|
|
f8089b |
# config-time generated cfgdefs.mk.
|
|
|
f8089b |
|
|
|
f8089b |
|
|
|
f8089b |
# cfgdefs helper functions
|
|
|
f8089b |
. "$mb_project_dir/project/config/cfghost.sh"
|
|
|
f8089b |
|
|
|
f8089b |
|
|
|
f8089b |
# sofort's config test framework
|
|
|
f8089b |
. "$mb_project_dir/sofort/cfgtest.sh"
|
|
|
f8089b |
|
|
|
f8089b |
|
|
|
f8089b |
for arg ; do
|
|
|
f8089b |
case "$arg" in
|
|
|
f8089b |
*)
|
|
|
f8089b |
error_msg ${arg#}: "unsupported config argument."
|
|
|
f8089b |
exit 2
|
|
|
f8089b |
esac
|
|
|
f8089b |
done
|
|
|
f8089b |
|
|
|
f8089b |
|
|
|
f8089b |
cfgdefs_set_cfghost_flavors()
|
|
|
f8089b |
{
|
|
|
f8089b |
cfghost_set_target_cfghost
|
|
|
f8089b |
cfghost_set_native_cfghost
|
|
|
f8089b |
}
|
|
|
f8089b |
|
|
|
f8089b |
|
|
|
8d7c97 |
cfgdefs_detect_python_version()
|
|
|
8d7c97 |
{
|
|
|
8d7c97 |
mb_internal_verinfo=$(mktemp)
|
|
|
8d7c97 |
|
|
|
8d7c97 |
if [ -z "$mb_internal_verinfo" ]; then
|
|
|
8d7c97 |
exit 2
|
|
|
8d7c97 |
fi
|
|
|
8d7c97 |
|
|
|
8d7c97 |
"$mb_native_cc" -E -dM "$mb_source_dir/Include/patchlevel.h" \
|
|
|
8d7c97 |
> "$mb_internal_verinfo"
|
|
|
8d7c97 |
|
|
|
8d7c97 |
python_major=$(grep '#define PY_MAJOR_VERSION ' "$mb_internal_verinfo" | cut -d' ' -f3)
|
|
|
8d7c97 |
python_minor=$(grep '#define PY_MINOR_VERSION ' "$mb_internal_verinfo" | cut -d' ' -f3)
|
|
|
8d7c97 |
python_micro=$(grep '#define PY_MICRO_VERSION ' "$mb_internal_verinfo" | cut -d' ' -f3)
|
|
|
8d7c97 |
|
|
|
8d7c97 |
if [ -z "$python_major" ] || [ -z "$python_minor" ] || [ -z "$python_micro" ]; then
|
|
|
8d7c97 |
error_msg "Could not properly parse Python's patchlevel.h"
|
|
|
8d7c97 |
exit 2
|
|
|
8d7c97 |
fi
|
|
|
8d7c97 |
|
|
|
8d7c97 |
python_ver="$python_major.$python_minor"
|
|
|
8d7c97 |
|
|
|
8d7c97 |
[ -z "$mb_package" ] && mb_package='python'"$python_ver"
|
|
|
8d7c97 |
[ -z "$mb_nickname" ] && mb_nickname="$mb_package"
|
|
|
8d7c97 |
[ -z "$mb_pkgname" ] && mb_pkgname="$mb_package"
|
|
|
8d7c97 |
[ -z "$mb_pkgdesc" ] && mb_pkgdesc="$mb_package"
|
|
|
8d7c97 |
}
|
|
|
8d7c97 |
|
|
|
8d7c97 |
|
|
|
8d7c97 |
cfgdefs_output_custom_defs()
|
|
|
8d7c97 |
{
|
|
|
8d7c97 |
sed \
|
|
|
8d7c97 |
-e 's/@python_ver@/'"$python_ver"'/g' \
|
|
|
8d7c97 |
-e 's/@python_major@/'"$python_major"'/g' \
|
|
|
8d7c97 |
-e 's/@python_minor@/'"$python_minor"'/g' \
|
|
|
8d7c97 |
-e 's/@python_micro@/'"$python_micro"'/g' \
|
|
|
8d7c97 |
"$mb_project_dir/project/config/cfgdefs.in" \
|
|
|
8d7c97 |
>> "$mb_pwd/cfgdefs.mk"
|
|
|
8d7c97 |
}
|
|
|
8d7c97 |
|
|
|
8d7c97 |
|
|
|
bacfcf |
cfgdefs_perform_common_tests()
|
|
|
f8089b |
{
|
|
|
f8089b |
# headers
|
|
|
998eeb |
cfgtest_header_absence 'stropts.h'
|
|
|
e9a8e5 |
cfgtest_header_presence 'stdatomic.h'
|
|
|
998eeb |
cfgtest_header_presence 'endian.h'
|
|
|
998eeb |
cfgtest_header_presence 'net/if.h'
|
|
|
998eeb |
cfgtest_header_presence 'sched.h'
|
|
|
998eeb |
cfgtest_header_presence 'sys/ioctl.h'
|
|
|
998eeb |
cfgtest_header_presence 'sys/sendfile.h'
|
|
|
998eeb |
cfgtest_header_presence 'sys/syscall.h'
|
|
|
998eeb |
cfgtest_header_presence 'sys/sysmacros.h'
|
|
|
998eeb |
cfgtest_header_presence 'sys/uio.h'
|
|
|
998eeb |
cfgtest_header_presence 'sys/xattr.h'
|
|
|
998eeb |
|
|
|
998eeb |
# interfaces
|
|
|
998eeb |
mb_cfgtest_headers='sys/epoll.h'
|
|
|
998eeb |
cfgtest_interface_presence 'epoll_create1'
|
|
|
998eeb |
|
|
|
998eeb |
mb_cfgtest_headers='sched.h'
|
|
|
998eeb |
cfgtest_interface_presence 'sched_get_priority_max'
|
|
|
998eeb |
cfgtest_interface_presence 'sched_rr_get_interval'
|
|
|
998eeb |
cfgtest_interface_presence 'sched_setaffinity'
|
|
|
998eeb |
cfgtest_interface_presence 'sched_setparam'
|
|
|
998eeb |
cfgtest_interface_presence 'sched_setscheduler'
|
|
|
998eeb |
|
|
|
998eeb |
mb_cfgtest_headers='sys/sendfile.h'
|
|
|
998eeb |
cfgtest_interface_presence 'sendfile'
|
|
|
f8089b |
|
|
|
592c56 |
# getrandom: easier to simply test,
|
|
|
592c56 |
# than to test whether we need to test
|
|
|
592c56 |
# (and then test).
|
|
|
592c56 |
mb_cfgtest_headers='sys/syscall.h'
|
|
|
592c56 |
|
|
|
592c56 |
if cfgtest_decl_presence 'SYS_getrandom'; then
|
|
|
592c56 |
cfgtest_cflags_append '-DHAVE_GETRANDOM_SYSCALL'
|
|
|
592c56 |
fi
|
|
|
592c56 |
|
|
|
bc7614 |
# ncurses
|
|
|
bc7614 |
cfgtest_newline
|
|
|
bc7614 |
cfgtest_comment 'ncurses/ncursesw'
|
|
|
bc7614 |
mb_cfgtest_headers='ncurses.h'
|
|
|
bc7614 |
|
|
|
bc7614 |
if [ $mb_cfgtest_cfgtype = 'target' ]; then
|
|
|
bc7614 |
mb_cfgtest_makevar='CFLAGS_NCURSES'
|
|
|
bc7614 |
else
|
|
|
bc7614 |
mb_cfgtest_makevar='NATIVE_CC_CFLAGS'
|
|
|
bc7614 |
fi
|
|
|
bc7614 |
|
|
|
bc7614 |
cfgtest_unit_header_presence 'curses.h'
|
|
|
bc7614 |
cfgtest_unit_header_presence 'ncurses.h'
|
|
|
bc7614 |
|
|
|
bc7614 |
cfgtest_unit_header_presence 'ncurses/panel.h' && mb_panel_wrapper='yes'
|
|
|
bc7614 |
cfgtest_unit_header_presence 'ncursesw/panel.h' && mb_panel_wrapper='yes'
|
|
|
bc7614 |
|
|
|
bc7614 |
if cfgtest_unit_interface_presence 'is_term_resized'; then
|
|
|
bc7614 |
cfgtest_makevar_append '-DHAVE_CURSES_IS_TERM_RESIZED'
|
|
|
bc7614 |
fi
|
|
|
bc7614 |
|
|
|
bc7614 |
if cfgtest_unit_interface_presence 'resizeterm'; then
|
|
|
bc7614 |
cfgtest_makevar_append '-DHAVE_CURSES_RESIZETERM'
|
|
|
bc7614 |
fi
|
|
|
bc7614 |
|
|
|
bc7614 |
if cfgtest_unit_interface_presence 'resize_term'; then
|
|
|
bc7614 |
cfgtest_makevar_append '-DHAVE_CURSES_RESIZE_TERM'
|
|
|
bc7614 |
fi
|
|
|
bc7614 |
|
|
|
bc7614 |
# ncursesw
|
|
|
bc7614 |
if cfgtest_unit_interface_presence 'mvwget_wch'; then
|
|
|
bc7614 |
cfgtest_makevar_append '-DHAVE_NCURSESW'
|
|
|
bc7614 |
fi
|
|
|
bc7614 |
|
|
|
f8089b |
# ncurses: python refers to members of typedef struct _win_st WINDOW
|
|
|
bc7614 |
cfgtest_makevar_append '-DNCURSES_INTERNALS'
|
|
|
bc7614 |
|
|
|
bc7614 |
# <panel.h>
|
|
|
bc7614 |
if [ -n "$mb_panel_wrapper" ]; then
|
|
|
bc7614 |
cfgtest_makevar_append '-I$(PROJECT_DIR)/wrappers'
|
|
|
bc7614 |
unset mb_panel_wrapper
|
|
|
bc7614 |
fi
|
|
|
f8089b |
|
|
|
bacfcf |
# ncurses libs (common part)
|
|
|
f8089b |
mb_ncurses_libs='-lpanelw -lncursesw'
|
|
|
f8089b |
mb_ncurses_tinfo='-ltinfo'
|
|
|
f8089b |
|
|
|
bc7614 |
if cfgtest_library_presence $mb_ncurses_tinfo; then
|
|
|
bc7614 |
mb_ncurses_libs="$mb_ncurses_libs $mb_ncurses_tinfo"
|
|
|
bc7614 |
fi
|
|
|
bacfcf |
}
|
|
|
bacfcf |
|
|
|
bacfcf |
|
|
|
bacfcf |
cfgdefs_perform_target_tests()
|
|
|
bacfcf |
{
|
|
|
bacfcf |
# init
|
|
|
bacfcf |
cfgtest_target_section
|
|
|
bacfcf |
|
|
|
bacfcf |
# common tests
|
|
|
bacfcf |
cfgdefs_perform_common_tests
|
|
|
f8089b |
|
|
|
2cf433 |
# ncurses libs
|
|
|
2cf433 |
mb_cfgtest_makevar='LDFLAGS_NCURSES_LIBS'
|
|
|
2cf433 |
cfgtest_makevar_append $mb_ncurses_libs
|
|
|
2cf433 |
|
|
|
bc7614 |
mb_cfgtest_makevar='LDFLAGS_NCURSES'
|
|
|
bc7614 |
cfgtest_makevar_append \
|
|
|
bc7614 |
'-Wl,--as-needed $(LDFLAGS_NCURSES_LIBS)' \
|
|
|
bc7614 |
'-Wl,--no-as-needed'
|
|
|
bc7614 |
|
|
|
bc7614 |
mb_cfgtest_makevar='LDFLAGS_NCURSES_STATIC'
|
|
|
bc7614 |
cfgtest_makevar_append '$(LDFLAGS_NCURSES)'
|
|
|
bc7614 |
|
|
|
23d81d |
# ndbm
|
|
|
2cf433 |
cfgtest_newline
|
|
|
2cf433 |
cfgtest_comment 'ndbm'
|
|
|
23d81d |
cfgtest_header_presence 'ndbm.h'
|
|
|
23d81d |
|
|
|
bacfcf |
# openssl
|
|
|
2cf433 |
cfgtest_newline
|
|
|
2cf433 |
cfgtest_comment 'openssl/libressl'
|
|
|
bacfcf |
|
|
|
2cf433 |
mb_cfgtest_headers='openssl/x509.h'
|
|
|
bacfcf |
|
|
|
2cf433 |
if cfgtest_interface_presence 'X509_NAME_ENTRY_set'; then
|
|
|
2cf433 |
cfgtest_cflags_append '-DOPENSSL_VERSION_1_1'
|
|
|
2cf433 |
fi
|
|
|
f8089b |
|
|
|
84ca86 |
# tcl/tk libc
|
|
|
2cf433 |
cfgtest_newline
|
|
|
2cf433 |
cfgtest_comment 'tcl/tk'
|
|
|
2cf433 |
|
|
|
84ca86 |
for mb_tcltk_ver in 8.9 8.8 8.7 8.6 8.5; do
|
|
|
84ca86 |
if [ -z "$mb_tcltk_libs" ]; then
|
|
|
84ca86 |
mb_tcltk_libs="-ltk$mb_tcltk_ver -ltcl$mb_tcltk_ver"
|
|
|
84ca86 |
cfgtest_library_presence $mb_tcltk_libs \
|
|
|
84ca86 |
|| mb_tcltk_libs=''
|
|
|
84ca86 |
fi
|
|
|
84ca86 |
done
|
|
|
84ca86 |
|
|
|
84ca86 |
mb_cfgtest_makevar='LDFLAGS_TCLTK_LIBS'
|
|
|
84ca86 |
cfgtest_makevar_append "$mb_tcltk_libs"
|
|
|
84ca86 |
|
|
|
c403d0 |
# sqlite
|
|
|
c403d0 |
cfgtest_newline
|
|
|
c403d0 |
cfgtest_comment 'sqlite3'
|
|
|
c403d0 |
|
|
|
c403d0 |
mb_cfgtest_makevar='CFLAGS_SQLITE'
|
|
|
c403d0 |
cfgtest_makevar_append '-DMODULE_NAME=\"sqlite3\"'
|
|
|
c403d0 |
cfgtest_makevar_append '-DSQLITE_OMIT_LOAD_EXTENSION'
|
|
|
c403d0 |
|
|
|
c403d0 |
mb_cfgtest_makevar='LDFLAGS_SQLITE'
|
|
|
c403d0 |
cfgtest_makevar_append '-lsqlite3'
|
|
|
c403d0 |
|
|
|
c403d0 |
mb_cfgtest_makevar='LDFLAGS_SQLITE_STATIC'
|
|
|
c403d0 |
cfgtest_makevar_append '$(LDFLAGS_SQLITE)'
|
|
|
c403d0 |
|
|
|
f8089b |
# pretty cfgdefs.mk
|
|
|
f8089b |
cfgtest_newline
|
|
|
f8089b |
}
|
|
|
f8089b |
|
|
|
f8089b |
|
|
|
f8089b |
cfgdefs_perform_native_tests()
|
|
|
f8089b |
{
|
|
|
f8089b |
# init
|
|
|
f8089b |
cfgtest_native_section
|
|
|
f8089b |
|
|
|
bacfcf |
# common tests
|
|
|
bacfcf |
cfgdefs_perform_common_tests
|
|
|
f8089b |
|
|
|
f8089b |
# ncurses libs
|
|
|
f8089b |
cfgtest_ldflags_append $mb_ncurses_libs
|
|
|
f8089b |
|
|
|
f8089b |
# pretty cfgdefs.mk
|
|
|
f8089b |
cfgtest_newline
|
|
|
f8089b |
}
|
|
|
f8089b |
|
|
|
f8089b |
|
|
|
f8089b |
# cfghost
|
|
|
f8089b |
cfgdefs_set_cfghost_flavors
|
|
|
f8089b |
|
|
|
8d7c97 |
# python version info
|
|
|
8d7c97 |
cfgdefs_detect_python_version
|
|
|
8d7c97 |
|
|
|
8d7c97 |
# cfgdefs.in --> cfgdefs.mk
|
|
|
8d7c97 |
cfgdefs_output_custom_defs
|
|
|
8d7c97 |
|
|
|
f8089b |
# target-specific tests
|
|
|
f8089b |
cfgdefs_perform_target_tests
|
|
|
f8089b |
|
|
|
f8089b |
# native system tests
|
|
|
f8089b |
cfgdefs_perform_native_tests
|
|
|
f8089b |
|
|
|
f8089b |
# all done
|
|
|
f8089b |
return 0
|