#!/bin/sh # # Configure # ARToolKit5 # # This file is part of ARToolKit. # # ARToolKit is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # ARToolKit is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with ARToolKit. If not, see . # # As a special exception, the copyright holders of this library give you # permission to link this library with independent modules to produce an # executable, regardless of the license terms of these independent modules, and to # copy and distribute the resulting executable under terms of your choice, # provided that you also meet, for each linked independent module, the terms and # conditions of the license of that module. An independent module is a module # which is neither derived from nor based on this library. If you modify this # library, you may extend this exception to your version of the library, but you # are not obligated to do so. If you do not wish to do so, delete this exception # statement from your version. # # Copyright 2015-2016 Daqri, LLC. # Copyright 2002-2015 ARToolworks, Inc. # # Author(s): Hirokazu Kato, Philip Lamb # ##################################################### # # ARToolKit Configure for Linux/Unix Video Devices # ##################################################### MDIR=". \ lib/SRC \ lib/SRC/AR \ lib/SRC/ARICP \ lib/SRC/AR2 \ lib/SRC/ARWrapper \ lib/SRC/KPM \ lib/SRC/Util \ lib/SRC/ARMulti \ lib/SRC/Gl \ lib/SRC/Video \ lib/SRC/VideoDummy \ lib/SRC/VideoImage \ lib/SRC/VideoLinuxV4L \ lib/SRC/VideoLinuxV4L2 \ lib/SRC/VideoLinux1394Cam \ lib/SRC/VideoLinux1394Cam/ver1 \ lib/SRC/VideoLinux1394Cam/ver2 \ lib/SRC/VideoQuickTime \ lib/SRC/VideoQuickTime7 \ lib/SRC/VideoGStreamer \ lib/SRC/ARosg \ lib/SRC/Eden \ util \ util/calib_camera \ util/calib_stereo \ util/mk_patt \ util/1394 \ util/1394/whiteBalance \ util/1394/listCamera \ util/1394/checkImage \ util/calib_optical \ util/calib_camera_old-v3 \ util/calib_stereo_old-v3 \ util/check_id \ util/genTexData \ util/genMarkerSet \ util/dispImageSet \ util/dispFeatureSet \ util/checkResolution \ examples \ examples/simple \ examples/simpleLite \ examples/simpleMovie \ examples/multi \ examples/simpleOSG \ examples/stereo \ examples/multiCube \ examples/multiWin \ examples/optical \ examples/opticalStereo \ examples/nftSimple \ examples/nftBook " #lib/SRC/VideoLinuxDV \ #lib/SRC/VideoSGI \ #util/calib_distortion \ SED=/tmp/SED.$$ trap "rm -f $SED; exit 0" 0 1 2 3 15 VERSION=`grep -E 'AR_HEADER_VERSION_STRING[[:space:]]+"[0-9]+\.[0-9]+(\.[0-9]+)*"' include/AR/config.h.in | grep -Eo "[0-9]+\.[0-9]+(\.[0-9]+)*"` E=`uname` MACHINE=`uname -m` if [ "$E" = "Linux" ] then SYSTEM="linux-$MACHINE" echo "\nThis script configures ARToolKit libraries, utilities and examples. For details on dependencies and further information please visit http://artoolkit.org/documentation/doku.php?id=8_Advanced_Topics:build_artoolkit \n\n" echo "Standard compiler is gcc and g++ with libstdc++. Do you want to use the Clang compiler with libc++ instead? (y or n)" echo -n "Enter : " read ANS if [ "$ANS" = "y" ] then CLANGCC="y" elif [ "$ANS" = "n" ] then CLANGCC="n" else echo "Please enter y or n." exit 0 fi DEFAULT_CAP_DEVICE="" echo "Do you want to enable the Video4Linux2 capture module? (y or n)" echo -n "Enter : " read ANS if [ "$ANS" = "y" ] then INPUT_V4L2="y" elif [ "$ANS" = "n" ] then INPUT_V4L2="n" else echo "Please enter y or n." exit 0 fi if [ "$INPUT_V4L2" = "y" ] then echo "Do you want to use it as the default input device? (y or n)" echo -n "Enter : " read ANS if [ "$ANS" = "y" ] then DEFAULT_CAP_DEVICE="V4L2" elif [ "$ANS" = "n" ] then DEFAULT_CAP_DEVICE="" else echo "Please enter y or n." exit 0 fi fi echo "Do you want to enable the Video4Linux capture module? (y or n)" echo -n "Enter : " read ANS if [ "$ANS" = "y" ] then INPUT_V4L="y" elif [ "$ANS" = "n" ] then INPUT_V4L="n" else echo "Please enter y or n." exit 0 fi if [ "$DEFAULT_CAP_DEVICE" = "" ] then if [ "$INPUT_V4L" = "y" ] then echo "Do you want to use it as the default input device? (y or n)" echo -n "Enter : " read ANS if [ "$ANS" = "y" ] then DEFAULT_CAP_DEVICE="V4L" elif [ "$ANS" = "n" ] then DEFAULT_CAP_DEVICE="" else echo "Please enter y or n." exit 0 fi fi fi echo "Do you want to enable the IEEE 1394 Digital Video Camera capture module? (y or n)" echo -n "Enter : " read ANS if [ "$ANS" = "y" ] then INPUT_CAM1394="y" elif [ "$ANS" = "n" ] then INPUT_CAM1394="n" else echo "Please enter y or n." exit 0 fi if [ "$INPUT_CAM1394" = "y" ] then echo "Do you want to use libdc1394_Ver.2? (y or n)" echo -n "Enter : " read ANS if [ "$ANS" = "y" ] then DC1394_V2="y" elif [ "$ANS" = "n" ] then DC1394_V2="n" else echo "Please enter y or n." exit 0 fi if [ "$DEFAULT_CAP_DEVICE" = "" ] then echo "Do you want to use it as the default input device? (y or n)" echo -n "Enter : " read ANS if [ "$ANS" = "y" ] then DEFAULT_CAP_DEVICE="CAM1394" elif [ "$ANS" = "n" ] then DEFAULT_CAP_DEVICE="" else echo "Please enter y or n." exit 0 fi fi echo "Does your IEEE1394 camera support color image? (y or n)" echo -n "Enter : " read ANS if [ "$ANS" = "y" ] then COLOR_1394="y" elif [ "$ANS" = "n" ] then COLOR_1394="n" else echo "Please enter y or n." exit 0 fi echo "Do you use a DragonFly as a IEEE 1394 camera? (y or n)" echo -n "Enter : " read ANS if [ "$ANS" = "y" ] then DRAGON="y" elif [ "$ANS" = "n" ] then DRAGON="n" else echo "Please enter y or n." exit 0 fi fi # echo "Do you want to use DV Video Camera? (y or n)" # echo -n "Enter : " # read ANS # if [ "$ANS" = "y" ] # then # INPUT_DV="y" # elif [ "$ANS" = "n" ] # then # INPUT_DV="n" # else # echo "Please enter y or n." # exit 0 # fi # if [ "$INPUT_DV" = "y" ] # then # if [ "$DEFAULT_CAP_DEVICE" = "" ] # then # echo "Do you want to use it as the default input device? (y or n)" # echo -n "Enter : " # read ANS # if [ "$ANS" = "y" ] # then # DEFAULT_CAP_DEVICE="DV" # elif [ "$ANS" = "n" ] # then # DEFAULT_CAP_DEVICE="" # else # echo "Please enter y or n." # exit 0 # fi # fi # fi echo "Do you want to enable the GStreamer capture module? (y or n)" echo -n "Enter : " read ANS if [ "$ANS" = "y" ] then INPUT_GSTREAMER="y" elif [ "$ANS" = "n" ] then INPUT_GSTREAMER="n" else echo "Please enter y or n." exit 0 fi if [ "$INPUT_GSTREAMER" = "y" ] then echo "Experimental: Do you want to use gstreamer-1.0 instead of gstreamer-0.10? (y or n)" echo -n "Enter : " read ANS if [ "$ANS" = "y" ] then USE_GSTREAMER_1="y" elif [ "$ANS" = "n" ] then USE_GSTREAMER_1="n" else echo "Please enter y or n." exit 0 fi if [ "$DEFAULT_CAP_DEVICE" = "" ] then echo "Do you want to use it as the default input device? (y or n)" echo -n "Enter : " read ANS if [ "$ANS" = "y" ] then DEFAULT_CAP_DEVICE="GSTREAMER" elif [ "$ANS" = "n" ] then DEFAULT_CAP_DEVICE="" else echo "Please enter y or n." exit 0 fi fi fi if [ "$CLANGCC" = "y" ] then CC="clang" CXX="clang++ -std=c++11 -stdlib=libc++" CFLAG="-O3 -fPIC -march=core2 -DHAVE_NFT=1" STDCXXLIB="-lc++" else CC="gcc" CXX="g++ -std=c++11 " CFLAG="-O3 -fPIC -march=core2 -DHAVE_NFT=1" STDCXXLIB="-lstdc++" fi case "$MACHINE" in armv7l) # NOTE: raspberry pi 3 workarounds if [ "$CLANGCC" = "y" ]; then # NOTE: libc++ doesn't seem to work yet on Raspberry Pi CXX="clang++ -std=c++11" STDCXXLIB="-lstdc++" CFLAG="-O3 -fPIC -march=native -DHAVE_NFT=1" else # NOTE: Some versions of gcc are buggy in their hardware detection code, # so just hardcode the architecture here. # See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70132 CFLAG="-O3 -fPIC -mcpu=cortex-a53 -mfpu=neon-vfpv4 -DHAVE_NFT=1" fi LDFLAG="-L/usr/lib" ;; x86_64) CFLAG="-O3 -fPIC -march=core2 -DHAVE_NFT=1" LDFLAG="-L/usr/lib/x86_64-linux-gnu -L/usr/lib64" ;; *) CFLAG="$CFLAG -I/usr/include/i386-linux-gnu" LDFLAG="-L/usr/lib/i386-linux-gnu -L/usr/lib" ;; esac AR="ar" ARFLAGS="rs" RANLIB="true" LIBS="-lglut -lGLU -lGL -lX11 -lm -lpthread -ljpeg" if [ "$INPUT_GSTREAMER" = "y" ] then if [ "$USE_GSTREAMER_1" = "y" ] then GST_CFLAGS="-DUSE_GSTREAMER_1 `pkg-config --cflags gstreamer-1.0`" GST_LIBS="-DUSE_GSTREAMER_1 `pkg-config --libs gstreamer-1.0`" else GST_CFLAGS=`pkg-config --cflags gstreamer-0.10` GST_LIBS=`pkg-config --libs gstreamer-0.10` fi CFLAG="$CFLAG $GST_CFLAGS" LIBS="$LIBS $GST_LIBS" fi if [ "$INPUT_CAM1394" = "y" ] then if [ "$DC1394_V2" = "y" ] then LIBS="$LIBS `pkg-config libdc1394-2 --libs` `pkg-config libraw1394 --libs`" CFLAG="$CFLAG `pkg-config libdc1394-2 --cflags` `pkg-config libraw1394 --cflags`" else LIBS="$LIBS -lraw1394 -ldc1394_control" fi fi # When linking against libc++, use supplied opencv rather than system opencv. if [ "$STDCXXLIB" = "-lc++" ] then CV_CFLAG="-I\$(INC_DIR)/$SYSTEM" CV_LIBS="-L\$(LIB_DIR)/$SYSTEM -lopencv_calib3d -lopencv_features2d -lopencv_imgproc -lopencv_flann -lopencv_core -lz" else CV_CFLAG=`pkg-config opencv --cflags` CV_LIBS=`pkg-config opencv --libs` #CV_CFLAG="" #CV_LIBS="-lopencv_calib3d -lopencv_features2d -lopencv_imgproc -lopencv_flann -opencv_core -lz" fi elif [ "$E" = "IRIX" ] then SYSTEM="irix" CC="cc" CXX="c++" #INPUT_SGI="y" CFLAG="-O -n32" LDFLAG="-n32" AR="ar" ARFLAGS="rs" RANLIB="true" LIBS="-lglut -lGLU -lGL -lXmu -lX11 -lvl -lm -ljpeg" CV_CFLAG=`pkg-config opencv --cflags` CV_LIBS=`pkg-config opencv --libs` elif [ "$E" = "IRIX64" ] then SYSTEM="irix64" CC="cc" CXX="c++" #INPUT_SGI="y" CFLAG="-O -n32" LDFLAG="-n32" AR="ar" ARFLAGS="rs" RANLIB="true" LIBS="-lglut -lGLU -lGL -lXmu -lX11 -lvl -lm -ljpeg" CV_CFLAG=`pkg-config opencv --cflags` CV_LIBS=`pkg-config opencv --libs` elif [ "$E" = "Darwin" ] then SYSTEM="macosx-universal" DEFAULT_CAP_DEVICE="" echo "Do you want to use QuickTime Video? (y or n)" echo -n "Enter : " read ANS if [ "$ANS" = "y" ] then INPUT_QUICKTIME="y" elif [ "$ANS" = "n" ] then INPUT_QUICKTIME="n" else echo "Please enter y or n." exit 0 fi if [ "$INPUT_QUICKTIME" = "y" ] then echo "Do you want to use it as the default input device? (y or n)" echo -n "Enter : " read ANS if [ "$ANS" = "y" ] then DEFAULT_CAP_DEVICE="QUICKTIME" elif [ "$ANS" = "n" ] then DEFAULT_CAP_DEVICE="" else echo "Please enter y or n." exit 0 fi fi echo "Do you want to use IEEE 1394 Digital Video Camera? (y or n)" echo -n "Enter : " read ANS if [ "$ANS" = "y" ] then INPUT_CAM1394_MAC="y" elif [ "$ANS" = "n" ] then INPUT_CAM1394_MAC="n" else echo "Please enter y or n." exit 0 fi if [ "$INPUT_CAM1394_MAC" = "y" ] then # echo "Do you want to use libdc1394_Ver.2? (y or n)" # echo -n "Enter : " # read ANS # if [ "$ANS" = "y" ] # then # DC1394_V2="y" # elif [ "$ANS" = "n" ] # then # DC1394_V2="n" # else # echo "Please enter y or n." # exit 0 # fi DC1394_V2="y" if [ "$DEFAULT_CAP_DEVICE" = "" ] then echo "Do you want to use it as the default input device? (y or n)" echo -n "Enter : " read ANS if [ "$ANS" = "y" ] then DEFAULT_CAP_DEVICE="CAM1394" elif [ "$ANS" = "n" ] then DEFAULT_CAP_DEVICE="" else echo "Please enter y or n." exit 0 fi fi fi #CC="cc -arch i386 -arch x86_64" CC="cc" CXX="c++" CFLAG="-O -DHAVE_NFT=1" LDFLAG="" #AR="libtool" #ARFLAGS="-static -o" #RANLIB="true" AR="ar" ARFLAGS="-r -u" RANLIB="true" LIBS="-framework Accelerate -framework QTKit -framework CoreVideo -framework Carbon -framework GLUT -framework OpenGL -framework Cocoa -ljpeg" if [ "$INPUT_QUICKTIME" = "y" ] then LIBS="$LIBS -framework QuickTime" fi if [ "$INPUT_CAM1394_MAC" = "y" ] then LIBS="$LIBS -ldc1394" fi if [ "$INPUT_CAM1394_MAC" = "y" ] then echo "Does your IEEE1394 camera support color image? (y or n)" echo -n "Enter : " read ANS if [ "$ANS" = "y" ] then COLOR_1394="y" elif [ "$ANS" = "n" ] then COLOR_1394="n" else echo "Please enter y or n." exit 0 fi echo "Do you use a DragonFly as a IEEE 1394 camera? (y or n)" echo -n "Enter : " read ANS if [ "$ANS" = "y" ] then DRAGON="y" elif [ "$ANS" = "n" ] then DRAGON="n" else echo "Please enter y or n." exit 0 fi fi #CV_CFLAG="-framework OpenCV" #CV_LIBS="-framework OpenCV" CV_CFLAG="" CV_LIBS="-lopencv_flann -lopencv_core -lopencv_calib3d -lopencv_imgproc -lopencv_highgui" else echo "This configure command supports Linux, IRIX and MacOSX." exit 0 fi if [ "$CLANGCC" = "n" ] then echo "Enable the OpenSceneGraph renderer and examples? (y or n)" echo -n "Enter : " read ANS if [ "$ANS" = "y" ] then ENABLE_OSG="y" elif [ "$ANS" = "n" ] then ENABLE_OSG="n" else echo "Please enter y or n." exit 0 fi else ENABLE_OSG="n" fi #[ "$CLANGCC" = "n" ] # # Output step 1. # Create Makefiles, setting symbols, and selecting directories for compilation. # # Prefix any slashes with '\' for sed. echo $CC | sed -e 's/\//\\\//g' >$SED CC=`cat $SED` echo $CXX | sed -e 's/\//\\\//g' >$SED CXX=`cat $SED` echo $CFLAG | sed -e 's/\//\\\//g' >$SED CFLAG=`cat $SED` echo $LDFLAG | sed -e 's/\//\\\//g' >$SED LDFLAG=`cat $SED` echo $AR | sed -e 's/\//\\\//g' >$SED AR=`cat $SED` echo $ARFLAGS | sed -e 's/\//\\\//g' >$SED ARFLAGS=`cat $SED` echo $RANLIB | sed -e 's/\//\\\//g' >$SED RANLIB=`cat $SED` echo $LIBS | sed -e 's/\//\\\//g' >$SED LIBS=`cat $SED` echo $CV_CFLAG | sed -e 's/\//\\\//g' >$SED CV_CFLAG=`cat $SED` echo $CV_LIBS | sed -e 's/\//\\\//g' >$SED CV_LIBS=`cat $SED` echo $VERSION | sed -e 's/\//\\\//g' >$SED VERSION=`cat $SED` echo $SYSTEM | sed -e 's/\//\\\//g' >$SED SYSTEM=`cat $SED` cat > $SED <> $SED <> $SED <> $SED <> $SED <> $SED <> $SED <> $SED <> $SED <> $SED <> $SED < $i/Makefile done echo " create share/artoolkit5-config" sed -f $SED share/artoolkit5-config chmod ugo+rx share/artoolkit5-config # # Output step 2. # Record configuration in config.h. # if [ "$DRAGON" = "y" ] then cat >> $SED <> $SED <> $SED <> $SED <> $SED <> $SED <> $SED <> $SED <> $SED <> $SED <> $SED <> $SED <> $SED <> $SED <> $SED <> $SED <> $SED <> $SED < include/AR/config.h echo "Done."