San Mehat | a430b2b | 2014-09-23 08:30:51 -0700 | [diff] [blame] | 1 | dnl Process this file with autoconf to produce a configure script. |
| 2 | dnl The macros which aren't shipped with the autotools are stored in the |
| 3 | dnl Tools/config directory in .m4 files. |
| 4 | |
| 5 | AC_INIT([VisualNaCro],[0.1],[http://libvncserver.sourceforge.net]) |
| 6 | AC_PREREQ(2.54) |
| 7 | AC_CANONICAL_HOST |
| 8 | AM_INIT_AUTOMAKE |
| 9 | |
| 10 | dnl Checks for programs. |
| 11 | AC_CHECK_PROG(SWIG,swig,swig) |
| 12 | AC_CHECK_PROG(LIBVNCSERVERCONFIG,libvncserver-config,yes,no) |
| 13 | if test "$LIBVNCSERVERCONFIG" != "yes"; then |
| 14 | AC_MSG_ERROR([Need to have libvncserver-config in PATH]) |
| 15 | exit 1 |
| 16 | fi |
| 17 | AC_PROG_CC |
| 18 | AC_PROG_RANLIB |
| 19 | AC_EXEEXT |
| 20 | AC_OBJEXT |
| 21 | |
| 22 | LIBVNCSERVERCFLAGS=`libvncserver-config --cflags` |
| 23 | LIBVNCSERVERLIBS=`libvncserver-config --libs` |
| 24 | AC_SUBST(LIBVNCSERVERCFLAGS) |
| 25 | AC_SUBST(LIBVNCSERVERLIBS) |
| 26 | |
| 27 | dnl Checks for header files. |
| 28 | AC_HEADER_STDC |
| 29 | |
| 30 | dnl How to specify include directories that may be system directories. |
| 31 | # -I should not be used on system directories (GCC) |
| 32 | if test "$GCC" = yes; then |
| 33 | ISYSTEM="-isystem " |
| 34 | else |
| 35 | ISYSTEM="-I" |
| 36 | fi |
| 37 | |
| 38 | |
| 39 | # Set info about shared libraries. |
| 40 | AC_SUBST(SO) |
| 41 | AC_SUBST(LDSHARED) |
| 42 | AC_SUBST(CCSHARED) |
| 43 | AC_SUBST(LINKFORSHARED) |
| 44 | |
| 45 | # SO is the extension of shared libraries `(including the dot!) |
| 46 | AC_MSG_CHECKING(SO) |
| 47 | if test -z "$SO" |
| 48 | then |
| 49 | case $host in |
| 50 | *-*-hp*) SO=.sl;; |
| 51 | *-*-darwin*) SO=.bundle;; |
| 52 | *-*-cygwin* | *-*-mingw*) SO=.dll;; |
| 53 | *) SO=.so;; |
| 54 | esac |
| 55 | fi |
| 56 | AC_MSG_RESULT($SO) |
| 57 | |
| 58 | # LDSHARED is the ld *command* used to create shared library |
| 59 | # -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5 |
| 60 | # (Shared libraries in this instance are shared modules to be loaded into |
| 61 | # Python, as opposed to building Python itself as a shared library.) |
| 62 | AC_MSG_CHECKING(LDSHARED) |
| 63 | if test -z "$LDSHARED" |
| 64 | then |
| 65 | case $host in |
| 66 | *-*-aix*) LDSHARED="\$(srcdir)/ld_so_aix \$(CC)";; |
| 67 | *-*-cygwin* | *-*-mingw*) |
| 68 | if test "$GCC" = yes; then |
| 69 | LDSHARED="dllwrap --driver-name gcc --dlltool dlltool --export-all-symbols --as as --dllname \$(LIBPREFIX)\$(TARGET)\$(SO)" |
| 70 | else |
| 71 | if test "cl" = $CC ; then |
| 72 | # Microsoft Visual C++ (MSVC) |
| 73 | LDSHARED="$CC -nologo -LD" |
| 74 | else |
| 75 | # Unknown compiler try gcc approach |
| 76 | LDSHARED="$CC -shared" |
| 77 | fi |
| 78 | fi ;; |
| 79 | *-*-irix5*) LDSHARED="ld -shared";; |
| 80 | *-*-irix6*) LDSHARED="ld ${SGI_ABI} -shared -all";; |
| 81 | *-*-sunos4*) LDSHARED="ld";; |
| 82 | *-*-solaris*) LDSHARED="ld -G";; |
| 83 | *-*-hp*) LDSHARED="ld -b";; |
| 84 | *-*-osf*) LDSHARED="ld -shared -expect_unresolved \"*\"";; |
| 85 | *-sequent-sysv4) LDSHARED="ld -G";; |
| 86 | *-*-next*) |
| 87 | if test "$ns_dyld" |
| 88 | then LDSHARED='$(CC) $(LDFLAGS) -bundle -prebind' |
| 89 | else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r'; |
| 90 | fi |
| 91 | if test "$with_next_framework" ; then |
| 92 | LDSHARED="$LDSHARED \$(LDLIBRARY)" |
| 93 | fi ;; |
| 94 | *-*-linux*) LDSHARED="gcc -shared";; |
| 95 | *-*-dgux*) LDSHARED="ld -G";; |
| 96 | *-*-freebsd3*) LDSHARED="gcc -shared";; |
| 97 | *-*-freebsd* | *-*-openbsd*) LDSHARED="ld -Bshareable";; |
| 98 | *-*-netbsd*) |
| 99 | if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]] |
| 100 | then |
| 101 | LDSHARED="cc -shared" |
| 102 | else |
| 103 | LDSHARED="ld -Bshareable" |
| 104 | fi;; |
| 105 | *-sco-sysv*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";; |
| 106 | *-*-darwin*) LDSHARED="cc -bundle -undefined suppress -flat_namespace";; |
| 107 | *) LDSHARED="ld";; |
| 108 | esac |
| 109 | fi |
| 110 | AC_MSG_RESULT($LDSHARED) |
| 111 | # CCSHARED are the C *flags* used to create objects to go into a shared |
| 112 | # library (module) -- this is only needed for a few systems |
| 113 | AC_MSG_CHECKING(CCSHARED) |
| 114 | if test -z "$CCSHARED" |
| 115 | then |
| 116 | case $host in |
| 117 | *-*-hp*) if test "$GCC" = yes; |
| 118 | then CCSHARED="-fpic"; |
| 119 | else CCSHARED="+z"; |
| 120 | fi;; |
| 121 | *-*-linux*) CCSHARED="-fpic";; |
| 122 | *-*-freebsd* | *-*-openbsd*) CCSHARED="-fpic";; |
| 123 | *-*-netbsd*) CCSHARED="-fPIC";; |
| 124 | *-sco-sysv*) CCSHARED="-KPIC -dy -Bdynamic";; |
| 125 | *-*-irix6*) case $CC in |
| 126 | *gcc*) CCSHARED="-shared";; |
| 127 | *) CCSHARED="";; |
| 128 | esac;; |
| 129 | esac |
| 130 | fi |
| 131 | AC_MSG_RESULT($CCSHARED) |
| 132 | |
| 133 | # RPATH is the path used to look for shared library files. |
| 134 | AC_MSG_CHECKING(RPATH) |
| 135 | if test -z "$RPATH" |
| 136 | then |
| 137 | case $host in |
| 138 | *-*-solaris*) RPATH='-R. -R$(exec_prefix)/lib';; |
| 139 | *-*-irix*) RPATH='-rpath .:$(exec_prefix)/lib';; |
| 140 | *-*-linux*) RPATH='-Xlinker -rpath $(exec_prefix)/lib -Xlinker -rpath .';; |
| 141 | *) RPATH='';; |
| 142 | esac |
| 143 | fi |
| 144 | AC_MSG_RESULT($RPATH) |
| 145 | AC_SUBST(RPATH) |
| 146 | |
| 147 | # LINKFORSHARED are the flags passed to the $(CC) command that links |
| 148 | # the a few executables -- this is only needed for a few systems |
| 149 | |
| 150 | AC_MSG_CHECKING(LINKFORSHARED) |
| 151 | if test -z "$LINKFORSHARED" |
| 152 | then |
| 153 | case $host in |
| 154 | *-*-aix*) LINKFORSHARED='-Wl,-bE:$(srcdir)/python.exp -lld';; |
| 155 | *-*-hp*) |
| 156 | LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; |
| 157 | *-*-linux*) LINKFORSHARED="-Xlinker -export-dynamic";; |
| 158 | *-*-next*) LINKFORSHARED="-u libsys_s";; |
| 159 | *-sco-sysv*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";; |
| 160 | *-*-irix6*) LINKFORSHARED="-all";; |
| 161 | esac |
| 162 | fi |
| 163 | AC_MSG_RESULT($LINKFORSHARED) |
| 164 | |
| 165 | # This variation is needed on OS-X because there is no (apparent) consistency in shared libary naming. |
| 166 | # Sometimes .bundle works, but sometimes .so is needed. It depends on the target language |
| 167 | |
| 168 | # Optional CFLAGS used to silence compiler warnings on some platforms. |
| 169 | |
| 170 | AC_SUBST(PLATFLAGS) |
| 171 | case $host in |
| 172 | *-*-darwin*) PLATFLAGS="-Wno-long-double";; |
| 173 | *) PLATFLAGS="";; |
| 174 | esac |
| 175 | |
| 176 | #---------------------------------------------------------------- |
| 177 | # Look for Perl5 |
| 178 | #---------------------------------------------------------------- |
| 179 | |
| 180 | PERLBIN= |
| 181 | |
| 182 | AC_ARG_WITH(perl5,[ --with-perl5=path Set location of Perl5 executable],[ PERLBIN="$withval"], [PERLBIN=]) |
| 183 | |
| 184 | # First figure out what the name of Perl5 is |
| 185 | |
| 186 | if test -z "$PERLBIN"; then |
| 187 | AC_CHECK_PROGS(PERL, perl perl5.8.1 perl5.6.1 perl5.6.0 perl5.004 perl5.003 perl5.002 perl5.001 perl5 perl) |
| 188 | else |
| 189 | PERL="$PERLBIN" |
| 190 | fi |
| 191 | |
| 192 | |
| 193 | AC_MSG_CHECKING(for Perl5 header files) |
| 194 | if test -n "$PERL"; then |
| 195 | PERL5DIR=`($PERL -e 'use Config; print $Config{archlib}, "\n";') 2>/dev/null` |
| 196 | if test "$PERL5DIR" != ""; then |
| 197 | dirs="$PERL5DIR $PERL5DIR/CORE" |
| 198 | PERL5EXT=none |
| 199 | for i in $dirs; do |
| 200 | if test -r $i/perl.h; then |
| 201 | AC_MSG_RESULT($i) |
| 202 | PERL5EXT="$i" |
| 203 | break; |
| 204 | fi |
| 205 | done |
| 206 | if test "$PERL5EXT" = none; then |
| 207 | PERL5EXT="$PERL5DIR/CORE" |
| 208 | AC_MSG_RESULT(could not locate perl.h...using $PERL5EXT) |
| 209 | fi |
| 210 | |
| 211 | AC_MSG_CHECKING(for Perl5 library) |
| 212 | PERL5LIB=`($PERL -e 'use Config; $_=$Config{libperl}; s/^lib//; s/$Config{_a}$//; print $_, "\n"') 2>/dev/null` |
| 213 | if test "$PERL5LIB" = "" ; then |
| 214 | AC_MSG_RESULT(not found) |
| 215 | else |
| 216 | AC_MSG_RESULT($PERL5LIB) |
| 217 | fi |
| 218 | AC_MSG_CHECKING(for Perl5 compiler options) |
| 219 | PERL5CCFLAGS=`($PERL -e 'use Config; print $Config{ccflags}, "\n"' | sed "s/-I/$ISYSTEM/") 2>/dev/null` |
| 220 | if test "$PERL5CCFLAGS" = "" ; then |
| 221 | AC_MSG_RESULT(not found) |
| 222 | else |
| 223 | AC_MSG_RESULT($PERL5CCFLAGS) |
| 224 | fi |
| 225 | else |
| 226 | AC_MSG_RESULT(unable to determine perl5 configuration) |
| 227 | PERL5EXT=$PERL5DIR |
| 228 | fi |
| 229 | else |
| 230 | AC_MSG_RESULT(could not figure out how to run perl5) |
| 231 | fi |
| 232 | |
| 233 | # Cygwin (Windows) needs the library for dynamic linking |
| 234 | case $host in |
| 235 | *-*-cygwin* | *-*-mingw*) PERL5DYNAMICLINKING="-L$PERL5EXT -l$PERL5LIB";; |
| 236 | *)PERL5DYNAMICLINKING="";; |
| 237 | esac |
| 238 | |
| 239 | AC_SUBST(PERL) |
| 240 | AC_SUBST(PERL5EXT) |
| 241 | AC_SUBST(PERL5DYNAMICLINKING) |
| 242 | AC_SUBST(PERL5LIB) |
| 243 | AC_SUBST(PERL5CCFLAGS) |
| 244 | |
| 245 | #---------------------------------------------------------------- |
| 246 | # Miscellaneous |
| 247 | #---------------------------------------------------------------- |
| 248 | |
| 249 | AC_CONFIG_FILES([Makefile]) |
| 250 | AC_OUTPUT |
| 251 | |
| 252 | dnl configure.in ends here |