Skip to content
Snippets Groups Projects
autogen.sh 46.3 KiB
Newer Older
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578
	if test -f "`dirname \"$CONFIGURE\"/Makefile.am`" ; then
	    _marker_found="`grep 'AUTOMAKE_OPTIONS.*'${marker} Makefile.am`"
	    if [ ! "x$_marker_found" = "x" ] ; then
		$VERBOSE_ECHO "${_marker_found_message}Makefile.am"
		break
	    fi
	fi
    done
    if [ "x${_marker_found}" = "x" ] ; then
	_suggest_foreign=no
	for file in AUTHORS COPYING ChangeLog INSTALL NEWS README ; do
	    if [ ! -f $file ] ; then
		$VERBOSE_ECHO "Touching ${file} since it does not exist"
		_suggest_foreign=yes
		touch $file
	    fi
	done

	if [ "x${_suggest_foreign}" = "xyes" ] ; then
	    $ECHO
	    $ECHO "Warning: Several files expected of projects that conform to the GNU"
	    $ECHO "coding standards were not found.  The files were automatically added"
	    $ECHO "for you since you do not have a 'foreign' declaration specified."
	    $ECHO
	    $ECHO "Considered adding 'foreign' to AM_INIT_AUTOMAKE in `basename \"$CONFIGURE\"`"
	    if test -f "`dirname \"$CONFIGURE\"/Makefile.am`" ; then
		$ECHO "or to AUTOMAKE_OPTIONS in your top-level Makefile.am file."
	    fi
	    $ECHO
	fi
    fi

    ##################################################
    # make sure certain generated files do not exist #
    ##################################################
    for file in config.guess config.sub ltmain.sh ; do
	if test -f "${_aux_dir}/${file}" ; then
	    $VERBOSE_ECHO "mv -f \"${_aux_dir}/${file}\" \"${_aux_dir}/${file}.backup\""
	    mv -f "${_aux_dir}/${file}" "${_aux_dir}/${file}.backup"
	fi
    done

    ############################
    # search alternate m4 dirs #
    ############################
    SEARCH_DIRS=""
    for dir in m4 ; do
	if [ -d $dir ] ; then
	    $VERBOSE_ECHO "Found extra aclocal search directory: $dir"
	    SEARCH_DIRS="$SEARCH_DIRS -I $dir"
	fi
    done

    ######################################
    # remove any previous build products #
    ######################################
    if test -d autom4te.cache ; then
	$VERBOSE_ECHO "Found an autom4te.cache directory, deleting it"
	$VERBOSE_ECHO "rm -rf autom4te.cache"
	rm -rf autom4te.cache
    fi
# tcl/tk (and probably others) have a customized aclocal.m4, so can't delete it
#     if test -f aclocal.m4 ; then
# 	$VERBOSE_ECHO "Found an aclocal.m4 file, deleting it"
# 	$VERBOSE_ECHO "rm -f aclocal.m4"
# 	rm -f aclocal.m4
#     fi

} # end of initialize()


##############
# initialize #
##############

# stash path
START_PATH="`pwd`"

# Before running autoreconf or manual steps, some prep detection work
# is necessary or useful.  Only needs to occur once per directory, but
# does need to traverse the entire subconfigure hierarchy to protect
# files from being clobbered even by autoreconf.
recursive_protect

# start from where we started
cd "$START_PATH"

# get ready to process
initialize


#########################################
# DOWNLOAD_GNULIB_CONFIG_GUESS FUNCTION #
#########################################

# TODO - should make sure wget/curl exist and/or work before trying to
# use them.

download_gnulib_config_guess () {
    # abuse gitweb to download gnulib's latest config.guess via HTTP
    config_guess_temp="config.guess.$$.download"
    ret=1
    for __cmd in wget curl fetch ; do
	$VERBOSE_ECHO "Checking for command ${__cmd}"
	${__cmd} --version > /dev/null 2>&1
	ret=$?
	if [ ! $ret = 0 ] ; then
	    continue
        fi

	__cmd_version=`${__cmd} --version | head -n 1 | sed -e 's/^[^0-9]\+//' -e 's/ .*//'`
	$VERBOSE_ECHO "Found ${__cmd} ${__cmd_version}"

	opts=""
	case ${__cmd} in
	    wget)
		opts="-O" 
		;;
	    curl)
		opts="-o"
		;;
	    fetch)
		opts="-t 5 -f"
		;;
	esac

	$VERBOSE_ECHO "Running $__cmd \"${CONFIG_GUESS_URL}\" $opts \"${config_guess_temp}\""
	eval "$__cmd \"${CONFIG_GUESS_URL}\" $opts \"${config_guess_temp}\"" > /dev/null 2>&1
	if [ $? = 0 ] ; then
	    mv -f "${config_guess_temp}" ${_aux_dir}/config.guess
	    ret=0
	    break
	fi
    done

    if [ ! $ret = 0 ] ; then
	$ECHO "Warning: config.guess download failed from: $CONFIG_GUESS_URL"
	rm -f "${config_guess_temp}"
    fi
}


