more small build tweaks. use mkdtemp if available

This commit is contained in:
dockes 2005-10-21 08:14:42 +00:00
parent ab0f3110c0
commit be12ed95ce
7 changed files with 22 additions and 9 deletions

View File

@ -13,4 +13,4 @@ clean:
cd qtgui; rm -f recoll; $(MAKE) clean cd qtgui; rm -f recoll; $(MAKE) clean
cd query; $(MAKE) clean cd query; $(MAKE) clean
cd utils; $(MAKE) clean cd utils; $(MAKE) clean
rm -rf qtgui/Makefile qtgui/preview/Makefile

View File

@ -1 +1 @@
1.01 1.02

View File

@ -19,3 +19,6 @@ excludefile
makedist.sh makedist.sh
mk/sysconf mk/sysconf
qtgui/Makefile qtgui/Makefile
qtgui/preview/Makefile
qtgui/preview/preview.pro
qtgui/preview/pvmain.cpp

View File

@ -2,7 +2,8 @@ CXXFLAGS = -pthread -Wall -Wno-unused-variable -g \
-I. -I../index -I../utils -I../common \ -I. -I../index -I../utils -I../common \
-I../unac -I../bincimapmime -I/usr/local/include \ -I../unac -I../bincimapmime -I/usr/local/include \
\ \
-DHAVE_VASPRINTF=1 -DHAVE_VASPRINTF=1 \
-DHAVE_MKDTEMP=1
LIBXAPIAN = -L/usr/local/lib -lxapian LIBXAPIAN = -L/usr/local/lib -lxapian
LIBICONV = -L/usr/local/lib -liconv LIBICONV = -L/usr/local/lib -liconv

View File

@ -1,7 +1,8 @@
CXXFLAGS = -Wall -g -I. -I../index -I../utils -I../common \ CXXFLAGS = -Wall -g -I. -I../index -I../utils -I../common \
-I../unac -I../bincimapmime -I/usr/local/include \ -I../unac -I../bincimapmime -I/usr/local/include \
\ -D_GNU_SOURCE \
-DHAVE_VASPRINTF=1 -D_GNU_SOURCE -DHAVE_VASPRINTF=1 \
-DHAVE_MKDTEMP=1
LIBXAPIAN = -L/usr/local/lib -lxapian LIBXAPIAN = -L/usr/local/lib -lxapian
LIBICONV = LIBICONV =

View File

@ -1,5 +1,5 @@
#ifndef lint #ifndef lint
static char rcsid[] = "@(#$Id: pvmain.cpp,v 1.3 2005-10-17 13:36:53 dockes Exp $ (C) 2005 J.F.Dockes"; static char rcsid[] = "@(#$Id: pvmain.cpp,v 1.4 2005-10-21 08:14:42 dockes Exp $ (C) 2005 J.F.Dockes";
#endif #endif
#include <stdio.h> #include <stdio.h>
@ -51,6 +51,9 @@ int main( int argc, char ** argv )
newEd->setText(str); newEd->setText(str);
w.pvTab->addTab(anon, "Tab 2"); w.pvTab->addTab(anon, "Tab 2");
#if QT_VERSION < 0x040000
a.setMainWidget(&w);
#endif
w.show(); w.show();
return a.exec(); return a.exec();
} }

View File

@ -1,5 +1,5 @@
#ifndef lint #ifndef lint
static char rcsid[] = "@(#$Id: smallut.cpp,v 1.5 2005-03-17 14:02:06 dockes Exp $ (C) 2004 J.F.Dockes"; static char rcsid[] = "@(#$Id: smallut.cpp,v 1.6 2005-10-21 08:14:42 dockes Exp $ (C) 2004 J.F.Dockes";
#endif #endif
#ifndef TEST_SMALLUT #ifndef TEST_SMALLUT
#include <string> #include <string>
@ -34,7 +34,11 @@ bool maketmpdir(string& tdir)
tdir.erase(); tdir.erase();
return false; return false;
} }
#ifdef HAVE_MKDTEMP
if (!mkdtemp(cp)) {
#else
if (!mktemp(cp)) { if (!mktemp(cp)) {
#endif // HAVE_MKDTEMP
free(cp); free(cp);
LOGERR(("maketmpdir: mktemp failed\n")); LOGERR(("maketmpdir: mktemp failed\n"));
tdir.erase(); tdir.erase();
@ -43,12 +47,13 @@ bool maketmpdir(string& tdir)
tdir = cp; tdir = cp;
free(cp); free(cp);
} }
#ifndef HAVE_MKDTEMP
if (mkdir(tdir.c_str(), 0700) < 0) { if (mkdir(tdir.c_str(), 0700) < 0) {
LOGERR(("maketmpdir: mkdir %s failed\n", tdir.c_str())); LOGERR(("maketmpdir: mkdir %s failed\n", tdir.c_str()));
tdir.erase(); tdir.erase();
return false; return false;
} }
#endif
return true; return true;
} }