diff options
Diffstat (limited to 'configure')
| -rwxr-xr-x | configure | 161 |
1 files changed, 115 insertions, 46 deletions
@@ -23,6 +23,7 @@ Fine tuning of the installation directories: --libexecdir=DIR package-scoped executables [EPREFIX/libexec] --libdir=DIR static library files [PREFIX/lib] --includedir=DIR C header files [PREFIX/include] + --pkgconfdir=DIR pkg-config .pc files [PREFIX/lib/pkgconfig] If no --prefix option is given, by default libdir (but not dynlibdir) will be /usr/lib, and includedir will be /usr/include. @@ -32,6 +33,7 @@ Dependencies: --with-include=DIR add DIR to the list of searched directories for headers --with-lib=DIR add DIR to the list of searched directories for static libraries --with-dynlib=DIR add DIR to the list of searched directories for shared libraries + --with-pkgconfig[=PROG] use pkg-config to look for dependencies If no --prefix option is given, by default sysdeps will be fetched from /usr/lib/skalibs/sysdeps. @@ -42,9 +44,9 @@ Optional features: --disable-allstatic do not prefer linking against static libraries [enabled] --enable-static-libc make entirely static binaries [disabled] --disable-all-pic do not build executables or static libs as PIC [enabled] + --enable-pkgconfig Build and install .pc files for pkg-config [disabled] --enable-slashpackage[=ROOT] assume /package installation at ROOT [disabled] - --enable-absolute-paths do not rely on PATH to access this package's binaries, - hardcode absolute BINDIR/foobar paths instead [disabled] + --enable-absolute-paths hardcode absolute BINDIR/foobar paths in binaries [disabled] --enable-nsss use the nsss library for user information [disabled] --with-seed-dir=DIR make DIR the default rngseed directory [/var/lib/rngseed] --enable-multicall build a multicall binary [disabled] @@ -142,6 +144,8 @@ libexecdir='$exec_prefix/libexec' bindir='$exec_prefix/bin' libdir='$prefix/lib' includedir='$prefix/include' +pkgconfdir='$prefix/lib/pkgconfig' +shebangdir='$bindir' sysdeps='$prefix/lib/skalibs/sysdeps' manualsysdeps=false shared=false @@ -149,19 +153,23 @@ static=true allpic=true slashpackage=false abspath=false -usensss=false -multicall=false +pcw=false sproot= home= exthome= allstatic=true evenmorestatic=false +pkgconf= addincpath='' addlibspath='' addlibdpath='' +depincpath='' +deplibpath='' vpaths='' vpathd='' build= +usensss=false +multicall=false seeddir=/var/lib/rngseed for arg ; do @@ -174,10 +182,14 @@ for arg ; do --bindir=*) bindir=${arg#*=} ;; --libdir=*) libdir=${arg#*=} ;; --includedir=*) includedir=${arg#*=} ;; + --pkgconfigdir=*) pkgconfigdir=${arg#*=} ;; --with-sysdeps=*) sysdeps=${arg#*=} manualsysdeps=true ;; - --with-include=*) var=${arg#*=} ; stripdir var ; addincpath="$addincpath -I$var" ;; - --with-lib=*) var=${arg#*=} ; stripdir var ; addlibspath="$addlibspath -L$var" ; vpaths="$vpaths $var" ;; + --with-include=*) var=${arg#*=} ; stripdir var ; addincpath="$addincpath -I$var" ; depincpath="${depincpath}${depincpath:+ }-I$var" ;; + --with-lib=*) var=${arg#*=} ; stripdir var ; addlibspath="$addlibspath -L$var" ; deplibpath="${deplibpath}${deplibpath:+ }-I$var" ; vpaths="$vpaths $var" ;; --with-dynlib=*) var=${arg#*=} ; stripdir var ; addlibdpath="$addlibdpath -L$var" ; vpathd="$vpathd $var" ;; + --with-pkgconfig=*) pkgconf=${arg#*=} ;; + --with-pkgconfig) pkgconf=${PKG_CONFIG:-pkg-config} ;; + --without-pkgconfig) pkgconf= ;; --enable-shared|--enable-shared=yes) shared=true ;; --disable-shared|--enable-shared=no) shared=false ;; --enable-static|--enable-static=yes) static=true ;; @@ -188,16 +200,21 @@ for arg ; do --disable-static-libc|--enable-static-libc=no) evenmorestatic=false ;; --enable-all-pic|--enable-all-pic=yes) allpic=true ;; --disable-all-pic|--enable-all-pic=no) allpic=false ;; + --enable-pkgconfig|--enable-pkgconfig=yes) pcw=true ;; + --disable-pkgconfig|--enable-pkgconfig=no) pcw=false ;; --enable-slashpackage=*) sproot=${arg#*=} ; slashpackage=true ; ;; --enable-slashpackage) sproot= ; slashpackage=true ;; --disable-slashpackage) sproot= ; slashpackage=false ;; --enable-absolute-paths|--enable-absolute-paths=yes) abspath=true ;; --disable-absolute-paths|--enable-absolute-paths=no) abspath=false ;; + --shebangdir=*) shebangisdefault=false ; shebangdir=${arg#*=} ;; --enable-nsss|--enable-nsss=yes) usensss=true ;; --disable-nsss|--enable-nsss=no) usensss=false ;; + --enable-pedantic-posix|--enable-pedantic-posix=yes) pposix=true ;; + --disable-pedantic-posix|--enable-pedantic-posix=no) pposix=false ;; --enable-multicall|--enable-multicall=yes) multicall=true ;; --disable-multicall|--enable-multicall=no) multicall=false ;; - --with-seed-file=*) seed=${arg#*=} ;; + --enable-*|--disable-*|--with-*|--without-*|--*dir=*) ;; --enable-*|--disable-*|--with-*|--without-*|--*dir=*) ;; --host=*|--target=*) target=${arg#*=} ;; --build=*) build=${arg#*=} ;; @@ -215,6 +232,9 @@ if test -z "$prefix" ; then if test "$includedir" = '$prefix/include' ; then includedir=/usr/include fi + if test "$pkgconfdir" = '$prefix/lib/pkgconfig' ; then + pkgconfdir=/usr/lib/pkgconfig + fi if test "$sysdeps" = '$prefix/lib/skalibs/sysdeps' ; then sysdeps=/usr/lib/skalibs/sysdeps fi @@ -222,29 +242,60 @@ fi # Expand installation directories stripdir prefix -for i in exec_prefix dynlibdir libexecdir bindir libdir includedir sysdeps sproot ; do +for i in exec_prefix dynlibdir libexecdir bindir libdir includedir pkgconfdir sysdeps sproot shebangdir ; do eval tmp=\${$i} eval $i=$tmp stripdir $i done -# Get usable temp filenames -i=0 -set -C -while : ; do - i=$(($i+1)) - tmpc="./tmp-configure-$$-$PPID-$i.c" - tmpo="./tmp-configure-$$-$PPID-$i.o" - tmpe="./tmp-configure-$$-$PPID-$i.tmp" - 2>|/dev/null > "$tmpc" && break - 2>|/dev/null > "$tmpo" && break - 2>|/dev/null > "$tmpe" && break - test "$i" -gt 50 && fail "$0: cannot create temporary files" -done -set +C -trap 'rm -f "$tmpc" "$tmpo" "$tmpe"' EXIT ABRT INT QUIT TERM HUP +# Process deps-build +if test -n "$pkgconf" || $pcw || $slashpackage ; then + oldifs="$IFS" + while IFS=" " read cond usedinlibs pkg ver libs ; do + IFS="$oldifs" + eval "cond=$cond; usedinlibs=$usedinlibs" + if $cond ; then + if test -n "$pkgconf" ; then + for lib in $libs ; do + if ! $pkgconf --atleast-version=${ver} --print-errors -- "$lib" ; then + echo "./configure: fatal: $pkgconf --atleast-version=${ver} --print-errors -- $lib failed" 1>&2 + exit 1 + fi + thisinc="`$pkgconf --cflags-only-I -- $lib`" + sldflags="`$pkgconf --libs-only-L --static -- $lib`" + dldflags="`$pkgconf --libs-only-L -- $lib`" + addincpath="${addincpath}${thisinc:+ }$thisinc" + addlibspath="${addlibspath}${sldflags:+ }$sldflags" + addlibdpath="${addlibdpath}${dldflags:+ }$dldflags" + for i in $sldflags ; do + vpaths="$vpaths ${i##-L}" + done + for i in $dldflags ; do + vpathd="$vpathd ${i##-L}" + done + if $usedinlibs ; then + depincpath="${depincpath}${thisinc:+ }$thisinc" + deplibpath="${deplibpath}${sldflags:+ }$sldflags" + fi + done + fi + if $slashpackage ; then + addincpath="$addincpath -I${DESTDIR}${sproot}${pkg}/include" + vpaths="$vpaths ${DESTDIR}${sproot}${pkg}/library" + addlibspath="$addlibspath -L${DESTDIR}${sproot}${pkg}/library" + vpathd="$vpathd ${DESTDIR}${sproot}${pkg}/library.so" + addlibdpath="$addlibdpath -L${DESTDIR}${sproot}${pkg}/library.so" + if $usedinlibs ; then + depincpath="$depincpath -I${DESTDIR}${sproot}${pkg}/include" + deplibpath="$deplibpath -L${DESTDIR}${sproot}${pkg}/library" + fi + fi + fi + done < package/deps-build + IFS="$oldifs" +fi -# Set slashpackage values +# Other slashpackage values if $slashpackage ; then home=${sproot}/package/${category}/${package}-${version} exthome=${sproot}/package/${category}/${package} @@ -259,22 +310,26 @@ if $slashpackage ; then libdir=${home}/library libexecdir=$bindir includedir=${home}/include - while read dep condvar ; do - if test -n "$condvar" ; then - eval "cond=$condvar" - else - cond=true - fi - if $cond ; then - addincpath="$addincpath -I${DESTDIR}${sproot}${dep}/include" - vpaths="$vpaths ${DESTDIR}${sproot}${dep}/library" - addlibspath="$addlibspath -L${DESTDIR}${sproot}${dep}/library" - vpathd="$vpathd ${DESTDIR}${sproot}${dep}/library.so" - addlibdpath="$addlibdpath -L${DESTDIR}${sproot}${dep}/library.so" - fi - done < package/deps-build + pkgconfdir=${home}/pkgconfig + fi +# Get usable temp filenames +i=0 +set -C +while : ; do + i=$(($i+1)) + tmpc="./tmp-configure-$$-$PPID-$i.c" + tmpo="./tmp-configure-$$-$PPID-$i.o" + tmpe="./tmp-configure-$$-$PPID-$i.tmp" + 2>|/dev/null > "$tmpc" && break + 2>|/dev/null > "$tmpo" && break + 2>|/dev/null > "$tmpe" && break + test "$i" -gt 50 && fail "$0: cannot create temporary files" +done +set +C +trap 'rm -f "$tmpc" "$tmpo" "$tmpe"' EXIT ABRT INT QUIT TERM HUP + # Find a C compiler to use if test -n "$target" && test x${build} != x${target} ; then cross=${target}- @@ -331,15 +386,15 @@ if [ "x$target" != "x$(cat $sysdeps/target)" ] ; then exit 1 fi +if $allpic ; then + tryflag CPPFLAGS_AUTO -fPIC +fi spawn_lib=$(cat $sysdeps/spawn.lib) socket_lib=$(cat $sysdeps/socket.lib) sysclock_lib=$(cat $sysdeps/sysclock.lib) timer_lib=$(cat $sysdeps/timer.lib) util_lib=$(cat $sysdeps/util.lib) -if $allpic ; then - tryflag CPPFLAGS_AUTO -fPIC -fi tryflag CFLAGS_AUTO -std=c99 tryflag CFLAGS -fomit-frame-pointer tryflag CFLAGS_AUTO -fno-exceptions @@ -374,6 +429,8 @@ else LDFLAGS_NOSHARED="${LDFLAGS_NOSHARED}${addlibdpath}" fi + + echo "Creating config.mak..." cmdline=$(quote "$0") for i ; do cmdline="$cmdline $(quote "$i")" ; done @@ -392,12 +449,15 @@ libexecdir := $libexecdir bindir := $bindir libdir := $libdir includedir := $includedir +pkgconfdir := $pkgconfdir sysdeps := $sysdeps slashpackage := $slashpackage sproot := $sproot version := $version home := $home exthome := $exthome +extra_includedirs :=$depincpath +extra_libdirs :=$deplibpath SPAWN_LIB := ${spawn_lib} SOCKET_LIB := ${socket_lib} SYSCLOCK_LIB := ${sysclock_lib} @@ -406,23 +466,25 @@ UTIL_LIB := ${util_lib} CC := $CC_AUTO CPPFLAGS_AUTO := $CPPFLAGS_AUTO -CPPFLAGS := $CPPFLAGS $CPPFLAGS_POST +CPPFLAGS := ${CPPFLAGS}${CPPFLAGS_POST:+ }$CPPFLAGS_POST CFLAGS_AUTO := $CFLAGS_AUTO -CFLAGS := $CFLAGS $CFLAGS_POST +CFLAGS := ${CFLAGS}${CFLAGS_POST:+ }$CFLAGS_POST LDFLAGS_AUTO := $LDFLAGS_AUTO -LDFLAGS := $LDFLAGS $LDFLAGS_POST +LDFLAGS := ${LDFLAGS}${LDFLAGS_POST:+ }$LDFLAGS_POST LDFLAGS_SHARED := $LDFLAGS_SHARED LDFLAGS_NOSHARED := $LDFLAGS_NOSHARED CROSS_COMPILE := $cross vpath lib%.a$vpaths vpath lib%.so$vpathd + EOF if $allstatic ; then echo ".LIBPATTERNS := lib%.a" echo "DO_ALLSTATIC := 1" else echo ".LIBPATTERNS := lib%.so" + echo "DO_ALLSTATIC :=" fi if $static ; then echo "DO_STATIC := 1" @@ -434,6 +496,11 @@ if $shared ; then else echo "DO_SHARED :=" fi +if $pcw ; then + echo "DO_PKGCONFIG := 1" +else + echo "DO_PKGCONFIG :=" +fi if $allpic ; then echo "STATIC_LIBS_ARE_PIC := 1" else @@ -451,7 +518,6 @@ if $multicall ; then else echo "MULTICALL :=" fi - exec 1>&3 3>&- echo " ... done." @@ -471,16 +537,19 @@ EOF if $slashpackage ; then echo "#define ${package_macro_name}_BINPREFIX \"$bindir/\"" echo "#define ${package_macro_name}_EXTBINPREFIX \"$extbinprefix/\"" + echo "#define ${package_macro_name}_EXTLIBEXECPREFIX \"$extbinprefix/\"" elif $abspath ; then echo "#define ${package_macro_name}_BINPREFIX \"$bindir/\"" echo "#define ${package_macro_name}_EXTBINPREFIX \"$bindir/\"" + echo "#define ${package_macro_name}_EXTLIBEXECPREFIX \"$libexecdir/\"" else echo "#define ${package_macro_name}_BINPREFIX \"\"" echo "#define ${package_macro_name}_EXTBINPREFIX \"\"" + echo "#define ${package_macro_name}_EXTLIBEXECPREFIX \"$libexecdir/\"" fi echo "#define ${package_macro_name}_LIBEXECPREFIX \"$libexecdir/\"" echo "#define RNGSEED_DIR \"$seeddir\"" echo echo "#endif" exec 1>&3 3>&- -echo " ... done." +echo " ... done."
\ No newline at end of file |
