#!/bin/sh cd "$(dirname "$0")" #******************************************************************************# # Defaults # #******************************************************************************# # Project variables name="$(make -s getname)" version="$(make -s getversion)" maintainer="$(make -s getmaintainer)" # Platform platform="$(command -v gcc 1>/dev/null && gcc --print-multiarch)" platform="$([ "$platform" ] && echo "/$platform")" # Make options make_full_log= more_warnings= # Build options target= static= windows= optimize_size= gint= libusb=y no_file= loglevel=none # none, info, warn, error, fatal init_tries=5 # Installation directories root='' prefix='${root}/usr' prefix_set= bindir='${prefix}/bin' libdir='${prefix}/lib'"$platform" includedir='${prefix}/include'"$platform" pkgdir='${libdir}/pkgconfig' mandir='${prefix}/share/man' sysconfdir='${root}/etc' udevrulesdir='${sysconfdir}/udev/rules.d' # Installation options install_manpages=yes install_devel=yes install_udev= # Tweaks cflags= ldflags= #******************************************************************************# # Help message # #******************************************************************************# usage() { cat </dev/null; then echo "$0 : --tries: expected number, got '"$tries"'" continue elif [ $tries -le 0 ]; then echo "$0 : --tries: should be greater than zero" continue fi init_tries=$tries ;; --no-manpages) install_manpages= ;; --no-devel) install_devel= ;; --udev) install_udev=yes ;; --root=*) root="${arg#*=}" ;; --prefix=*) prefix="${arg#*=}"; prefix_set=y ;; --bindir=*) bindir="${arg#*=}" ;; --pkgdir=*) pkgdir="${arg#*=}" ;; --libdir=*) libdir="${arg#*=}" ;; --includedir=*) includedir="${arg#*=}" ;; --mandir=*) mandir="${arg#*=}" ;; --sysconfdir=*) sysconfdir="${arg#*=}" ;; --udevrulesdir=*) udevrulesdir="${arg#*=}" ;; CFLAGS=*) cflags="${arg#*=}" ;; LDFLAGS=*) ldflags="${arg#*=}" ;; *) echo "$arg: didn't read" ;; esac; done #******************************************************************************# # Little things # #******************************************************************************# # Cross-compilation things if [ ! $prefix_set ] && [ $target ]; then prefix="$prefix"/"$target" fi # Check MS-Windows targets win_target= case "$target" in *-mingw32) if [ ! "$static" ]; then windows=y; win_target=y fi;; esac # Evaluate variables vars="prefix sysconfdir bindir libdir pkgdir includedir mandir udevrulesdir" for var in $vars; do eval $var'='$(eval 'echo $'$var) done # Check that static and MS-Windows are not asked. if [ "$static" ] && [ "$windows" ]; then cat >&2 <&2 <&2 </dev/null 2>/dev/null # Create the configuration header opt="--version=${version} " [ "$gint" ] && opt+="--gint " [ "$no_file" ] && opt+="--no-file " tools/write-header-config $opt >include/libp7/config.h # Do it! exec 3>&1 1>Makefile.cfg cat <&3 3>&- chmod +x Makefile.cfg # Print the end message. echo "Configuration loaded, you can make now." # End of file.