paivana

HTTP paywall reverse proxy
Log | Files | Refs | Submodules | README | LICENSE

configure (8577B)


      1 #!/bin/sh
      2 
      3 pkg_name="paivana"
      4 pkg_default_features="doc logging"
      5 pkg_optional_features="coverage only-doc install-rpath sanitizers"
      6 pkg_optional_dependencies=""
      7 
      8 # DO NOT EDIT BELOW THIS LINE
      9 standard_dirs="prefix exec_prefix bindir sbindir libexecdir sysconfdir sharedstatedir localstatedir runstatedir libdir includedir oldincludedir datarootdir datadir infodir localedir mandir docdir htmldir dvidir pdfdir psdir srcdir mesonbuilddir"
     10 standard_utils="AR AS BISON CC CXX CPP FLEX INSTALL LD LDCONFIG LEX MAKE MAKEINFO RANLIB TEXI2DVI YACC CHGRP CHMOD CHOWN MKNOD RM NINJA MESON"
     11 standard_flags="ARFLAGS BISONFLAGS CFLAGS CXXFLAGS CPPFLAGS FLEXFLAGS INSTALLFLAGS LDFLAGS LDCONFIGFLAGS LFLAGS MAKEFLAGS MAKEINFOFLAGS RANLIBFLAGS TEXI2DVIFLAGS YACCFLAGS CHGRPFLAGS CHMODFLAGS CHOWNFLAGS MKNODFLAGS"
     12 standard_vars="INSTALL_DATA INSTALL_PROGRAM INSTALL_SCRIPT"
     13 generated_comment="# This file was generated by configure. DO NOT edit it directly."
     14 
     15 # Save arguments
     16 cat > config.status <<EOF
     17 #!/bin/sh
     18 $generated_comment
     19 $0 $*
     20 EOF
     21 chmod 755 config.status
     22 
     23 # Parse arguments
     24 oldifs="$IFS"
     25 while [ "$#" -gt "0" ]; do
     26 	arg="$1"
     27 	shift
     28 	argsave="$@"
     29 
     30 	IFS="="
     31 	set -- $arg
     32 	IFS="$oldifs"
     33 	arg="$1"
     34 	shift
     35 	argparam="$@"
     36 
     37 	case "$arg" in
     38 		--help|-h)
     39 			cat <<-EOF
     40 			Usage: $0 [options...]
     41 			General options:
     42 
     43 			<variable>=<value>       Overrides default utils and flags, e.g. CC=gcc
     44 			EOF
     45       echo ""
     46       echo "Directory variables:"
     47 			for sdir in $standard_dirs; do
     48 				echo "--$sdir=<directory>"
     49 			done
     50       echo ""
     51       echo "Options specific to $pkg_name:"
     52 			for feat in $pkg_optional_features; do
     53 				echo "--enable-$feat[=arg]"
     54 			done
     55 			for feat in $pkg_default_features; do
     56 				echo "--disable-$feat"
     57 			done
     58 			for dep in $pkg_optional_dependencies; do
     59 				echo "--with-$dep"
     60 			done
     61 
     62 			echo
     63 			echo Other options will be ignored. Please see the README for additional information.
     64 			exit 0
     65 			;;
     66 		--enable-*)
     67 			for feat in $pkg_optional_features $pkg_default_features; do
     68         ft=$(echo $feat | tr - _)
     69 				if [ "--enable-$feat" = "$arg" ] && [ -z "$argparam" ]; then
     70 					eval "enable_$ft=true"
     71 				elif [ "--enable-$feat" = "$arg" ]; then
     72           if [ "$argparam" = "yes" ]; then
     73 					  eval "enable_$ft=\"true\""
     74           else
     75 					  eval "enable_$ft=\"$argparam\""
     76           fi
     77 				fi
     78 			done
     79 			;;
     80 		--disable-*)
     81 			argsave="--enable-${arg#--disable-}=false $argsave"
     82 			;;
     83 		--with-*)
     84 			for dep in $pkg_optional_dependencies; do
     85 				if [ "--with-$dep" = "$arg" ] && [ -z "$argparam" ]; then
     86 					eval "with_$dep=yes"
     87 				elif [ "--with-$dep" = "$arg" ]; then
     88 					eval "with_$dep=\"$argparam\""
     89 				fi
     90 			done
     91 			;;
     92 		--without-*)
     93 			argsave="--with-${arg#--without-}=no $argsave"
     94 			;;
     95 		--*)
     96 			for dir in $standard_dirs; do
     97 				[ "--$dir" = "$arg" ] && eval "var_$dir=\"$argparam\""
     98 			done
     99 			;;
    100 		*)
    101 			for flag in $standard_utils $standard_flags $standard_vars; do
    102 				[ "$flag" = "$arg" ] && eval "$flag=\"$argparam\""
    103 			done
    104 			for flag in $standard_utils $standard_flags; do
    105 				[ "$flag" = "$arg" ] && eval export "$flag"
    106 			done
    107 			;;
    108 	esac
    109 
    110 	set -- $argsave
    111 done
    112 
    113 # Set default values
    114 for util in $standard_utils; do
    115 	case "$util" in
    116 		CPP) eval "$util=\"\${${util}:-\\\$(CC) -E}\"" ;;
    117 		CXX) eval "$util=\"\${${util}:-g++}\"" ;;
    118 		RM)  eval "$util=\"\${${util}:-rm -f}\"" ;;
    119 		MESON)  eval "$util=\"\${${util}:-meson}\"" ;;
    120 		NINJA)  eval "$util=\"\${${util}:-ninja}\"" ;;
    121 		*)   eval "$util=\"\${${util}:-${util}}\"" ;;
    122 	esac
    123 done
    124 for feat in $pkg_optional_features; do
    125   ft=$(echo $feat | tr - _)
    126 	eval "enable_$ft=\${enable_$ft:-false}"
    127 done
    128 for feat in $pkg_default_features; do
    129 	eval "enable_$feat=\${enable_$feat:-true}"
    130 done
    131 for feat in $pkg_optional_dependencies; do
    132 	eval "with_$feat=\${with_$feat:-no}"
    133 done
    134 
    135 # Find source files
    136 if [ -z "$var_srcdir" ]; then
    137 	[ -f ../Makefile.in ] && var_srcdir=..
    138 	[ -f ./Makefile.in ]  && var_srcdir=.
    139 fi
    140 if [ -z "$var_srcdir" ]; then
    141 	echo "Source files not found. Please specify a directory using --srcdir=..." >&2
    142 	exit 1
    143 fi
    144 
    145 # Write Makefile
    146 cat > Makefile <<EOF
    147 $generated_comment
    148 SHELL = /bin/sh
    149 VPATH = ${var_srcdir}
    150 
    151 mesonbuilddir = ${var_mesonbuilddir:-build}
    152 srcdir = ${var_srcdir}
    153 prefix = ${var_prefix:-/usr/local}
    154 exec_prefix = ${var_exec_prefix:-\$(prefix)}
    155 bindir = ${var_bindir:-\$(exec_prefix)/bin}
    156 sbindir = ${var_sbindir:-\$(exec_prefix)/sbin}
    157 libexecdir = ${var_libexecdir:-\$(exec_prefix)/libexec}
    158 datarootdir = ${var_datarootdir:-\$(prefix)/share}
    159 datadir = ${var_datadir:-\$(datarootdir)}
    160 sysconfdir = ${var_sysconfdir:-\$(prefix)/etc}
    161 sharedstatedir = ${var_sharedstatedir:-\$(prefix)/com}
    162 localstatedir = ${var_localstatedir:-\$(prefix)/var}
    163 runstatedir = ${var_runstatedir:-\$(localstatedir)/run}
    164 includedir = ${var_includedir:-\$(prefix)/include}
    165 oldincludedir = ${var_oldincludedir:-/usr/include}
    166 docdir = ${var_docdir:-\$(datarootdir)/doc/"$pkg_name"}
    167 infodir = ${var_infodir:-\$(datarootdir)/info}
    168 htmldir = ${var_htmldir:-\$(docdir)}
    169 dvidir = ${var_dvidir:-\$(docdir)}
    170 pdfdir = ${var_pdfdir:-\$(docdir)}
    171 psdir = ${var_psdir:-\$(docdir)}
    172 libdir = ${var_libdir:-\$(exec_prefix)/lib}
    173 lispdir = ${var_lispdir:-\$(datarootdir)/emacs/site-lisp}
    174 localedir = ${var_localedir:-\$(datarootdir)/locale}
    175 mandir = ${var_mandir:-\$(datarootdir)/man}
    176 manext = .1
    177 EOF
    178 
    179 if [ -d ${var_mesonbuilddir:-build} ]; then
    180   echo "${var_mesonbuilddir:-build} already exists, deleting with"
    181   $RM -r ${var_mesonbuilddir:-build} || exit 1
    182 fi
    183 
    184 for var in $standard_utils $standard_flags $standard_vars; do
    185 	eval "echo \"${var} = \$${var}\" >> Makefile"
    186 done
    187 echo >> Makefile
    188 
    189 mesonfeatopts=""
    190 for feat in $pkg_optional_features $pkg_default_features; do
    191   ft=$(echo $feat | tr - _)
    192 	eval "echo \"enable_$ft=\${enable_$ft}\" >> Makefile"
    193 	eval "mval=\${enable_$ft}"
    194 	# Not every switch maps onto an identically named boolean meson
    195 	# option: coverage is a meson built-in, doc is expressed as its
    196 	# negation, and logging is a four-valued choice.  A switch that
    197 	# falls through to a meson option that does not exist, or to a
    198 	# value that option does not accept, is silently ignored, so keep
    199 	# this in sync with meson.options.
    200 	case "$feat" in
    201 		coverage)
    202 			mfeat="b_coverage"
    203 			;;
    204 		doc)
    205 			mfeat="disable-doc"
    206 			case "$mval" in
    207 				true) mval=false ;;
    208 				false) mval=true ;;
    209 			esac
    210 			;;
    211 		logging)
    212 			mfeat="logging"
    213 			case "$mval" in
    214 				true) mval=yes ;;
    215 				false) mval=no ;;
    216 			esac
    217 			;;
    218 		sanitizers)
    219 			# meson's sanitizer switch is build-wide, so this is a
    220 			# build variant rather than an extra test.  Never enabled
    221 			# for a package build: ASan is not available on every
    222 			# architecture Debian builds for, it adds a libasan
    223 			# dependency, and a leak in a dependency the suppression
    224 			# file has not learned about would fail the build for a
    225 			# reason that is not paivana's bug.  The ownership
    226 			# handshake it protects is identical everywhere, so
    227 			# building it once in CI finds what building it eleven
    228 			# times would.
    229 			mfeat="b_sanitize"
    230 			case "$mval" in
    231 				true) mval="address,undefined" ;;
    232 				false) mval="none" ;;
    233 			esac
    234 			;;
    235 		*)
    236 			mfeat="$feat"
    237 			;;
    238 	esac
    239 	mesonfeatopts="$mesonfeatopts -D$mfeat=$mval"
    240 done
    241 for dep in $pkg_optional_dependencies; do
    242 	eval "echo \"with_$dep=\${with_$dep}\" >> Makefile"
    243 done
    244 echo >> Makefile
    245 
    246 cat "${var_srcdir}/Makefile.in" >> Makefile
    247 
    248 # Create default targets, if not already present
    249 default_target() {
    250 	grep "^$1:" Makefile >/dev/null && return
    251 	echo ".PHONY: $1" >> Makefile
    252 	echo "$1: $2" >> Makefile
    253 	cat >> Makefile
    254 	echo >> Makefile
    255 }
    256 
    257 #default_target Makefile <<EOF
    258 #	./config.status
    259 #EOF
    260 for format in html dvi pdf ps; do
    261 	default_target "$format" </dev/null
    262 	default_target "install-$format" "$format" </dev/null
    263 done
    264 default_target check </dev/null
    265 default_target mostlyclean clean </dev/null
    266 default_target distclean clean <<EOF
    267 	\$(RM) Makefile config.status
    268 EOF
    269 default_target maintainer-clean distclean </dev/null
    270 default_target install-strip <<EOF
    271 	\$(MAKE) INSTALL_PROGRAM='\$(INSTALL_PROGRAM) -s' \\
    272 		INSTALL_SCRIPT='\$(INSTALL_SCRIPT)' install
    273 EOF
    274 
    275 mesondiropts=""
    276 for dr in $standard_dirs; do
    277   if [ $dr = "srcdir" ]; then
    278     continue
    279   fi
    280   if [ $dr = "mesonbuilddir" ]; then
    281     continue
    282   fi
    283   eval "vn=\${var_$dr}"
    284   if [ ! -z $vn ]; then
    285     eval "mesondiropts=\"$mesondiropts -D$dr=\${var_$dr}\""
    286   fi
    287 done
    288 
    289 ${MESON} setup \
    290 	-Ddefault_library=shared \
    291   $mesondiropts \
    292   $mesonfeatopts \
    293 	${var_mesonbuilddir:-build} \
    294 	${var_srcdir} || exit 1
    295 
    296 # Done
    297 echo "Package $pkg_name configured successfully."
    298 echo "Run 'make' to build and 'make install' to install the package"
    299