cd src

NAUTY_CONFIGURE=""

if [ "$SAGE_FAT_BINARY" = "yes" ]; then
   NAUTY_CONFIGURE+="--enable-generic --disable-popcnt"
fi

# Nauty doesn't have an install target; passing a prefix to configure is
# useless (but harmless)
sdh_configure CC="$CC -fPIC" $NAUTY_CONFIGURE --enable-static --disable-shared
sdh_make

# No install target so we resort to manual copy
PROGRAMS="
addedgeg addptg amtog ancestorg assembleg biplabg catg complg converseg copyg
countg countneg cubhamg deledgeg delptg dimacs2g directg dreadnaut dretodot
dretog edgetransg genbg genbgL geng gengL genposetg genquarticg genrang
genspecialg gentourng gentreeg genktreeg hamheuristic labelg linegraphg listg
multig nbrhoodg newedgeg pickg planarg productg ranlabg ransubg shortg showg
subdivideg twohamg underlyingg uniqg vcolg watercluster2 NRswitchg"
sdh_install $PROGRAMS "$SAGE_LOCAL/bin"

sdh_install nauty.h "$SAGE_LOCAL/include/nauty"

cp nauty.a libnauty.a
sdh_install libnauty.a "$SAGE_LOCAL/lib"
