| 1 |
#! /bin/sh |
| 2 |
# configure script for GNU ddrescue - Data recovery tool |
| 3 |
# Copyright (C) 2004-2026 Antonio Diaz Diaz. |
| 4 |
# |
| 5 |
# This configure script is free software: you have unlimited permission |
| 6 |
# to copy, distribute, and modify it. |
| 7 |
|
| 8 |
pkgname=ddrescue |
| 9 |
pkgversion=1.30 |
| 10 |
progname=ddrescue |
| 11 |
use_non_posix= |
| 12 |
srctrigger=doc/${pkgname}.texi |
| 13 |
|
| 14 |
# clear some things potentially inherited from environment. |
| 15 |
LC_ALL=C |
| 16 |
export LC_ALL |
| 17 |
srcdir= |
| 18 |
prefix=/usr/local |
| 19 |
exec_prefix='$(prefix)' |
| 20 |
bindir='$(exec_prefix)/bin' |
| 21 |
datarootdir='$(prefix)/share' |
| 22 |
infodir='$(datarootdir)/info' |
| 23 |
mandir='$(datarootdir)/man' |
| 24 |
CXX=g++ |
| 25 |
CPPFLAGS= |
| 26 |
CXXFLAGS='-Wall -W -O2' |
| 27 |
LDFLAGS= |
| 28 |
MAKEINFO=makeinfo |
| 29 |
|
| 30 |
# checking whether we are using GNU C++. |
| 31 |
/bin/sh -c "${CXX} --version" > /dev/null 2>&1 || { CXX=c++ ; CXXFLAGS=-O2 ; } |
| 32 |
|
| 33 |
# Loop over all args |
| 34 |
args= |
| 35 |
no_create= |
| 36 |
while [ $# != 0 ] ; do |
| 37 |
|
| 38 |
# Get the first arg, and shuffle |
| 39 |
option=$1 ; arg2=no |
| 40 |
shift |
| 41 |
|
| 42 |
# Add the argument quoted to args |
| 43 |
if [ -z "${args}" ] ; then args="\"${option}\"" |
| 44 |
else args="${args} \"${option}\"" ; fi |
| 45 |
|
| 46 |
# Split out the argument for options that take them |
| 47 |
case ${option} in |
| 48 |
*=*) optarg=`echo "${option}" | sed -e 's,^[^=]*=,,;s,/$,,'` ;; |
| 49 |
esac |
| 50 |
|
| 51 |
# Process the options |
| 52 |
case ${option} in |
| 53 |
--help | -h) |
| 54 |
echo "Usage: $0 [OPTION]... [VAR=VALUE]..." |
| 55 |
echo |
| 56 |
echo "To assign makefile variables (e.g., CXX, CXXFLAGS...), specify them as" |
| 57 |
echo "arguments to configure in the form VAR=VALUE." |
| 58 |
echo |
| 59 |
echo "Options and variables: [defaults in brackets]" |
| 60 |
echo " -h, --help display this help and exit" |
| 61 |
echo " -V, --version output version information and exit" |
| 62 |
echo " --srcdir=DIR find the source code in DIR [. or ..]" |
| 63 |
echo " --prefix=DIR install into DIR [${prefix}]" |
| 64 |
echo " --exec-prefix=DIR base directory for arch-dependent files [${exec_prefix}]" |
| 65 |
echo " --bindir=DIR user executables directory [${bindir}]" |
| 66 |
echo " --datarootdir=DIR base directory for doc and data [${datarootdir}]" |
| 67 |
echo " --infodir=DIR info files directory [${infodir}]" |
| 68 |
echo " --mandir=DIR man pages directory [${mandir}]" |
| 69 |
echo " --enable-non-posix enable non-portable code and ioctl's [disable]" |
| 70 |
echo " CXX=COMPILER C++ compiler to use [${CXX}]" |
| 71 |
echo " CPPFLAGS=OPTIONS command-line options for the preprocessor [${CPPFLAGS}]" |
| 72 |
echo " CXXFLAGS=OPTIONS command-line options for the C++ compiler [${CXXFLAGS}]" |
| 73 |
echo " CXXFLAGS+=OPTIONS append options to the current value of CXXFLAGS" |
| 74 |
echo " LDFLAGS=OPTIONS command-line options for the linker [${LDFLAGS}]" |
| 75 |
echo " MAKEINFO=NAME makeinfo program to use [${MAKEINFO}]" |
| 76 |
echo |
| 77 |
exit 0 ;; |
| 78 |
--version | -V) |
| 79 |
echo "Configure script for GNU ${pkgname} version ${pkgversion}" |
| 80 |
exit 0 ;; |
| 81 |
--srcdir) srcdir=$1 ; arg2=yes ;; |
| 82 |
--prefix) prefix=$1 ; arg2=yes ;; |
| 83 |
--exec-prefix) exec_prefix=$1 ; arg2=yes ;; |
| 84 |
--bindir) bindir=$1 ; arg2=yes ;; |
| 85 |
--datarootdir) datarootdir=$1 ; arg2=yes ;; |
| 86 |
--infodir) infodir=$1 ; arg2=yes ;; |
| 87 |
--mandir) mandir=$1 ; arg2=yes ;; |
| 88 |
|
| 89 |
--srcdir=*) srcdir=${optarg} ;; |
| 90 |
--prefix=*) prefix=${optarg} ;; |
| 91 |
--exec-prefix=*) exec_prefix=${optarg} ;; |
| 92 |
--bindir=*) bindir=${optarg} ;; |
| 93 |
--datarootdir=*) datarootdir=${optarg} ;; |
| 94 |
--infodir=*) infodir=${optarg} ;; |
| 95 |
--mandir=*) mandir=${optarg} ;; |
| 96 |
--no-create) no_create=yes ;; |
| 97 |
--enable-non-posix) use_non_posix=-DUSE_NON_POSIX ;; |
| 98 |
|
| 99 |
CXX=*) CXX=${optarg} ;; |
| 100 |
CPPFLAGS=*) CPPFLAGS=${optarg} ;; |
| 101 |
CXXFLAGS=*) CXXFLAGS=${optarg} ;; |
| 102 |
CXXFLAGS+=*) CXXFLAGS="${CXXFLAGS} ${optarg}" ;; |
| 103 |
LDFLAGS=*) LDFLAGS=${optarg} ;; |
| 104 |
MAKEINFO=*) MAKEINFO=${optarg} ;; |
| 105 |
|
| 106 |
--*) echo "configure: WARNING: unrecognized option: '${option}'" 1>&2 ;; |
| 107 |
*=* | *-*-*) ;; |
| 108 |
*) echo "configure: unrecognized option: '${option}'" 1>&2 |
| 109 |
echo "Try 'configure --help' for more information." 1>&2 |
| 110 |
exit 1 ;; |
| 111 |
esac |
| 112 |
|
| 113 |
# Check whether the option took a separate argument |
| 114 |
if [ "${arg2}" = yes ] ; then |
| 115 |
if [ $# != 0 ] ; then args="${args} \"$1\"" ; shift |
| 116 |
else echo "configure: Missing argument to '${option}'" 1>&2 |
| 117 |
exit 1 |
| 118 |
fi |
| 119 |
fi |
| 120 |
done |
| 121 |
|
| 122 |
# Find the source code, if location was not specified. |
| 123 |
srcdirtext= |
| 124 |
if [ -z "${srcdir}" ] ; then |
| 125 |
srcdirtext="or . or .." ; srcdir=. |
| 126 |
if [ ! -r "${srcdir}/${srctrigger}" ] ; then srcdir=.. ; fi |
| 127 |
if [ ! -r "${srcdir}/${srctrigger}" ] ; then |
| 128 |
## the sed command below emulates the dirname command |
| 129 |
srcdir=`echo "$0" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` |
| 130 |
fi |
| 131 |
fi |
| 132 |
|
| 133 |
if [ ! -r "${srcdir}/${srctrigger}" ] ; then |
| 134 |
echo "configure: Can't find source code in ${srcdir} ${srcdirtext}" 1>&2 |
| 135 |
echo "configure: (At least ${srctrigger} is missing)." 1>&2 |
| 136 |
exit 1 |
| 137 |
fi |
| 138 |
|
| 139 |
# Set srcdir to . if that's what it is. |
| 140 |
if [ "`pwd`" = "`cd "${srcdir}" ; pwd`" ] ; then srcdir=. ; fi |
| 141 |
|
| 142 |
echo |
| 143 |
if [ -z "${no_create}" ] ; then |
| 144 |
echo "creating config.status" |
| 145 |
rm -f config.status |
| 146 |
cat > config.status << EOF |
| 147 |
#! /bin/sh |
| 148 |
# This file was generated automatically by configure. Don't edit. |
| 149 |
# Run this file to recreate the current configuration. |
| 150 |
# |
| 151 |
# This script is free software: you have unlimited permission |
| 152 |
# to copy, distribute, and modify it. |
| 153 |
|
| 154 |
exec /bin/sh "$0" ${args} --no-create |
| 155 |
EOF |
| 156 |
chmod +x config.status |
| 157 |
fi |
| 158 |
|
| 159 |
echo "creating Makefile" |
| 160 |
if [ -n "${use_non_posix}" ] ; then echo "USE_NON_POSIX = yes" ; fi |
| 161 |
echo "VPATH = ${srcdir}" |
| 162 |
echo "prefix = ${prefix}" |
| 163 |
echo "exec_prefix = ${exec_prefix}" |
| 164 |
echo "bindir = ${bindir}" |
| 165 |
echo "datarootdir = ${datarootdir}" |
| 166 |
echo "infodir = ${infodir}" |
| 167 |
echo "mandir = ${mandir}" |
| 168 |
echo "CXX = ${CXX}" |
| 169 |
echo "CPPFLAGS = ${CPPFLAGS}" |
| 170 |
echo "CXXFLAGS = ${CXXFLAGS}" |
| 171 |
echo "LDFLAGS = ${LDFLAGS}" |
| 172 |
echo "MAKEINFO = ${MAKEINFO}" |
| 173 |
rm -f Makefile |
| 174 |
cat > Makefile << EOF |
| 175 |
# Makefile for GNU ddrescue - Data recovery tool |
| 176 |
# Copyright (C) 2004-2026 Antonio Diaz Diaz. |
| 177 |
# This file was generated automatically by configure. Don't edit. |
| 178 |
# |
| 179 |
# This Makefile is free software: you have unlimited permission |
| 180 |
# to copy, distribute, and modify it. |
| 181 |
|
| 182 |
pkgname = ${pkgname} |
| 183 |
pkgversion = ${pkgversion} |
| 184 |
progname = ${progname} |
| 185 |
use_non_posix = ${use_non_posix} |
| 186 |
VPATH = ${srcdir} |
| 187 |
prefix = ${prefix} |
| 188 |
exec_prefix = ${exec_prefix} |
| 189 |
bindir = ${bindir} |
| 190 |
datarootdir = ${datarootdir} |
| 191 |
infodir = ${infodir} |
| 192 |
mandir = ${mandir} |
| 193 |
CXX = ${CXX} |
| 194 |
CPPFLAGS = ${CPPFLAGS} |
| 195 |
CXXFLAGS = ${CXXFLAGS} |
| 196 |
LDFLAGS = ${LDFLAGS} |
| 197 |
MAKEINFO = ${MAKEINFO} |
| 198 |
EOF |
| 199 |
cat "${srcdir}/Makefile.in" >> Makefile |
| 200 |
|
| 201 |
echo "OK. Now you can run make." |