##############################
# LIBTOOLIZE_NEEDED FUNCTION #
##############################
libtoolize_needed () {
    ret=1 # means no, don't need libtoolize
    for feature in AC_PROG_LIBTOOL AM_PROG_LIBTOOL LT_INIT ; do
	$VERBOSE_ECHO "Searching for $feature in $CONFIGURE"
	found="`grep \"^$feature.*\" $CONFIGURE`"
	if [ ! "x$found" = "x" ] ; then
	    ret=0 # means yes, need to run libtoolize
	    break
	fi
    done
    return ${ret}
}



############################################
# prepare build via autoreconf or manually #
############################################
reconfigure_manually=no
if [ "x$HAVE_AUTORECONF" = "xyes" ] ; then
    $ECHO
    $ECHO $ECHO_N "Automatically preparing build ... $ECHO_C"

    $VERBOSE_ECHO "$AUTORECONF $SEARCH_DIRS $AUTORECONF_OPTIONS"
    autoreconf_output="`$AUTORECONF $SEARCH_DIRS $AUTORECONF_OPTIONS 2>&1`"
    ret=$?
    $VERBOSE_ECHO "$autoreconf_output"

    if [ ! $ret = 0 ] ; then
	if [ "x$HAVE_ALT_LIBTOOLIZE" = "xyes" ] ; then
	    if [ ! "x`echo \"$autoreconf_output\" | grep libtoolize | grep \"No such file or directory\"`" = "x" ] ; then
		$ECHO
		$ECHO "Warning: autoreconf failed but due to what is usually a common libtool"
		$ECHO "misconfiguration issue.  This problem is encountered on systems that"
		$ECHO "have installed libtoolize under a different name without providing a"
		$ECHO "symbolic link or without setting the LIBTOOLIZE environment variable."
		$ECHO
		$ECHO "Restarting the preparation steps with LIBTOOLIZE set to $LIBTOOLIZE"

		export LIBTOOLIZE
		RUN_RECURSIVE=no
		export RUN_RECURSIVE
		untrap_abnormal

		$VERBOSE_ECHO sh $AUTOGEN_SH "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
		sh "$AUTOGEN_SH" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
		exit $?
	    fi
	fi

	$ECHO "Warning: $AUTORECONF failed"

	if test -f ltmain.sh ; then
	    $ECHO "libtoolize being run by autoreconf is not creating ltmain.sh in the auxillary directory like it should"
	fi

	$ECHO "Attempting to run the preparation steps individually"
	reconfigure_manually=yes
    else
	if [ "x$DOWNLOAD" = "xyes" ] ; then
	    if libtoolize_needed ; then
		download_gnulib_config_guess
	    fi
	fi
    fi
else
    reconfigure_manually=yes
fi


############################
# LIBTOOL_FAILURE FUNCTION #
############################
libtool_failure ( ) {

    # libtool is rather error-prone in comparison to the other
    # autotools and this routine attempts to compensate for some
    # common failures.  the output after a libtoolize failure is
    # parsed for an error related to AC_PROG_LIBTOOL and if found, we
    # attempt to inject a project-provided libtool.m4 file.

    _autoconf_output="$1"

    if [ "x$RUN_RECURSIVE" = "xno" ] ; then
	# we already tried the libtool.m4, don't try again
	return 1
    fi

    if test -f "$LIBTOOL_M4" ; then
	found_libtool="`$ECHO $_autoconf_output | grep AC_PROG_LIBTOOL`"
	if test ! "x$found_libtool" = "x" ; then
	    if test -f acinclude.m4 ; then
		rm -f acinclude.m4.$$.backup
		$VERBOSE_ECHO "cat acinclude.m4 > acinclude.m4.$$.backup"
		cat acinclude.m4 > acinclude.m4.$$.backup
	    fi
	    $VERBOSE_ECHO "cat \"$LIBTOOL_M4\" >> acinclude.m4"
	    chmod u+w acinclude.m4
	    cat "$LIBTOOL_M4" >> acinclude.m4

	    # don't keep doing this
	    RUN_RECURSIVE=no
	    export RUN_RECURSIVE
	    untrap_abnormal

	    $ECHO
	    $ECHO "Restarting the preparation steps with libtool macros in acinclude.m4"
	    $VERBOSE_ECHO sh $AUTOGEN_SH "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
	    sh "$AUTOGEN_SH" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
	    exit $?
	fi
    fi
}


