dnl -*- mode: m4-mode -*- dnl Process this file with autoconf to produce a configure script. dnl We must use autotools 2.53 or above AC_PREREQ(2.53) AC_INIT(Makefile.in) #dnl Uncomment this if you want to use your own define's too #AC_CONFIG_HEADER(module_config.h) #dnl To make sure that didn't get #define PACKAGE_* in modules_config.h #echo "" > confdefs.h dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL ################################################# # Directory handling stuff to support both the # legacy SAMBA directories and FHS compliant # ones... AC_PREFIX_DEFAULT(/usr/local/samba) AC_ARG_WITH(fhs, [ --with-fhs Use FHS-compliant paths (default=no)], libdir="\${prefix}/lib/samba", libdir="\${prefix}/lib") AC_SUBST(libdir) SAMBA_SOURCE="../../source" #################################################### # set the location location of the samba source tree AC_ARG_WITH(samba-source, [ --with-samba-source=DIR Where is the samba source tree (../../source)], [ case "$withval" in yes|no) # # Just in case anybody calls it without argument # AC_MSG_WARN([--with-samba-source called without argument - will use default]) ;; * ) SAMBA_SOURCE="$withval" ;; esac]) AC_SUBST(SAMBA_SOURCE) dnl Unique-to-Samba variables we'll be playing with. AC_SUBST(CC) AC_SUBST(SHELL) AC_SUBST(LDSHFLAGS) AC_SUBST(SONAMEFLAG) AC_SUBST(SHLD) AC_SUBST(HOST_OS) AC_SUBST(PICFLAG) AC_SUBST(PICSUFFIX) AC_SUBST(POBAD_CC) AC_SUBST(SHLIBEXT) AC_SUBST(INSTALLCLIENTCMD_SH) AC_SUBST(INSTALLCLIENTCMD_A) AC_SUBST(SHLIB_PROGS) AC_SUBST(EXTRA_BIN_PROGS) AC_SUBST(EXTRA_SBIN_PROGS) AC_SUBST(EXTRA_ALL_TARGETS) AC_ARG_ENABLE(debug, [ --enable-debug Turn on compiler debugging information (default=no)], [if eval "test x$enable_debug = xyes"; then CFLAGS="${CFLAGS} -g" fi]) AC_ARG_ENABLE(developer, [ --enable-developer Turn on developer warnings and debugging (default=no)], [if eval "test x$enable_developer = xyes"; then developer=yes CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER" fi]) # compile with optimization and without debugging by default, but # allow people to set their own preference. if test "x$CFLAGS" = x then CFLAGS="-O ${CFLAGS}" fi #dnl Check if we use GNU ld #LD=ld #AC_PROG_LD_GNU #dnl look for executable suffix #AC_EXEEXT builddir=`pwd` AC_SUBST(builddir) # Assume non-shared by default and override below BLDSHARED="false" # these are the defaults, good for lots of systems HOST_OS="$host_os" LDSHFLAGS="-shared" SONAMEFLAG="#" SHLD="\${CC}" PICFLAG="" PICSUFFIX="po" POBAD_CC="#" SHLIBEXT="so" if test "$enable_shared" = "yes"; then # this bit needs to be modified for each OS that is suported by # smbwrapper. You need to specify how to created a shared library and # how to compile C code to produce PIC object files AC_MSG_CHECKING([ability to build shared libraries]) # and these are for particular systems case "$host_os" in *linux*) BLDSHARED="true" LDSHFLAGS="-shared" DYNEXP="-Wl,--export-dynamic" PICFLAG="-fPIC" SONAMEFLAG="-Wl,-soname=" ;; *solaris*) BLDSHARED="true" LDSHFLAGS="-G" SONAMEFLAG="-h " if test "${GCC}" = "yes"; then PICFLAG="-fPIC" if test "${ac_cv_prog_gnu_ld}" = "yes"; then DYNEXP="-Wl,-E" fi else PICFLAG="-KPIC" ## ${CFLAGS} added for building 64-bit shared ## libs using Sun's Compiler LDSHFLAGS="-G \${CFLAGS}" POBAD_CC="" PICSUFFIX="po.o" fi ;; *sunos*) BLDSHARED="true" LDSHFLAGS="-G" SONAMEFLAG="-Wl,-h," PICFLAG="-KPIC" # Is this correct for SunOS ;; *netbsd* | *freebsd*) BLDSHARED="true" LDSHFLAGS="-shared" DYNEXP="-Wl,--export-dynamic" SONAMEFLAG="-Wl,-soname," PICFLAG="-fPIC -DPIC" ;; *openbsd*) BLDSHARED="true" LDSHFLAGS="-shared" DYNEXP="-Wl,-Bdynamic" SONAMEFLAG="-Wl,-soname," PICFLAG="-fPIC" ;; *irix*) case "$host_os" in *irix6*) ;; esac ATTEMPT_WRAP32_BUILD=yes BLDSHARED="true" LDSHFLAGS="-set_version sgi1.0 -shared" SONAMEFLAG="-soname " SHLD="\${LD}" if test "${GCC}" = "yes"; then PICFLAG="-fPIC" else PICFLAG="-KPIC" fi ;; *aix*) BLDSHARED="true" LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry,-berok" DYNEXP="-Wl,-brtl,-bexpall" PICFLAG="-O2" if test "${GCC}" != "yes"; then ## for funky AIX compiler using strncpy() CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000" fi ;; *hpux*) SHLIBEXT="sl" # Use special PIC flags for the native HP-UX compiler. if test $ac_cv_prog_cc_Ae = yes; then BLDSHARED="true" SHLD="/usr/bin/ld" LDSHFLAGS="-B symbolic -b -z" SONAMEFLAG="+h " PICFLAG="+z" fi DYNEXP="-Wl,-E" ;; *qnx*) ;; *osf*) BLDSHARED="true" LDSHFLAGS="-shared" SONAMEFLAG="-Wl,-soname," PICFLAG="-fPIC" ;; *sco*) ;; *unixware*) BLDSHARED="true" LDSHFLAGS="-shared" SONAMEFLAG="-Wl,-soname," PICFLAG="-KPIC" ;; *next2*) ;; *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]) ;; *sysv4*) case "$host" in *-univel-*) LDSHFLAGS="-G" DYNEXP="-Bexport" ;; *mips-sni-sysv4*) ;; esac ;; *sysv5*) LDSHFLAGS="-G" ;; *vos*) BLDSHARED="false" LDSHFLAGS="" ;; *) ;; esac AC_SUBST(DYNEXP) AC_MSG_RESULT($BLDSHARED) AC_MSG_CHECKING([linker flags for shared libraries]) AC_MSG_RESULT([$LDSHFLAGS]) AC_MSG_CHECKING([compiler flags for position-independent code]) AC_MSG_RESULT([$PICFLAGS]) fi ####################################################### # test whether building a shared library actually works if test $BLDSHARED = true; then AC_CACHE_CHECK([whether building shared libraries actually works], [ac_cv_shlib_works],[ ac_cv_shlib_works=no # try building a trivial shared library if test "$PICSUFFIX" = "po"; then $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/tests/shlib.c && $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o "shlib.$SHLIBEXT" shlib.po && ac_cv_shlib_works=yes else $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.$PICSUFFIX ${srcdir-.}/tests/shlib.c && mv shlib.$PICSUFFIX shlib.po && $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o "shlib.$SHLIBEXT" shlib.po && ac_cv_shlib_works=yes fi rm -f "shlib.$SHLIBEXT" shlib.po ]) if test $ac_cv_shlib_works = no; then BLDSHARED=false fi fi AC_OUTPUT(Makefile)