###########################
# MANUAL_AUTOGEN FUNCTION #
###########################
manual_autogen ( ) {

    ##################################################
    # Manual preparation steps taken are as follows: #
    #   aclocal [-I m4]                              #
    #   libtoolize --automake -c -f                  #
    #   aclocal [-I m4]                              #
    #   autoconf -f                                  #
    #   autoheader                                   #
    #   automake -a -c -f                            #
    ##################################################

    ###########
    # aclocal #
    ###########
    $VERBOSE_ECHO "$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS"
    aclocal_output="`$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS 2>&1`"
    ret=$?
    $VERBOSE_ECHO "$aclocal_output"
    if [ ! $ret = 0 ] ; then $ECHO "ERROR: $ACLOCAL failed" && exit 2 ; fi

    ##############
    # libtoolize #
    ##############
    if libtoolize_needed ; then
	if [ "x$HAVE_LIBTOOLIZE" = "xyes" ] ; then
	    $VERBOSE_ECHO "$LIBTOOLIZE $LIBTOOLIZE_OPTIONS"
	    libtoolize_output="`$LIBTOOLIZE $LIBTOOLIZE_OPTIONS 2>&1`"
	    ret=$?
	    $VERBOSE_ECHO "$libtoolize_output"

	    if [ ! $ret = 0 ] ; then $ECHO "ERROR: $LIBTOOLIZE failed" && exit 2 ; fi
	else
	    if [ "x$HAVE_ALT_LIBTOOLIZE" = "xyes" ] ; then
		$VERBOSE_ECHO "$LIBTOOLIZE $ALT_LIBTOOLIZE_OPTIONS"
		libtoolize_output="`$LIBTOOLIZE $ALT_LIBTOOLIZE_OPTIONS 2>&1`"
		ret=$?
		$VERBOSE_ECHO "$libtoolize_output"

		if [ ! $ret = 0 ] ; then $ECHO "ERROR: $LIBTOOLIZE failed" && exit 2 ; fi
	    fi
	fi

	###########
	# aclocal #
	###########
	# re-run again as instructed by libtoolize
	$VERBOSE_ECHO "$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS"
	aclocal_output="`$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS 2>&1`"
	ret=$?
	$VERBOSE_ECHO "$aclocal_output"

	# libtoolize might put ltmain.sh in the wrong place
	if test -f ltmain.sh ; then
	    if test ! -f "${_aux_dir}/ltmain.sh" ; then
		$ECHO
		$ECHO "Warning:  $LIBTOOLIZE is creating ltmain.sh in the wrong directory"
		$ECHO
		$ECHO "Fortunately, the problem can be worked around by simply copying the"
		$ECHO "file to the appropriate location (${_aux_dir}/).  This has been done for you."
		$ECHO
		$VERBOSE_ECHO "cp -p ltmain.sh \"${_aux_dir}/ltmain.sh\""
		cp -p ltmain.sh "${_aux_dir}/ltmain.sh"
		$ECHO $ECHO_N "Continuing build preparation ... $ECHO_C"
	    fi
	fi # ltmain.sh

	if [ "x$DOWNLOAD" = "xyes" ] ; then
	    download_gnulib_config_guess
	fi
    fi # libtoolize_needed

    ############
    # autoconf #
    ############
    $VERBOSE_ECHO
    $VERBOSE_ECHO "$AUTOCONF $AUTOCONF_OPTIONS"
    autoconf_output="`$AUTOCONF $AUTOCONF_OPTIONS 2>&1`"
    ret=$?
    $VERBOSE_ECHO "$autoconf_output"

    if [ ! $ret = 0 ] ; then
	# retry without the -f and check for usage of macros that are too new
	ac2_59_macros="AC_C_RESTRICT AC_INCLUDES_DEFAULT AC_LANG_ASSERT AC_LANG_WERROR AS_SET_CATFILE"
	ac2_55_macros="AC_COMPILER_IFELSE AC_FUNC_MBRTOWC AC_HEADER_STDBOOL AC_LANG_CONFTEST AC_LANG_SOURCE AC_LANG_PROGRAM AC_LANG_CALL AC_LANG_FUNC_TRY_LINK AC_MSG_FAILURE AC_PREPROC_IFELSE"
	ac2_54_macros="AC_C_BACKSLASH_A AC_CONFIG_LIBOBJ_DIR AC_GNU_SOURCE AC_PROG_EGREP AC_PROG_FGREP AC_REPLACE_FNMATCH AC_FUNC_FNMATCH_GNU AC_FUNC_REALLOC AC_TYPE_MBSTATE_T"

	macros_to_search=""
	ac_major="`echo ${AUTOCONF_VERSION}. | cut -d. -f1 | sed 's/[^0-9]//g'`"
	ac_minor="`echo ${AUTOCONF_VERSION}. | cut -d. -f2 | sed 's/[^0-9]//g'`"

	if [ $ac_major -lt 2 ] ; then
	    macros_to_search="$ac2_59_macros $ac2_55_macros $ac2_54_macros"
	else
	    if [ $ac_minor -lt 54 ] ; then
		macros_to_search="$ac2_59_macros $ac2_55_macros $ac2_54_macros"
	    elif [ $ac_minor -lt 55 ] ; then
		macros_to_search="$ac2_59_macros $ac2_55_macros"
	    elif [ $ac_minor -lt 59 ] ; then
		macros_to_search="$ac2_59_macros"
	    fi
	fi

	configure_ac_macros=__none__
	for feature in $macros_to_search ; do
	    $VERBOSE_ECHO "Searching for $feature in $CONFIGURE"
	    found="`grep \"^$feature.*\" $CONFIGURE`"
	    if [ ! "x$found" = "x" ] ; then
		if [ "x$configure_ac_macros" = "x__none__" ] ; then
		    configure_ac_macros="$feature"
		else
		    configure_ac_macros="$feature $configure_ac_macros"
		fi
	    fi
	done
	if [ ! "x$configure_ac_macros" = "x__none__" ] ; then
	    $ECHO
	    $ECHO "Warning:  Unsupported macros were found in $CONFIGURE"
	    $ECHO
	    $ECHO "The `basename \"$CONFIGURE\"` file was scanned in order to determine if any"
	    $ECHO "unsupported macros are used that exceed the minimum version"
	    $ECHO "settings specified within this file.  As such, the following macros"
	    $ECHO "should be removed from configure.ac or the version numbers in this"
	    $ECHO "file should be increased:"
	    $ECHO
	    $ECHO "$configure_ac_macros"
	    $ECHO
	    $ECHO $ECHO_N "Ignorantly continuing build preparation ... $ECHO_C"
	fi

	###################
	# autoconf, retry #
	###################
	$VERBOSE_ECHO
	$VERBOSE_ECHO "$AUTOCONF"
	autoconf_output="`$AUTOCONF 2>&1`"
	ret=$?
	$VERBOSE_ECHO "$autoconf_output"

	if [ ! $ret = 0 ] ; then
	    # test if libtool is busted
	    libtool_failure "$autoconf_output"

	    # let the user know what went wrong
	    cat <<EOF
$autoconf_output
EOF
	    $ECHO "ERROR: $AUTOCONF failed"
	    exit 2
	else
	    # autoconf sans -f and possibly sans unsupported options succeed so warn verbosely
	    $ECHO
	    $ECHO "Warning: autoconf seems to have succeeded by removing the following options:"
	    $ECHO "	AUTOCONF_OPTIONS=\"$AUTOCONF_OPTIONS\""
	    $ECHO
	    $ECHO "Removing those options should not be necessary and indicate some other"
	    $ECHO "problem with the build system.  The build preparation is highly suspect"
	    $ECHO "and may result in configuration or compilation errors.  Consider"
	    if [ "x$VERBOSE_ECHO" = "x:" ] ; then
		$ECHO "rerunning the build preparation with verbose output enabled."
		$ECHO "	$AUTOGEN_SH --verbose"
	    else
		$ECHO "reviewing the minimum GNU Autotools version settings contained in"
		$ECHO "this script along with the macros being used in your `basename \"$CONFIGURE\"` file."
	    fi
	    $ECHO
	    $ECHO $ECHO_N "Continuing build preparation ... $ECHO_C"
	fi # autoconf ret = 0
    fi # autoconf ret = 0

    ##############
    # autoheader #
    ##############
    need_autoheader=no
    for feature in AM_CONFIG_HEADER AC_CONFIG_HEADER ; do
	$VERBOSE_ECHO "Searching for $feature in $CONFIGURE"
	found="`grep \"^$feature.*\" $CONFIGURE`"
	if [ ! "x$found" = "x" ] ; then
	    need_autoheader=yes
	    break
	fi
    done
    if [ "x$need_autoheader" = "xyes" ] ; then
	$VERBOSE_ECHO "$AUTOHEADER $AUTOHEADER_OPTIONS"
	autoheader_output="`$AUTOHEADER $AUTOHEADER_OPTIONS 2>&1`"
	ret=$?
	$VERBOSE_ECHO "$autoheader_output"
	if [ ! $ret = 0 ] ; then $ECHO "ERROR: $AUTOHEADER failed" && exit 2 ; fi
    fi # need_autoheader

    ############
    # automake #
    ############
    need_automake=no
    for feature in AM_INIT_AUTOMAKE ; do
	$VERBOSE_ECHO "Searching for $feature in $CONFIGURE"
	found="`grep \"^$feature.*\" $CONFIGURE`"
	if [ ! "x$found" = "x" ] ; then
	    need_automake=yes
	    break
	fi
    done

    if [ "x$need_automake" = "xyes" ] ; then
	$VERBOSE_ECHO "$AUTOMAKE $AUTOMAKE_OPTIONS"
	automake_output="`$AUTOMAKE $AUTOMAKE_OPTIONS 2>&1`"
	ret=$?
	$VERBOSE_ECHO "$automake_output"

	if [ ! $ret = 0 ] ; then

	    ###################
	    # automake, retry #
	    ###################
	    $VERBOSE_ECHO
	    $VERBOSE_ECHO "$AUTOMAKE $ALT_AUTOMAKE_OPTIONS"
	    # retry without the -f
	    automake_output="`$AUTOMAKE $ALT_AUTOMAKE_OPTIONS 2>&1`"
	    ret=$?
	    $VERBOSE_ECHO "$automake_output"

	    if [ ! $ret = 0 ] ; then
	 	# test if libtool is busted
		libtool_failure "$automake_output"

		# let the user know what went wrong
		cat <<EOF
$automake_output
EOF
		$ECHO "ERROR: $AUTOMAKE failed"
		exit 2
	    fi # automake retry
	fi # automake ret = 0
    fi # need_automake
} # end of manual_autogen


#####################################
# RECURSIVE_MANUAL_AUTOGEN FUNCTION #
#####################################
recursive_manual_autogen ( ) {

    # run the build preparation steps manually for this directory
    manual_autogen

    # for projects using recursive configure, run the build
    # preparation steps for the subdirectories.
    if [ ! "x$CONFIG_SUBDIRS" = "x" ] ; then
	$VERBOSE_ECHO "Recursively configuring the following directories:"
	$VERBOSE_ECHO "  $CONFIG_SUBDIRS"
	for dir in $CONFIG_SUBDIRS ; do
	    $VERBOSE_ECHO "Processing recursive configure in $dir"
	    cd "$START_PATH"
	    cd "$dir"

	    # new directory, prepare
	    initialize

	    # run manual steps for the subdir and any others below
	    recursive_manual_autogen
	done
    fi
}


################################
# run manual preparation steps #
################################
if [ "x$reconfigure_manually" = "xyes" ] ; then
    $ECHO
    $ECHO $ECHO_N "Preparing build ... $ECHO_C"

    recursive_manual_autogen
fi


#########################
# restore and summarize #
#########################
cd "$START_PATH"

# restore COPYING and INSTALL from backup if necessary
recursive_restore

# make sure we end up with a configure script
config_ac="`locate_configure_template`"
config="`echo $config_ac | sed 's/\.ac$//' | sed 's/\.in$//'`"
if [ "x$config" = "x" ] ; then
    $VERBOSE_ECHO "Could not locate the configure template (from `pwd`)"
fi

# summarize
$ECHO "done"
$ECHO
if test "x$config" = "x" -o ! -f "$config" ; then
    $ECHO "WARNING: The $PROJECT build system should now be prepared but there"
    $ECHO "does not seem to be a resulting configure file.  This is unexpected"
    $ECHO "and likely the result of an error.  You should run $NAME_OF_AUTOGEN"
    $ECHO "with the --verbose option to get more details on a potential"
    $ECHO "misconfiguration."
else
    $ECHO "The $PROJECT build system is now prepared.  To build here, run:"
    $ECHO "  $config"
    $ECHO "  make"
fi


# Local Variables:
# mode: sh
# tab-width: 8
# sh-basic-offset: 4
# sh-indentation: 4
# indent-tabs-mode: t
# End:
# ex: shiftwidth=4 tabstop=8